Jump to content
  • Advertisement
Sign in to follow this  
dpadam450

Usage of RAM in a game.

This topic is 4256 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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).

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!