Since other interesting news are still missing, I continue to describe the libraries included in the APOCALYX engine. After eSpeak, MicroPather, and in some older post OperSteer, Stellarium and SimulAxion, it's now the time of FSM, a library devoted to the management of finite state machines, to which APOCALYX adds an easy to master Lua interface. A demo that shows FSM in action is the "FiniteStateMachine.lua" script available in DemoPack1.
A finite state machine is an abstract device that defines a collection of states connected by transitions. Each transition between two states occurs when some specified event happens. Sometimes is useful in games to manage this kind of devices, to keep track of the states in which the game or is characters are.
The authors describe their library as follows: "FSM is an implementation of an extensible dynamic configurable finite state machine. The configuration of the state machine is not compiled, but loaded at the runtime from a file. The manipulation of the states, transitions etc. at runtime is also possible.
The FSM consists of a number of states. One of them is defined as the initial state. Each state is associated with a number of transitions. If a certain event occurs, a transition that is associated with this event causes the FSM to change its state. Such a transition may be limited by a set of conditions, that have to be fulfilled before the transition is activated. Each transition may be associated with a number of action, that are executed, when the transition occurs. Also may a state be associated with a number of actions that are executed each time the FSM enters or leaves the state.
The mightiness of the FSM was extended by introducing variables. A transition may be associated with a value range of a variable as an additional condition and is only executed when the variable value is within the specified range. The value of a variable is manipulated by special actions."