Get Updates By E-mail 

Article Written By:
Johann Dowa

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.


  •  
  •  
  •  
  •  
  •  

Submit A Resource

Have you created a useful tutorial, library or tool for iOS development that you would like to get in front of our 300,000+ monthly page views from iOS developers?

You can submit the url here.

The resources we feel will appeal to our readers the most will be posted on the front page.

Comments