-
Notifications
You must be signed in to change notification settings - Fork 227
Combat
This article should explain the actual combat mechanics and not the different possibilities of unit interaction within a combat. Combat is only possible with units (sea units and land units), so see List of units for these that are able to fight.
In a combat there are different factions fighting against each other. They try to lower the health of the opposing units or buildings with attacks. Once health reaches zero, the unit dies resp. the building is destroyed. Damage and injuries have no effect on production, inhabitants or fighting capability.
We will from now on also refer to attacked buildings when talking about units.
Each unit has one possible attack.
Attacks are categorized to fit a certain type.
These attack categories have properties such as
- impact radius/diameter
- attack distance (often referred to as attack range)
- scatter factor & damage behaviour
- actual impact value
Each unit can defend against various attacks. For now, we will only implement one possible defense but later on, different defense types (against the corresponding attack) are possible. Each unit has a defined (and to be balanced) chance to
- totally evade an attack
- reduce damage suffered from an attack
Each attack has a target which can be a unit or a range. Ranges are defined by clicking (center) and the attack's impact radius. If this range is zero, you need to directly click on units to target them.
Attacks have two properties that slow down the fight:
- duration until impact happens
- cooldown, duration until you can launch a new attack.
There are two different combat modes for units planned right now: Aggressive and Passive.
Players toggle this mode on a per-unit or per-selection basis. When a unit in aggressive mode is sent to a spot on the map, it will attack any hostile unit or building that gets into their attack range while finding a path to their destination. They will not chase these units in case the player gave a movement order though.
When in passive mode, units will only attack if they get attacked. We need to if units should be chasing their attackers.
This is similar to the previous paragraph, but addresses unit behaviour when positioned somewhere and not following a move order.
In both modes, the unit won't care when an allied or neutral unit gets in its range. Players can still attack everything, but they will need to explicitly click on an 'attack' button and a target. This attack will declare war and turn all units of the two involved players mutually hostile.
Especially: If you have multiple units at a location and one of them gets attacked, all of your units will fight back.
Aggressive units will chase any enemy (maybe we add a small AI here to find out the best victim) until players interrupt that by giving a movement task.
Passive units will attack the aggressors as long as any of them is in attack range, but not try to chase.
Another feature to consider is introducing some kind of danger measurement function. As long as the player didn't explicitly order units to attack (read: the units are ambushed by an evil warmonger) they could move away if getting aware of the dangers.
We could imagine to rate the damage taken in a certain time and qualify it with the amount of attackers and the damage the unit itself can deal, but there is a lot more possible thoughts.
Selecting units happens via LMB. If single own units are selected, a tab is displayed. It contains stats and properties, a small portrait as well as certain buttons to switch this unit's mode.
If more than one own units are selected, the tab displayed should not differ too much from the above. It will contain a list of the selected units (maybe small portraits and their health). The possible interactions in this list are discussed (together with its look).
Since we already feature grouping of selections to shortcut keys (0-9), we could somehow display these, too.
If you have selected own units and perform a right click on free terrain, units will move there. If you click on an enemy unit instead, the whole selection will try to perform its attacks from where they currently are located. This includes moving in case the target is far away (not in attack range).
enemy means that either of you declared mutual war, not just a different player / side
Players can enhance these modifier values by doing research, buying upgrades etc. Scenario writers could use modifications they can grant in code (to either a certain unit or the player).
Defines the attack's area of effect. Uses the real missile impact zone (scatter) as center.
- If zero, this attack can only be performed at a single unit which the player needs to select then.
Only units that are in a certain range can be targeted for attacks at all. If a target unit is too far away, units might move until they can attack. Also important for ship-to-shore battles.
Scatter factor describes the various reasons why a certain missile, mainly a cannonball, will not precisely hit the area you target. It is implemented as a radius (invisible to the player? ) which gets larger for a high scatter factor. This means that the missile has the same probability to hit any ground spot in the circle determined by the actual target (player input) and the scatter factor. With higher value of scattering, the mean thus stays where it is but the variance grows.
Finally: the basic damage an attack deals by default. Higher value means more damage dealt -> health lost. If we implement resistances, we either want to define different impact values for each defender type or define resistances against each attacker type.
Read more here: Fighting_units