Discussing State Machine Implementations for Games in Rust

⚓ Rust    📅 2026-02-23    👤 surdeus    👁️ 2      

surdeus

State machines are a common concept in game programming, often manifested at a very high level (Main Menu - Level - Ingame Menu - Cut Scene), or a very low level on a per-object basis
(patrolling - waiting - charging - animating). In the following repository, I have discussed five different implementations.

Personally, I also have a clear preference for two of them, depending on the use case (per object basis: old_fashioned, high level: with_enum_map_trait_objects).

What would be your preference, or would you suggest an entirely different approach?

https://github.com/Carbonfreezer/state_machine_games/tree/main

3 posts - 2 participants

Read full topic

🏷️ Rust_feed