Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

[RELEASED] SECTR STREAM: Seamless Scene Streaming

Discussion in 'Assets and Asset Store' started by MakeCodeNow, Feb 21, 2014.

  1. MakeCodeNow

    MakeCodeNow

    Joined:
    Feb 14, 2014
    Posts:
    1,246
    Glad you got it working! If you are using VIS make sure to enable simple culling :)
     
  2. MakeCodeNow

    MakeCodeNow

    Joined:
    Feb 14, 2014
    Posts:
    1,246
    SECTR 1.2.0 now uploaded to the UAS. Includes an Open World demo (finally!) and a native Unity 5 build.
     
    julianr and syntystudios like this.
  3. mantekkerz

    mantekkerz

    Joined:
    Dec 24, 2013
    Posts:
    111
    Is there a video coming soon for the open world demo? I'm interested in this asset but I'd like to know a bit more about how exactly it works in a open world scenario, just a basic run down similar to the box level demo on your web site would be good.
     
  4. MakeCodeNow

    MakeCodeNow

    Joined:
    Feb 14, 2014
    Posts:
    1,246
    I'm working on one now, but you can email support@makecodenow.com for an eval if you want to just try it yourself.
     
  5. boysenberry

    boysenberry

    Joined:
    Jul 28, 2014
    Posts:
    365
    Hi there, I am loving what I am seeing with your product's demo, etc.
    I am building a massive game with a voxel rendering system called Ultimate Terrains and am wondering if the streaming portion of Sectr package would be able to work with it. I will be having indoor scenes and there will be prefab towns, etc. that I would imagine would benefit regardless.
    My questions are, have you had anyone use this with volumetric terrains with any success; and as a follow up do you think I would still benefit from Sectr regardless? Also as a side note I am using Master Audio: AA Sound, I assume from posts I've read that you're aware of the package, does Sectr Audio work with it, or is it more of a replacement? And last but not least, I am using a rather large assortment of assets to try to keep me focused on my game and less on having to build a bunch of foundational tech, that has already been developed, are there any incompatibilities I should be aware of before purchasing, e.g. I am using Advanced Additive Scenes to merge UI with my other scenes, etc.?

    PS I guess I should have posted this in the COMPLETE forum, since that is the asset I am looking at purchasing, sorry.

    Thanks in advance,
    Boysenberry Payne
     
    Last edited: May 27, 2015
  6. MakeCodeNow

    MakeCodeNow

    Joined:
    Feb 14, 2014
    Posts:
    1,246
    Good questions. First, SECTR audio is a competitor to Master audio. You can use both at the same time, but they are independent and best to pick one. SECTR stream can be used for scene management ala additive scene system, but it also includes all the logic for actually streaming your scenes.

    Regarding streaming voxel terrains, SECTR can stream anything you can make in the editor. However, the streaming does not work (easily) for scenes that are created entirely procedurally ala Minecraft. This is because SECTR uses additive scene loading and creating scenes requires editor only functions.

    Regarding compatibility with other assets on the store, there are 10s of thousands of them so I can't really make hard guarantees. SECTR is implanted as generally add possibly and in a way that adheres to Unity standards in order to maximize compatibility with other assets. I hope that helps!
     
    boysenberry likes this.
  7. boysenberry

    boysenberry

    Joined:
    Jul 28, 2014
    Posts:
    365
    Thanks for the answers and fast response. Its a great deal right now with the Complete going for 50% off, its like buying 3 for the price of one, that's the kind of deal that's hard for me to pass up :) I think I will pick it up and use it where I am able, the vis package and stream packages are worth it alone.
     
    BackwoodsGaming likes this.
  8. MakeCodeNow

    MakeCodeNow

    Joined:
    Feb 14, 2014
    Posts:
    1,246
    Cool! Thanks for your support :)
     
    boysenberry likes this.
  9. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,676
    @boysenberry - I think there's room for interoperability with those assets. A plugin like Advanced Additive Scenes could help with the workflow part of making your separate scenes, and then when you have the additive scenes the way you want them, you can SECTR-ize them before building so that the scenes add/remove based on SECTR's in-game triggers.

    Likewise, I think you can use Master Audio more to manage music, and SECTR Audio to handle 3D audio FX.
     
    boysenberry likes this.
  10. MakeCodeNow

    MakeCodeNow

    Joined:
    Feb 14, 2014
    Posts:
    1,246
    That's all true. Regarding the workflow part, though, the SECTR Stream window includes very easy scene management tools for importing and exporting chunks. Teams like Campo Santo/Firewatch use SECTR STREAM extensively as both a workflow tool and as a streaming system.
     
    boysenberry likes this.
  11. boysenberry

    boysenberry

    Joined:
    Jul 28, 2014
    Posts:
    365
    I am pouring over the docs now. Great stuff in there. I am sure I'll be able to put SECTR to good use.
    With my terrain, the way it's going to work is I generate in edit mode, set it up the way I want, then before runtime the asset removes any existing terrain and recreates it (so that its exactly the same as it was in edit mode). This allows me to set stuff up on the terrain in edit that will still be in place during runtime, e.g. water, trees, etc.
    I am wondering if I can use SECTR with my terrain prefabs, like trees, buildings, rivers, etc. The culling would be really useful. The volumetric terrain already has culling etc. built in, so it should take care of itself, but 10,000 trees get to be a bit much, to stream them would be really nice, especially with speedtrees being so resource intensive. Think that will be possible?
    Also, I've noticed the water (SUIMONO) system I am using doesn't have an easy mechanism for during off the infinite oceans when you are no longer near the shoreline, something I am hoping I can correct with SECTR Audio. Think that would be possible?
    Again, incredible package, I am certainly glad I scooped it up yesterday!
     
  12. BackwoodsGaming

    BackwoodsGaming

    Joined:
    Jan 2, 2014
    Posts:
    2,229
    Good questions @boysenberry... I'm not quite to that point yet but will probably face same issues with Suimono and Environment Gator eventually..

    One thing that I'm trying to wrap my head around is I created a 3x3 grid using a combination of world composer and terrain composer. Is it possible to take that entire land mass and break it into smaller Sectrs? Say like a 9x9? I know Sectr can grab the neighbors from TC information and easily create a 3x3 grid of Sectrs. But could I do the same and ignore the TC info to create a 9x9?
     
  13. jdraper3

    jdraper3

    Joined:
    May 28, 2015
    Posts:
    117
    That's a good question and one that I'm wondering myself.
     
  14. MakeCodeNow

    MakeCodeNow

    Joined:
    Feb 14, 2014
    Posts:
    1,246
    It's possible but I don't recommend it. You have to manually use the terrain tool on each of the 3x3 terrains and then fixup all of the edges. It's pretty labor intensive and may break some assumptions rtp and tc make internally.
     
  15. BackwoodsGaming

    BackwoodsGaming

    Joined:
    Jan 2, 2014
    Posts:
    2,229
    Ok.. You pretty much confirmed what I was thinking.. Would be better to start from scratch and recreate the terrain using a different image scale (I think that is what world composer calls it) to get more and smaller tiles from the start. At this point I'm just playing around to try to get a feel for how to integrate all the tools together anyways. So probably good that I asked and figured this out now! lol

    Thanks for the answer! :)
     
  16. MakeCodeNow

    MakeCodeNow

    Joined:
    Feb 14, 2014
    Posts:
    1,246
    SECTR vis is entirely runtime so it'll cull whatever you throw at it. Just make sure that you are actually saving time. If you try to cull a ton of small stuff it may be slower to cull than to just render.

    Regarding water audio, SECTR automatically hibernates sounds that are too far away to be audible. If you're talking about turning off the visible parts of infinite water, there's nothing in SECTR to do that for you.

    Again, streaming will handle anything you build in the editor and which can be saved into a separate scene.
     
    Last edited: May 30, 2015
    boysenberry likes this.
  17. MakeCodeNow

    MakeCodeNow

    Joined:
    Feb 14, 2014
    Posts:
    1,246
    FYI that SECTR 1.2.0c went live on the UAS. It enables streaming optimizations for non-Pro Unity 5 users.
     
    boysenberry likes this.
  18. Hamesh81

    Hamesh81

    Joined:
    Mar 9, 2012
    Posts:
    405
    Hi MakeCodeNow, I have a question regarding SECTR Stream and SECTR Viz culling. I have been trying to work out how to handle the culling of dynamic objects and objects that have a different number of submeshes/gameobjects depending on their LOD.

    For example, let's say I have a building prefab which gets culled by SECTR Viz at some distance. At LOD0 the building has all of its windows as separate gameobjects, for collision reasons. For performance reasons the final LOD3 prefab is one mesh with the building and all of the windows combined into one.

    I have simple projectile collision functionality which when colliding with any window triggers the window's destruction (switching the unbroken window for a broken one). If the projectile strikes the building instead of the window only a decal is created on the surface hit. Now, if a user is standing within range of the LOD0 all is well. However if a user fires a projectile at a window from a distance when it is culled, or from an LOD3 distance (windows and building combined into one), how can the projectile now trigger that specific window to break? This is important because if a second player happens to be standing right next to this window, they should be able to see it breaking from the impact. It is my understanding that culling and LODs take effect based on player distance, therefore how close the projectile is to the window will have no effect on the culling or LOD at all?

    The only optimized solution I can work out for this functionality, is to simply not cull any objects within the projectile's maximum range. The trouble with this though is of course performance. If a projectile is being fired from a sniper rifle, or worse still an aircraft, the maximum range can span several miles. It doesn't seem very optimized to have all assets within such a vast range not culled just in case a single one is fired upon.

    Any suggestions as to how this can be approached with SECTR Stream and SECTR Viz? I look forward to your suggestions.
     
  19. MakeCodeNow

    MakeCodeNow

    Joined:
    Feb 14, 2014
    Posts:
    1,246
    So, LOD is by definition view dependent. It should be a client side effect and boy something that affects other players.

    In your case, I think you'll need a custom building component that tracks which windows have been broken and then apples those changes to the object whenever lod becomes active. This component will need to be synced on all machines.
     
  20. Hamesh81

    Hamesh81

    Joined:
    Mar 9, 2012
    Posts:
    405
    A building component is definitely a good idea. But I am wondering how this would work in the case when the building is either culled or in LOD 3 when being fired at. In (1) below the user is far enough from the building that it gets culled by SECTR Viz; therefore if they fire at it, because it has been culled how can the building keep track of where it has been hit? Similarly in (2), since the LOD3 of the building does not have any windows how can it track whether a window was hit? The only possibility I can come up with is keeping the window colliders behind when the building is culled or changes to LOD3 and thus does not have any models of windows. Any suggestions?
    Culling.PNG
     
  21. MakeCodeNow

    MakeCodeNow

    Joined:
    Feb 14, 2014
    Posts:
    1,246
    Your question boils down to "how can I have something exist and not exist at the same time". The answer of course is that you can't :)

    Keeping the window colliders separate from LOD is probably the right way to go.
     
    Hamesh81 likes this.
  22. Hamesh81

    Hamesh81

    Joined:
    Mar 9, 2012
    Posts:
    405
    Ok sure. So in that case then, is it possible to setup SECTR Stream and Viz in a way so that once a gameobject is initially streamed in, when the user has reached a certain distance away the gameobject will not be disabled (since this will also disable collision) but will instead only turn off the relevant renderer components? This would basically work in the same manner, except instead of disabling gameobjects they would remain enabled but have their rendere components turned on and off.

    To get realistic results, I think that the colliders would need to be attached the relevant gameobjects and not exist separately. For example, if the window glass is shot and falls from the window frame you would want the collider to be moving with it and not still be positioned in the window frame as if nothing had happened. If there is no window anymore, there shouldn't be an invisible collider.
     
  23. MakeCodeNow

    MakeCodeNow

    Joined:
    Feb 14, 2014
    Posts:
    1,246
    Given that you want the colliders to exist independent of view distance, they should not be part of the LOD of the object, as the whole point of that system is to change the object based on distance. SECTR VIS works on a per object basis, not a per-object-component basis, so that's kind of a hard requirement.

    As far as the colliders go, you could create them as they are now, but then have the building component make a copy of the window colliders at startup, then disable colliders as the windows are destroyed.
     
  24. Hamesh81

    Hamesh81

    Joined:
    Mar 9, 2012
    Posts:
    405
    Ok sure, that makes sense. Is there a boolean or some other check made when either SECTR Stream or Viz disable/cull a particular SECTR/gameobject? Eg. If object is outside culling distance, cull object. Since if I cannot enable and disable components by default I thought that maybe I can execute my own custom logic whenever Stream or Viz is about to execute its disable/cull logic.
     
  25. MakeCodeNow

    MakeCodeNow

    Joined:
    Feb 14, 2014
    Posts:
    1,246
    Right now there is no callback, but you can add one easily in the _ActivateLOD() function.

    PS - Everything that we've discussed is VIS specific. STREAM isn't involved at all.
     
  26. Hamesh81

    Hamesh81

    Joined:
    Mar 9, 2012
    Posts:
    405
    Ok excellent, thanks for that I will have a look at the _ActivateLOD() function for Vis. For Stream, is there a similar function for when a chunk is streamed in or out? So that similarly, I could execute custom logic whenever a chunk has just been streamed in, or just streamed out.
     
  27. MakeCodeNow

    MakeCodeNow

    Joined:
    Feb 14, 2014
    Posts:
    1,246
    Chunk already has proper event callbacks that you can hook into for load and unload. You can follow that pattern for your lod callbacks if you like.
     
    Hamesh81 likes this.
  28. Hamesh81

    Hamesh81

    Joined:
    Mar 9, 2012
    Posts:
    405
    Excellent I will have a look. Thanks so much MakeCodeNow, appreciate your help.
     
  29. voncarp

    voncarp

    Joined:
    Jan 3, 2012
    Posts:
    187
    Struggling a bit with public override boolLoaded in public class SECTR_RegionLoader : SECTR_Loader.

    Just to watch whats going on I change this:

    #regionPrivateDetails
    publicList<SECTR_Sector> sectors = newList<SECTR_Sector>(16);
    publicList<SECTR_Sector> loadSectors = newList<SECTR_Sector>(16);
    publicList<SECTR_Sector> unloadSectors = newList<SECTR_Sector>(16);
    #endregion

    I notice loaded returns true if items are shown are the list loadSectors. But this list keeps changing. So it will show true and false. I check this in here:

    IEnumeratorStart() {
    if (!tno.isMine) {
    playerRigid.useGravity = true;
    this.enabled = false;
    Debug.Log (playerRigid.useGravity);
    }
    while (!regionLoader.Loaded) {
    Debug.Log (!regionLoader.Loaded);
    Debug.Log (playerRigid.useGravity);

    yieldreturnnull;
    }
    playerRigid.useGravity = true;
    Debug.Log (playerRigid.useGravity);
    }

    What is happening for me, is that the player is spawning before the terrain loads. And then the player is falling into the depths because the terrain loads a little bit after.

    Does this make sense? I am trying to add gravity for the character after all the terrains have loaded. But, the terrains loaded vary upon spawning in. And sometimes the list is varies a frame or two later. Do you have suggestions on how to enable certain components until everything has been loaded properly?
     
  30. MakeCodeNow

    MakeCodeNow

    Joined:
    Feb 14, 2014
    Posts:
    1,246
    Sorry for the very slow reply. I'm looking into this issue. Your code looks correct.
     
  31. MakeCodeNow

    MakeCodeNow

    Joined:
    Feb 14, 2014
    Posts:
    1,246
    So, I'm unable to repro this. SECTR_RegionLoader's Loaded is only based on the sectors field. loadSectors and unloadSectors are just book-keeping. They are only members in order to prevent garbage generation.

    There may be an order of Update call issue here. If your script's update runs before RegionLoader's update, then you'll get this behavior. RegionLoader's update needs to be run at least once before the Loaded function works properly. If you want to work around that, try changing this line:

    bool loaded = true;
    int numSectors = sectors.Count;

    to this:

    int numSectors = sectors.Count;
    bool loaded = numSectors > 0;
     
  32. Tiny-Tree

    Tiny-Tree

    Joined:
    Dec 26, 2012
    Posts:
    1,314
    i havent seen an answer about this but cant we do sectors inside sectors, like i have an island which is my sector then inside there is a subsector for a cave ?
     
  33. MakeCodeNow

    MakeCodeNow

    Joined:
    Feb 14, 2014
    Posts:
    1,246
    You can totally do that. Nested sectors are fine, just don't make the Cave a child of the Island.
     
  34. wightwhale

    wightwhale

    Joined:
    Jul 28, 2011
    Posts:
    397
    I was wondering if there's a way to check if the initial chunks are done loading. Right now my game loads in the chucks based on neighbor location of my character, but I don't want people running around until the local chunks are loaded. So I would preferably keep the loading screen up until the initial chunks got loaded.
     
  35. wightwhale

    wightwhale

    Joined:
    Jul 28, 2011
    Posts:
    397
    Also my SECTR_Member.LateUpdate() is taking more than half my total game time. Specifically UpdateChildren() and updateSectorMembership() Is there something I'm doing wrong with it? The load is this intense even when standing still and the sectors around me have loaded.
     
  36. BackwoodsGaming

    BackwoodsGaming

    Joined:
    Jan 2, 2014
    Posts:
    2,229
    I'm curious to find what everyone's setup is. I'm still in the early stages of playing with the sectr package and so far, I'm loving it. One of the issues that I'm having is in keeping sectors small enough to where I can have decent looking terrain details, I'm having to chop down into 500m sectors. And even then, with neighbors, it still seems to bog things down a bit. I ended up switching to a region loader with a 750m distance and that seems to be better, but as I'm approaching the borders, I'm seeing where terrain is chopped on the other side. I've decreased view distance, but still having issues with seeing edges of sectors.

    What size sectors are you using for your projects and how are you dealing with the edges. I'm assuming I can probably increase sector sizes before I slice with stream and maybe use Vis for additional culling options (like my underwater spawns or above water spawns when underwater), but I still need to dig into that.

    Also is anyone using Horizon[On] along with Stream? I had originally thought about that to solve the chopped terrain issue but trying to create all the horizon tiles for all the different streamed terrain options seemed a bit daunting..

    Any thoughts/suggestions are greatly appreciated!
     
  37. MakeCodeNow

    MakeCodeNow

    Joined:
    Feb 14, 2014
    Posts:
    1,246
    Yes, you can check the Loaded property of each Chunk to see if it's loaded yet or not.
     
  38. MakeCodeNow

    MakeCodeNow

    Joined:
    Feb 14, 2014
    Posts:
    1,246
    That's pretty odd. How many Members are there in the scene? There's a section in the Core Manual that discusses good techniques for decreasing SECTR Member update time. Also make sure that you have an up to date version of SECTR as recent updates have increased performance there.
     
  39. MakeCodeNow

    MakeCodeNow

    Joined:
    Feb 14, 2014
    Posts:
    1,246
    0.5 km^2 and 1 km^2 Sectors are the most common sizes for open world games that I've seen. You can set your region loader to whatever distance you think makes sense.

    You definitely need to design a streaming open world to hide those transitions. The easiest thing to do is use fog, but the best solution is to more carefully control your sight lines. You can also use the built in Chunk Proxy feature to have low res geometry for the more distant terrain.
     
    BackwoodsGaming likes this.
  40. nickfourtimes

    nickfourtimes

    Joined:
    Oct 13, 2010
    Posts:
    219
    Apologies if it's been asked before, but suppose I have two separate scenes built already, is there any way to flag each one as a chunk, and then stream scene B from within scene A programmatically?
     
  41. MakeCodeNow

    MakeCodeNow

    Joined:
    Feb 14, 2014
    Posts:
    1,246
    As long as scene A and B are in the SceneSettings list and are part of the build it is possible. You can dynamically create a GameObject with a Sector and Chunk component, properly fill out the chunk fields, and then go from there. Note that this is not a officially supported workflow so you may need some trial and error and a bit of debugging to get it all sorted out. Feel free to post follow up questions if you run into issues.
     
  42. nickfourtimes

    nickfourtimes

    Joined:
    Oct 13, 2010
    Posts:
    219
    Hey, that worked pretty much right out of the box! In my test scene, I just used an FPS controller to walk through a collider. The latter had the TriggerLoader component on it, with a reference to an "empty" object with just the sector & chunk components, as you described. Once you walk through the trigger, the sector is loaded -- bringing in the second scene. I might spend some time one night this week to put the project online for demo purposes.

    I was wondering about something else though. In my actual game, there's no real moving parts to trigger loading -- we just reach a certain state and load the next level. To try out the above technique in our project, I sorta hacked it so that there's a box collider off-camera in the scene; when the state is correct, I drop a sphere through that trigger, and that fires the TriggerLoader, &c. Not super elegant, but it worked for testing.

    Is there another way for me to just fire a level/sector loading via script? As in nextLevelSector.StartLoading() or some such.

    Also, once I've loaded Level B, can I keep it "deactivated" until I know my Level A ending animation is done, then remove Level A, then activate Level B? I feel like that's a bit of a stretch, but someone might have an idea to hack around it.

    Thanks!
     
  43. MakeCodeNow

    MakeCodeNow

    Joined:
    Feb 14, 2014
    Posts:
    1,246
    Hooray!

    If you want to load a Chunk, simply call AddReference. To unload, call RemoveReference. That's it. Loaders are just convenient wrappers around that API.

    Each Chunk has a chunkRoot member, which points to the base game object. It's not exposed, but you can add a get only property and then feel free to SetActive() on it or whatever. You could also modify the logic in SECTR_StreamExport to automatically export chunks deactivated and/or to auto-deactivate just after load in Chunk itself.
     
  44. passerbycmc

    passerbycmc

    Joined:
    Feb 12, 2015
    Posts:
    1,741
    When sectr appends new lightmaps to the global lightmap array, is there any way to find out what indexes are associated with what chunks?

    I got a situation where i have to swap out a lightmap at run time, and it is hard to figure out which index it is at when a few chunks have been loaded and unloaded
     
  45. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,240
    I have a number of overlapping sectors, and some places where there is a gap between sectors, which seems to create some odd behavior -- at runtime, when my PC is in some spots, all sectors are unloaded even though the PC is within a few meters of several sectors. Should all the sector bounds be touching (which I guess requires adding objects to ensure that) or are there other particular things I should be doing in my sector setup to prevent these issues?
     
  46. MakeCodeNow

    MakeCodeNow

    Joined:
    Feb 14, 2014
    Posts:
    1,246
    SECTR doesn't append to or otherwise change the lightmap indices. It just uses whatever was there. Each Chunk has a GameObject with a LightmapRef component on it, which you can access if you want to figure out which textures are for which indices.

    Note that this may change for 5.2 and above now that Unity is finally fixing issues w/ lightmap streaming in Unity 5. Details TBD as I'm still working with this new interface.
     
  47. MakeCodeNow

    MakeCodeNow

    Joined:
    Feb 14, 2014
    Posts:
    1,246
    The answer depends on the kind of Loader that you are using .Which one are you using?
     
  48. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,240
    I'm using Neighbor Loader (set to 1) on the player-camera.
     
  49. MakeCodeNow

    MakeCodeNow

    Joined:
    Feb 14, 2014
    Posts:
    1,246
    If all the Sectors unload when using a Neighbor Loader, then it means that the camera is not in any Sectors (e.g. no longer overlaps the bounds of any Sector).
     
  50. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,240
    Okay, thanks. So I should set up the sectors so the bounds overlap a bit. Good to know.