Advertisement

Battle alghoritm?

Started by July 02, 2000 05:47 PM
1 comment, last by Lego1403 24 years, 5 months ago
Never thought it will be the hardest part of my game. But I still cant create this. I want to write a game like Warlords, but a little sophisticated battle alghoritm. I dont want armies kill each other so simply (just attack/defence *** random) So when I have 2 archer units and 2 infantry from one side and 4 infantry from another, how should I calculate all this? You can look my demo (its not a game yet, but it has many features of it) www.hot.ee/olegus Oleg
To make it more complex or realistic I''d look to history to explain more about battles and battle tactics. If your making a warlords game I''d go for adding something like :

- Formation Tactics
- Battle Experience
- Health (as in they just go stuck in a forced march through a storm)
- Suprise(hiding in forests? ambushes?)
- Terrain advantages\disadvantages.
- Archers attack first
- Distance from support

I could go on but you get the idea. Just haveing x units isn''t really good enough, add a lot of variety and your will make combat more complex. Read a copy of Sun Tzu''s "The Art of War". You''ll find only a small portion will apply to a battle based game(much is about images and social management) but of what you do read you''ll have some really good idea''s.

Try this:
"Never go in to battle with a swamp to you backs." This comment can be used for may kinds of terrain.

Then from there you can add a few random numbers and do the math.


gimp

(Warlords great game I met the coder at his house one day while beta testing WL2, he was impressed with this guy who built his own warlords 1 map with a hex editor. )
Chris Brodie
Advertisement
Oh, and as for the actually battle algorithm, do it in mini rounds, say average 50 minirounds where the troops wear each other down. If you hit 0 HP your dead. This will allow you to fix a major problem with WL, "Breaking off an attack". So as the battle roars on you should have the ability to break off. This also allows for some interesting tactics.. eg:

Your Warg Archers attack the Solarian Knights... Attack for a while then break off the attack when your 50% damaged. Retreat back to your preists for recuperation, then 2 turns later attack again. In this way an intelligent weaker opponent can ware down a stronger entrenched opponent.

So I suggest something like a loop that will conduct a ''mini battle'' then maybe a Sleep(500)(or a loop that just waits for input, perhaps the general(player) presses the retreat key.). Then you cold add some code for retreat and rout. Retreat take say 2 seconds and rout 0.5. But in a rout you get 80% less defence.

If you want more idea''s just ask me.... I was wayyy in to turn based strats before multipler 3d took over

gimp
Chris Brodie

This topic is closed to new replies.

Advertisement