Ideas for calculating when to generate new tiles.

I’m looking for some ideas on how I could build some logic for a project I’m working on.

I’ve got an isometric, map I’m currently generating/rendering. It’s broken down into regions, chunks, and tiles.
One region has 10 chunks, one chunk has 15 tiles. I’m initially only generating one region, but trying to generate more as they’re needed.

I’ve got a map generator that sets tile images based on a noise calculation of altitude (blue tiles for water, tan for beaches, green for grass, etc up to mountains). This noise calculation is based on a seed and the tile’s position.

What I’m trying to figure out now, is how I can figure out when the player is getting close to the end of a region. I can calculate the x/y coordinates of the region’s northern, southern, eastern, and western points, but what kind of logic could I use if the player is walking directly northeast? I would need to generate a new region long before getting to the northern or eastern corners of the region.

Anybody have any ideas/advice on how I would calculate something like this?

Usually you split the current region into quadrants and always have the 3 other regions generated/preloaded that connect to that quadrant:


+---------+---------+---------+
|         |         |         |
|    A    |   A/D   |    D    |
|         |         |         |
+---------+----+----+---------+
|         | A *| D  |         |
|   A/B   +----+----+   D/C   |
|         | B  | C  |         |
+---------+----+----+---------+
|         |         |         |
|    B    |   B/C   |    C    |
|         |         |         |
+---------+---------+---------+

So here the middle of this 9 cells is your current region and the player (the *) is in quadrant A of it, so you need to generate the 3 top-left regions to allow seemless transition.

Thanks for the input, This is probably the method I’ll go with.

One thing i can recomend is use tiles to the power of 2, so your chunk size will be 8x8, 16x16 etc so you can do bit shift like ‘x>>3’ , its much faster and…well looks more professional.