Modding the AI

Modding the AI

A late World War II game which attempts to balance historical realism with a tactically complex model of battle.

Moderator: Content Developer

Post Reply
discodowney
Posts: 47
Joined: 19 Apr 2010, 15:31

Modding the AI

Post by discodowney »

Hi,

Im doing a Masters in Computer Games Technology. My MAsters dissertation is to create a Support Vector Machine AI to control the enemy AI in a RTS.

Spring 1944 seems less complicated than others on the site. If people would let me know of their experiences developing AI for the game thatd be great.

One more thing actually, could someone point me to some technical info about the AI in the game. If there is none then could you leave a few lines describing it - if its a FSM, theres loads of states, how the strategy is handled, something along those lines.

Cheers.
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6240
Joined: 29 Apr 2005, 01:14

Re: Modding the AI

Post by FLOZi »

discodowney wrote:Spring 1944 seems less complicated than others on the site.
Guess again, I'm afraid. S44 is one of the most complex games on Spring im(perhaps biased)o. There's a lot of lua code which would make it more complex for a non-lua AI to play properly.
SpikedHelmet
MC: Legacy & Spring 1944 Developer
Posts: 1948
Joined: 21 Sep 2004, 08:25

Re: Modding the AI

Post by SpikedHelmet »

Yeah, current Spring AI's commonly used are completely incompatible with S44 because of the heavy amount of lua gadgets embedded in important gameplay elements -- deploying guns (specifically directional guns), upgrading factories, and deploying aircraft. Current CRAIG AI that was made for S44 functions quite adequately in most regards, it provides for a challenging and rather unpredictable game due to its simple logic, but even then it basically boils down to telling the AI which units to build and in what frequency, and where to send units on maps. For the latter case they are given orders to move to random flags in groups, and then head for the player's base, resulting in quite challenging multi-directional attacks, but CRAIG doesn't do any of the above stuff either. Deploying guns isn't that big a deal but specific behaviour -- suiciding tank destroyers because they will ignore any non-armour unit in their fight commands and thus drive headlong into enemy infantry; calling in aircraft; and upgrading factories are things I'd like to see.
Tobi
Spring Developer
Posts: 4598
Joined: 01 Jun 2005, 11:36

Re: Modding the AI

Post by Tobi »

discodowney wrote: One more thing actually, could someone point me to some technical info about the AI in the game. If there is none then could you leave a few lines describing it - if its a FSM, theres loads of states, how the strategy is handled, something along those lines.
There is not really something describing it (not that I recall at least). I'm the developer of the AI btw. I know this reaction is a bit late (hadn't seen your post before) but it might be useful to someone anyway :-)

Basically the whole behaviour of C.R.A.I.G. can be described like this:

First, for many maps an approximation of the possible routes has been made using a handmade graph. This ensures pathfinding and other fancy algorithms are very cheap as this graph has at most a few hundred vertices, vs. millions when considering the whole map in detail.

Then it behaves approximately according to these rules:
  • Build base and units according to the spec in the config file.
  • If there are more than X units capable of capturing flags in the base, find the closest flag we don't own yet (using the graph) and send the units there. (Through all intermediate vertices along the shortest path to it.)
  • If a flag is captured, do the same thing again for the units that captured it, but now starting at the vertex nearest to the flag. (So a squad that is capturing flags will move from flag to flag with fight commands, waiting at each flag until it is captured.)
  • If there are more than Y units not capable of capturing flags in the base, calculate the intersection of [the vertices neighbouring any vertex that contains enemy buildings] and [all the vertices on the graph reachable from our base without passing through any vertex that contains enemy buildings]. (this the "frontline", basically, I think I called it that in the code anyway). Then send those units to a random vertex out of this set, giving intermediate commands near each vertex on the shortest path from the base to the selected target vertex that does not pass through any vertex that contains enemy buildings. Last but not least the units get a fight command into the enemy base.
  • There may be something that collects idle units and applies the last point to them again, but I forgot.
This ensures it looks like it is capping flags intentionally, it makes it attack a base from all sides, and it kind of ensures it only attacks reachable bases first.
Post Reply

Return to “Spring: 1944”