You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Had the realization that I have not been fully utilizing the ECS. Having such a heavyweight map resource has been causing more and more of the state to go into that instead of into entities and components. This has led to code duplication (copying logic for components and for things on the map) and code smells like FloorMap getting increasingly complex.
To solve this issue, we need to refactor/rearchitect the app as follows:
Level generator is a top-level module (folder) that produces a vector of specs::World structs
Each World is populated with the following: a resource with the bare-bones map (defined below), components for each enemy, item, door, etc. (Should be no reason to query the map anymore other than to find adjacent tiles that are walls)
Having a separate World per level removes the need to remove and readd enemies every time the level switches
The bare-bones map is just the rooms and their tiles which are now either Wall or Floor tiles -- no tile objects or wall decorations stored in the map (represented with components now)
This removes all the special cases we had for updating animations in the map
Copy player components between level World structs every time the player changes levels
Had the realization that I have not been fully utilizing the ECS. Having such a heavyweight map resource has been causing more and more of the state to go into that instead of into entities and components. This has led to code duplication (copying logic for components and for things on the map) and code smells like FloorMap getting increasingly complex.
To solve this issue, we need to refactor/rearchitect the app as follows:
Will need to print the debug representation of the map from the World now -- this is even more powerful for debugging now(Printable debug representation for checking map generation #88)MergeNo, because there are things that only have positions and no bounding boxes (e.g. wall decorations, tile objects, etc.)Position
andBoundingBox
The text was updated successfully, but these errors were encountered: