Sign in to follow this  
Weston

2D tile map loading

Recommended Posts

The next part of my project involves finding a way to load a 2D tile map from file. What I hope to achieve is a seamless environment that loads chunks of the map when needed, but appears as if everything is assembled as a whole. This is difficult to explain, so let me try examples... Metroid Prime has doors that seperate map files. When you shoot a door, it tells the game to load in the next chunk before it opens. This way, it seems that the entire world exists at the same time by using a clever loading scheme. The Legend of Zelda: A Link to the Past has several tile maps with boundries at which the camera stops, when the boundry is touched, it loads the next map and scrolls the screen over. I want to avoid a loading scheme such as this. I want my world to seem complete at all times. If you've played Pokémon, the tile maps look enormus, with the only some buildings or doors that seperate areas. Still, some outside places are so huge, that it's hard to imagine that the whole thing was loaded in at once. That is the effect I'd like to have, but I don't know how to implement something like that. Loading chunks of map seems like a very slow process unless I do small chunks at a time. I've had some ideas, but nothing solid yet. Any suggestions?

Share this post


Link to post
Share on other sites
Yes, sufficiently small chunks are necessary for this.

A method I've often thought of using, but never implemented (because I haven't needed it since I thought of it) involves a load/unload set of BSP trees. Basically, you break your map up into chunks, however big you want. Then, for each chunk, you find a bigger chunk that represents the area of the world where that chunk can be seen from. For instance, a city street might have its visible chunk include itself, the surrounding streets, and an upstairs window. Then you expand that chunk again by the distance the player can reasonably travel in the time it takes to load the original chunk, and put the resultant chunks (with much overlap) into a BSP as the "loading tree". The effect of this is, for each loading chunk, if the player is not in it, you don't need to load, and if the player is in it, you do need to load. Load chunks the player passes into, and unload chunks the player passes out of. Obviously minor tweaks are necessary, such as handling multiple competing loads, but I think this would work pretty well.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this