realtime file loading...

Started by
5 comments, last by Kilj 21 years, 12 months ago
Rather than splitting up my game world into sectors I thought i could use something like one reallly reallly big heightmap. I would then load parts of it while the game ran. My camera is fixed (ff3 kinda rpg) so I thought i could do something like the following: player moves up x units load next x units of map. etc I dont know how slow this kind of thing would be, and also when you open a file for reading does it load the entire file into some buffer or something. What I mean is if i have a 10 meg map file, do i have to have 10 megs of memory for it at all times? Hope someone understands what im asking. -Chris
something...
Advertisement
When you open a file for reading, no reading at all is performed. It's in the docs *hint* for future reference.

I'd avise you loaded a lot more than the next "x units of the map", unless your game is absolutely linear. If it allows for free roaming, then you'll want to load all 8 grid squares adjacent to the current location:
-------|1|2|3|-------|4|x|5|-------|6|7|8|------- 

[Edit: Formatting.]

[ GDNet Start Here | GDNet Search Tool | GDNet FAQ ]
[ MS RTFM [MSDN] | SGI STL Docs | Boost ]
[ Google! | Asking Smart Questions | Jargon File ]
Thanks to Kylotan for the idea!


[edited by - Oluseyi on April 19, 2002 10:35:13 PM]
ok cool, thanks man.

docs, yeah im an idiot. Thanks.

I see what your saying.

what if the player is on the boarder of x and say 5. (using your layout). When he crosses into 5 then 1 4 and 6 are deloaded and 3 more are loaded. But if the player is on the boarder and keeps crossing it then i have all this loading of big blocks. Thats why i was wondering about just loading what he will be seeing or the x units that he went up. Ill probably be using the sector method you outlined, but is there a huge performance hit by just loading the x units that the player will now be able to see. Please excuse my ignorance, im an idiot, but why would i not want to to do this?

if it matters(my camera is fixed, looking down on the ground at 45degrees)

-chris




something...
I think you should load in the background. That''s the entire point of having a bit more map data loaded. While you enter sector five, the game starts to load the three new blocks to the right as you play. When you return to x, it will start loading the left 3 again in the background. But you still continue playing.

Indeed, if the player keeps crossing between 5 and x, the game will keep switching ''bout what to load. But it will never even finish any of the loading as long as the player switches. You probably wont finish loading ''till right before a running player can cross square 5.

-Maarten Leeuwrik

Follower of the NLS
(New Lounge Standards)
Don''t unload a part of the map as soon as it''s not needed. In my opinion, the best way to do it would be to have a "pool" of chunks. You''d have a certain number of available chunks (like, say 16) and you then just make sure that the 8 surrounding ones are loaded. You only unload a chunk when you need to a load a new one and there''s no free spaces left. That way, if you keep moving back and forth over the boundary, you''ll still have all those chunks in memory and won''t need to reload anything.

codeka.com - Just click it.
Thanks everyone. Gotta love gamedev =)
something...
You could also split the map into smaller portions such as Town.map, World.map, Cave.map . . . and others, just to make your filesize smaller, and then when you go back and edit it (unless you have an editor already made) it would be a lot easier to keep up-to-date with changes.

This topic is closed to new replies.

Advertisement