Recently I was thinking about making an exploration/puzzle game. It would have a *huge* open-world style map. The game itself would be quite simple, but that's not the point of this post. The point is how to load maps.
I want to load maps form some external file, probably a image or a text file. The problem I have is this:
I want the game to be reasonably fast. I think it would take a lot of time to load the entire map at one time, and take up a lot of memory (I haven't tested this yet). I also thought about having it load small chunks of the map when they were needed, but that might create lag when you move to the edge or corner of a chunk.
TL;DR: What is the best way to load a large map file without lag or long loading time?
Thanks,
Nsmurf
Questions about lag/loading time and huge maps.
- substitute541
- Party member
- Posts: 484
- Joined: Fri Aug 24, 2012 9:04 am
- Location: Southern Leyte, Visayas, Philippines
- Contact:
Re: Questions about lag/loading time and huge maps.
Try looking at Orthorobot's level loading code.
Currently designing themes for WordPress.
Sometimes lurks around the forum.
Sometimes lurks around the forum.
- Roland_Yonaba
- Inner party member
- Posts: 1563
- Joined: Tue Jun 21, 2011 6:08 pm
- Location: Ouagadougou (Burkina Faso)
- Contact:
Re: Questions about lag/loading time and huge maps.
Well, you can split the map into subsets. At startn load only the visible area.
Then, according to the moving direction of the player, load the next/following parts.
Also, it seems love.thread would be perfect for that.
Then, according to the moving direction of the player, load the next/following parts.
Also, it seems love.thread would be perfect for that.
Last edited by Roland_Yonaba on Thu Nov 08, 2012 10:33 am, edited 1 time in total.
- kikito
- Inner party member
- Posts: 3153
- Joined: Sat Oct 03, 2009 5:22 pm
- Location: Madrid, Spain
- Contact:
Re: Questions about lag/loading time and huge maps.
What the previous guys say.
Do what google maps does. Don't load the whole thing, divide it in small grids and load them/unload them as needed. You will want to organize the code so that you can use it in both the game and the level editor.
Do what google maps does. Don't load the whole thing, divide it in small grids and load them/unload them as needed. You will want to organize the code so that you can use it in both the game and the level editor.
When I write def I mean function.
Who is online
Users browsing this forum: No registered users and 7 guests