I assumed GC would be useful for AI/game world. It will benefit from GC because you have complex interdependencies, many different classes and want to be able to experiment. Experimentation and explicit memory deallocation is a likely source for memory leaks… However this will only work well with a basic GC if the AI/game world representation consists of relatively few objects. So it limits your design space.

I can imagine that, and I have been there in my C# days. I agree that its not a GC-friendly pattern. But then why use it in a language with a GC?

In my engine, world object (entity) is basically just a number. All of the entity data is stored in multiple components that are just functionless structs held in few global arrays. All of the game logic is done by separate managers.

In the end, AI/game logic uses the same mechanic as texture streaming - reuse of the previously allocated memory.

Reply via email to