State machines
See also:
System:
Is what he says here ACTUALLY true? I think it comes down to semantics. Still, an interesting video…
‘If you’re not using state machines as the fundamental organising principle behind your game, then you’re doing it wrong…”
https://gameprogrammingpatterns.com/state.html
https://shaggydev.com/2021/11/01/state-machines-intro
https://gameprogrammingpatterns.com/state.html
---
title: NES Controller
---
stateDiagram-v2
direction LR
S1 --> S2
S2 --> S1
S3 --> S4
S4 --> S3
What the machine recons
stateDiagram-v2
[*] --> Idle
Idle --> Walking: Move
Walking --> Idle: Stop
Walking --> Attacking: Attack
Idle --> Attacking: Attack
Attacking --> Idle: Done
Idle --> Hit: Enemy Attack
Hit --> Dead: HP <= 0
Hit --> Idle: Recover
stateDiagram-v2
[*] --> Idle
Idle --> Patrolling: Timer
Patrolling --> Chasing: Player in Sight
Chasing --> Attacking: In Range
Attacking --> Chasing: Player Moves
Chasing --> Patrolling: Player Lost
Idle --> Hit
Hit --> Dead: HP <= 0
Hit --> Idle: Recover
stateDiagram-v2
[*] --> Unavailable
Unavailable --> Available: NPC Offers
Available --> Active: Accept
Active --> Completed: Objective Done
Completed --> TurnedIn: Player Talks to NPC
https://github.com/jakesgordon/javascript-state-machine
https://jotai.org – Jotai takes an atomic approach to global React state management.
Resources
https://gamedevacademy.org/what-is-a-state-machine-complete-guide