So currently I am having a go at creating a region system, and I'm having some trouble with understanding the whole concept. It is for the 317 revision if that changes anything.

From what I know, a region is a chunk of the world map, consisting of several tiles (single coordinates), designed to make it easier to handle things.
To begin with I thought the region size was 8x8x4 (x,y,z), which is 256 tiles (a 8x8 square with 4 height layers) , so I started my region system accordingly.

I also found out;
  • Every 40 steps up or down the y axis, or left and right of the x axis that my player moves, the change region packet is sent
  • Region 0,0 is at 48,48 on the world map.


Then I started to think;
  • If every 40 steps up/down, left/right I move sends the change region packet, is 40x40x4 the size of a region? Doesn't seem right but it's what it's showing.


Also:
What is the purpose of localX and localY?

Can anybody supply me with any information on the region system? please be simple with your explaination as I'm confused right now