To start off, I technically KNOW the way i’m doing it isn’t correct, i’m more just wondering whether it’s going to matter in the long run, I prefer my method because its the easiest for me to understand and work with, but if it completely negates the usefulness that ECS brings then I need to fix it.
Currently, I have a big dictionary for all of the current entities in the game, which looks something like this:
local Entities = {
["6783-7845-9232-7845328"] = {
RegistryId = "core:arrow",
UUID = "6783-7845-9232-7845328",
Components = {
Position = {X = 0, Y = 0, Z = 0},
InGround = true
},
IsPersistant = false
}
}
Everything is saved in this one table, including all of the components an entity has. When I inform the client of a new entity, I have to send the whole table, but only the UUID when making changes.
Correct me if i’m wrong but I believe the way to do ECS is each entity is a number like a UUID, but its stored in the component, rather than components stored in entities, like:
local PositionComponent = {
["6783-7845-9232-7845328"] = {X = 0, Y = 0, Z = 0},
["7834-9034-3217-7895443"] = {X = 2, Y = 2, Z = 2},
}