Search Unity

combat systems for a battle simulation game.

Discussion in 'General Discussion' started by sungazing, Mar 28, 2021.

  1. sungazing

    sungazing

    Joined:
    Mar 1, 2021
    Posts:
    6
    so im currently messing around with an idea for a game, and part of that game is going to involve 2 armies meeting, fighting it out, and establishing a winner, a loser, and the losses involved.

    the 2 armies will meet. there will be an animation to show fighting, and one army will end up on fire, followed by a data sheet showing damage and casualties.

    im not so much looking at how to go about coding this atm , as much as im wondering the best general setup of this kind of thing. id like to figure out the order things will take place in, to be able to work out what troops cause which damage and when etc, and id like to pick your brains about it.

    atm, in my head im seeing three troop types, infantry, cavalry, and archers. each with thier own stats for attack, defence, health, speed and range.

    when two sets of troops come into range they engage, with said stats being used to determine how one set of troops does against the other. the range of the archers will set the size of the battlefield, and once battle has commenced, the archers will stay put, while cavalry and infantry move forward.

    the archers will engage the cavalry first as cavalry will move forward quicker than infantry, then the cavalry will engage the infantry as they come into range of them and attack first as they have the faster movement speed.

    the infantry will have the higher defense stats, so they can hold against the cavalry. all the while, archers are still firing on the cavalry.

    ill use the range and speed stats to create waves of attack and generally speaking, the battle will be lost when the stronger force breaks through the enemies cavalry and infantry to attack the archers, who at that point wont hold up well against the enemy in thier face.

    the main issues im discovering is how to make it so that one of the troop types doesn't just annihilate the others. keeping the three in some sort of balance is the aim.

    my general thoughts on that matter are, infantry have the highest defence stats and hp, cavalry have the highest speed and attack, while archers have medium attack, defence and hp, but high range.

    any thoughts are appreciated, and any tips are very welcome. im not sure this is the best way to deal with this idea, as its turning out to be a pretty complex. any input from people who have dealt with this kind of thing will be invaluable.
    cheers.
     
    Last edited: Mar 28, 2021
  2. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,566
    Instead of "thoughts" why don't you just experiment and prototype it?

    Make a cube, a sphere, and a capsule.

    Make them represent each troop type and have them fight it out. See how it goes.
     
    Antypodish likes this.
  3. sungazing

    sungazing

    Joined:
    Mar 1, 2021
    Posts:
    6
    i have a spreadsheet im working on (still in the very beginning stages) to simulate how differing stats effect different outcomes.

    i dont intend on having a physical representation of these battles. they will just be outputs of data. so im not sure how i could apply your suggestion, though i appreciate the input. thank you.
     
  4. Billy4184

    Billy4184

    Joined:
    Jul 7, 2014
    Posts:
    6,012
    Reduce the scope of your problem to the minimum possible, and adjust the economics to balance.

    You only have 3 unit types, so you only need one of each in the scene for testing, e.g. an Archer engaging a Cavalry at X distance, who simultaneously engages a Soldier at Y distance. That is all you need to simulate the fundamental battle loop.

    Now just work iteratively:

    1. Determine a DPS value for each unit against each other unit (as if they all just fought face to face).

    2. Balance them such that each unit does the same amount of total damage (i.e. when you add up the DPS values they have for all other units, that total is the same for each unit. But it will be more or less for different unit types). E.g. Soldier does 2 DPS to Cavalry and 1 DPS to Archer, Archer does 1 DPS to Soldier and 2 DPS to Cavalry, Cavalry does 2 DPS to Soldier and 1 DPS to Archer.

    3. Add a new parameter, i.e. distance. Balance closing time for Cavalry and range for Archer and DPS for everyone such that the Archer kills the Cavalry at the same moment that the Cavalry kills the Soldier.

    4. Repeat 3 for each new parameter, although you will want to keep it to only a few to prevent conflicts.

    After you have created essentially a perfectly balanced 'ideal' battle, the question you need to ask is: what aspects can the player control in a way that gives them a positive advantage or disadvantage? Then either do not balance for those aspects, or balance them with a possible counter-strategy by the enemy. Either randomize whether the enemy will use that strategy, or determine a way that the player can plan to prevent that strategy from being used beforehand.