Making an artillery bombard algorithm

player1 fanatic

Fanatic
Joined
Mar 19, 2002
Messages
2,639
Location
Belgrade, Serbia
Everybody says that AI should use bombard units better.
That's true, but nobody really knows exact way how to do it.

So, I decided to try to make hypothetical artillery algorithm.
(if someone from Firaxis reads this, this could be a guideline how to make a real algorithm)


When to build them?
There should be two modes:
-artillery low mode (same as Civ3 now)
-artillery heavy mode

Artillery heavy mode should be initiated:
-when best defending unit of neighbor civ has higher defense then your best attacking unit with movement of 2 or more
-when best defending unit of neighbor civ has same or higher defense then your best attacking unit with movement of 1

This will mean making more bombard units when you have just Cavalry against Infantry (but not Riflemen), or Swordsmen against Greek Hoplites (but not Mounted Warriors vs Hoplites).

Now I'm not sure what build ratio should be for artillery heavy mode.


Goal acquisition:
-Artillery should be used offensively against stacks of units or cities.
-In order to choose city for bombardment, you need to have as many bombard units as enemy has units in defending stack, but never less then 3.
-Bombard units should be accompanied with as many defensive units equal to half number of artillery units (rounded up), but never less then 2 (this is pretty conservative, but we don't want human player to "harvest" enemy bombard units for free).
-Stack should retreat (go to nearest city), if number of defenders gets lower then one quarter or number of artilleries or 1.
-If stack has fewer defenders then normal but still not enough to retreat, reinforce it with more defenders.
-When choosing cities, put higher priority on those near the borders and lower priority on those away of borders (using bombard stack deep intro enemy territory is suicide).

-Target unit stack on open only if they are on your border or one tile in enemy border.
-When attacking enemy unit stacks on open there lower limit on number of artilleries still applies (as many as enemy units), but not if artillery is in city and can bombard a target without moving (then fire with whatever you have).

When having not enough artillery to have a valid target, use them in defense mode:
-put them in city near the border, but only if there is enough defenders (half number of arties or at least 2)
-If no one city has as many defense units then put them in two or more cities.

-If your artillery stack is captured, put high attack priority on enemy group with them for recapture.


Well, that all that I could think of at this moment.
If the engine in which Civ3 is made, has functions similar to those I used in descriptions, then this should be possible to program.

Any ideas how to improve it?


P.S.
Possible problem: Harvesting AI's bombard units.
That's why I gave high number of defenders to any AI stack of units. Still, it would maybe be better to slightly change game rules, so only half of artilleries gets captured and rest destroyed. Just to help AI a little.
 
Originally posted by player1 fanatic
Anyone?

You've made quiet some thoughts, but I fear you're still missing things....

As we (at least I hope, we do) all agree, defense is easier than offense. So, the AI should at first hand be enabled to perform better when defending it's country.
This can be achieved on two ways:
a) just have that many units that no attack will have a realistic chance of success. This is easy to implement, and the result will be, that the AI is economically just dead
b) make proper threat analysis and react to the result. Part of this reaction then very well may be the positioning of artillery units.

As we see, a) is just not a solution.
As we know, b) is impossible with the current engine.

Since the meaningful offensive use of any unit will be just more complicated than for defense, since it implies that there is some kind of reversed threat analysis, the anticipation of the reaction and the counter-reaction to that reaction, I just have to state that many of your thoughts are really good, but we won't see them even in Civ4.
The only escape would be to force the developers to do their homework during the next two years.
Do I hear any bets on this?
 
What we need is a "Goal-oriented" AI but the complexity gets out of hand very quickly.

Imagine that I have 3 cities within range of the best AI offensive units. One city has a luxury resource and is heavily defended, another city has a strategic resource and is lightly defended but is within re-inforcement range of another city, my last city has no resources within its radius but occupies a strategic position (a land choke point, an ocean to ocean crossing or has the only harbour linking the cities on this continent to the mainland). How do you prioritise those targets?

As a human I can assess the pros & cons of attacking any of those cities but even a "Goal-oriented" AI would quickly run out of steam at this point.

I wish it were otherwise but I don't hold out much hope of a greatly improved AI in Civ4 or even Civ5 :(


Ted
 
Originally posted by Commander Bello
As we (at least I hope, we do) all agree, defense is easier than offense. So, the AI should at first hand be enabled to perform better when defending it's country.
This can be achieved on two ways:
a) just have that many units that no attack will have a realistic chance of success. This is easy to implement, and the result will be, that the AI is economically just dead
b) make proper threat analysis and react to the result. Part of this reaction then very well may be the positioning of artillery units.

As we see, a) is just not a solution.
As we know, b) is impossible with the current engine.

Well, I positioned my algorithm in that way. that arty is usualy used offensive, if good number of defensive units is free to acompany them (not needed in cities).

If not, then all those arties should be added to cities which support enough defenders to make them safe.


Still, I think that if Firaxis programer could get some time (if they have any), artillery algorithm could probably be improved a little.


Of course there is a harvesing atillrey problem that needs to be worked out.
 
About the harvesting. If the AI is stupid enough to try to race through my territory (about 50 tiles or more) with settlers accompanied by one defender each during a war, I don't see how the artillery harvesting could be avoided. It doesn't matter if the settler has five defenders - it will eventually be captured as the defending units are no threat to me and can be dealt with in time. They should have offending units with the settler too so I couldn't block its path and bombard it to death. But this would make one settler need too much units in wartime, so I would suggest that the settler would not even attempt such a heroic feat..

But as this clearly points out: there are problems with the AI that should be dealt with properly before this should be attempted. The AI really doesn't know how to put their units in good use in defence. So, although your suggestions are good, I see no way this could be done. You could, though, use your energy to make algorithms that enhance the AI's manouverability and tactics :)
 
There could be some logic, to make artillery stack target only goals near the border.

Other option would be a rule change to make not all artillery captured automaticly (maybe only 50%).
 
Originally posted by player1 fanatic
There could be some logic, to make artillery stack target only goals near the border.

Other option would be a rule change to make not all artillery captured automaticly (maybe only 50%).

With that option you would make 2 catapults being a stronghold, since you could capture only one per turn. Would that make sense?
Or the other ones would have to be destroyed, but then you would have to put in just more new code (although not too much - but, are we sure they wouldn't mess up this calculation, either?). And be assured, there would be uproar at the forum!
"Why can't I get all of those trebuchets?" - "Because it is unbalancing the game, to get even one. I request this exploit to be fixed at once!" - "It never has been intended, to capture any units!" - "I feel fine with how it never was!" - "Why not making it dependant from the cultural ratio?" ... and so on, and so on
 
Top Bottom