11-14-2012, 08:31 AM
(11-14-2012, 01:37 AM)Phaze Wrote: Yeah I know how addressing systems work and I highly doubt my game would come close to exceeding even 1GB. The only things that even approach that level of memory consumption are the 'sandbox' type games like Minecraft/Terraria or the seriously heavy duty games like Team Fortress 2. My game would be top-down 2D with (hopefully) some fancy stuff like shadows, as mentioned above - though it could probably be a generic dark overlay if the system can't support shadows.
That's not necessarily the case, especially if you're working in C++. Your game may not need more than 1GB at any one time (which is probably true, since I've made a 2D engine that barely uses more than 1MB at any one time), however, keep in mind that C++ does not have built in garbage collection. The reason Minecraft crashes a lot is because of Java's flawed GC, and from Notch's careless code, which causes memory leaks and eventually the system to run out of stack memory and crash.
Without a GC, your game may only be using 1GB at a time, but will keep everything it had used previously in memory anyway. This means that after a short while (and if you're using 1GB, probably only a few minutes), your game will toss you a stack overflow error, and crash. You'll need to find a library with a decent GC (which most will have), or implement it yourself. Don't make the mistake of assuming that just because it's in 2D, it will never use all your memory. Memory leaks are a horrible thing, and can make even the smallest game horrendous if not dealt with.
I managed to keep a 2D engine at around the 1-2MB mark on menus, pushing up to 3-5MB in game, by paying close attention to what my resources were doing, and ensuring I disposed of them when they weren't being used. The language I was using (C#) did have a built in garbage collection system, but I ensured it could do what I needed it to, by deallocating unused resources, and at every screen transition, manually calling it, to clean them up. This way, I only have what is absolutely necessary in memory at any one time.
Basically, be warned that, especially if you want to keep this working with older x86 models, you'll need to do careful memory management.