OSMeta icon indicating copy to clipboard operation
OSMeta copied to clipboard

Tile loading Order

Open DerKarlos opened this issue 2 years ago • 1 comments

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

DerKarlos avatar Nov 21 '23 10:11 DerKarlos

The function that computes the score for each tile (to decide which one to load next) is https://github.com/DerKarlos/OSMeta/blob/dfd870703d7d9ddc9e1c9adc0bb958ab49d1daf8/src/tilemap.rs#L50

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

oli-obk avatar Nov 25 '23 21:11 oli-obk