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

in an open world scenario what is "better" to do everything in a single scene or split

Discussion in 'General Discussion' started by TiagoB66, Aug 10, 2023.

  1. TiagoB66

    TiagoB66

    Joined:
    Oct 22, 2017
    Posts:
    16
    I'm developing an open world game (in order to learn), I'm now developing the world's base scenario and I have a doubt that I haven't found answers that would make me understand what's best. I have the following situation, I am dividing the Unity terrain into some parts, but I don't know what is better to do, separate them into different scenes (scene 1, scene 2...) and load each part asynchronously, or simply use a system of enabling and disabling parts of the scenery in a single scene.

    Initially I thought of keeping the whole project in a single scene, but I don't know if it will consume a lot of pc memory
     
  2. TheNullReference

    TheNullReference

    Joined:
    Nov 30, 2018
    Posts:
    222
    If your open world is in a single scene, then all assets will be loaded into memory when the scene is loaded. If you have a large variety of models and textures then this might become a problem.

    If your terrain prefabs re-use a lot of the of the same textures you might get away with it. For example you could see a Minecraft like generation managing to fit in a single scene, as the texture memory is small.
     
    TiagoB66 likes this.
  3. ShilohGames

    ShilohGames

    Joined:
    Mar 24, 2014
    Posts:
    2,984
    You will probably want to have one main scene and then use additive scene loading to manage additional resources. You can even create low detail impostors of additional scenes, and then additively load/unload those so far away regions don't need much memory at runtime.
     
    CodeRonnie and TiagoB66 like this.
  4. gilley033

    gilley033

    Joined:
    Jul 10, 2012
    Posts:
    1,151
    It's hard to give a definitive answer without knowing the complexity of the game world you are trying to build. It could be that using a single scene would be fine, it could be that it's not. Using a single scene makes some things much easier, such as lighting and pathfinding, so if you are seeking to learn about those systems as well you may be better off just using a single scene.

    However, in most game worlds of sufficient complexity it will be more performant to split things up. As this is a learning project I doubt you are interested in third party assets, however if you start with a single scene, then down the road decide you need to split things up, and are struggling with how to do so, you can take a look at my Asset Store product (in my signature), The Streamable Assets Manager.
     
    TiagoB66 likes this.
  5. warthos3399

    warthos3399

    Joined:
    May 11, 2019
    Posts:
    1,644
    Large open-world scenes/maps/etc. takes alot of knowledge. as they are harder to optimize for performance. Now i dont really know needed info about your project. But i can give this advice: no matter how you do it, you NEED to chunk stream your terrain. With Unity, optimization is a total different skill all together.

    You can be a great coder, modeler, level designer.. none of it matters if you cant optimize...

    Best of luck :)
     
    TiagoB66 likes this.
  6. Lurking-Ninja

    Lurking-Ninja

    Joined:
    Jan 20, 2015
    Posts:
    9,904
    CodeMonkey recently scratched the surface... obviously this experiment is far from complete and it's just a quick prototype with 1-2 features, but if you have money, you can buy in proper tools which make your life easier. If not, you can write your own systems to do essentially the same. Again, all it demonstrates that it is not impossible. The more features you add, the more problems will be waiting for you to solve.

     
    Last edited: Aug 11, 2023
    TiagoB66, warthos3399 and spiney199 like this.
  7. warthos3399

    warthos3399

    Joined:
    May 11, 2019
    Posts:
    1,644
    Though this is true, and i feel your pain, optimization is the key. You cant add a feature without a performance impact.
     
    TiagoB66 likes this.
  8. dlorre

    dlorre

    Joined:
    Apr 12, 2020
    Posts:
    700
    If you are going with a single scene you will have to despawn/destroy the non-static objects that are out of reach one way or another.
     
    warthos3399 and TiagoB66 like this.
  9. kdgalla

    kdgalla

    Joined:
    Mar 15, 2013
    Posts:
    4,355
  10. TiagoB66

    TiagoB66

    Joined:
    Oct 22, 2017
    Posts:
    16
    I even saw this one, but I wanted it for an open world, and this one doesn't apply very well
     
  11. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    9,745
    Why not?
     
    TiagoB66 likes this.
  12. warthos3399

    warthos3399

    Joined:
    May 11, 2019
    Posts:
    1,644
    What Murgilod stated is true and relevant. You stated: "I'm developing an open world game (in order to learn)" (with no info like Unity version used, 2d/3d game, what SRP used, etc.). At this point theres 2 ways to address this. Chunk streaming a single scene (then port to the next scene), or... Streaming multiple scenes, in a single scene manner.

    Hence my 1st reply, "no matter how you do it, you NEED to chunk stream your terrain". Correct?. Heres why, Unity shot itself in the foot with 2 things: Occlusion Culling and Static Batching. They are working on it, but as of current state, not so much. So, for a large open-world game, at the very least, you should plan on a good terrain chunk streaming solution.

    Best of luck :), there are many systems and assets that can help you. Just relax, and modify your work flow/plan. You got this, now get back to work! ;)
     
    TiagoB66 likes this.
  13. TiagoB66

    TiagoB66

    Joined:
    Oct 22, 2017
    Posts:
    16
    because it works with triggers, (at least according to what I understood from the example and the documentation it had) I'm looking for something based on the player's position not depending on triggers
     
  14. TiagoB66

    TiagoB66

    Joined:
    Oct 22, 2017
    Posts:
    16
    I'm using HDRP in a 3D world. I started to develop something based on the ideas you gave me here in this question, I chose to develop something with dynamic scenes separating part of the terrain into blocks and adding it to a scene. Finish creating a system that generates a grid of blocks that are activated according to the player's position, but now I'm trying to convert this block "activation" system to actually load the scenes, which is giving a headache
     
  15. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    9,745
    You didn't seem to pay that much attention to either the functionality or the documentation because there are manual loading and unloading methods you could use to bypass triggers entirely. It's literally on the second page of the PDF.
     
    TiagoB66 likes this.
  16. TiagoB66

    TiagoB66

    Joined:
    Oct 22, 2017
    Posts:
    16
    I thought it could be a translation into my language, but the explanations are minimal, you said you had explanations on the second page, but it has 3 lines.
    For this reason, I was confused and did not understand at all how it would be possible to use something like Scene Streamer.
     
  17. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    15,509
    You're right that the documentation is sparse... still, it does tell you what methods to look at if you want to use custom logic rather than triggers. And if you want it to be based on position but not use the built-in system that's based on position (i.e. triggers) then custom logic is likely what you need.
     
    stain2319 and warthos3399 like this.
  18. ArIaNFury008

    ArIaNFury008

    Joined:
    Dec 22, 2019
    Posts:
    6
    hey guys what about Subscene can we use a single scene with some Subscenes?
     
    Last edited: Aug 15, 2023
  19. kdgalla

    kdgalla

    Joined:
    Mar 15, 2013
    Posts:
    4,355
    Possibly, but it looks like that's an ECS feature. I don't know how deep you'd need to go down that whole ECS rabbit-hole to get that to work. ECS is a relatively new and advanced feature so I haven't seen many tutorials about how to use this system.

    What do you think subscenes will do that can't be done with just regular scenes?
     
  20. ArIaNFury008

    ArIaNFury008

    Joined:
    Dec 22, 2019
    Posts:
    6
    from CodeMoneky videos

    It seems very easy, especially from the other methods I have seen so far, but I could not implement it in Unity 2022 because it requires a Hybrid Renderer and it is still an experimental package, and it does not match with the only version of Entities 1.0 in 2022 LTS, and it gives an error. You must use Unity 2020 version for Subscene to work. if I am wrong please correct me.

    also a couple of years ago someone find out how a game like "the forest" is loading their scene which was like super simple they had a single scene for terrain and spawning the objects then for caves they used streaming scenes. (forestMain_v08 is the game) Sample.png
     
  21. TiagoB66

    TiagoB66

    Joined:
    Oct 22, 2017
    Posts:
    16
    I managed to do something similar without using ecs, loading scenes dynamically according to the position, I found it much simpler, and I had a result of about 450 FPS in a simple scene with a terrain divided into 25 parts that add up to 400 meters in total. I also tried to test ECS, and it's not compatible with the version I'm using and thousands of errors appeared that I didn't particularly understand. Dots are an amazing technology, but I didn't find many ways to start with the documentation, it's still confusing for me, and in my language (Portuguese), there is no documentation, which makes it difficult to understand through videos or something.
     
  22. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    20,124
    That YouTube video is three years old. Entities 1.0 is three months old. Any learning resource that is older than those three months will be full of differences.

    Last I checked Entities Graphics (which is what you will use for rendering entities) was only able to render a single subscene at once.

    Yeah you basically have to be capable of learning solely by reading and experimenting around with code. DOTS will eventually have learning resources available but we're likely a year or two out from that point. You also have to be willing to use the most recent releases of Unity. Anything older than the 2022 LTS won't work.
     
    Last edited: Aug 15, 2023
    MadeFromPolygons and warthos3399 like this.
  23. e_Zinc

    e_Zinc

    Joined:
    Oct 31, 2019
    Posts:
    16
    We are making an open world multiplayer game. It's called Saleblazers, if you want to look it up. The map is quite large.

    We have a master scene, with props chunks / building chunks loading in asynchronously using the Unity Scene Manager.

    Please learn from our mistakes. I wish I had a master scene and invested time in creating our own data-based editor. This would have been much more performant, easier with source control, can play better with version upgrades, and we could stream in assets in a more controllable manner.

    With our current scene-based setup, we have had to write our own custom Start/Awake/Update functions to avoid hitches. It's also impossible to scale up the chunk sizes without it being catastrophic + deleting version control history.

    We can't really benefit from meshes/materials being streamed in per scene, because our game is like Minecraft where items in each chunk belong to a master database that we stream from anyway.
     
    joshcamas likes this.