The RPG Maker Resource Kit

RMRK RPG Maker Creation => RPG Maker General => General Scripting => Topic started by: LoganF on February 06, 2012, 06:28:52 AM

Title: (VX) Map data
Post by: LoganF on February 06, 2012, 06:28:52 AM
So I'm playing around with an idea and I'm a little unsure what exactly these numbers mean that are churned out from the code below (from the @map.data that's held in $game_map).

I have this code set up to nosy into the map data for the current map:

Code: [Select]
d = $game_map.data
for x in 0..d.xsize
  for y in 0..d.ysize
    for z in 0..d.zsize
      p d[x, y, z]
    end
  end
end

I'm intrigued by the contents of the element of the array referenced by [x, y, z]. On the map that I'm calling this code on, I get a 1536, followed by 2 zero values and a nil value.

I'm hoping that someone can give me some clue as to what these all mean, and in the case of the numbers, how they're used to get what the tile actually is.

I know both Modern and Cozzie have played with these numbers as I'm using those to get an idea of what's going on, but having spent all day reading a lot of maths on graphical projection and other related things like algorithms, my brain's a little cooked as it is and I'm going a little code blind looking at it.

Any clue/pointers would definitely be appreciated.

Thanks in advance.
Title: Re: (VX) Map data
Post by: TDS on February 06, 2012, 06:48:54 AM
If I recall correctly, it's supposed to be the Tile ID on the layer at X and Y.

As for how they get the tile from those large ID's, that is one messy math problem... Dervvulfman made a script which allow you to set terrain tags to specific tiles, even auto tiles which means that he might have figured out the exact math for it, sadly he encrypted the project which had the script.
Title: Re: (VX) Map data
Post by: cozziekuns on February 06, 2012, 07:00:39 AM
Yeah, VX's tile id system is kinda weird. There's a few different types of tiles on different layers. 1536 is the first tile on TileA5. I think 2048 is the first tile on TileA1, and each tile has 48 iterations (for different autotiles). Tall grassIand and deep water like overlay tiles have a Z value of 1. TileB to E objects have a Z value of 2 and start at the tile id 0. I was actually planing to write a guide on this, but then I got kinda lazy, but that's tile id in as much as I could fit on my PSP.
Title: Re: (VX) Map data
Post by: LoganF on February 06, 2012, 10:34:42 AM
If I recall correctly, it's supposed to be the Tile ID on the layer at X and Y.

As for how they get the tile from those large ID's, that is one messy math problem... Dervvulfman made a script which allow you to set terrain tags to specific tiles, even auto tiles which means that he might have figured out the exact math for it, sadly he encrypted the project which had the script.

That's awfully nice of him. I'll see if I can get anything from him.

Yeah, VX's tile id system is kinda weird. There's a few different types of tiles on different layers. 1536 is the first tile on TileA5. I think 2048 is the first tile on TileA1, and each tile has 48 iterations (for different autotiles). Tall grassIand and deep water like overlay tiles have a Z value of 1. TileB to E objects have a Z value of 2 and start at the tile id 0. I was actually planing to write a guide on this, but then I got kinda lazy, but that's tile id in as much as I could fit on my PSP.

Whilst I'm somewhat happy enough to trust the way it's designed, with a lot of hesitation that's for sure, it would be nice to know what it's doing. It would definitely be nice for the whole of the RGSS to be transparent. I get that you might not want people fiddling with key stuff, but a scripter could do a lot more, a lot easier, if you could see what was going on properly.

For now I'll keep looking through your Tilemap to Bitmap script. More comments would have been nicer, though :P

Thanks for the responses, guys. And if you do feel like writing up even a bit of a guide, Cozzie, I'm sure it'll be very useful for a lot of people (if not, then definitely for me).

On a side random: does VXA use the same type of math/strangely assigned numbers to handle tilemaps? It'd be nice to know because I intend to convert over to VXA when I get a proper unlimited version of it.