Announcement

Collapse
No announcement yet.

Load Level Instance ~ Create Multiple Transformed Instances of the Same Level, not in levels list!

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Load Level Instance ~ Create Multiple Transformed Instances of the Same Level, not in levels list!

    Dear Community,

    I've just put in a new PR that I think many of you would enjoy!

    ULevelStreamingKismet::Load Level Instance
    https://github.com/EpicGames/UnrealEngine/pull/2320

    This node / C++ function allows you to easily create multiple instances of the same .umap within your main level, without having to add the levels to the persistent maps level's list!

    This is ideal for dynamic world generation composed of "tiles" of existing .umaps.

    I could have made this into a plugin to sell on marketplace but I decided it was too important to not give to the whole world as part of the engine

    https://github.com/EpicGames/UnrealEngine/pull/2320

    Here's some pics!

    Click image for larger version

Name:	LoadLevelInstance.jpg
Views:	4
Size:	151.4 KB
ID:	1180997

    Click image for larger version

Name:	LoadLevelInstance2.jpg
Views:	4
Size:	136.2 KB
ID:	1180998

    Click image for larger version

Name:	LoadLevelInstance3.jpg
Views:	4
Size:	292.6 KB
ID:	1180999
    100+ UE4 C++ Tutorials on the UE4 Code Wiki, including UE4 Multi-Threading!

    UE4 Marketplace: Melee Weapon Plugin & Compressed Binary Save System Plugin | Rama's C++ AI Jumping Videos | Vertex Snap Editor Plugin

    Visit www.ue4code.com to see lots of videos about my C++ Creations! ♥ Rama

    #2
    How to Ensure Maps Get Packaged With Your Game

    Updated here:

    https://github.com/EpicGames/UnrealE...ment-214616122

    ~~~

    Wiki on Adding Additional UAssets or Custom Files to Your Packaged Build

    I have a wiki on adding non-uasset or uasset/umap files to your cooked build here:
    https://wiki.unrealengine.com/How_To...With_Your_Game

    ~~~

    For anyone needing help ensuring that umaps package with their game (for any reason) here are two methods you can use!

    Manually specify maps to include in packaged game
    Click image for larger version

Name:	AdditonalMaps.jpg
Views:	2
Size:	220.6 KB
ID:	1105944

    ~~~


    You can also add an entire folder of UE4 assets/umaps if you want to!

    Use "Additional Assets to Cook" for .umaps!

    Click image for larger version

Name:	AdditionalPackgeDir.jpg
Views:	2
Size:	116.2 KB
ID:	1105945
    Last edited by Rama; 05-04-2016, 09:12 PM.
    100+ UE4 C++ Tutorials on the UE4 Code Wiki, including UE4 Multi-Threading!

    UE4 Marketplace: Melee Weapon Plugin & Compressed Binary Save System Plugin | Rama's C++ AI Jumping Videos | Vertex Snap Editor Plugin

    Visit www.ue4code.com to see lots of videos about my C++ Creations! ♥ Rama

    Comment


      #3
      You are the best! <3

      Comment


        #4
        This is simply a great feature must be added to the engine! Especially because runtime landscape deformation is not provided by Epic, it gives an opportunity to create random maps from pieces.
        Hopefully it would be an essential part of my WIP game...
        "Age of Total Heroes" - RTS Pathfinding and Movement System for UE4
        RTS Camera C++ Tutorial

        Comment


          #5
          Hi , I need to know how light affects to this when is instanced if light is Static and meshes are static for example

          Comment


            #6
            Is it a convenience node or does it add functionality?
            i.e. is there any benefit to this approach other than not needing to drag the levels to the Levels list?

            Tried it with 4.13, but am getting a terrible performance using the node.
            With "Get Streaming Level" + "Create Instance" my test setup runs at 120fps/8ms,
            whereas when I replace it with the new "Load Level Instance" node, it dropps to 5fps/200ms.
            Any ideas what could be causing this?


            Edit: performance drop was due to me not providing the directory of the level, just the name (it still did find the level). Works fine now.
            Last edited by Cpt.Trips; 09-03-2016, 11:21 AM.
            [Marketplace] Loading Screen System (ᴘʀᴏᴘᴇʀ ʟᴏᴀᴅɪɴɢ sᴄʀᴇᴇɴs, ɴᴏᴡ ᴡɪᴛʜ ᴘʀᴏɢʀᴇss ʙᴀʀs)
            [Free][Script] Automate Download of Mixamo Animations
            [VłĐɆØ] Performance: BP vs C++ vs Blueprint Nativization

            Comment


              #7
              Congrats on getting this implemented Rama.

              Is there any way to remove the instances once you've spawned them?

              I see Unload Stream Level doesn't appear to do the job and I can't find any relevant functions.

              Thanks.

              Comment


                #8
                Originally posted by sivan View Post
                This is simply a great feature must be added to the engine! Especially because runtime landscape deformation is not provided by Epic, it gives an opportunity to create random maps from pieces.
                Hopefully it would be an essential part of my WIP game...
                Landscape shader deformation is now fast enough to use actually, although that doesn't give you a collision solution and it only applies to nearby tiles.

                Comment


                  #9
                  This is a pretty great feature, and I'm very excited to play around with it. That being said, it seems that the node is only callable from the Level Blueprint. The LoadLevelInstance function is not callable from C++ because ULevelStreamingKismet is MinimalAPI and the function was not marked for export. I'm not familiar with how Level Streaming works under the hood, but could it be possible to call this function elsewhere other than the level blueprint?

                  Comment


                    #10
                    Yeah, how DO you remove these instances? All I can do is Hide 'em?

                    Comment


                      #11
                      Like ALWAYS, when I post a question to the Forums or the Answer hub, I figured out the solution immediately after posting:
                      There are a couple Boolean Variables associated with the Loaded Map Instance, one is Should Be Loaded, setting this to false seems to unload the level. I'm not sure if it actually does, because I can set the Boolean back to True and the level reappears. My test levels are pretty small so I can't really tell if it's unloading everything correctly.

                      Comment


                        #12
                        Has anybody implemented this without huge fps spikes?

                        Comment


                          #13
                          Originally posted by MatzeOGH View Post
                          Has anybody implemented this without huge fps spikes?
                          If you have big levels you can tweat streaming values in Project Settings -> Streaming -> Level Streaming
                          Realtime Database Firebase | Ultimate Mobile Kit Firebase | Extended Facebook | Universal Mobile Ads | Google Analytics

                          Comment


                            #14
                            A static function for unloading would be handy. Something like:

                            void UnloadLevel()
                            {
                            FString LevelName = LevelStreamKismet->GetWorldAssetPackageName();
                            LevelName.RemoveFromStart(FString("/Game/<I keep my levels here>/uedpie_0_"), ESearchCase::IgnoreCase);
                            UGameplayStatics::UnloadStreamLevel(this, *LevelName, LatentInfo);
                            }
                            BP/C++ Programmer
                            Main developer of Ascension Of Heroes. @AscensionOfHeroes

                            Comment


                              #15
                              Hi Rama, thank you for providing this, it's been a very useful function so far.

                              Would you have any advice on how to modify the implementation so that it would take into account the "local" offset of tiled maps that are encompassed in a level that has world composition enabled?

                              WC-enabled level:
                              1. lvl_x0_y0 ---> X: 0, Y: 0
                              2. lvl_x0_y1 ---> X: 0, Y: 1000
                              3. lvl_x1_y0 ---> X: 1000, Y: 0
                              4. lvl_x1_y1 ---> X: 1000, Y: 1000
                              etc.

                              Each of the sub-levels here will have an offset that's stored somewhere by the engine, however your function mandates a location & rotation as parameters. What I'd like to do is have it take the sub-levels, check their offsets in world composition & apply that automatically upon loading. I have come up with workarounds already but feel that a native approach would be more efficient.

                              Any thoughts welcome, and thanks again for making this available in the first place!

                              Regards,
                              David

                              Comment

                              Working...
                              X