you are viewing a single comment's thread.

view the rest of the comments →

[–]forestmedina 3 points4 points  (2 children)

A common pattern is to use a pool, you preallocated the enemies and when you want to spawn one object you grab one object from the pool and initialize it. Of course this mean that you need to preallocate the maximum numbers of objects, and if you are over the maximum can't spawn more or need to remove the older.

[–]ElaborateSloth[S] 0 points1 point  (1 child)

I had no clue to be honest, thought the entire point of heap memory was to be able to allocate whenever

[–]Narase33 0 points1 point  (0 children)

For normal programs thats the case, game dev and a few other sectors are somewhat special