How to Learn AI Scripting

I’m currently learning how to script. I’ve got most of the basics down. My team is developing a game pretty fast, so is there any tutorials in which to get me started on scripting AI. Thanks in advance.

Update

I have some more experience with scripting, so are their any tutorials specifically for scripting AI. I don’t need anything specific about AI, just some tutorials on basic concepts to get down. If you don’t have any resources, tips would be nice too.

Lovely comments in here. :slight_smile: Well… for the task you describe it’s no biggie (book a couple of hours of testing and a couple of days of developing though into your calendar). So here’s some thoughts that might help on the way:

You create checkpoints (as a simple example) for a computer driven character. You make sure that it follows these checkpoints in a correct order of sequence. The movement of how it progresses is merely up to what your game looks like. I would make the character physic driven where script control the aiming of the rigidbody towards each checkpoint, to do this you make great use of raycasts and SweepTests. The rays will act as the very eyes (or tentacles if you will) of the character.

When the character is aiming towards its goal you can go full speed - When the character is oversteering you can simply decrease the speed of the moving rigidbody so it gets time to aim towards its goal. Randomize the target area of a single checkpoint to not get exactly the same movement every time. Small adjustments like this will make it seem very much alive.

For different behavior logic you can make use of enums, they’ll make the logic seem even more logical for you as a developer (if that makes sense). With this method you can trigger different events on given situations, for instance if no target is in sight and everything seems clear towards next checkpoint you make a switch for “lonesomeFlyMode”, when danger occurs you switch to “barrelrollMyAssOutOfHere” / “bringOutTheBigGuns” - and so on.

Its all a matter of how complex things has to be, many events might even be able to be animated, a question you should always ask yourself before entering the realm of artificial intelligence.

Funny, the Related Questions box in the lower right corner of this page, showed me this link:

http://unity3d.com/support/resources/tutorials/fpstutorial.html

Greetz, Ky.