Jump to content

moving an x,y between chunks


ThunderAI

Recommended Posts

I am looking for advice on the best way to achieve the following:

 

say you have a player at a given x,y that can be moved to another x,y.  The player is on a map that is a grid of 38x38 squares, furthure say you can see a total of 64 squares (8x8 grid). There are an unlimited number of map grids (chunks) which are related to each chunck by a field north, east,west, and south where the value in the field is the ID of the chunk next to it in that direction.

 

If there were no chunks you could just search the database for all squares within sight of the player, but this process is more complicated with chunks as a simple search does not result in all viewable sqaures because some would be in different chunks.

 

How do I find the squares that are viewable in a different chunk from my players perspective?

 

Thanks for anything you can help me with.

Link to comment
https://forums.phpfreaks.com/topic/265787-moving-an-xy-between-chunks/
Share on other sites

How are you storing this all? How do you position each chunk in the larger map? Using two sets of x,y coords should be easy.

 

What's the point in storing this data in chunks, anyways?

 

A lot of what you wrote is hard to follow. I don't have a clear picture of how you've set up your system.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.