X hits on this document

PDF document

Enhanced NPC Behaviour using Goal Oriented Action Planning - page 23 / 110

341 views

0 shares

0 downloads

0 comments

23 / 110

machine. Creating a custom FSM scripting language involves defining the FSM in an external text file and on being read into the program it is transformed into C++ or bytecode. Houlette continues to explain that this system requires a custom vocabulary along with a native condition and action library. The condition and action library is a vocabulary subset of the scripting language for game-specific actions and conditions. The state transitions must also be encoded in the external scripting file. Houlette warns that defining a scripting language requires a lot of man-power and it can be tricky to design a good scripting language. The macro assisted FSM language is only briefly explained and as there isn’t any source code or examples of its use available and combined with little previous experience with macros in C++, made it a risky undertaking. The traditional C++ approach is described as being problematic when coming up with state transitions, occasionally troublesome to debug and can increase compile times, however it is one of the most tried and tested means of creating FSMs in the games industry.

Buckland approaches FSMs by using C++ templates to represent FSM states along with an overall state machine class to control state transitions. Buckland’s article (Buckland, 2005) describes a quite neat implementation with sample code of the actual state machine in action provided. The entire state machine itself is relatively straight forward and is contained within the single header file. Each state extends a base C++ template state and has the same general structure.

There have been some criticisms levelled at FSMs. Isla states that with ever increasing game complexity FSMs can become unwieldy and difficult to manage due to the number of states and the transitions between these states (Isla, 2002). Another criticism of FSMs is that they are deterministic. Given an input and if the current state is known, the state transitions can be predicted (Brownlee, 2002). This is often used to players’ advantage as they often ‘learn’ AI behaviour and can predict what actions the AI is going to perform. Brownlee

15

Document info
Document views341
Page views345
Page last viewedSun Dec 11 12:25:07 UTC 2016
Pages110
Paragraphs700
Words23812

Comments