Loading Large Worlds

Started by
3 comments, last by ScottyKarate 14 years, 1 month ago
I've got a couple ideas about how to manage a large world map in a 3D tile-based RPG but I'm unsure of which one is the best approach, if any. 1. Maintain 1 very large world map file that has all of the tile data. Load a few extra tiles that aren't on the screen and keep updating which tiles are loaded everytime the player is on a new tile. 2. Maintain 1 very large world map file that has all of the tile data. Load 9 large sections surrounding the player (maybe something like 32*32 tiles per section). When the player enters a new section, load the new sections surrounding the player. 3. Maintain 1 file to define "fragments" of map, 32*32 tiles in size. Have additional files to represent these "fragments" of map. Load the fragments of map like in step 2. Sorry if I'm unclear about any of my approaches. I'm open to listening to any solutions about working with extremely large maps.
Advertisement
I thought the way to do it was with a technique called 'clipping'
The basic idea is that you only draw the tiles visiible (or within a rectangle slightly larger than the viewing area would be better), you could still break your large world into sections and then load or unload when appropriate, this saves on memory, but what you dont want to be doing is loading and unloading tile sets all the time (I think that would be too slow).

Im not too sure but yeah thats probably the direction I would head in, were I in your situation.
I've always been a fan of approach #3. The 3x3 grid approach is intuitive and not having a giant ass map file is easier to manage on the content development side (fragmenting the map into multiple files allows multiple artists/designers to work in parallel)

If it's an isometric RPG the 3x3 should work trivially. The size of those grids should be informed by player movement speed and your best measurements of file load times. Accept that in certain circumstances loading might take a while; you may have to pause the game with a "loading" overlay so that the player doesn't see gaps in the map.

Things get a little more interesting if it's an FPS perspective because you'll need to handle long-range lines of sight somehow. You can always take the WoW solution and just set a fog barrier somewhat inside your 3x3 grid radius.

-me
A giant 2d array on a disk won't load very efficiently. Tile X+1,Y might be right after tile X,Y. But tile X,Y+1 will be a long way away from tile X,Y. The disk heads will go from X,Y to X,Y+1 across an entire horizontal line on your map, and ignore nearly all of it.

With that in mind, it seems that number 3 is the winner. The main map is a thousand times smaller and can fit in memory, while all fragments should load with reasonable efficiency.
Option #3 seems to me like the most efficient approach. You might want to put some logic in to detect when the player is getting close to the boundary of a section and load the new section little bits at a time over several frames. Otherwise you'll have to pause while loading.
Scotty KarateCheck out my game programming blog @ scottmakesgames.blogspot.com

This topic is closed to new replies.

Advertisement