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
I find sad to set each field this way, this is error-prone (missing one, i.e.) better to use the constructor to pass these parameters: the compiler will warn you in case of missing one.
You use m_entitiesToDestroy for not interfering deleting elements when iterating on them, but why not for createEntityInternal ? I guess you can create entities during the entity->onUpdate ? I guess a fake solution is to use mutex because creating entities at run-time will create a dead lock. But point to take into account when threading your game. Another solution would be unordered_map (confer section Iterator validity https://cplusplus.com/reference/unordered_map/unordered_map/erase/ vs https://cplusplus.com/reference/map/map/erase/)
In
OpenGL-3D-Game-Tutorial-Series/Tutorial8_EntitySystem_Basics/Game/MyGame.cpp
Line 41 in 4d38177
not missing calling OEntitySystem::update ?
In
OpenGL-3D-Game-Tutorial-Series/Tutorial8_EntitySystem_Basics/OGL3D/source/OGL3D/Entity/OEntitySystem.cpp
Line 41 in 4d38177
I find sad to set each field this way, this is error-prone (missing one, i.e.) better to use the constructor to pass these parameters: the compiler will warn you in case of missing one.
In
OpenGL-3D-Game-Tutorial-Series/Tutorial8_EntitySystem_Basics/OGL3D/source/OGL3D/Entity/OEntitySystem.cpp
Line 54 in 4d38177
You use m_entitiesToDestroy for not interfering deleting elements when iterating on them, but why not for createEntityInternal ? I guess you can create entities during the entity->onUpdate ? I guess a fake solution is to use mutex because creating entities at run-time will create a dead lock. But point to take into account when threading your game. Another solution would be unordered_map (confer section Iterator validity https://cplusplus.com/reference/unordered_map/unordered_map/erase/ vs https://cplusplus.com/reference/map/map/erase/)
Risk of recursivity
OpenGL-3D-Game-Tutorial-Series/Tutorial8_EntitySystem_Basics/OGL3D/source/OGL3D/Entity/OEntitySystem.cpp
Line 44 in 4d38177
In
OpenGL-3D-Game-Tutorial-Series/Tutorial8_EntitySystem_Basics/OGL3D/source/OGL3D/Entity/OEntity.cpp
Line 32 in 4d38177
In
OpenGL-3D-Game-Tutorial-Series/Tutorial8_EntitySystem_Basics/OGL3D/include/OGL3D/Entity/OEntity.h
Line 44 in 4d38177