Skip to content
ionous edited this page Jun 7, 2016 · 11 revisions

hsm-statechart is a fast, lightweight, state machine implementation based on UML statecharts.

Status of the code

The C code and Lua wrapper haven't been touched in quite a while. It works though, and could provide a starting point ( or solution! ) for some folks.

The AngularJs code is new as of May 2016. It's based on the same core algorithms, extended for parallel region support.

Motivation

There are other statechart implementations out there, so what's so good about hsm-statechart?

  1. A liberal license for games and indie development.
  2. The creation of state machines directly in code.
  3. An easy to understand hierarchical engine, with low policy requirements on user code.
  4. It's written in C and ports easily between OSX, Win32, and mobile platforms.

In addition hsm-statechart supports:

  • Zero dynamic memory allocation in its core API.
  • Optional per state instance data in the extended API.
  • A compact declarative interface.
  • [Lua] [ completely optional ]

The Stop watch tutorial provides a good overview of the system for both C and LUA. Event handlers provides more information on creating event handlers in C, and the Lua page provides more information on the Lua implementation.

Hsm builder provides a declarative interface above the core of hsm-statechart for more easily defining states.

The UML guide ( and Regions ) compares hsm-statechart's implementation with the UML statechart specification, while Resources provides links to more information about state charts, and other great projects.

There's also some thoughts on Future Work and C++ extensions, as well as a short list of Changes from prior versions.

Clone this wiki locally