Search Unity

Feasibility Check - Seamless "illusion" Terrain Load System

Discussion in 'World Building' started by Cody-Rauh, Jul 9, 2018.

  1. Cody-Rauh

    Cody-Rauh

    Joined:
    Oct 12, 2013
    Posts:
    256
    I was hoping to get opinions from those experienced with world building on this topic.

    Concept:

    I want to give the illusion that the world is unending and seamless as if you could travel around it full circle, and just keep going around and around as much as you would like.

    Approach:

    Would be similar to wrap around text, or what you would do when transitioning from one area to the next in old games. Keep in mind this is for a 3D environment!



    The difference would be that each tile would have a number assigned and instead of simply loading the next scene a script would say something similar to the following. ( below the next image )



    If the player was moving right from 4 to 5,

    OnCollision with tile 5, check to see if tiles 1,2,3,4,6,7,8,9 are loaded. If not then load. so it would load 3,6,9.

    If you had the player moving from 6 to 9

    OnCollision with tile 9, check to see if tiles 1,2,3,4,5,6,7,8, are loaded. If not then load. so it would load 2,3,1.

    Obviously, we want to call our terrain tiles much further out than just one tile!




    LOD Distance Layering:

    All objects would be a child to the parent prefab of the terrain chunk where they belong. Spawners could instantiate the correct animal at correct distance threshold.

    1. 6 tiles on every side, canyons, terrain, mountains etc ( farthest distance )
    2. 3 tiles on every side, Buildings, landmarks, extremely large animals would spawn
    3. 2 tiles on every side, tree, vegetation, large animals would spawn
    4. 0.5 tiles on every side, props, items, decor character size animals would spawn ( shortest distance )


    Handling Object Fade In/Out:

    Something similar to this



    Ideally, we want the objects loaded into the scene before the shader allows the object to become visible, to ensure it is smooth.

    We also want to give the game plenty of time to load the stuff slowly over time rather than choking the system in high-density areas.

    Concerns:

    1. Is this approach feasible? ( Any major flaws in the concept or approach? )
    2. What pitfalls do I need to keep in mind? ( performance, memory, etc )
    3. Are there any games out there that use this type of system that has documentation on the development process? ( If so please provide link! )
    4. Are there well documented easier/better ways to implement this concept/approach?


    Suggestions I don't have an interest in:

    1. Minecraft / Voxel Terrains
    2. Procedurally Generated Terrains.


    I will keep updating this post as I get feedback and comments from people to reflect the discussion and hopefully fine tune any flaws with the system if it is at all a reasonable approach.
     
    Last edited: Jul 9, 2018
  2. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    9,859
    Yes, it should work fine. I know I've seen this technique used before; I vaguely recall a flight demo where the terrain was handled in this way so as to be infinite. I can't point to any specific examples, but it's not all that uncommon.
     
  3. Cody-Rauh

    Cody-Rauh

    Joined:
    Oct 12, 2013
    Posts:
    256
    Haha, good to know I am not crazy and out of my mind. ^^
     
  4. I suggest to take a look to two assets on the AS:
    https://assetstore.unity.com/packages/tools/utilities/world-streamer-36486
    and
    https://assetstore.unity.com/packages/tools/utilities/sectr-stream-15354

    Two different approach to tackle the same problem, one of them probably good enough for you if you don't want to spend time to build it yourself.
    Although for terrains, especially if you want to setup "lod"-s for terrain, the world streamer I think a better choice. Sectr great for room to room experience or predefined, short visible distance-games (BTW, used in Firewatch)
     
  5. Cody-Rauh

    Cody-Rauh

    Joined:
    Oct 12, 2013
    Posts:
    256
    Hello LurkingNinjaDev, first thank you for sharing both of those assets with me. I have seen many assets in Unity store in general, and I am always leery as I feel something may appear open-ended, but really only work under very tight and specific niche conditions.

    Have you used either of those assets extensively? If so what has been your experience?
     
  6. I own both of them, I haven't published anything with them yet (I'm planning to use the world streamer, but with my current project I'm not quite yet there), but both of these assets are used in actual projects (Sectr - Firewatch, World Streamer - Drone and Green Hell project) so they are usable and proven.
    I have made a couple of dumb test-projects with both of them (and decided to go with the WS, because it fits more of my future needs on my current project).
    The setup a bit cumbersome right now, but they're working on the design of the 2.0 and it probably will more easy to use but still powerful.
    You also gain the ability to have LOD on terrain, so eventually you can replace it with lowres mesh (like in Skyrim)
    These assets are cheap I think it worth the try.
     
  7. joshcamas

    joshcamas

    Joined:
    Jun 16, 2017
    Posts:
    1,278
    I use this method! Heres what I do

    I split the world into chunks. Each chunk is a scene.

    I have a special tool that automatically generates "distance prefabs" for each of these chunks. These prefabs contain two parts:

    1) a terrain mesh - this is a low poly mesh that is generated based on the terrain in each chunk. Also, a low res texture is generated as well. I actually combine all of these into a single "atlas" texture, so only one material for all of the terrain. Also, I also serialize the terrain mesh by saving its normals and triangles and stuff, then deserializing it by creating a mesh at runtime. (otherwise the mesh would need to be an asset)

    2) any objects in that scene with a "Add to Distance" component. This simply grabs all of the mesh filters/renderers on these objects and copies it over to the distant terrain. When I implement lods, I'd also make it so it grabs the lowest lod. I also plan on implementing a "mesh combiner" that combines all the meshes per object.

    So then, in a 3x3 grid around the player (player in the center), it loads the scenes, while beyond, it loads these relatively cheap distant terrains. It works quite well!!

    Some notes:
    if there's any baked lighting, there will be a flicker of black when each chunk loads. Not very fun.

    Since you're unloading and loading stuff, including let's say npcs, there will naturally have to be a way to save and load the state of this stuff. Make sure to think of this (and saving in general) before you build the world, since that really defines how world building goes down.

    Splitting everything into scenes also makes it ugly in the heirarchy, so making them small will make it even uglier

    You'll have to make some sort of event when a chunk is going to unload, to allow any npcs that have left that chunk to move to whatever chunk they need to go to. Or, do this every frame. Either way I suppose.

    I hope this helps