> For the complete documentation index, see [llms.txt](https://doc.hfsm.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://doc.hfsm.dev/general-information/history.md).

# History

The predecessor of [HFSM2](https://hfsm.dev/) has been created in 2013 in C# for a 3D platformer game in Unity.

UML statechart has been considered, and ultimately rejected.

Instead, the decision has been made to create yet another state machine framework based on the actual needs of the project.

The C# framework supported:

* 2 types of regions: `Composite` and `Orthogonal`
* 3 kinds of transitions: `Restart()`, `Resume()` and `Schedule()`

It has been used for most of the game objects, including:

* Animated player character (\~50 states total)
* Doors
* Game menus
* etc.

After the release of VS 2013 (which debuted with C++ variadic templates), the first version of HFSM has been developed with the idea to exploit variadic teplates to generate the entire FSM structure at compile time.

[HFSM](https://github.com/andrew-gresyk/HFSM) 1 has been [presented](https://gresyk.dev/presentations/2017/04/11/hfsm-for-videogames.html) for the first time at the [C++ London](https://www.meetup.com/CppLondon/)’s [April 2017 Meetup](https://www.meetup.com/CppLondon/events/237580202/).

At the end of September 2018, [HFSM](https://github.com/andrew-gresyk/HFSM) evolved into [HFSM2](https://github.com/andrew-gresyk/HFSM2). [HFSM](https://github.com/andrew-gresyk/HFSM) used a variation of the Robin Hood hash table to map `stateId` (implemented using [std::type\_info](https://en.cppreference.com/w/cpp/types/type_info)) and state info. Starting with [HFSM2](https://github.com/andrew-gresyk/HFSM2), the `stateId` became a cumulative index of the state, which is known for every state at compile time.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://doc.hfsm.dev/general-information/history.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
