123
-=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- (c) WidthPadding Industries 1987 0|329|0 -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=-
Socoder -> Concept/Design -> Calculating battle results

Sat, 25 Apr 2009, 18:35
mindstorm8191
For those of you who haven't talked to me recently in the chatroom, I've recently been working on a browser-based game, called Vesuvious. The game will be played entirely in the browser, no downloads, no flash player, no java applets to run. Vesuvious will be a war game, a bit like www.Travian.com, and a bit like Command & Conquer. I've gotten fairly far on developing the game, but currently I'm needing some design help with controlling how battles turn out.

Right now, I have a pretty simple equation to figure out how many troops die in a given attack. Keep in mind that attacks are cyclic, and are repeated every 5 minutes or so. The troops being attacked will have chance to retaliate as needed, so troops should die on both sides, based on circumstances. I have a lot of different fields for determining the attack and defense rating against different unit types: for example, a swordsman could kill a calvary unit, but would have no effect on a tank. At least this is what I am hoping for.

I have a formula in use right now, but I don't think its quite accurate. This only works for one type of unit attack, too; adding more may end up being a nightmare. Basically, I take all the offensive points of the attacker, and defensive points of the defender, and add them up, based on the number of troops. I then take the offensive value, and subtract the defensive value from that. Whatever offensive points are left count as kill points, and they go against a unit's hit points. I pick a unit at random, and subtract the hitpoints from the remaining kill points. If its more than that units hit points, it dies and another unit it chosen, until there are no more kill points remaining.

...Hmm, it might look easier in code than here, but I hope you can get the idea. The problem is, from the tests I've run, the battles don't seem all that fair, even when I adjust the different variables involved (hitpoints, offensive and defensive values). If a group is large enough to kill one soldier in a smaller group, the smaller group can't do anything against the larger group. Plus, two groups of equal size are left in a stalemate. Does anyone have any ideas on how to make this a better balanced system? I could certainly use some input on these matters.

-=-=-
Vesuvius web game