ThunderAI Posted July 16, 2012 Share Posted July 16, 2012 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. Quote Link to comment https://forums.phpfreaks.com/topic/265787-moving-an-xy-between-chunks/ Share on other sites More sharing options...
xyph Posted July 17, 2012 Share Posted July 17, 2012 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. Quote Link to comment https://forums.phpfreaks.com/topic/265787-moving-an-xy-between-chunks/#findComment-1362001 Share on other sites More sharing options...
btherl Posted July 17, 2012 Share Posted July 17, 2012 If I understand you correctly, you would look at adjacent chunks if they are within the viewable area. I can't really give a more detailed answer than that as there's not much detail of your implementation in the question. Quote Link to comment https://forums.phpfreaks.com/topic/265787-moving-an-xy-between-chunks/#findComment-1362017 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.