Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Question Addressables in large open world - 2+ versions of the map?

Discussion in 'Addressables' started by swimswim, Jul 12, 2023.

  1. swimswim

    swimswim

    Joined:
    Jun 24, 2023
    Posts:
    2
    Hi guys,

    Firstly thank you for your posts on this forum as they've been very helpful. Although I'm no Unity expert, I believe/hope my question is reasonably well informed, having researched my options here and elsewhere over the last couple of weeks, so I hope that any response I receive will not be made in vain. Any perspective would be very much appreciated.

    I've decided to use addressables with my game, primarily to keep memory in check in a large open world with a high Far Plane camera distance. I have just one addressable scene, loaded from a bootstrap scene from the build. Each tile is an addressable prefab. As you move around and enter a new tile, a script updates the new sets of tiles to load/unload based on distance from the new tile and instantiates them into the scene as required.

    The problem is that for distant map tiles, I want to be able to show their shape and maybe a low res version of the terrain texture, but I don't want to store all of the other assets that the tile requires in memory. I've looked into SVT, mipmaps, LOD, and probably some other options I'm forgetting, but they all seem to have compatibility issues with addressables.

    Therefore, I'm looking for feedback on the following idea: have two separate prefabs for each map tile. One with everything on it, and one with just the basics. When I get close enough to a distant tile, it unloads and despawns itself and the full version loads in instead. Potentially, I could even have 3 sets: the 3x3 around the player will load everything; 5x5 around that is some mid-way level of detail, and 9x9 for example would have the lowest detail.

    Can anyone think of any problems with doing it this way? I haven't found any other forum posts etc discussing this method. It seems like it should work. The scene doesn't need to know that the full version of a tile has anything to do with the low-memory version. Data for the full versions is stored in ScriptableObjects which are marked with Hide Flags so they don't unload; therefore when the full version of a tile is required to be loaded again, GameObjects in that tile can just access the data they need to set themselves up again. Creating the low-memory versions of each map tile will be a bit of work, but not too much, as you can just take the full version and start deleting things.

    If you have any thoughts, I would love to hear them. Thank you very much!
     
  2. XiangAloha

    XiangAloha

    Joined:
    Jun 19, 2020
    Posts:
    11
    I have seen this kind of implementation in Megacity. They use Entities package instead of addressable. The combination of HLOD and entity SceneSection component allows low-res and high-res versions to be streamed accordingly.

    In case you are interested, you can find GameObject version of HLOD here.


    There is also store assets called Impostors. It helps reducing drawcalls for distant objects.
     
    swimswim likes this.