Original Post
Greetings, guys. We have been working on a fight system for a turn-based strategy game and we haven't been able to find a working solution. We have tried quite a few approaches and prototypes, but none worked. Therefore I present the problem to you, fellow coders and designers, for maybe you will know of something old as time itself or come up with a bright idea. The system is pretty simple, at least from the player's viewpoint. You (the player) have two armies facing each other, consisting of one to eight units. You know the strength of every unit of your army and every unit of enemy army. You know which units do well against which particular enemy units and vice versa. Battle is calculated anonymously, you do not see its workings, only the result. Unit Each unit has the following properties relevant to battle: * Strength - a number from 1 to some limited value (perhaps around 15). This defines how well the unit does in battle. * Type - this defines how well the unit does versus particular unit types. Types are: ** Foot - goos vs pike. ** Pike - good vs mounted. ** Mounted - good vs foot. ** Giant - good vs flyer. ** Flyer - good vs foot and mounted. 'Good vs' means that the unit has a strength bonus when fighting the respective unit type. The bonus is the same for all combinations and is deduced from the unit strength. Battle There is nothing like accessibility of units one to another (like archers hiding behind infantry) or any unit positioning or terrain. It is just the unit's strength and bonus system that count. Now, we need a formula that calculates strengths of both armies resulting in a ratio (for instance, 15:12) which will be the chance of one army defeating the other. We do not need to calculate which units die in battle, just which army wins. For better imagination, let's define the armies. Let's have attackers consisting of a golem (strength: 5, type: giant) and a skeleton (1, foot), and defenders of a dragon (5, flyer). In this config, attackers should clearly win, as their golem is equally strong as the enemy dragon, but has a bonus against him, and they are two against one. Defenders have only one unit, the dragon, and he has a bonus against the skeleton, which should help him a bit, but not enough to flatten the powers of both armies. What do you think is the magic here, to get one final number for each army?