How to structure the AI code?

BlitzMax Forums/BlitzMax Programming/How to structure the AI code?

Tibit(Posted 2006) [#1]
I'm trying to make my AI rutines as modular as possible, separating the part that is game specific and those parts who are more general, more game-type specific and also those parts that are general to most types of AI. I want to make it "right" the first time, so I ask those of you who are more experienced "what is not so good to do" and "what is good to do" when it comes to AI programming.

It is for my 2D Tank game. I had an idea to update six nodes in a circle around the AI-tank, the AI can then pick the node which is closest to the objective, which could be the base or another tank. Nodes that are behind or inside walls are ignored.

Any tips and ideas are welcome.


slenkar(Posted 2006) [#2]
Im using a decision tree. You create a flow=chart of what the tank is going to think.e.g.
questions and answers

1.is the (1) node the nearest one?
if yes then goto 2
if no then goto 3

2.is there a direct route?

3.check node (2)

this system is totally seperate and very easy to change.
Look for Frank Taylor's binary decision tree code in the archives