Search Unity

Large World Best Practices

Discussion in 'World Building' started by Danimita92, Aug 8, 2019.

  1. Danimita92

    Danimita92

    Joined:
    Jan 25, 2010
    Posts:
    22
    Hi everyone! So I’m currently working on a game that consists of one large hub town (could be considered “open world”) which connects several levels together. Think old 3D Zelda games such as Ocarina of Time, or games like Dark Souls, which have a similar structure.

    My goal is to be able to move the player through each of these levels and through the hub without any loading screens in between and ideally without any hitches in FPS, too. What would be the best method of setting this up?


    I know I’m going to have to use LODs everywhere I can, and static environments for proper occlusion culling. I have also had a look at World Streamer and SECTR, but after watching their tutorial videos I got the feeling that what they’re doing is splitting the whole game world into different scenes based on position and async loading/unloading them depending on the player’s position, which I could do myself. Is there more to it?


    Also, if I go for async loading/unloading of scenes, what are the best ways of avoiding FPS hitches and making sure the scenes have enough time to load?
     
  2. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    8,131
    My first thought would be to load everything, but group it into chunks (in the scene hierarchy) based on position, and deactivate large chunks of the world that are not nearby. My understanding is that an inactive GameObject (and all sub-objects under it) costs almost nothing, assuming the rest of your code isn't explicitly doing something with those objects.

    But this approach has the additional advantage that if you need to do something with one of those objects — notify it that a quest has been completed or whatever — you can do so, even when it's inactive.
     
    Danimita92 likes this.
  3. Danimita92

    Danimita92

    Joined:
    Jan 25, 2010
    Posts:
    22
    If that's the case, what's the difference between async loading a scene and simply activating objects of a chunk of the same scene?
     
  4. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    8,131
    Well the difference is, async loading a scene implies that the objects don't exist most of the time. That means you can't call methods on them or otherwise affect them (since they don't exist), and also, you have to load them at some point, which is much more likely to cause a FPS drop than just activating objects that were already in memory (but inactive).
     
    Danimita92 likes this.