I'm working on an Android app (you could call it a "game") that loads meshes (= kind of tiles) depending on your line of sight. Basically I'm generating the ground in a void world in which you are a ghost (you can fly and don't actually need the ground to move).

At the moment I'm only checking what tile you're looking at, then load in the tiles from between there and your own position, which means that some tiles that are really far away (and hard to see) are loaded first, while the one actually in front of you usually loads last.

This is suboptimal because it should at least load the tile in front of you first, then spread out in your viewing direction.

I now want to change the loading order and was thinking about something like this:

enter image description here

The black "X" marks your position, then it's just in ascending order and the red number marks the tile you're directly looking at.

Since I'm working with limited resources, I limit the amount of tiles that can be displayed at the same time to 25 and I don't care about the tiles behind you, you have to turn around to actually load them. The width is limited as well, usually to just 2 tiles on each side.

What algorithms are usually used for something like this? Are there even any commonly used ones?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.