Samstag, 27. März 2010

Developing an AI from scratch

I guess most people who come across this blog probably know me from the XNA Creators' Club or followed a link from the Squar website.

Here, I will try and develop an AI from scratch, improve it step by step and keep you updated with videos of how the AI evolves. The idea is to make the process of developing an AI transparent and perhaps to strike up a conversation with fellow hobby developers, both about technical aspects as well as how we feel an AI should behave in order to allow for a satisfying gaming experience.

As all algorithmic considerations will be very specific for the game Squar, people who are not familiar with the project should definitely check out the above mentioned site and see what Squar is about.

As already mentioned, the idea is to get something up and running as soon as possible and to determine by playtesting (and of course by twisting our mind) how to extend and enhance the behavior of the AI.

And here we go:

Basically a player in Squar has only a few simple tasks - and yet he has much more to do than in a simple FPS: He should extend his infrastructure to tap energy sources, he should collect and use power-ups and he should attack the enemy and his infrastructure whenever possible. The standard way an AI is usually thought of is a finite state machine, which means that we have one state for each of our desired behaviors (or tasks) and that we switch from one state to the other depending on the way our environment evolves.

That being said, it is clear that a simple enumeration of behavior names together with a switch-statement can be used to allow for different behaviors. Each behavior should then contain orders what the AI has to do to fulfil the present task and a check whether the present task has been completed or should be abandoned. For this case we provide a function GetNewTask() that "evaluates the situation" and determines our next task.

We start out with 3 states for our (hithero pacifistic) Squar AI which is perfectly happy to extend its infrastructure and collect power-ups.

Keine Kommentare:

Kommentar veröffentlichen