You would think that as we get more and more memory in consoles, that memory management would get easier but alas its not to be…

PS3 has 512Mb of RAM in total, which is a sizeable chunk when compared with the last generation of consoles (64Mb in the Xbox). The problem is that, we want to do much more and we want to do it ‘easier‘.

So where does it all go…

Well first you have to OS thats going to take a bit of the apple. And its a sizeable chunk…

Then we need space for all these lovely HDR AA framebuffers and render targets.

Then we have textures and geometry and least we forget animation data and sound. These content items consume the vast majority of the RAM. Off the top of my head its in the region of about 300Mb in total! This is all streamed as well, so be glad you have a nice big disk (Edit: talking about optical disks i.e. Blu-ray) to put things on…

So whats left? This gets to be used by code and the actual run-time heap. And suddenly all those ‘high level’ C++ things don’t seem like such a good idea. XML, std::strings, std::maps etc. consume memory like its going out of fashion… then something wants some more for pushbuffers and havok wants some for collision meshes and then there are load buffers and etc.

The grand result is you find your way over memory budget and whats potentially worse, its a really hard problem to track. We are a big team that can produce far more resources than I (as Lead Programmer) can cope with… So I have to resort to forgetting all this new fancy PC techniques and falling back to the good ol’ fashioned console style system.

So no memory allocation in-game, fixed size heaps and linear (AKA frame) allocators for each sub-system. If something don’t fit, tough… Of course its a harsh reality for some, given how many people who trained in a modern university are taught. To be clear I mean, taught badly. Quite a few university in the UK don’t even teach C++ let along C and ASM these days. What good is it teaching people in languages like Java and C# with garbage collectors when in some cases we don’t even have conventional heaps!

So my list of things to make games development on consoles easier…

Track everything - Every allocation, every free. Have different memory policies and make people stick to them. Its easier to keep to a limit, than have to scramble to make things fit later on. Decide early, how much memory each system gets and don’t budge unless the person is really convincing (Any of my team reading this… I have been known to take bribes ;-) )

Keep things simple - While fancy C++ is fun, avoid it if you can. STL and things like vtables can hurt you badly unless your very careful. Any bits you use, make sure you have custom memory allocators.

Don’t think its a PC - Running well on PC, tells you exactly nothing about the performance and footprint on a console. Its a hard real-time embedded system just like its ancestors. One early library call we used was an order of magnitude slower than the same code on PC, so something that took a couple of seconds (development only serialisation code) took minutes. Luckily the library was quickly fixed but there were a few scary moments for a while :-(

Don’t forget the old stuff - Its really no different in many ways from PS1 and PS2. If it good on PS1 its likely still good today, just you can do it ALOT more times on PS3.

To be honest, it make me feel comfortable knowing its still the same stuff that important. Guess its means my skills aren’t quite yet ready to be put out to pasture, even if many of the younger programmers think I’m a bit mad when I talk about fixed sized array versus std::vector and C/ASM rather than C++.

One bit I don’t like about it though, is sometimes having to be the bad guy and forcing the team to do things the hard way… Lot of them are good guys but really don’t want to program in a console friendly fashion…

Prehaps the most interesting bit, is that like a console of yore, there is going to be a lot of mileage over the generations of games.

I’ll make a prediction for how PS3 games will evolve. 1st Gen: PPU used for most things with the SPUs just doing some heavy lifting 2nd Gen: PPU still dominant but SPUs doing a lot more tasks. 3rd Gen: SPU completely dominant with PPU now more of a game coprocessor.

I expect the third generation of PS3 titles will really shine, the first engine that is really SPU centric and just treats the PPU as a coprocessor is going to kick arse. The SPUs are fast like greased lightning but just require a different paradigm thats not going to be fully incorporated for a few generations…