Search Unity

[RELEASED] SECTR COMPLETE: Spaces, and the Connections Between Them

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

  1. MakeCodeNow

    MakeCodeNow

    Joined:
    Feb 14, 2014
    Posts:
    1,246
    The simplest would be three sectors, one for exterior, one for interior, one for the airlock. Put portals at either end if the airlock. Connect one portal to the exterior and the airlock, the other to the airlock and the interior. That'll get you going and you can get more complex from there.
     
    hopeful likes this.
  2. GamerPET

    GamerPET

    Joined:
    Dec 25, 2013
    Posts:
    367
    I remember the last time when I tried this, it was a problem because the sectors were somehow touching the other sectors ...

    can I have a sector within a sector? Like the exterior will contain the airlock & the building? Even the building itself... it's shape is in a way that the airlock is inside the building so the shape of the sector is going to be weird.
     
  3. MakeCodeNow

    MakeCodeNow

    Joined:
    Feb 14, 2014
    Posts:
    1,246
    You may want to set the portal determined flag as well on the players member component. That will prevent them from being in both the inner and outer sectors at once.

    Abs generally it's fine to have sectors overlap. Just don't parent one sector to another.
     
    GamerPET likes this.
  4. GamerPET

    GamerPET

    Joined:
    Dec 25, 2013
    Posts:
    367
    Thanks for the reply.

    Question:
    Will I be able to trigger the load/unload of a particular sector trough code (if this is possible, can I do it with Playmaker?).

    My current scenario is pretty straight forward... and I prefer to trigger the loading manually and not use the "Neighbor Loader". Simply, when I'm in X location, I want to load Sector 1 & Unload Sector 2.

    EDIT:
    I created a GameObject that has all my interior stuff. I created a GameObject that has all my exterior stuff.

    My scenario is already made so you will be in an "Airlock" where you don't see the interior or the exterior. This "Airlock" is in it's own GameObject. Also this Airlock & another structure will always be seen no matter where you are.
     
    Last edited: Jul 27, 2016
  5. MakeCodeNow

    MakeCodeNow

    Joined:
    Feb 14, 2014
    Posts:
    1,246
    Yes. SECTR ships with playmaker command to load and unload sectors.
     
  6. GamerPET

    GamerPET

    Joined:
    Dec 25, 2013
    Posts:
    367
    That's great.

    However one problem that I'm having right now is that ... my sectors are not getting splitted.

    I have a gameobject that's like this:


    I can just select the Interior and do a ALT+SHIFT+S to create a sector.
    Then do the same with the exterior?

    Because I did it like this and I see this:


    But the chunks are not yet created. (I pressed Export All Sectors) It said that I have to do a BUILD. I did a build only with this scene... but I had the same problem. What am I doing wrong?
    This was because my GameObjects were not Static.

    Sorry for all this questions. I did this on a small scene which mimic the one you had in the demo videos, but here is more complex and confusing for me.

    Good thing is that once I get used to this I plan to make some tutorials later. :D
     
    Last edited: Jul 27, 2016
  7. MakeCodeNow

    MakeCodeNow

    Joined:
    Feb 14, 2014
    Posts:
    1,246
    You need to press export all sectors. That will make the chunks.
     
  8. GamerPET

    GamerPET

    Joined:
    Dec 25, 2013
    Posts:
    367
    Yea I did but it was not working... turns out that I need to have everything on Static. Now I exported the chunks!

    Ok I'm making some progress. When I initialize my level I added a "Load Sector" exterior. I also added a Camera Fade In because you could see the terrain pop in. Still have to thinker with this because it adds a couple of small problems.

    However. When I'm in my "airlock" I'm doing this:


    The Interior get's loaded (YAY!), however the Exterior does not get unloaded.

    It's a bit weird because the Loading of the interior happens much sooner than the state it should have been:


    My Interior chunk loads when the "Close Blast Door" happens but it should actually load on the "Start Laser Scan" state.
     
    Last edited: Jul 27, 2016
  9. MakeCodeNow

    MakeCodeNow

    Joined:
    Feb 14, 2014
    Posts:
    1,246
    In SECTR, loading and unloading is reference counted. If you call Load twice, you have to call Unload twice before the unload actually happens. I suspect somehow you are loading a chunk twice but only unloading once.

    I'm not sure about the bug in the timing of the load in Close Blast Door vs Start Laser Scan. Most likely that is a bug in your PlayMaker logic, not SECTR.
     
  10. GamerPET

    GamerPET

    Joined:
    Dec 25, 2013
    Posts:
    367
    Weird. I just placed 2 "unloadings" and now the Exterior unloads. I'm only calling Loading (exterior) once at the start of the game so my terrain will load.

    About the second part... not sure what's happening. I will post on the PlayMaker forums. Usually actions from other states should not happen when not in that state.

    Thank you for your answers. This is pretty cool actually :)

    EDIT: Oh nice. You have a Start Loader that has a fade in. I have a weird problem however that... when I start the game I'm instantly setting the "Scale Time" to 0 so basically the fade in does not happen. Need to find a solution.

    EDIT2: One more question. I have a TV (mesh) that has a screen (mesh). On that screen I'm projecting a video. The reference of the video is in the Main Scene. The TV is in a chunk. When I split the scene into chunks, that TV & Screen go into that new chunk and so, the link to the video is broken. I tried to un-check the Static on the screen mesh, but the screen still went to the new Chunk. Is there a way to stop game objects of being send to the chunk, and still be kept into the main scene, even if they are party of that Sector?
     
    Last edited: Jul 28, 2016
  11. GamerPET

    GamerPET

    Joined:
    Dec 25, 2013
    Posts:
    367
    Hey there,

    I'm here with an update :)

    The Quickstart Guide says to add a Sectr_Neighbor Loader to the "Player"... which is what I blindly did. In a way I even forgot about it.

    This was the reason why my "interior" was loading "on a different state". It was loading because my player was walking into the Interior Sector. Also, ... I was manually loading the exterior on startup which seemed fine, but at the same time I had to use 2 Unloaders ... because I was loading it myself ... when in reality the exterior was loaded anyway because of the Neighbor on the player.

    This is how I'm doing it now.

    - The Player only has a SECTR_Member (not sure if totally necessary)
    - I load the Exterior on Level Startup
    - I manually load the Interior ...
    - .. and at the same time I unload the exterior

    This seems to work fine. What thing that I used for a couple of good tries was "SECTR_Start Loader" on the Exterior Sector... which actually confused me because I was thinking that the Exterior get's loaded because of this. It stopped loading when I removed the Neighbor Loader from the Player.

    ---------------------

    Another thing that I have to do now because basically I'm working on multiple scenes is...
    Normally I have a Playmaker FSM that was looking for a GameObject by name ... then I was looking at the childs of that GameObject and that information I was placing it into variables. The GameObject itself had no FSM, everything was done from one place. But since my object is not going to be part of the main scene anymore, the FMS will search for my object but of course, it could not find it. So right now I moved this "Initialization" process on the object itself and the object itself it placing himself on a global variable that is going to be used by the main FSM.

    ----------------------

    Also a programmer made me a script that Fades In/Out an Image UI, that way I don't see the terrain pop-in after 0.5 seconds. So I created a Canvas with a Huge black Image UI. Then this script has a DELAY ... and only after that DELAY has passed he is starting the fade in/out. It's pretty cool. Basically my level loads and you see a black screen for 1 second, and only after that I have a Fade In for 2 seconds.

    I hope that my post was useful for someone :)
     
  12. MakeCodeNow

    MakeCodeNow

    Joined:
    Feb 14, 2014
    Posts:
    1,246
    That all seems very reasonable. If you are doing your own loading logic you don't want to use a built in loader.

    And yeah, object references get tricker when streaming is involved.

    A fade is a reasonable way to hide the load. If you always have airlocks you can do a loading door ala deadspace or Metroid prime.
     
  13. 99thmonkey

    99thmonkey

    Joined:
    Aug 10, 2012
    Posts:
    521
    Is the Complete package ready for Unity 5.4?
     
  14. MakeCodeNow

    MakeCodeNow

    Joined:
    Feb 14, 2014
    Posts:
    1,246
    Right now there are 2-3 harmless warnings if you use it in 5.4 but otherwise everything seems to be working just fine.
     
    99thmonkey likes this.
  15. bome99

    bome99

    Joined:
    Sep 14, 2009
    Posts:
    105
    Is this one of them?

    Is using 5.4 and haven't seen this before.

    ArgumentException: An element with the same key already exists in the dictionary.
    System.Collections.Generic.Dictionary`2[UnityEngine.Transform,SECTR_Member].Add (UnityEngine.Transform key, .SECTR_Member value) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Collections.Generic/Dictionary.cs:404)
    SECTR_Member.OnEnable () (at Assets/SECTR/Code/Core/Scripts/SECTR_Member.cs:470)
    SECTR_Sector.OnEnable () (at Assets/SECTR/Code/Core/Scripts/SECTR_Sector.cs:278)
    UnityEditor.SceneManagement.EditorSceneManager:OpenScene(String, OpenSceneMode)
    SECTR_StreamExport:ImportFromChunk(SECTR_Sector) (at Assets/SECTR/Code/Stream/Editor/SECTR_StreamExport.cs:60)
    SECTR_StreamExport:ImportSceneChunks() (at Assets/SECTR/Code/Stream/Editor/SECTR_StreamExport.cs:718)
    SECTR_StreamExport:ImportSceneChunksUI() (at Assets/SECTR/Code/Stream/Editor/SECTR_StreamExport.cs:704)
    SECTR_StreamWindow:OnGUI() (at Assets/SECTR/Code/Stream/Editor/SECTR_StreamWindow.cs:144)
    UnityEditor.DockArea:OnGUI()
     
  16. MakeCodeNow

    MakeCodeNow

    Joined:
    Feb 14, 2014
    Posts:
    1,246
    Hi. That's a runtime error and probably not 5.4 specific. I'm on vacation this week but will check it out next week. If you get a repro please share it here.
     
  17. bome99

    bome99

    Joined:
    Sep 14, 2009
    Posts:
    105
    Found the issue, one of my chunks had two SECTR members, don't know how that happen.
     
  18. GamerPET

    GamerPET

    Joined:
    Dec 25, 2013
    Posts:
    367
    Hello MakeCodeNow!

    I hope you are having a good vacation!



    We are currently having something like this. It's pretty strange. I was thinking on using Sectr VIS. Right now I only use Sectr Stream which works great. I can really see the Batches, Tris & Memory going down when I unload the exterior and load the interior.

    I read the QuickSTart for the VIS some time ago and it kept saying that you need "portals". The problem is that we don't use portals. How critical is this? Will Sectr VIS be useful for us?

    Thanks
     
  19. MakeCodeNow

    MakeCodeNow

    Joined:
    Feb 14, 2014
    Posts:
    1,246
    Glad you got it fixed :)
     
  20. MakeCodeNow

    MakeCodeNow

    Joined:
    Feb 14, 2014
    Posts:
    1,246
    It's hard to say whether SECTR Vis will help you. If your interior is complex enough (e.g. lots of rooms) VIS can help a lot. Outdoors, you need to rely more on things like LODs and distance culling. You should probably also disable shadow casting on some of your objects or make them static. Even though your scene is running > 60 fps, ~1700 shadow casters is a lot!
     
  21. GamerPET

    GamerPET

    Joined:
    Dec 25, 2013
    Posts:
    367
    Thanks for the tip. Outdoors is only a small part of the "demo". Something like 20 seconds where you walk in a straight line. You don't see to much stuff. The interior will be a huge circular room that will have different rooms in those circular places... so you don't see parts of the interior so I'm thinking on even splitting the interior even into more parts. Dunno yet.

    But the tip with the Shadows is good. Some stuff are so obvious that you forget about them :D In my case there is no need to have shadows on some objects because you will not see that shadow anyway because you don't go there.
     
  22. v2-Ton-Studios

    v2-Ton-Studios

    Joined:
    Jul 18, 2012
    Posts:
    181
    Was sitting down to build a streaming world system (going for the big endless level experience of Limbo) for my upcoming 2D game, and bam you guys seem to have already done it. Super excited! A few questions before I get ahead of myself :).

    1, Reading back through this thread, way back (2014!) you mention "SECTR STREAM will also work for 2D, but you'd have to set of the Sectors with a bit of care...". Can you talk a bit more about what you mean by "set the Sectors with a bit of care"? Is this just to ensure things like the ground aligning or is it something more nuanced.

    2, After I export my chunks what is produced, a set of scenes?

    2b, Assuming they are scenes, can you talk a bit about the scene editing / update workflow? For instance, can I edit / update these scenes separately as I would traditional Unity scenes? Will edits push back to the whole e.g. I want to update the placement of enemies but just for one chunk? Would there be any trouble having people people on my team work on separate scenes?

    3, Are entities originally placed in a chunk forever confined to that chunk? Can an enemy move between chunks after getting "paged in"? For instance, if I run away from said enemy such that its scene is unloaded, does it get unloaded as well or will it automatically get reparented into the "active" chunk?

    I'm sure I'll have other questions, but that's it for now.

    Huge thanks in advance!
     
    Last edited: Sep 8, 2016
  23. MakeCodeNow

    MakeCodeNow

    Joined:
    Feb 14, 2014
    Posts:
    1,246
    Lots of very good questions. answers below...

    1) I basically mean alignment and possibly forcing a minimum amount of Z thickness (depending on how you set things up).

    2) Yes, a set of scenes and components in the master scene that reference those sub-scenes.

    2b) SECTR STREAM has custom UI that lets you export and re-import Sectors. You can edit one at a time, all at once, just a few, whatever. And yes, you can use it as a kind of multi-user workflow tool, which is what the Campo Santo team did for Firewatch.

    3) For streaming, entities are parented to a chunk and are destroyed along with it. You can unparent them from the chunk to prevent them from being destroyed along with it if you want that behavior.

    Hope that helps!
     
  24. v2-Ton-Studios

    v2-Ton-Studios

    Joined:
    Jul 18, 2012
    Posts:
    181
    Thanks for the speedy reply, very helpful.

    A few followups...

    re 1) "forcing a minimum amount of Z thickness" can you expand on that a bit? My game is 2D, in that all the characters and assets are planar, but it uses several 3D (perspective rather than ortho) cameras for the actually rendering. Z position is important for creating that feeling of depth as seen in atmospheric games like Limbo or Ori.

    - What specific limitations would I have to be aware of regarding use of Z?

    - Where can I read more about these constraints?

    - In your opinion, is a Limbo / Ori style presentation a good fit for SECTR?

    re 3) where can I read up on how to do that? Is there an API doc or even better a tutorial for that kind of stuff? Perhaps I just ping you here?

    A few new questions...

    - How should I handle larger background pieces of geometry like a mountain range that span multiple chunks? Should I break that up into separate pieces each owned by a chunk or keep them as a global piece?

    - On a similar line of thot, how should I handle world light sources, like the sun or moon, would I just have those as "unchunked" objects that are working against the active chunks? Is there a "correct" way to handle that kind of thing?

    Again, big thanks in advance!
     
  25. MakeCodeNow

    MakeCodeNow

    Joined:
    Feb 14, 2014
    Posts:
    1,246
    I think we're getting into the "easier just to try it" territory. If you would like an eval copy, please email support@makecodenow.com.

    In general, the you just need to make sure that the Sectors are thick enough to intersect the Members (the objects that move through the world).

    You could definitely do a Limbo/Ori style game with sECTR.

    For backgrounds, you can have it all in the global scene or in larger "zone" sectors.

    Global light sources probably should be in the master scene.
     
  26. v2-Ton-Studios

    v2-Ton-Studios

    Joined:
    Jul 18, 2012
    Posts:
    181
    I think you're right. Email on the way. Thanks for the replies!
     
  27. Wikzo-DK

    Wikzo-DK

    Joined:
    Sep 6, 2012
    Posts:
    67
    Can you explain the differences between STREAM and VIS and when/why you would use one instead of the other?
     
  28. MakeCodeNow

    MakeCodeNow

    Joined:
    Feb 14, 2014
    Posts:
    1,246
    Streaming is about loading and unloading entire chunks of the world at a time. It saves memory, CPU, and GPU by making entire chunks of the world not exist, but it requires pretty careful level design. Culling takes the world that is there and tries to avoid rendering large chunks of it. It does not save any memory, and when done correctly saves CPU and GPU but may actually be CPU neutral or even CPU negative if used incorrectly.
     
  29. GamerPET

    GamerPET

    Joined:
    Dec 25, 2013
    Posts:
    367
    Hey man,

    I'm in my final steps of this project and I have a problem with the lighting.

    With all scenes combined it looks like this:


    When I split up the scenes, it looks like this:


    Any ideas what is wrong?

    Thank You

    EDIT:
    Also, I have a place where I'm unloading/loading a scene. I have separated the unloading & loading to different scenes, yet I still have a 0.5 seconds drop to 1fps when I load my interior. Is there any way to avoid this? I'm not in a rush to load everything super fast... so I want to avoid this drop.
     
    Last edited: Sep 28, 2016
  30. MakeCodeNow

    MakeCodeNow

    Joined:
    Feb 14, 2014
    Posts:
    1,246
    Are you using baked lighting? If so can't bake and then export. You need to export and then bake using the SECTR stream window.

    Regarding the hitch, what kind of loader component are you using? And is this in editor or a proper build?

    You can try to remove the call to unload all resources in SECTR_Chunk.cs to see if that helps.
     
  31. GamerPET

    GamerPET

    Joined:
    Dec 25, 2013
    Posts:
    367
    Hello MCN,

    Yea we use some kind of baked lighting to. I normally... import everything into the main scene, BAKE, then export. I thought that's what you supposed to do it... from what I read in the manual.

    I'm Loading the level using a playmaker action. This happens in the build... but also sometimes in the editor.

    At frist I was doing the export/import on the same frame but now I spaced them out a bit.

    Is there a way to add the loading ... like over X number of seconds?
     
  32. MakeCodeNow

    MakeCodeNow

    Joined:
    Feb 14, 2014
    Posts:
    1,246
    I'm sorry for the confusion on baking. The instructions for > unity 5.2 are different than <= 5.2. Assuming you as using a new unity you need to export everything then use the light baking button in the SECTR stream window.

    Regarding the loading, are you using a SECTR load command or a regular playmaker load level command? The SECTR one shouldn't hitch at all. If it is hitching, try removing the call to unload unused resources I mentioned above.
     
  33. GamerPET

    GamerPET

    Joined:
    Dec 25, 2013
    Posts:
    367
    I'm on Unity 5.4. So I export into chunks, then on the Stream window ... I press the lightmap button from below?


    I'm using the normal playmaker action that you created.
     
  34. MakeCodeNow

    MakeCodeNow

    Joined:
    Feb 14, 2014
    Posts:
    1,246
    You're correct on the lightmapping process for newer versions of Unity.

    If you are still seeing stalls at runtime after you rebake the lighting you'll need to use the profiler to see what is causing the stall. Most likely you have some scripts that do a lot of work in Start/Enable/Awake, but feel free to post a shot of the profiler here with the spikey frame selected and we'll go from there.
     
    GamerPET likes this.
  35. Alex3333

    Alex3333

    Joined:
    Dec 29, 2014
    Posts:
    332
    I have cut the map 6 *6 pieces 2048*2048. You can make sectors as well 6*6 2048*2048. But for me it's biggest sectors. I need to make a 24*24 sectors of 512*512. how to do it? If to do every piece of card separately , then between 2 adjacent pieces are not created portals. how to be?
     
    Last edited: Oct 20, 2016
  36. MakeCodeNow

    MakeCodeNow

    Joined:
    Feb 14, 2014
    Posts:
    1,246
    Hi. I just replied to you via email, but this should "just work"
     
  37. zornor90

    zornor90

    Joined:
    Sep 16, 2015
    Posts:
    163
    Hey, hope that you're doing well! I am interested in using SECTR VIS for my project but had some questions.

    My project consists only of one scene. All rooms are created and stored as prefabs during design time, and then streamed in and placed during runtime. I have watched your videos and read some documentation, and am curious if this would still work, or if I'd have to build each room into a scene.



    Each map is randomized, but the rooms themselves are the same - just rotated so that their exits are connected to the maze. I already have a system to ensure that each exit has one and only one door, so theoretically i could ensure that portals exist between each room. I just wanted to run it by you to ensure that this would work. As I am using deferred lighting the number of active lights and shadow casters is insane, and I'd love to be able to cut down on this for lower-end hardware.

    Thanks!
     
  38. MakeCodeNow

    MakeCodeNow

    Joined:
    Feb 14, 2014
    Posts:
    1,246
    Looks very cool. SECTR VIS should work perfectly for you. You basically just need to add a SECTR_Sector component to each of your rooms and then create a SECTR_Portal at each doorway and hook up the Portal to the Sectors on either side. Then you add a SECTR_CullingCamera component to your main camera and you'll have dynamic occlusion culling.
     
  39. zornor90

    zornor90

    Joined:
    Sep 16, 2015
    Posts:
    163
    Awesome! Looking forward to seeing how it works. I'm assuming that I can get it set up with SECTR CORE and then once I purchase VIS just add the camera then?
     
  40. MakeCodeNow

    MakeCodeNow

    Joined:
    Feb 14, 2014
    Posts:
    1,246
    That's right.
     
  41. AltaVR

    AltaVR

    Joined:
    Oct 16, 2013
    Posts:
    8
    @MakeCodeNow
    I've just bought the SECTR complete package and it works like a charm, but I'd like to know if you can imagine any way that I can use the tool to stream a procedurally generated map.

    Thank you in advance
     
  42. SureSight

    SureSight

    Joined:
    Aug 2, 2013
    Posts:
    61
    I'm having an issue with SECTR Complete 1.3.0 in unity 5.4 where SECTR Stream does not appear to stream the terrain tiles.
    All tiles remain active all the time regardless of the camera's positions

    Steps:
    1. Split terrain into chunks
    2. Added SECTR_RegionLoader to camera
    3. Added SECTR_Member to camera

    It's not just my scene. I tried loading the SECTR Strem demo scenes and they don't work either.
    All suggestions welcome.
     
  43. MakeCodeNow

    MakeCodeNow

    Joined:
    Feb 14, 2014
    Posts:
    1,246
    Unity makes streaming procedural worlds pretty difficult. If your world is build out of a set of prebuilt rooms then you can use SECTR STREAM to export each room as a "sector" with recentering enabled. You then place those "sectors" during procedural map generation and then load and unload them as usual. There are plenty of edge cases, especially with baked lighting, so the path is not for the faint of heart.
     
  44. MakeCodeNow

    MakeCodeNow

    Joined:
    Feb 14, 2014
    Posts:
    1,246
    Which version of 5.4 are you using? I'm not able to repro with 5.4.0 demo scenes. For example, opening Demos/Stream/Open world, exporting or streaming, and running "just works".
     
  45. Cereal_Killa

    Cereal_Killa

    Joined:
    Oct 20, 2013
    Posts:
    204
    I'm also doing something similar - procedurally generating a level by combining existing prefabs. It's easy enough to define rooms for each prefab and put portals at every exit but how do I link these portals together in code at runtime?

    Also, are sound effects pooled or created and destroyed?
     
  46. MakeCodeNow

    MakeCodeNow

    Joined:
    Feb 14, 2014
    Posts:
    1,246
    You basically just put a sector component on each room and then set the front and back sector properties on the portal at runtime. Easy!
     
  47. Cereal_Killa

    Cereal_Killa

    Joined:
    Oct 20, 2013
    Posts:
    204
    Thanks!
    I was advised against using sectr on another thread but this seems simple enough to get working.
     
  48. 99thmonkey

    99thmonkey

    Joined:
    Aug 10, 2012
    Posts:
    521
    For the Audio part, is it set up to work fine over networking (i.e. multiplayer)?
     
  49. MakeCodeNow

    MakeCodeNow

    Joined:
    Feb 14, 2014
    Posts:
    1,246
    Why were you advised not to use SECTR? I'm always interested in addressing issues.
     
    hopeful likes this.
  50. MakeCodeNow

    MakeCodeNow

    Joined:
    Feb 14, 2014
    Posts:
    1,246
    There's nothing multiplayer specific about SECTR. It should be compatible with most multiplayer solutions but doesn't have built in networking.