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