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?
Possible Artillery Group AI?
Moderators: hoijui, Moderators
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

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
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.
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.
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
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.