If you're looking for a relational model built for GUI applications, then you're probably looking for an Entity-Component System. Well, they're closer to column stores than the typical row stores, but still. They're used pretty widely nowadays, popular enough that traditional OO people have started complaining about it.
SPECS, being a completely generic "data layer" rather than a full engine or GUI framework, is probably what you want.
2 Likes
@notriddle "Entity Component system / SPECS" looks very interesting. Thanks! (I'm not sure how I never heard of this until now.)
Off the top of my head:
LMDB
RocksDB
LevelDB
UnQLite
And a few pure Rust embedded DBs that I found with a few carefully chosen keywords. These are in various stages of completeness.
4 Likes
Probably because nobody's been talking about it except game developers and functional programming nerds.
There are a couple reasons why game developers (re)invented ECS. Reason 1 is that they need easy refactoring, and the relational model gives them that. Reason 2 is that they need good performance, and the column store model allows them to turn out code that has good locality and can easily be vectorized.
1 Like
@parasyte : Thanks! Your answer is a comprehensive answer to the question i actually asked.
@notriddle 's ECS / SPECS links answers the question I intended to ask.
@notriddle : Are there any "high performance game design patterns" book / resource list you would recommend?
I am not designing a game, however, I'm writing a high performance GUi app in OpenGL/WebGL, so there's probably a thing or two I can learn from the hardcore game dev community.
@notriddle : Are these the high level ideas ?
- Entity -- basically a u32.
For each ComponentType, we can have 0 or 1 of that ComponentType attached to the Entity.
- Component: basically a struct.
For the i-th ComponentType, we have some storage that does:
Entity -> Option<Component_i>
Here, the common storage type as BTreeMap, HashMap, DenseVec (two vec w/ indirection), SparseVec (allocates space for every entityt, whether the entity has given component or not).
Sorta looks like a "table" of a database.
- System: each system consists of:
3a. a set of Components
3b. some update function
When run, the System runs through all entities -- and if the entity has all the required components, then the update function runs on the entity.
There is some way to specify dependency / order among systems.
====
Is that the core principles of ECS systems ?
At first, I wasn't sure whether to think of a "ComponentType" as a Table or a Column.
However, given that we can not "decompose" a ComponentType into smaller components, I agree with your view of "ComponentType == sorta == Column".
The only thing "missing" would be an ability to:
easily serialize ECS to disk in a way where we can use something like SQL to query/manipulate the data while it's "dead / on disk"
This topic was automatically closed after 2 days. We invite you to open a new topic if you have further questions or comments.