Question about system memory

Started by
7 comments, last by Someone1 22 years, 4 months ago
Hi. I''m not sure I understand exactly what system memory is used for? If its used for every texture, vertex and data to be loaded when a game runs, how could games possibly fit them on 128Mb or 256 at most? For example, taking an example of a game like Anarchy Online. There are hundreds of models and textures and the whole world is one huge level. If everything is supposed to be loaded on to memory, how could it possibly fit? Or as another example, everquest: even with the zones allowing for small levels, what about all the characters, skins, items and weapons? These could be in any given level at any time. How could they all fit on memory? I had always assumed that things are loaded in and out of memory as a level is running but apparently thats not the case and everything has to be loaded as the level starts. So considering that, how could games possibly fit everything into 128Mb system memory. I am confused. Thanks in advance
Advertisement
simple, they dont

because the game has much more meory then that to work with thanks to paging. windows will once it runs out of physical ram will start sending some of the physical ram contents to disk into a swap file. by doing this windows then can free up memory for other apps. now if something sent to the swap file is needed, windows will send something else to swap to free memeory then load what the app needs from swap.

very poor simple explaination of virtual memory. fortunatly you just need to know, windows (and other OSs) handle this for you without you having to do anything.

also with games, the game only loads what is required to be loaded. even if an item or player has multiple levels, the game only loads the levels that the players in the game are at.
Actually your original assumption was correct. Games with large playing areas will usually only load those textures and objects which are visible (or which will be visible soon). When they go out of eyeshot again, they can be "un"loaded ready for a new object/texture.

codeka.com - Just click it.
Oh Nice

It makes sense now. I always did wonder why on games'' requirements, there is a certain amount of free disk space needed. So thats why? I also did wonder why RAM space is increasing at such a slow rate even though it seemed way too small. Now its all making sense

Thanks alot for the help. Let me see if I got it: The ram is used for things that are required at the time? Does that mean only things on screen? For example, when you are in the game, only the models and textures that are nearby need to be on physical memory? Everything else can just get loaded back on whenever you come across them. Is that right?

So when we have 128Mb of ram to use up, that means 128Mb to use for the scene or area of the game where the player happens to be rather than the entire game or entire level right?

Have I gotten it?

Thanks a million
quote:Original post by Dean Harding
Actually your original assumption was correct. Games with large playing areas will usually only load those textures and objects which are visible (or which will be visible soon). When they go out of eyeshot again, they can be "un"loaded ready for a new object/texture.


So they are unloaded from physical memory into virtual memory and loaded back from virtual to physical memory when back in eyeshot? Like "a person" mentioned? Just wanted to check.

Thanks



Edited by - Someone1 on December 18, 2001 3:26:41 PM

Edited by - Someone1 on December 18, 2001 3:27:07 PM
quote:Original post by Someone1
So they are un"loaded" from physical memory into virtual memory and loaded back from virtual to physical memory when needed right?

Although this could be done, it''s more likely that they are ''unloaded'' from _all_ memory, and loaded from the disk again when they are needed. You wouldn''t want to keep everything in the pagefile, as it would get too large.
ReactOS - an Open-source operating system compatible with Windows NT apps and drivers
it really depends on the game. few game unloads and reloads things from memory (physical/virtual) depending on if it was currently visible or close to you. its very slow to do that. instead levels are broken into sections. you can go between the sections but this will cause a pause in the action as that section is loaded. one step further could be to stream the next section while you are going through the section in hopes that by loading it a slower rate you can do this without disrupting the action (may console games do this). though sometimes if the section is too small and the next section is big, there may be a pause anyway.

things are not loaded from physical to virtual memory depending on if they are in eyeshot or not. virtual memory paging is completely independent of the game. the os decides what pages (sized chunks of physical ram) ar not needed in memory by whether they have been accessed recently. it only pages them out if something else needs to access a page that is not in physical ram. the os then drops the current page or pages in physical ram to disk and loads the required pages. this goes transparently and the game has very little control over what is paged out. it does not work on a model basis, in fact only part of a model may be paged out due to the model size being larger then the page size.

again read up on virtual memory, it will explain things much better then most ppl here can.

also as a coder you cannot differente between the physical and virtual memory, so dont bother. the os handles this.

also why cant a game run suing only 128mb of system ram? console seem to do fine with only 24mb of ram.

you probally are confused because a 128mb scene is much much larger then anyt game does. (assuming whne you say scene you mean a visible portion of the level). it all depends on how your game works and how big levels are. you are limited by what you can load and process. if you are constantly loading models from disk because they go into and out of yoru scene then you are being stupid. most games load ALL models that will appear in the level at level load. games like quake also load the entire level, textures, sounds. music on the other hand is streamed fomr the disk unless its a mod format in which case its loaded into memory as well.
I was under the impression that Someone1 was interested in games like MMORPGs, which don''t have set "levels". Obviously, a game like quake, where there are only very small levels and it only takes a few seconds to traverse the level keep everything in memory. Even something like Baldur''s Gate does the same, since the game is broken up into small areas would load everything at once.

However, games like Ascheron''s Call, and (to a lesser extent) Everquest, where it can take minutes or hours to traverse the map, and where they have hundreds of megabytes of textures and level data, do not load everything at "level" start - simply because there are no levels. These games do stream textures and level data from the disk (even from the network in the case of AC) - you can see this in AC when you move from one place via a teleport. There''s a long pause as you load all the new textures (it''s even got a progress bar). However, you can still run from one place to another, and it''ll just load all the textures as you go.

So, while you''re right for small games where there are levels, for large, open games where there are no gaps between places, the only way you can do it is via streaming.

codeka.com - Just click it.

Yes, I was asking about massive-multiplayer games.

Thanks a lot all. I really appreciate all the help. I''ve been reading up and digging in past topics of this forum and I think I understand most of it now.

There is just one more thing I wanted to check:
All games have a certain amount of empty harddrive space requirement. e.g. Horizons 1.5Gb, Anarchy Online 1 Gb, Everquest 200Mb. They require that this much space be open when running the game. Is this empty harddrive space used for virtual memory?

If so, does that mean that a game such as Anarchy Online with 1G of empty space requirement, loads 1Gb of data on to virtual memory?

The above is my last question. Again, thanks alot.

This topic is closed to new replies.

Advertisement