Giter VIP home page Giter VIP logo

andrew-gresyk / ffsm2 Goto Github PK

View Code? Open in Web Editor NEW
42.0 5.0 4.0 842 KB

High-Performance Flat Finite State Machine Framework

Home Page: https://flat.hfsm.dev

License: MIT License

CMake 0.12% C++ 98.68% Python 0.29% SCSS 0.04% Batchfile 0.01% Lua 0.85%
fsm fsm-library state-machine cpp cpp11 modern-cpp template-metaprogramming header-only mit-license game-dev game-development embedded embedded-systems

ffsm2's Introduction

License: MIT GitHub Release Date
CII Best Practices
GCC, Clang ARM GCC MS VS
Gitter Discord Twitter Follow


FFSM2

High-Performance Flat Finite State Machine

Header-only flat FSM framework in C++11, with fully statically-defined structure (no dynamic allocations), built with variadic templates.


Compiler Support

  • Visual Studio: 2015, 2017, 2019, 2022
  • GCC: 5, 6, 7, 8, 9, 10, 11, 12
  • ARM GCC: 9
  • Clang: 3.9, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
  • AppleClang: 12, 13, 13

(Currently CI-tested toolchains in bold)


Quick Start


See Also


Documentation


Feature Highlights

  • Permissive MIT License
  • Written in widely-supported modern(ish) C++11
  • Header-only
  • Convenient, minimal boilerplate
  • Fully static, no dynamic allocations
  • Uses inline-friendly compile-time polymorphism, no virtual methods are used
  • Type-safe transitions: FSM.changeTo<TargetState>() with optional payloads
  • Flexible configuration using FFSM2_ENABLE_* macros
  • Scalable, supports robust state re-use via state injections
  • Gamedev-friendly, supports explicit State::update()
  • Also supports traditional event-based workflow with State::react()
  • Inspect anything: previous and current transitions, state activation status, and more!
  • Game AI-friendly with dynamic planning support
  • Debug-assisted, includes automatic structure and activity visualization API
  • Built-in logging support

3rd Party Libraries


Get In Touch


Special Thanks

ffsm2's People

Contributors

andrew-gresyk avatar dependabot[bot] avatar gitter-badger avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

ffsm2's Issues

16-bit architectures support

FFSM2 single-header library does not compile on 16-bits architectures.

Description

FFSM2 cannot be compiled on a 16-bits architecture because the following code generates a compile-time error:

#if INTPTR_MAX == INT64_MAX
    #define FFSM2_ARCHITECTURE_64()    true
    #define FFSM2_ARCHITECTURE_32()    false

    #define FFSM2_64BIT_OR_32BIT(p64, p32)    p64
#elif INTPTR_MAX == INT32_MAX
    #define FFSM2_ARCHITECTURE_64()    false
    #define FFSM2_ARCHITECTURE_32()    true

    #define FFSM2_64BIT_OR_32BIT(p64, p32)    p32
#else
    #error
#endif

The case for INTPTR_MAX == INT16_MAX is missing.

Possible Fix

Doing a simple find in the code, neither FFSM2_64BIT_OR_32BIT nor FFSM2_ARCHITECTURE_32/64 defines seems to be used.
Commenting out those defines the code seems to compile just fine. Are they really needed?

Steps to Reproduce

Unfortunately, the compiler I'm using is not publicly available right now. You could reproduce the error by redefining INTPTR_MAX as INT16_MAX.

Environment

  • Version used (clang --version): clang version 14.0.4
  • Operating System and version: not relevant

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.