Archived

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

Poya

Background Terrain loading from HDD

Recommended Posts

Hello I apologise if this has been asked before but I couldn''t find anything by searching this forum. I have already been able to implement a normal heightmap based ROAMing terrain. The problem is for that very large games (eg MMOs) there is not enough RAM on an average comuter to hold a very massive terrain and so I thought I could do dynamic loading, ie as the player moves I load extra amounts of the terrain and destroy the part the player is too far away from I a bit confused about how to approach this. My terrain consists of patches, each of which is 16x16 vertices. I though I could check the patch the player is at, and if it''s closer to one side I load an extra stip of patches in that direction. But this could be very slow (or could it?) Any suggestions which you may have, or any sources which you can refer me to on this topic is greatly appreciated. Thanks

Share this post


Link to post
Share on other sites
I was toying around with this idea for a 2d engine, but I''m sure you can extend it to a 3d engine. What you need to do is break up your huge terrain into smaller chunks. Keep track of which chunk the player is in, and then only draw the chunks that are currently visible. If your chunks are large enough, you could just do that by drawing the chunks that connect to the one that the player is in. Once the player moves to another chunk, update the chunks that are being drawn.

Share this post


Link to post
Share on other sites
I was thinking along the same lines. The problem I thought I would face is this: there will be certain ''lines'' on the map where if the player crosses is it a new chunk of terrain will be loaded, right? So what happens if the player accidentally keeps walking across or over that line. Two chunks of the terrain would keep getting loaded and destroyed and this might kill performance. I hope I explained myself well.

Share this post


Link to post
Share on other sites
If you use my approach, the current chunk the player is on will be surrounded by other chunks on all sides that are already loaded. Once a play moves into another chunk, you then load up all the chunks that are around that one that arn''t already loaded. If your chunks are large enough, the player should never get to a place where something isn''t ready to be shown.

Share this post


Link to post
Share on other sites
I really don''t have time to go into detail on an idea I have for this, but I''ll give you : a priority queue based on distance between the camera and each data set''s midpoint in the world. Just think about it, and maybe you''ll see where I''m thinking.


Kevin "Khawk" Hawkins
CEO and News Director, GameDev.net
Author, OpenGL Game Programming
Developer Diary