Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tile loading Order #18

Open
DerKarlos opened this issue Nov 21, 2023 · 1 comment
Open

Tile loading Order #18

DerKarlos opened this issue Nov 21, 2023 · 1 comment

Comments

@DerKarlos
Copy link
Owner

DerKarlos commented Nov 21, 2023

After the camera/player teleported/rotated/moved, the frustum should be filled with tiles. Missing tiles need to be loaded in the GPU (from the a cash or downloaded from the web)
A random order may be funny but not a good user experience. Let's do it as done in previous implementation (OSM2World):
map.update only gets the camera and handles the loading:
The camera has a position and a focus in the GPU scene. The tile at focus is important but also the tiles neat the "eye". So we use the spot between camera and focus. The height is irrelevant in this case.

All tiles in view range around the camera have to be checket for "importance":

  • Tiles outside the frustum angle don't count.
  • Small angles to the focus direction get more priority
  • Less distance to the spot get more priority
    The not loaded/visible tile with the best priority get loaded next.

As the camera may always move, the next tile is only calculated if no load is running. This may not apply for the first start of the app or a far distance teleport. In this case, a bunch of hight priorities may be calculated and loaded in parallel, while a Loading-Screen hides the "unordered" loading view.

This is an old code version, but only partly applying: (see findHighscore)
https://github.com/DerKarlos/OSMeta/blob/70e754bbd19425904374b21dae814fe124b8cb43/src/cam_map/osmscene.rs

@oli-obk
Copy link
Collaborator

oli-obk commented Nov 25, 2023

The function that computes the score for each tile (to decide which one to load next) is

pub fn get_view_tile_score(&self, pos: IVec2, offset: IVec2) -> f32 {

to add information like player look direction, we need to pass it down from the call site. Right now we only pass in the player position

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants