Using a DOD approach, what is the typical way to handle dealing with the actual IDs of game objects?
Obviously, each entity has a unique
entity_id that is generated in-game. And using the component system, the game (server side at least) can determine if the entity is an item, an NPC, a player, etc. My question concerns handling the 'data' ID, as in the ID of the item/npc stored in the database.
The first approach I can think of, is just having one gigantic 'entities' table, with columns that can represent what that entity actually is. In this approach, all entities will have a unique ID (ie, the primary key in the database).
The second approach is to have an Items table, an NPC table, a Vegetation table, etc. But assuming on how one designs the table, there can be an item with an ID of 1, and NPC with an ID of 1, and a Tree with an ID of 1.
Because its an MMO, its inefficient to send all data concerning the entity to the player through a packet. Instead, the client side would have the same data set, so that when one of these pre-defined entites spawns in, the packet can simply tell the ID and location, then the client can look up the ID and construct the entity itself.
Would it then be best to have seperate packet types per entity type? This would be necessary if using the second approach, as there can be entities with the same 'data ID'; IE, a 'NPC spawned' packet, an 'Item spawned' packet. But at the same time, I would also need to include a bit of extra data, the entity_id generated in-game, so the server can confirm which entity the player attacked/picked up, etc. This of course means slightly more bandwidth usage.
The first approach would simply mean I have a single packet type, 'entity spawned', with the data ID and location. Because the first approach is guaranteed to have 'unique' data IDs, would I even need to send the 'entity_id', assuming the entity_id is the same as the data ID?
Sorry if this question isn't too clear. I guess the tldr version is: Whats the best way to design the data tables to hold entities, and whats the best way to design the packets that 'send' that entity to the client?