Skip to content

ECS and finite state machine #1230

Answered by skypjack
rudiHammad asked this question in Q&A
Discussion options

You must be logged in to vote

It doesn't depend on EnTT. It's more a matter of tastes when using entities and components.
One way to do that is to define your states as components, attach and remove them as needed, and have different systems for different states.
Otherwise, you can have a component that stores all data along with a state identifier, then use an fsm system to update this state representation.
Of course, you can also have a pointer to a more OOP-ish data structure that gets the job done and stay more on the OOP side.
None of these solutions is more right or more wrong than the others. 🤷‍♂️

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by rudiHammad
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
discussion it sounds interesting, let's discuss it
2 participants