Lead architect Paul Holden discusses the engine impacts of giving users free reign
During the second day keynote at the Montreal International Game Summit, Media Molecule lead architect Paul Holden described how LittleBigPlanet's lofty ambitions were achieved by 'embracing the worst case scenario'.
Because users were being empowered to create content as professional as that shipped with the game, the team had to account for extreme situations. Because the levels were dynamic, pre-baking or packing data wasn't possible, and similarly because elaborate systems were being constructed offscreen that affected the experience, physics objects couldn't be culled, meaning they had to simulate the whole level every frame.
"While most engines try to minimise dynamic memory allocation due to the fragmentation concerns, we had no choice but to do a lot of it, so we worked on memory managers to minimise fragmentation and align memory allocations correctly. Rather than restrict the complexity, we built a tool to manage it."
That tool, called HeapMon, wraps malloc/realloc/free calls and flushes logs to sockets or files, giving the team a view to how memory was being used. Using a swizzled memory view, the programmers were able to quickly identify bugs with the memory manager and places where unreserved memory was being misused when a reserved pool would be a better choice.
"When you are making a game that relies heavily on user-generated content, you can't avoid the worst case. Invest in your tools, especially if you're a small team like us, and it'll pay dividends in the end even if you don't immediately see the full range of uses for it. We saved multiple megabytes of RAM by using this."