This is my idea for an AI. It is more state machine than real AI.
It is somewhat inspired by an AI I did for an unfinished rts game in visual basic (haha oh wow) but it isn't in spring yet, so theoretic blabla follows.
The goal is more to have an AI that:
-is as simple as possible to make.
-plays interessting, does not matter so if it is not perfect.
-uses different tactics for different maps.
Basically the AI has "zones" where it likes to do stuff. In the picture the zones are those blue circles but they could as well be rectangles or whatever. For the topleft startposition it might look like this:

(ignore dotted lines for now)
The zones are connected like nodes in a graph or something.
Idle units:
New units are randomly assigned to some zones and patroll there.
One could have some rules, like how many units of what unittype can be in one zone etc.
Could also add that the "next" zone is only filled with units when the previous has reached its unitlimit.
Defending:
If a zone is in danger, units from connected zones (note the lines) are send to help.
If no units can be send, the attacked units could also run away to a zone that is nearer to the startposition.
Attacking:
Maybe it would work to just put some zones into enemy land, but that is boring. So the dotted lines are attack routes.
When the AI wants to attack, it choses one route and sends units along that path. Different routes could have different unittpes assigned, eg the middle route in the picture goes down a cliff, so maybe only use air units for that.
Pathfinding:
Is not needed, because you can lay out the zones and routes in a way that units do not get stuck. The connections between zones do not have to be straight lines, they could also be a list of waypoints.
(eg to get around a lake)
So per map there would be a config like this:
Code: Select all
startposition[1]=
{
zones =
{[1]x=450, z=800, radius=400, maxUnits=20, connectedTo={2,3,4}, whenAttackedgetsHelpFrom = {2,4},...
[2] = ...
attackRoutes = {
[1] = {{list of coordinates}, type = "ground"}
[2] = {{list of coordinates}, type = "airdrop"}
...
}
Could maybe have some tools to speed up creation of configs.
But that is all so rigid! The AI will be predicable!

It will take a few games on the same map for players to notice.
If they play that much, that is a sucess
Imo there is no need to come up with algorythms to have the AI figure out everything. Why should the AI analyze all units to find the best anti air defense? I made the game, so I
already know the answer and can just tell it to the AI.
It is similiar with things like "where to place defense:" One quick look at the map and each player can tell where you should set up defences.