How to think the ECS way?
Posted: Thu Aug 11, 2022 10:46 am
Trying to understand how to use ECS correctly, as in, the "data model" for want of a better term.
There is, of course, entities, components and systems and I'm hoping an example will make this easy to understand. I'm a bit of a drag car fan so want to make a drag race game. Will involve reaction times but also starting with a basic drag car and building up modules so that the car gets better. Bit of a meta-game to it I guess.
I think my 'data model' will be this:
- two cars racing down a straight track simultaneously.
- the cars will have bits that make it perform better
- those bits will be "common" in the sense that a super-charger on one car will perform and behave the same on any other car.
If I have an entity called "car" and an entity called "super-charger" then I can link the two together in a table that belongs to 'car'. Yes?
The super-charger will have a neat ability to multiple acceleration by 1.5. Is that a component?
And if "motion" is something that happens to the car, but is influenced by the super-charger then ... idk. How to unpack all that? (and haven't even mentioned 'system' yet).
There is, of course, entities, components and systems and I'm hoping an example will make this easy to understand. I'm a bit of a drag car fan so want to make a drag race game. Will involve reaction times but also starting with a basic drag car and building up modules so that the car gets better. Bit of a meta-game to it I guess.
I think my 'data model' will be this:
- two cars racing down a straight track simultaneously.
- the cars will have bits that make it perform better
- those bits will be "common" in the sense that a super-charger on one car will perform and behave the same on any other car.
If I have an entity called "car" and an entity called "super-charger" then I can link the two together in a table that belongs to 'car'. Yes?
The super-charger will have a neat ability to multiple acceleration by 1.5. Is that a component?
And if "motion" is something that happens to the car, but is influenced by the super-charger then ... idk. How to unpack all that? (and haven't even mentioned 'system' yet).