Wednesday, May 30, 2018

game design - Calculating the output of two armies fighting



I am programming a strategic game using Flash. The game works very similar to the famous game "Travian".


My problem is as follows: I am trying to make the calculation of the troops lost as a result of a fight between two armies. The two armies have different types of units. Some of them are stronger against some other units and weaker against other types.


How can I put that effect of this differences in the equation of the fight?


It seems to be easy if they only have att and def points only, but when it comse to the units type dependency, I am lost.



Answer



In addition to supporting Amit's suggestion of looking at the Lanchester equations, I just want to add that this is a game design decision, not an empirical fact that we can give you. If you want to take unit type into account, you have to decide what that means. This means choosing an equation that includes all the factors that you want your gameplay to include. If you want infantry to be better than cavalry, then you have to decide what that should mean - eg. how many cavalry do you need to equal 100 infantry? And does it matter who attacks who? You seem to be implying that simply giving infantry and cavalry different attack and defence values isn't good enough - why is that? What else are you trying to represent that can't be captured just by those values?


You have to decide which factors you want to model in your game, as they affect the way the players will approach it. These might include unit size/quantity, unit type, unit experience (eg. veteran status), terrain and environmental effects, differences between attacking and defending if any, whether to model damage and attrition or not, whether to model the passage of time during the combat, the ability to withdraw or flee (possibly including modelling of morale), how much randomness you want in the equation, and so on.


Once you know all this, there are several basic mathematical approaches you can take. You could do a round by round "chance to hit" system like many RPGs have, eg. the d20 combat system. You could do a one-round "attack vs defence" weighted coin toss system like the original Civilisation game does. You could have each side generate a score by adding attributes to a random number and whoever gets the highest value wins. And you can permute these systems to work on a round-by-round basis, or to deduct hit points or morale points, or whatever. Any system can work, but you have to balance it the way you want it to play. As ultimately the choice of how to model the combat is a key part of the game design, and is not something other people can just give to you.


No comments:

Post a Comment

Simple past, Present perfect Past perfect

Can you tell me which form of the following sentences is the correct one please? Imagine two friends discussing the gym... I was in a good s...