Possible Artillery Group AI?

Possible Artillery Group AI?

Here is where ideas can be collected for the skirmish AI in development

Moderators: hoijui, Moderators

Post Reply
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6242
Joined: 29 Apr 2005, 01:14

Possible Artillery Group AI?

Post by FLOZi »

The idea being that you have some scout unit in the group, which when it gets an enemy in its LOS or weapon range, the arty units in the group will fire on it if they are in range, or if they are above a certain limit of mobility, move into firing range.

Possible?
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post by AF »

Write it out in pseudo code for us =p
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6242
Joined: 29 Apr 2005, 01:14

Post by FLOZi »

well, the problem is i don't know whats possible with the interface :|

the steps required would be:

1. determine which units in the group were a scout or artillery unit
2. determine the speed of the artillery units (i.e. which are self propelled and which are 'static' (whether they be a building or a very slow mobile unit)
3. search for targets within LOS or weapon range of the scout(s)
4. order all the arty units in the group to fire at said targets when they appear, if they are in range
5. move mobile artillery into range and order them to fire
User avatar
MadRat
Posts: 532
Joined: 24 Oct 2006, 13:45

Post by MadRat »

It would be smarter to use two AI groups in unison, one to scout and draw out human controlled units and a second group of artillery to bushwhack them.
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post by AF »

Now take that pseudo code and make it more detailed using primitive orders such as move attack change trajectory, and use TDF tags from the unit fbis aswell.

Put them all under these headers, here's something to start you off.

Code: Select all

list of unit id's of artillery
list of unit id's of scouters/bait
other arbitrary values to control things

Unit (a) has finished command
    Assign a new command or wait

Unit (a) has been added to the group
    if artillery
        add (a) to artillery unit list
    else if scouter
        add (a) to scouter unit list
    else
        ignore and dont add it

Unit (a) has been removed from the group (destroyed maybe?)
    Remove unit

Init GroupAI has been created
    Do initial actions/calculations

Update, called 30 times a second.
    Check issue necessary orders, such as attack enemy if in range etc

true false Is This a scouter? (a)
    if its a scouter
        true
    else
        false

true false Is This artillery? (a)
    if it's artillery
        true
    else
        false
Just take some of the things in that and expand on them like take :

Check issue necessary orders, such as attack enemy if in range etc

And rewrite it into several lines describing how you would do that.

If you write something there that cant be done then we'll say and find a workaround, then at the end I'll take your pseudocode and translate it as best I can into C++.


But suffice to say writting out even a simplistic pseudocode of a groupAI will mean your chances of it actually being written rise astronomically.
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6242
Joined: 29 Apr 2005, 01:14

Post by FLOZi »

Well first off I was just checking it wasn't completely beyond the realm of possibility :-)

edit: infact if you can send me in the direction of some group AI documentation I might take a crack at it myself, all I can find is the greenai article on the wiki
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post by AF »

Your best bet is to look at skirmish AIs and existing groupAI, as both use the same callback interface, and IGroupAI is the only different between the skirmish AIs and the groupAIs in terms of how the engine calls them.
Post Reply

Return to “AI”