This rewrites Entities and parts of Table and World to be a little cleaner conceptually and more readable. Most excitingly, this removes the two "nullish" tables and moves to one.
Reviews/questions/comments are welcome but not expected!
Changes:
Added Vec class, which abstracts over some common functionality
For internal use only right now
Only handles u32s right now, I’d like to work out an externally useable abstraction in the future.
Complete rewrite of Entities internals
Less code, more comments. Yay!
Now owns entity generations
We end up with some slight data duplication that we didn’t before (generations are held both by Entity component and entities), but this is a fine trade-off for stability, readability, and modularity
Now owns list of freed entities
Lazy allocation
Don’t pre-allocate a set amount of entities, just grow as needed
Removed Entities.fromWorld - just using the constructor
Table
Removed Table.new - just using the constructor
grow() accepts a new capacity
Code is a little more modular for this, but it also means consumers of the library can find individual tables and resize them independent of the world config
Removed #world as it was no longer needed
Lazy allocation
Don’t allocate for columns when constructing - less code & localizes column allocation to grow()
Renamed table.bitfield to table.archetype for clarity.
move() can return null
World
Renamed world.archetypes to world.tables for clarity.
The “empty” and “recycled” tables have been merged into one “true” empty table
This table is essentially a placeholder so that archetype/table 0 means an entity isn’t alive
Has no columns (like the previous "empty" table, but unlike the previous "recycled" table)
This rewrites
Entities
and parts ofTable
andWorld
to be a little cleaner conceptually and more readable. Most excitingly, this removes the two "nullish" tables and moves to one.Fixes https://github.com/JaimeGensler/thyseus/issues/11 (cc @kayhhh) Also cc @3mcd because this potentially has some minor (easy to resolve) conflicts with Commands rewriting
Reviews/questions/comments are welcome but not expected!
Changes:
Vec
class, which abstracts over some common functionalityEntities
internalsEntity
component and entities), but this is a fine trade-off for stability, readability, and modularityEntities.fromWorld
- just using the constructorTable.new
- just using the constructorgrow()
accepts a new capacity#world
as it was no longer neededgrow()
table.bitfield
totable.archetype
for clarity.move()
can return nullworld.archetypes
toworld.tables
for clarity.