Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

pym

Dynamic loading of 3D world

This topic is 5965 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

Here is the situation : I have a 3D game engine that works quite well (physic engine + graphic engine + sound engine). And I use it in a game... but I wi*ould like to optimise the usage of the memory because it is quite basic for the moment. Here is the axact problem : For the moment fot each level I load the whole level at the begining and then, acording to the situaton, I render the scene. Of course most of the data of the world are useless for the rendering (for exemple the one in my back ). So it would be a good idea to have a DYNAMIC LOAD of the world... it would be really nice ! So does anyone has ever had that problem/idea before ? And do you have any idea of the way to manage such thing : what should be load/unload ? things like that.... Merci d''avance ! (yes I am French ) PYM

Share this post


Link to post
Share on other sites
Advertisement
For the moment no reply... but I have some new data so I post them !

In fact the game looks like... Mid Town Maddness I think... you drive in big world in a car ! And the world is in fact TOO big to be loaded in one piece (for the moment it works like that because the beta levels are quite small) but I can''t stop the game with "now loading" screens all the time !

So the idea is maybe to divide each level in square that could be loaded when it is needed... a kind of streaming loading

Is it realy a good idea ?
When should I load/unload a piece of level ?
How to make a good streamloading ???

Here are the questions.....



PYM

Share this post


Link to post
Share on other sites
I read about this problem in another forum I think. I think that the consensous was that you split your track into "sectors" and load enough ahead, behind and to the sides to allow the game to see everything around it.

When you advance out of one sector to the next, the one "behind" can be freed and the next loaded into memory.


Oli



All the best problems start with C

The Most Boring Website Ever?

Share this post


Link to post
Share on other sites
Thanks for your reply !

What do you mean by "memory mapped file" ?

But I think idea of loading the "near" parts of track is a good start... but if I move fast ? I should load very quickly le new part... maybe I could load all the parts that I could see if I drive has a mad hell''s angel . In fact the maximum speed of my car is perhaps important ?...

What do you think of that ?

PS : "I read about this problem in another forum I think." which ones ? it could help me a lot



PYM

Share this post


Link to post
Share on other sites
[link]http://www.gamedev.net/community/forums/topic.asp?topic_id=78575[/link]

That was one of the posts on here.

A memory mapped file is basically memory... mapped into a.... file

You can toy with it as if it were just standard memory, but it''s physical location is on a disc. If your map (and vetices, etc) is (are) huge then this could help?

I dunno.



Oli



All the best problems start with C

The Most Boring Website Ever?

Share this post


Link to post
Share on other sites
Actually, a memory mapped file is like a file... mapped into... memory! You can perform standard file operations, but the file actually is stored in memory, not on disc.

Share this post


Link to post
Share on other sites
quote:
Original post by Simagery
Actually, a memory mapped file is like a file... mapped into... memory! You can perform standard file operations, but the file actually is stored in memory, not on disc.


Well, that's not entirely true, it's more the other way around. What you say is that a memory mapped file is basically just memory that acts like a file. It's not that simple.

Basically, a memory mapped file is a real file (you actually map an existing file), which can be bigger than the amount of RAM you have on your system. When you call the APIs to map the file, it actually gives you back a memory pointer. So, say you create a memory mapped file of 1GB, but you only have 128MB. You can access that memory pointer as if it's the full 1GB, like "real" memory. If you try to access a part of the memory (file) that is not in memory, the system will automatically discard rarely used parts of the file, and load (swap) in the parts you request (in 4K blocks I believe). It uses buffering, etc, so it is pretty efficient. This is exactly how virtual memory on your system works. There is a physical swap file on your drive.

A memory mapped file is great for vast amounts of data, but you have to make sure you keep things that will be loaded together in the same area of the file, so not to read from too many parts of the file at once, which would be a performance hit. I have used memory mapped files for other things in the past, but not for levels. Eventually I will use them for levels too.

Read up in MSDN on the CreateFileMapping and MapViewOfFile APIs.

SS



Edited by - Axter on February 8, 2002 2:48:49 AM

Share this post


Link to post
Share on other sites
Thanks

Now I have an other problem (that mapped file can''t solve I think) I can''t use swaping because in fact the game will be ported on console (I hope St Developper pray for me). And consoles (except XBOX) have no HD... no HD means no swaping... gasp !

I do not want to do a level management system unportable... so I am looking for some kind of idea...

In fact maybe I can map a file on a cdrom or dvd... that could be an idea... or split my data files into sectors as downgraded said...

Whatdo you think of those 2 idea ?

note : while writing that post I am also reading the things about mapped files... never used it before... but seems really very iinteresting... for many usage...



PYM

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

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

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!