Well, an entity being a number, by definition is data and since each ‘thing’ in world must be associated with one and only one number, that set of numbers must be stored somewhere. I could see making the rule that every entity must have at least one component and therefore at least one entry in the component table, eg - a render component, but that would seem to add un-needed complication and make database maintenance more complicated.
I understand that components don’t reflect any action in the sense that components don’t take actions since there is no code in components but do reflect actions in the sense that the component contains the data that will allow a specific machine/system to act on the entity.
My background is only very recently involved with object oriented stuff. I spent many years doing server side pipelined transaction systems and the essence of this entity structure sounds very familiar.
Morris
No that set of numbers does not have to be stored somewhere. Only the Components that have the data need to store the number. Of course without a Component you cannot do much but still you can say “Entity 1002 does not exist” without having to store the entity number. The actual number is abstract, the entity itself is just an idea, the components are the first bit of code. The data does not imply at all how its going to be used most of the time (e.g. the location of an entity can be used in the fighting system, the navigation system or any other system).
Thanks. Its a little bit clearer all the time. So the assumption is that every entity will have at least one component and that the default (or first) component record is created at entity creation time. In terms of database structure, it is just an issue of where the entity number is stored because it must be stored somewhere otherwise a system stop would be disastrous. If I understand, you are saying that the entity numbers are stored in the component records. I am saying it would stored one additional place, in an entity record.
How would ‘entity 1002 does not exist’ happen? The only way I can think of would be that some part of the system found a reference to 1002 and there were no component records for that entity.
Morris
No, there is no entity record, that would be a Component. And yes, you find no “base information Component” for an entity number and thus deduct the entity doesn’t exist.
Maybe we shouldn’t hijack this thread for learning entity system basics here though, a new thread in the general chat or AI forum is more appropriate for this. Also make sure to repeatedly read the linked article and comments.
No problem. I just appreciate the information. Can you move the thread?
Morris
No
Some entity systems do keep an entity table but it’s dangerous and superfluous. Superfluous because the data can be ascertained a different way and dangerous because if you have a table then it’s very tempting to put data there. Even that series of articles discussed that and I believe he did have an entity table.
Mythruna has an entity table with only one record in it. That record contains the next available entity ID.
Every component table has a column for entity ID. One nice thing about this is that there is never a central table to clean-up once all of the components are gone. That (to me) seemed to be breaking the whole idea of an entity system… that something would have to somehow reconcile across all components I found really distasteful. An entity exists as long as it has components… because if it doesn’t have components then it’s completely useless (unless you are about to set a component on it).