Blitz2D Newbies: A.I. - The Rating System
by Lattyware

When crating AI you have to have a list of things the object CAN do, and you choose what it WILL do.

Now, normally, this is a first come bussiness where if the object finds it can do it, it does it, and dosn't see what else is on offer.

What I suggest doing, is to give each option a rating, then see which has the best. So you have a list of things the object CAN do, what it SHOULD do, and what it WILL do. Using this method means you can easily change the Cleaverness of your AI. Lets use a practicle example.

Your enemy can:
Stay Still
Move Forward
Move Backward
Move Left
Move Right
Fire
Now, let's say there is a wall in the way of moving left - so we'll give that a rating of -5 - this can mean impossible.

Now, if we say that moving forward is not doing anything good, nor bad - so I'll give this a rating of 0 Along with Staying Still

Firing could be facing the player, so lets give that a rating of +5 as it's really good.

Moving left could be falling into a pit, so we'll give that -4

And right can be collecting a heart - so let's give it +4.

So, our scale ranges from -5 to +5, If we were using a superly powerfull enemy we could look through and say, aha! Firing is the highest at +5, so we can pick that. For an enemy that is a bit eaisier, you could choose +4, so it is a bit stupider. And if you wanted an easy enemy you could choose 0, or for suicidal you can choose -4.

By using this method you gain the abbility of checking which is best, and easily controlling how smart your enemy is.


For a printable copy of this article, please click HERE.


This site is Copyright© 2000-2004, BlitzCoder. All rights reserved.