Why 11kittiz Chose XState for Their Game
Key point
By using XState to clearly separate state transitions, they improved automatic progression and quality of the game logic.
Details
11kittiz implemented its core business logic with XState. They judged that typical frontend state management tools like useState, Redux, and Zustand alone were not enough to clearly handle the complex state transitions unique to games.
There are two key reasons. First, being based on a Finite State Machine, it allows states and transition rules to be declaratively fixed, reducing bugs and making maintenance easier. This fits especially well with cases where states are clearly defined, like in games — states such as Idle, Moving, Attacking, Defending, Eating, Playing, Using Booster, and Leveling Up.
Second, Inversion of Control becomes possible, simplifying automatic progression flows. The state machine can handle branching logic — such as moving on to reward distribution after a level-up without additional user input, or allowing only certain inputs — while React can focus on rendering and event handling.
In practice, it's better to gather as much business logic directly tied to state as possible inside the XState machine. Conversely, making a machine too large makes debugging difficult, so it's advisable to split it into smaller machines and combine multiple machines as needed.
This summary was generated automatically by AI. Check the original for the author's claims and context. Copyright belongs to the original author.
Our guide explains how the AI works. Report summary errors, attribution issues, or removal requests via Contact.