• Create Account

### #ActualMoBaT

Posted 08 February 2013 - 10:57 PM

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 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.

Sorry I'm not being that clear. I mean I want to draw the map around my player similar to what you showed above in the images but using the code I have provided above. That's what my two for loops were above in my second post. I tried getting the characters position and then loading 10 tiles before him and 10 tiles after him. Same thing for the y axis.

### #1MoBaT

Posted 08 February 2013 - 10:51 PM

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:

Sorry I'm not being that clear. I mean I want to draw the map around my player similar to what you showed above in the images but using the code I have provided above. That's what my two for loops were above in my second post. I tried getting the characters position and then loading 10 tiles before him and 10 tiles after him. Same thing for the y axis.

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.

PARTNERS