Tutorial: How To Easily Create A Cocos2D AI Controlled Actors With A Finite State Machine Compiler

A finite state machine is really the simplest AI you can build for a game character.  You define all the character character states, and what state the character is in when a specific event occur.  A fancy sounding name for a really simple concept.

That being said it can be extremely tedious to program a finite state machine with a good number of states in a language such as Objective-C as you’ll likely wind up with many nested conditional statements making things difficult.

That’s where SMC (the State Machine Compiler) providing a simple syntax for defining your state machine, and generating the appropriate Objective-C code.

Raúl Uranga has written a tutorial showing how to create an AI controlled character (a caveman) from the ground up using SMC and Cocos2D.

Here’s a video of the caveman doing his thing:

You’ll learn how to define the walking, clubbing, and attacking states, generate the Objective-C code and integrate it into the Cocos2D framework.

You can find the tutorial on Raul’s website here.

Looks like a nice technique for creating AI Controlled characters.

Added to the Cocos2D tutorial page, thanks to @raulraga for the submission.

©2012 iPhone, iOS 5, iPad SDK Development Tutorial and Programming Tips. All Rights Reserved.

.

DeliciousTwitterTechnoratiFacebookLinkedInEmail


Leave a Reply

Your email address will not be published. Required fields are marked *