Search Unity

[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
    There's no requirement that there geometry in chunks be square. There bounds of a sector are always square, but the contents can be whatever you like.

    You are right that SECTR will work just fine in the city case. The use of a regular grid on outdoor terrain is just an easy way to get started, but not a requirement.
     
  2. MakeCodeNow

    MakeCodeNow

    Joined:
    Feb 14, 2014
    Posts:
    1,246
    Yes, you can get the chunk component from the sector and check the loaded property. The built in loaders check this and try to immobilize the physics until the scene is loaded, but it may not work depending on how hot player is setup.
     
  3. kimsama

    kimsama

    Joined:
    Jan 2, 2009
    Posts:
    166
    Hey,

    I found a curious thing with chunk loading.

    The function _Load() in SECTR_Chunk.cs, it returns asyncLoadOp for async loading:

    Code (csharp):
    1.  
    2.         else
    3.         {
    4.             #if UNITY_MSE
    5.             SceneManager.LoadSceneAsync(ScenePath, LoadSceneMode.Additive);
    6.             #else
    7.             asyncLoadOp = Application.LoadLevelAdditiveAsync(ScenePath);
    8.             #endif
    9.             activationQueue.AddLast(this);
    10.         }
    11.  
    By the way, there is no asyncLoadOp return value for SceneManager.LoadSceneAsync. Why?

    I guess it also should return the asyncLoadOp to wait till it done with loading.

    So, it is likely to change as the following:

    Code (csharp):
    1.  
    2.         else
    3.         {
    4.             #if UNITY_MSE
    5.             // return asyncLoadOp!
    6.             asyncLoadOp = SceneManager.LoadSceneAsync(ScenePath, LoadSceneMode.Additive);
    7.             #else
    8.             asyncLoadOp = Application.LoadLevelAdditiveAsync(ScenePath);
    9.             #endif
    10.             activationQueue.AddLast(this);
    11.         }
    12.  
    Any ideas?


    Best,

    -Kim

    [Edit]
    Forgot to mention that, I use the latest version of SECTOR Stream 1.2.2a which is part of SECTOR Complete with Unity 5.3.3f1.
     
    Last edited: Mar 3, 2016
  4. MakeCodeNow

    MakeCodeNow

    Joined:
    Feb 14, 2014
    Posts:
    1,246
    Thanks for the report. That is definitely a bug.
     
  5. Chris-Clark

    Chris-Clark

    Joined:
    Jan 16, 2012
    Posts:
    128
    First time posting here, but this is a great product, thanks for all your work on it! I've only been working with STREAM and had a question about future functionality.

    Are you planning on swapping out your load/unload editor functions to instead use the multiple scene loading that's now built into Unity?

    I've found it already mostly works, as in I can work directly on each chunk by adding all the scenes add once into the editor. The only problem I see is that if a scene is already loaded in the editor, STREAM doesn't notice and loads it again on top in runtime. Because when you import in your tool, it turns off the SECTR_Chunk script. Unity is supposed to have some delegates for that, but I can't access them in 5.3.4f1 http://docs.unity3d.com/ScriptReference/SceneManagement.EditorSceneManager.html (At the bottom)

    I'm going to submit a bug and see if they can expose the delegates.

    The sectors themselves will always have to exist in a main always loaded scene, but I don't see that as an issue. And when creating a sector I could use your tool to initially set the bounds and export it.

    Anyways, just wondering if that was on your todo list for the future. It would make all the multi-scene-wide stuff easier to do and you wouldn't have to worry about running the Lighting code manually from your STREAM window or trying to keep it up to date for future multi-scene features.

    Thanks again for the awesome tool!
     
    Teila likes this.
  6. MakeCodeNow

    MakeCodeNow

    Joined:
    Feb 14, 2014
    Posts:
    1,246
    Glad to hear the SECTR love!

    I don't plan to remove SECTR's STREAM window and related chunk management code. I have to do fixup whenever a scene is loaded or unloaded. The latest code does support the MSE APIs, and should work fine as long as you just use the SECTR STREAM window and don't manually load and unload subscenes.

    If those delegates get exposed, I'd be glad to use them. Please do file a bug. That way it wouldn't matter which GUI you used to load the sub-scene.
     
  7. Chris-Clark

    Chris-Clark

    Joined:
    Jan 16, 2012
    Posts:
    128
    Great, thanks! I did file a bug letting them know about it, we'll see how long it takes now. ;)

    Your tool window still works great so I'll continue using it. Thanks again for the awesome code.
     
  8. Chris-Clark

    Chris-Clark

    Joined:
    Jan 16, 2012
    Posts:
    128
    I just got a reply about the bug report. Those delegates are only available in 5.4 beta, so the documents will be updated to reflect that.
     
  9. MakeCodeNow

    MakeCodeNow

    Joined:
    Feb 14, 2014
    Posts:
    1,246
    Ok. Awesome. I'll take a look in the next few weeks.
     
    Chris-Clark likes this.
  10. Tom_Timothy

    Tom_Timothy

    Joined:
    Nov 21, 2013
    Posts:
    85
    Small question is there any tool to easily take a large group of objects, and separate them into 4 groups for sectr same as land or do I half to hand select them all?


    Basically asking If i have a 100 objects in a square area is there a way to make each 25% of that square a sectr?

    After thinking i guess group all objects in a parent sectr then cut that sectr into 4 parts just objects not terrain
     
    Last edited: Mar 30, 2016
  11. MakeCodeNow

    MakeCodeNow

    Joined:
    Feb 14, 2014
    Posts:
    1,246
    Yep. You have the right idea.
     
  12. Tom_Timothy

    Tom_Timothy

    Joined:
    Nov 21, 2013
    Posts:
    85
    is there a tool to brake one sectr into 4 sectr or do i half to do it manualy?
     
  13. MakeCodeNow

    MakeCodeNow

    Joined:
    Feb 14, 2014
    Posts:
    1,246
    You have to do it manually.
     
  14. Tom_Timothy

    Tom_Timothy

    Joined:
    Nov 21, 2013
    Posts:
    85
    I want these sectrs in equall size any easy tool for selecting same meeters sized area of objects? say 200 metters at a time?
     
  15. MakeCodeNow

    MakeCodeNow

    Joined:
    Feb 14, 2014
    Posts:
    1,246
    Not that I know of, but you should check out the asset store.
     
  16. Tiny-Tree

    Tiny-Tree

    Joined:
    Dec 26, 2012
    Posts:
    1,278
    there is a bug on last version: if i set a terrain tile shader to be "Built in legacy Difuse" when i export and play the scene it will be reloaded as standard shader. so in short the terrain shader is reset.
     
  17. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,024
    I'm using SECTR Streaming with a project stuck on 4.7, which uses the old Unity GUI. On iPhones, I'm having a weird problem where all the GUI disappears, or flickers, when moving from one sector to another. It's still working (I can still use the virtual joystick to move around, it's just invisible), and then it'll reappear after a bit. Any idea what might cause that?
     
  18. Tiny-Tree

    Tiny-Tree

    Joined:
    Dec 26, 2012
    Posts:
    1,278
    the gui is immediate mode so rendering everyframe, it might be a normal behaviour if its not displaying during loading? does you gameobject with the script is set outside of a sector? do you load an other scene or just sectors additive chunk?
     
  19. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,024
    The GUI is old Unity GUI (onGUI) so it doesn't reside on an object, it's all in code. We're just doing standard sector chunks.
     
  20. MakeCodeNow

    MakeCodeNow

    Joined:
    Feb 14, 2014
    Posts:
    1,246
    I'm really not sure. SECTR should be totally independent of GUI rendering so very likely a unity bug that appears when the async level loading code is run.
     
  21. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,024
    Turns out this seems to be related to Unity occlusion culling. Sorry for the misreport.
     
  22. hablaine

    hablaine

    Joined:
    May 21, 2016
    Posts:
    1
    have a strange problem with the door loader where it completely hangs the editor. i have to kill the process to exit out. i noticed this happens when the player walks out of the door's box collider trigger. this happens with the example door too. am i messing up the config somewhere?
     
  23. Gozdek

    Gozdek

    Joined:
    Jun 21, 2015
    Posts:
    356
  24. MakeCodeNow

    MakeCodeNow

    Joined:
    Feb 14, 2014
    Posts:
    1,246
    Hi. What version of Unity are you using?
     
  25. MegaFlash

    MegaFlash

    Joined:
    Dec 29, 2014
    Posts:
    18
    I need to change the layer on over 1000 sector terrain, is there an easy way to do this or do I need to import each of them and change the layer manually (and then bake it as changing layer removes the baking?)

    Thanks,
     
  26. MakeCodeNow

    MakeCodeNow

    Joined:
    Feb 14, 2014
    Posts:
    1,246
    The easiest would be to import all of them and then change them all and then export all of them. You could also open each sub-scene and change it there. Or write a script :)
     
  27. MegaFlash

    MegaFlash

    Joined:
    Dec 29, 2014
    Posts:
    18
    Hi again,

    I tried baking the lightmap for all scenes but unity crashes after some point. It's impossible for unity to import all the Sectr at the same time. My PC specs as of now is i7 extreme with 64Go of RAM and PICe 512Go SSD drive and it cannot handle the load?
     
  28. MakeCodeNow

    MakeCodeNow

    Joined:
    Feb 14, 2014
    Posts:
    1,246
    Hi, sadly this is a limitation of Unity and not something I can work around in SECTR. I've tried to find ways to bake individual sectors, but it always corrupts the main scene's lighting.
     
  29. StevenP94

    StevenP94

    Joined:
    Jun 3, 2013
    Posts:
    142
    Hello, I'm evaluating the SECTR complete and have just a doubt: If I understand, the streaming is done using LoadLevelAdditiveAsync or LoadSceneAsync, why you don't use assetbundles ? Should not have better performances?
     
  30. MakeCodeNow

    MakeCodeNow

    Joined:
    Feb 14, 2014
    Posts:
    1,246
    You are correct that SECTR uses LoadLevelAdditiveAsync. This actually has better memory and performance than asset bundles. Asset bundles were designed to enable DLC like scenarios, not game streaming, which is the focus for SECTR. With asset bundles, unless you are very careful, you'll wind up with the shared files duplicated across asset bundles. Also, asset bundles require a lot of memory to load because the bundle is loaded and then the individual resources are created, and then the bundle is unloaded. That means your peak memory can be very high. Neither asset duplication nor excessive memory peaks are a problem with LoadLevelAdditiveAsync.
     
    hopeful likes this.
  31. StevenP94

    StevenP94

    Joined:
    Jun 3, 2013
    Posts:
    142
    Thanks for your fast reply!

    I'm planning the realization of a MMORPG and the chunks loading must be seamless of course. I developed my streaming solution based on assetbundles but I may not proceed with this implementation, because I need to have a working prototype in few time, so I'm looking for a good streaming solution and SECTR seems to be good for this. I'm just scared from some messages about lag while loading chunks.
     
  32. Tiny-Tree

    Tiny-Tree

    Joined:
    Dec 26, 2012
    Posts:
    1,278
    it will lag from editor but in the build its extra smooth
     
  33. MakeCodeNow

    MakeCodeNow

    Joined:
    Feb 14, 2014
    Posts:
    1,246
    Damien is right. The editor isn't fully optimized but standalone builds do pretty well, as long as you don't have too much script logic that executes in Start/Awake/Enable.
     
  34. ilusomu

    ilusomu

    Joined:
    May 28, 2015
    Posts:
    24
    I was looking through the changelist for 5.4b25 and noticed this bit here:

    To be addressed post-5.4:
    • [762371] Scene Management: SceneManager.UnloadScene hangs if called from a physics trigger. Workaround is to defer unload. This will not be addressed in 5.4.
    Will this impact certain SECTR Stream loaders?
     
    syscrusher likes this.
  35. MakeCodeNow

    MakeCodeNow

    Joined:
    Feb 14, 2014
    Posts:
    1,246
    Yikes. Yes it probably will. I will add a workaround that delays the unload by a frame. Man, that is a super gnarly bug.
     
    syscrusher and hopeful like this.
  36. Elzean

    Elzean

    Joined:
    Nov 25, 2011
    Posts:
    578
    Hi, the doc suggest to mark objects as static. I have many objects that do not move but are not mark as "lightmap static" or "navigation static", often (but not always) those are small objects child of bigger pieces.

    Which part of the "static" flags are important for Sectr to optimize the object ?

    Also i couldnt find where is the "Member Bounds Modes" ?
     
  37. MakeCodeNow

    MakeCodeNow

    Joined:
    Feb 14, 2014
    Posts:
    1,246
    As long as the static checkbox is checked it'll be OK.

    Member bounds modes are in the sector and member components but are automatically hidden for static objects.

    Children of static sectors are not required to be static. It's just generally a good idea.
     
    Elzean likes this.
  38. Cereal_Killa

    Cereal_Killa

    Joined:
    Oct 20, 2013
    Posts:
    205
    Hi I'd like to create a 2D platformer that is endless in 4 directions.
    I'm happy to design the rooms manually but need to connect them procedurally at runtime and obviously stream them as the player moves around the world.

    Is this possible with this asset?

    And is it possible to have different streaming layers so that major geometry is loaded further away than doodads and enemies?
    Also, I would like to be able to view the map in the editor if possible.

    Thanks for your time.
     
  39. MakeCodeNow

    MakeCodeNow

    Joined:
    Feb 14, 2014
    Posts:
    1,246
    Hi. This is possible in SECTR, but it requires a decent amount of additional to teleport the Sectors post load. If I were you I'd recommend just making each room as a scene and then using LoadLevelAdditiveAsync and UnloadLevel from your code.
     
  40. Cereal_Killa

    Cereal_Killa

    Joined:
    Oct 20, 2013
    Posts:
    205
    Thanks for your response!
    I'll give this a shot manually as you suggested.
     
  41. pixelsplit

    pixelsplit

    Joined:
    Sep 16, 2013
    Posts:
    124
    For me I excatly ran into this issue (took me a while to figure it out...). Here is the stack trace:
    Code (CSharp):
    1. Destroying GameObjects immediately is not permitted during physics trigger/contact, animation event callbacks or OnValidate. You must use Destroy instead.
    2. UnityEngine.SceneManagement.SceneManager:UnloadSceneNameIndexInternal(String, Int32)
    3. UnityEngine.SceneManagement.SceneManager:UnloadScene(String) (at /Users/builduser/buildslave/unity/build/artifacts/generated/common/runtime/SceneManagerBindings.gen.cs:160)
    4. SECTR_Chunk:_DestoryChunk(Boolean, Boolean) (at Assets/External Assets/SECTR/Code/Stream/Scripts/SECTR_Chunk.cs:297)
    5. SECTR_Chunk:_Unload() (at Assets/External Assets/SECTR/Code/Stream/Scripts/SECTR_Chunk.cs:281)
    6. SECTR_Chunk:RemoveReference() (at Assets/External Assets/SECTR/Code/Stream/Scripts/SECTR_Chunk.cs:114)
    7. SECTR_TriggerLoader:_UnrefChunks() (at Assets/External Assets/SECTR/Code/Stream/Scripts/SECTR_TriggerLoader.cs:118)
    8. SECTR_TriggerLoader:OnTriggerExit(Collider) (at Assets/External Assets/SECTR/Code/Stream/Scripts/SECTR_TriggerLoader.cs:77)
    Is there an ETA when this'll be fixed?
     
  42. AlteredPlanet

    AlteredPlanet

    Joined:
    Aug 12, 2013
    Posts:
    448
    Hello,

    So I am using streaming in my project, I wanted to remove networked NPCs out of a sector locally to save memory , but if player reenters sectr the AI is still there.... here is my therory...


    so basically you spawn the AI over the (master) network (Network.instantiate), so that each peer(client) gets copy of that AI with the photon view(snyced) ...

    if Player 1 leaves a sector, then he deletes his copy, but if he re - enters that sectr again he can still see that AI because its being synced from player 2 or 3 etc..
    but its no longer a object in player 1's ram or client......

    if player1 wanted to interact with AI after re - entering sectr his still can, just make sure that you spawning bullets over the master (Network.Instantiate)

    Does think make sense? is this industry standard?
     
  43. MakeCodeNow

    MakeCodeNow

    Joined:
    Feb 14, 2014
    Posts:
    1,246
    I decided to just fix up trigger loader rather than add delays to the whole system. Next version should be live by the end of the week. If you want an early copy of the fix, email support@makecodenow.com.
     
    hopeful likes this.
  44. MakeCodeNow

    MakeCodeNow

    Joined:
    Feb 14, 2014
    Posts:
    1,246
    There are lots of different ways to solve this problem. In general, you can't simply smash SECTR style streaming together with photon. You either need to modify SECTR to understand how you are handling replication or you should remove the NPC's from the sectors and have a dedicated NPC system create and destroy them.
     
  45. AlteredPlanet

    AlteredPlanet

    Joined:
    Aug 12, 2013
    Posts:
    448
    Hi,

    So the streams work fine in editor ,but in build, they never load , or load like 5 mins later.

    any idea why?
     
  46. voncarp

    voncarp

    Joined:
    Jan 3, 2012
    Posts:
    167
    I think Sectr Terrain is not functioning properly in Unity 5.5. In a blank project I cant seem to be able to sectorize the terrains.

     
  47. MakeCodeNow

    MakeCodeNow

    Joined:
    Feb 14, 2014
    Posts:
    1,246
    Thanks for the bug report. I'll take a look.
     
  48. MakeCodeNow

    MakeCodeNow

    Joined:
    Feb 14, 2014
    Posts:
    1,246
    I'm not able to repro that at all in my project in 5.5. I have forced text serialization and did a 4x4 split on a terrain with 512 control texture res and 1024 base texture.
     
  49. Wikzo-DK

    Wikzo-DK

    Joined:
    Sep 6, 2012
    Posts:
    72
    I am trying out streaming, but it seems like the loading is not asynchronous. I am experiencing the "hitching" problem as described in the SECTR Stream Manual (Note that async loading is a Pro-only feature, Free users may see "hitching" when loading new sections in SECTR STREAM. These hitches can be avoided with some clever design, and some helpful components are included the package.)

    But I was under the impression that the async/additive level loading became part of the free version of Unity some time ago? Is it not possible to do smooth level streaming without Unity Pro?

    I am using Unity 5.4.3 Personal with SECTR Complete 1.3.1
     
    Last edited: Mar 8, 2017
  50. pixelsplit

    pixelsplit

    Joined:
    Sep 16, 2013
    Posts:
    124
    Is this hickup in Editor on in a build? The loading is much(!!!) slower in editor than in an actual build.