Hello, A small introduction in the game I'm develloping a web game called mobsterland. It's a medieval game with allot of features. One of the features is the map, you can check where your village is located and who is near you. By using the map, players are able to atack each other or to send troups. ex: map example The actual problem My problem is that i got stuck at the atacking. If player(atacker) is atacking someone with a nr of x (variable) units, and defender has an y (variable) nr of units how many will die and how many will rezist? Problem comes here: each unit belongs to a category, if i atack with multiple units that belongs to different categories, how do i calculate the atack ? Example: Category sword - atack 30 defense 50 Category ax - atack 60 defense 10 Category cavallery - atack 120 defense 40 Code (markup): Atacker has 10 sword men, 1 ax and 10 cavllery, total atack power = 1560. The victim will have only 20 sword men, total defense = 1000. Total atack - Total defense = 560... this is where i need help. After i calculated the points of the atack left(560 > 0, atack succesfull), how many units are going to die from both players?(from atacker and victim) PS: Atacker uses only atack points from units, and victim uses only defense points. If you have any ideea please post it in here, for 2 weeks i'm trying to figure out how, and still no ideea .
As a game designer you should define the rules of the game, for instance, do you take into consideration the formation of the army? let's say your attacker is using cavalry that has a logic advantage over swordmen, and probably they could easily crush then, something that would not apply to lancemen... i mean, you are presenting this engine in a very simple way, and to be realistic you should consider more factors. It's not only about who has more power, because then the game is easily exploidable and not fun. Consider terrain factor, units experience, and obviously formation. Imagine your cavalry has more attack power than the enemy but he is using archers, then probably some of your men would die because of the range factor before they reach the archers, and then the starting attack power is reduced when they are close to archers, even more if they are on a high spot and the horsemen cannot get there easily, most of them dying when trying to get the higher spot. I guess you got the idea.
in this first release i won't take care for the formation of the army, i just want at the moment to have a fomula for it.