•      Sign In
• Create Account

### #ActualServant of the Lord

Posted 08 February 2013 - 12:37 AM

I'm not sure I fully understand what method you're using. You're talking about loading maps, but it looks like you are showing code for drawing maps.

You said, "so basically you have map files from like 1-100". Well, that might work for a linear side-scrolling game, but my game is a 2D RPG, so my chunks have to have 2D numbers, like chunk (0,0), and chunk (0,1).

Let's imagine for a second that there are who knows how many areas in the game, and each 'Area' is identified by a string, like "Great Forest".

Now let's imagine that each area (for simplicity) is broken into 10 by 10 chunks, and each chunk is 20 by 20 (or 10x10 or whatever) tiles.

So if the player is at "Green Forest" in chunk (-4, 3), on tile (15, 12), then that means chunk (-4, 3) is loaded and each chunk around that:

If the player moves over a chunk, then some chunks need to be streamed out, and other chunks need to be streamed in.

If you could explain the method you're currently using in more detail, perhaps I could find the problem. All I currently see is two for() loops with nothing in them that could be doing almost anything. Your previous code post looked more like drawing the map and not loading the map. I'm not exactly sure what part of your code you are having difficulty with? Perhaps you have your drawing code too tightly integrated into your loading code and it's hard for you to separate them? The loading of the map should not be in the same functions as the drawing of the map.

### #1Servant of the Lord

Posted 08 February 2013 - 12:36 AM

I'm not sure I fully understand what method you're using. You're talking about loading maps, but it looks like you are showing code for drawing maps.

You said, "so basically you have map files from like 1-100". Well, that might work for a linear side-scrolling game, but my game is a 2D RPG, so my chunks have to have 2D numbers, like chunk (0,0), and chunk (0,1).

Let's imagine for a second that there are who knows how many areas in the game, and each 'Area' is identified by a string, like "Great Forest".

Now let's imagine that each area (for simplicity) is broken into 10 by 10 chunks, and each chunk is 20 by 20 (or 10x10 or whatever) tiles.

So if the player is at "Green Forest" in chunk (-4, 3), on tile (15, 12), then that means chunk (-4, 3) is loaded and each chunk around that:

If the player moves over a chunk, then some chunks need to be streamed out, and other chunks need to be streamed in.

If you could explain the method you're currently using in more detail, perhaps I could find the problem. All I currently see is two for() loops with nothing in them that could be doing almost anything. Your previous code post looked more like drawing the map and not loading the map. I'm not exactly sure what part of your code you are having difficulty with?

PARTNERS