bbuck/dragon-mud

Create the Entity framework

bbuck opened this issue · 1 comments

bbuck commented

Create a base class to interact with the database and load/save entities. This is not just a class to represent models but also a way to control access (in other words, thread safe ways) to database records.

bbuck commented

So I really wanted this to be entirely in Lua, but the potential need for entity sharing seems relevant. It'd be nice to have a copyable data type with which entities can be shared. So either 100% Go, or somehow half and half will have to work with this.

The reason entities need to be shared (and therefore persisted outside of a Lua State) is in the case of events. For a damage flow, it might look like:

-- in some combat module
events.emit("damage_dealt", {from = player, to = target, amount = 110})

The other option is to enforce those be IDs only (which means they have to be refetched every handler). Instead, it'd be nice if they maintained their entity status with dynamic components throughout.