ai concept

ai concept

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

Moderators: hoijui, Moderators

Post Reply
joshthewhistler
Posts: 4
Joined: 08 Feb 2010, 16:50

ai concept

Post by joshthewhistler »

[edited to make it readable, thanks AF]

Hi, I have been working on an ai concept which I shall properly code once I have access to something other than my netbook. For now I have been working on algorithms to solve specific problems in it. I wondered if anyone had already thought along the same lines or could find any serious flaws in my ideas. I would love to hear your comments.
  • Almost anything an ai needs to do can be represented by a "target" object. Build targets, attack targets, repair targets, reclaim targets, anything...
  • A "target" would have a position (that can change if for example it is linked to a specific unit), a required ability and a priority.
  • A unit list would have position and ability(ies) listed for each unit.
The code would consist of the following levels, as far as I can tell it can all be unsynced and probably in a separate thread using kmcguire's method:
  • 1. High level strategy, left entirely to the individual coder, regarding resource balance, build order, unit mix, etc.
  • 2.Low level strategy: "Target" placement. This includes for example deciding where to place a build target, deciding what priority to give to the different targets, placing extra reclaim targets if resources are low, setting a scouting target in unexplored areas, setting a defend target on a vulnerable unit, setting a nuke target on an enemy base, etc.
  • 3.Assigning units to targets: the unit list is cycled through and each unit is assigned to a target using an algorithm that factors in the time it would take for the unit to get there (approx.) and the difference in completion time the unit would make if it worked on that target as well as the priority of the target. For example, this code would decide whether a light fast aeroplane (high scouting ability) should be sent to a close scouting target with a small area (low time to completion) and low priority or to one much farther away with high priority and larger area (high time to completion).
  • 4.The code to tell a unit what to do to complete a certain target. Some of these are obvious and already included in the game engine: building, reclaiming, shooting at something... Others, like scouting are less well defined.
In order of importance the levels are:
  • Level 4 would be a bunch of functions shared amongst all ais using this system.
  • Level 3 would be shared as well. It would most probably be a single large function that would run as often as possible to make sure units are being assigned to the best possible targets.
  • Level 2 is the key to the system. Proper target placement and giving them the right priority would be where gaming sense (something I don't generally possess) would be required from the coder.
  • Finally, If level 2 is well coded, level 1 could be done by a non-coder (read player) by setting a few constants. Level 1 is kind of optional; the difference from level 2 is vague.
  • If levels 3 and 4 are finished then this would make a fun "helper ai", the player would set targets and train units and the code would assign the units to different jobs. Anyone who has played globulation2 (a fun little rts game worth trying) would know what I am talking about.
This is an absolutely modular approach. A target can be set even if no unit is available for a long time. I see it working a bit like an intelligent anthill. It could start with only a few basic target types that correspond to basic actions in the game but could then be expanded. A target is simply defined by its required ability. A short algorithm would be needed to determine which units have the required ability and more code would be needed to define units' behaviour once they have been assigned to a target.

I think this is most suited to Kernel Panic. Resource management and training units is unnecessary and large quantities units are available to be assigned to various targets. I think it would however be suited to the other spring games.

Finally, my credentials: Not many. I have mainly coded age of empires II ais and was always frustrated by the lack of control I had over the ai. It was designed for rapid development but not optimal solutions, and of course the game engine was a closed box. Much time was spent guessing at how a particular script command was executed by the game. I am a python coder. I have not learned c++ or java because I have found that what I usually want to do is test an idea or develop an algorithm. Coding in python is almost like writing pseudo-code. If I do write my spring ai it will definitely be in Lua.
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: ai concept

Post by knorke »

globulation2
when i read about the targets i at first thought about glob 2 :)
I think it would however be suited to the other spring games.
not sure. for kernel panic it would definetly work for an ai to float target areas with units but for other games thats not so good.
like rushing artillery into defense does not work. (units must be mixed and used fitting to their rules)
also in kp there are always enough units avaible while in other games thats not true.
like if an "bomber attack here" target is placed, the planes must be produced first. so thats more complicated...
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Re: ai concept

Post by AF »

So goal oriented design!
joshthewhistler
Posts: 4
Joined: 08 Feb 2010, 16:50

Re: ai concept

Post by joshthewhistler »

So goal oriented design!
absolutely. Is design ever anything else? :wink:
like rushing artillery into defense does not work. (units must be mixed and used fitting to their rules)
units would only be assigned to a target which they would be good at. Or rather, the best unit available that isn't more suited to an alternative target would be assigned to a particular target.
also in kp there are always enough units avaible while in other games thats not true.
like if an "bomber attack here" target is placed, the planes must be produced first. so thats more complicated...
It is only slightly more complicated and a lot more flexible. An advantage is that targets could be placed way before any units are available to fulfill them. The whole point of the method is to separate figuring out jobs from choosing the units that will do the job into two independent problems for the ai.
Post Reply

Return to “AI”