Skip to main content
added 8 characters in body
Source Link
doppelgreener
  • 7.3k
  • 7
  • 44
  • 69

useUse pooling and don't actually delete objects but instead. Instead, change the data structure they are registered to. For example for rendering objects there is a scene object and all the entities somehow registered to it for rendering, collision detection etc.. Instead of deleting the object, detach it from the scene and insert into a dead objects pool. This method will not only prevent memory problems (such as an object deleting itself) but also my fastenmay speed up youyour game if you use the pool correctly.

use pooling and don't actually delete objects but instead change the data structure they are registered to. For example for rendering objects there is a scene object and all the entities somehow registered to it for rendering, collision detection etc.. Instead of deleting the object, detach it from the scene and insert into a dead objects pool. This method will not only prevent memory problems (such as deleting itself) but also my fasten up you game if you use the pool correctly.

Use pooling and don't actually delete objects. Instead, change the data structure they are registered to. For example for rendering objects there is a scene object and all the entities somehow registered to it for rendering, collision detection etc. Instead of deleting the object, detach it from the scene and insert into a dead objects pool. This method will not only prevent memory problems (such as an object deleting itself) but also may speed up your game if you use the pool correctly.

Source Link
hevi
  • 21
  • 1

use pooling and don't actually delete objects but instead change the data structure they are registered to. For example for rendering objects there is a scene object and all the entities somehow registered to it for rendering, collision detection etc.. Instead of deleting the object, detach it from the scene and insert into a dead objects pool. This method will not only prevent memory problems (such as deleting itself) but also my fasten up you game if you use the pool correctly.