Usage of RAM in a game.

Started by
8 comments, last by Kylotan 16 years, 11 months ago
So I've been slowly working on my engine which only takes up 18KB in memory. I'm just curious where all of the RAM goes to for games. ie "Minimum 512RAM". Are they storing some textures in RAM and waiting to swap them into the GPU so that there is no disk usage? Because if not, then wtf.

NBA2K, Madden, Maneater, Killing Floor, Sims http://www.pawlowskipinball.com/pinballeternal

Advertisement
What does your engine do so far? Because in normal games you have textures, models, sound, AI in the game. A quick hop in the Task Manager will show immediately.

Beginner in Game Development?  Read here. And read here.

 

Textures will probably take up most of your system memory. The default, MANAGED pool for textures stores (uncompressed!) texture data in system memory and uploads it to video memory as well. This allows DirectX to decide which textures should be currently on the video card based on usage, and swap them around.

If you have a couple of 2048x2048 textures for your GUI, one of them would take 2048 * 2048 * 4 = 16777216 bytes, which is about 16 MB. Which is quite a lot. And if you have several other 512x512 textures for your other stuff, that's even more.
You can't forget all the level geometry, physics state, AI state, triggers, sounds, ect. that a game needs.
All of this takes up RAM. And even if there is dedicated hardware for it, the information is not always perminatly ofloaded.
That is up to the drivers to decide.
Geometry and textures are the biggest memory eaters, IMO. To support alt+tabbing and resolution changes in-game, all that graphics data needs to have a local copy stored in system memory.
NextWar: The Quest for Earth available now for Windows Phone 7.
It depends an awful lot on what you're doing, but the base engine part of the game isn't really memory intensive [USUALLY!, my network backbone that i use for large multiplayer stuff can pretty easily soak up 250+ mb of data in buffers alone.]. Your memory is going to get eaten up by game resources [graphics/ect], redundant data representation [optimized for different things. A level might be stored one way for physics, and the exact same level stored all over again for graphics culling, and again for AI, ect], AI state information [which can easily get really large, depending on what you're doing], and game entities [EVERYTHING needs stored.]

It's also worth considering that those numbers you see on the back of game boxes are often times high-ball recommendations. If you know for a fact that you will not have memory constraints up to a certain level, you don't have to worry about being super memory efficient when your subsystems start doing thier thing.
Also remember that the OS and other programs (eg: antivirus) are running in the background, so even though the computer has 512mb RAM, you can only use a portion of it.
Quote:Original post by Ezbez
Also remember that the OS and other programs (eg: antivirus) are running in the background, so even though the computer has 512mb RAM, you can only use a portion of it.


This is probably one of the more important reasons for these "recommendations" : you are using an application in a multi-tasking environment, whose limited resources are shared. Vista for example upped the minimum memory reqs to about 2 GB, just to be safe (for example on GPU memory virtualization).
On a related note, is there a common way of deciding how much RAM the game will allocate to keep loading times down, and how much to save for other applications running in the background?
You allocate RAM as needed - knowing how much you need in advance won't affect loading times much. And reserving RAM for other processes is the operating system's job really. Finding out how much you use is an imprecise art. You can total it up in your memory allocator, or check in the task manager, etc.

This topic is closed to new replies.

Advertisement