NoSQL or SQL for game worlds ?

I cant decide… im currently developing a little mmo with automatic generated terrain. And i need to persist this game somehow. Therefore im using an entity component system. Each entity is a container of a list of unknown components. Components are simply classes which contain attributes, other classes or references to other entities.

So the structure of an entity looks like this…

{ id: 129939, type: "Player", components:[ {class:"Player", username:"lars", password:"..."}, {class:"Transform", position:..., rotation:...}, {class:"CollidingWith", collisions:[123321,39993,123129]} ] } 

Each entity has a unpredictable structure. Atleast whats inside “components”. This brings to to NoSQL, but on the other side each entity can have references to other entities. Imagine an inventory where each item is also such an entity. A player entity would have a inventory component that references other item entities -> 1:n relation. And there many relations between entities.

In SQL however, our database schema ist a hybrid : Entity{ id, serializedJsonComponents} Inventory{ ownerEntity_ID, itemEntity_ID }… so each component containing a relation would require its own table. Many joins, many tables…

So the unpredictable structure speaks for nosql, but the relations between entities speak for sql. What would you choose and why ? Im stuck, i actually dont wanna pick the “wrong” one.

Glad for any help, thanks !

submitted by /u/genarTheDev
[link] [comments]


Go to Source of this post
Author Of this post: /u/genarTheDev
Title Of post: NoSQL or SQL for game worlds ?
Author Link: {authorlink}