Handling Entities
So, I've been learning about the idea of an Entity-Component-System. It seems like it might solve some outstanding problems for me, while giving me a bit of trouble until I master it... Such is life.
The basic idea seems to be that you have a big list of everything in the game (and this really can be everything -- cameras, text strings, animation curves, whatever). Each item is an "entity". Any particular entity will have some properties (if we were talking object-oriented style), but instead we call them "componenents" here.
The "system" part is trickier. It seems that a "system" is just a function that takes a list of entities and does something to them.
Now to me, this sounds a lot like the Prolog triple-store. So maybe I can get somewhere with that:
store = [ ["entity", "player", null], ["position", "player", [0, 0, 0]], ["model", "player", POINTER], ["entity", "treasure1", null], ["position", "treasure1", [10, 3, 0]], ["about", "treasure1", "...used gym socks."], ["entity", "treasure2", null], ["position", "treasure2", [9, -5, 0]], ... ];
So each three-element list here defines a relation. I can search and filter through this quickly.
Now, this may not necessarily make the best sense -- because compiling to JavaScript, I get dictionaries (hashes) for free, so I could just have a list of dictionaries and set those in the conventional way. However, I'll give it a try.
RFK2K
Robot Finds Kitten - 2000
Status | In development |
Author | oofoe |
Genre | Adventure |
More posts
- Entity-Component-Systems (or Entity-Systems)Nov 03, 2023
- Tools Down!Oct 30, 2023
- Coming Together!Oct 29, 2023
- Robots in Motion and Import WoesOct 28, 2023
- Wheels in MotionOct 27, 2023
- Bringing it to LIFE!Oct 26, 2023
- Spinning Wheels (Not in a Good Way)Oct 25, 2023
- It Lives!Oct 24, 2023
- Working ECS and First ModelOct 23, 2023
Leave a comment
Log in with itch.io to leave a comment.