So, again I turn my eye to modding Civ4 and adressing one of the meatier issues of the game: The overly simplistic combat model.
But it's tough deciding how to handle combat as part of a stack attack model. So far I've devised this:
Attacker starts the combat.
Attacking artillery fires
Defending Artillery fires
Defending archers fire (this is one of the few cases the defender gets the initative)
Attacking archers fire
Attacking cavalry go.
Defending Cavalry go.
Attacking infantry go.
Defending infantry go.
Nearby artillery "arrives"
Nearby cavalry "arrives"
Repeat cycle
Nearby archers and infantry arrive
Repeat until victory is determined. If victory is determined before any nearby units arrive, they are not affected by the combat.
Any units reduced to 10% will fall back.
For the specifics, units of equal strength, all factors considered, will do 20% damage to one another (how this varies, or if it will vary at all, will come in later iterations). However, if one side is outnumbering the other, that side will suffer a 50% penalty ratio for proportion he outnumbers the opponent. To detail this, if one person attacks a single unit with two units, both of the attacking units will be at 75% effectiveness in terms of attacking: For the purpose of taking damage, they will still be at full effectiveness.
If this damage puts a unit below 10% or into death, health gets set to 10% and the unit is flagged as "wounded" and moved back one square. Wounded units can be killed. Calvary will have the opportunity to take a promotion to bypass this step for units they damage.
Units with an advantage versus another unit type will have a 50% chance of attacking their favored foe, if one exists in the battle. Units can take tactics promotions that increase this chance of attacking their favored foe and decrease their chance of being attacked by their counter. Infantry (and certain ships) may also take the guard ability which allows them to be selected instead of another unit. The way this will proceed:
Unit's turn (attacker or defender) comes up to attack. It rolls to see if it gets to attack a favored foe (if it has one). Upon success, the target unit is checked for a tactics promotion. If the original roll would not have been a success with the defender's modifier, the target is picked at random (treated as a failure). The targetted unit may be re-targetted, however. Upon success, the defender's units are polled to see if any have the guard promotion. If any do, a check is made for intervention and the best possible guard is selected. If that guard stands a better chance than the original targetted unit, the guard is now the defending unit. At this point the attacking unit has a 20% chance of attacking the guard unit, again modified by tactics, otherwise will select a unit at random. This part seems to involve a lot of steps, so I may need to revise this process of target selection.
When nearby units are pulled in, their location is polled versus that of the enemy. If an enemy unit is pincered (enemy units on both sides) units will get a boost when entering combat to assist. Example: Tiles A B C. Player 1 is in tile B, is attacking tile C. When units from A arrive (after a couple of rounds into combat, depending), those units will have a boost, so player 1 better be able to take out units in tile C quickly.
The advantage of this system is that it allows units to fight as a stack, as well as hold ground or a line (the system used in Alpha Centauri), as well as gerally making the system more tactical. Units will hopefully live longer and allow a player to recover from a mistake and/or recover from being massively outnumbered and, ideally, give the defender an advantage in the form of attrition (defender regenerates, attacker does not).
Options? Suggestions? I need to make sure I have a solid "flowchart" of sorts before I start programming.
But it's tough deciding how to handle combat as part of a stack attack model. So far I've devised this:
Attacker starts the combat.
Attacking artillery fires
Defending Artillery fires
Defending archers fire (this is one of the few cases the defender gets the initative)
Attacking archers fire
Attacking cavalry go.
Defending Cavalry go.
Attacking infantry go.
Defending infantry go.
Nearby artillery "arrives"
Nearby cavalry "arrives"
Repeat cycle
Nearby archers and infantry arrive
Repeat until victory is determined. If victory is determined before any nearby units arrive, they are not affected by the combat.
Any units reduced to 10% will fall back.
For the specifics, units of equal strength, all factors considered, will do 20% damage to one another (how this varies, or if it will vary at all, will come in later iterations). However, if one side is outnumbering the other, that side will suffer a 50% penalty ratio for proportion he outnumbers the opponent. To detail this, if one person attacks a single unit with two units, both of the attacking units will be at 75% effectiveness in terms of attacking: For the purpose of taking damage, they will still be at full effectiveness.
If this damage puts a unit below 10% or into death, health gets set to 10% and the unit is flagged as "wounded" and moved back one square. Wounded units can be killed. Calvary will have the opportunity to take a promotion to bypass this step for units they damage.
Units with an advantage versus another unit type will have a 50% chance of attacking their favored foe, if one exists in the battle. Units can take tactics promotions that increase this chance of attacking their favored foe and decrease their chance of being attacked by their counter. Infantry (and certain ships) may also take the guard ability which allows them to be selected instead of another unit. The way this will proceed:
Unit's turn (attacker or defender) comes up to attack. It rolls to see if it gets to attack a favored foe (if it has one). Upon success, the target unit is checked for a tactics promotion. If the original roll would not have been a success with the defender's modifier, the target is picked at random (treated as a failure). The targetted unit may be re-targetted, however. Upon success, the defender's units are polled to see if any have the guard promotion. If any do, a check is made for intervention and the best possible guard is selected. If that guard stands a better chance than the original targetted unit, the guard is now the defending unit. At this point the attacking unit has a 20% chance of attacking the guard unit, again modified by tactics, otherwise will select a unit at random. This part seems to involve a lot of steps, so I may need to revise this process of target selection.
When nearby units are pulled in, their location is polled versus that of the enemy. If an enemy unit is pincered (enemy units on both sides) units will get a boost when entering combat to assist. Example: Tiles A B C. Player 1 is in tile B, is attacking tile C. When units from A arrive (after a couple of rounds into combat, depending), those units will have a boost, so player 1 better be able to take out units in tile C quickly.
The advantage of this system is that it allows units to fight as a stack, as well as hold ground or a line (the system used in Alpha Centauri), as well as gerally making the system more tactical. Units will hopefully live longer and allow a player to recover from a mistake and/or recover from being massively outnumbered and, ideally, give the defender an advantage in the form of attrition (defender regenerates, attacker does not).
Options? Suggestions? I need to make sure I have a solid "flowchart" of sorts before I start programming.