I’ve just put in a new PR that I think many of you would enjoy!
ULevelStreamingKismet::Load Level Instance
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
Here’s some pics!
How to Ensure Maps Get Packaged With Your Game
**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:**
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
**You can also add an entire folder of UE4 assets/umaps if you want to!**
Use "**Additional Assets to Cook**" for .umaps!
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…
Hi , I need to know how light affects to this when is instanced if light is Static and meshes are static for example
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.
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.
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.
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?
Yeah, how DO you remove these instances? All I can do is Hide 'em?
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.
Has anybody implemented this without huge fps spikes?
If you have big levels you can tweat streaming values in Project Settings -> Streaming -> Level Streaming
A static function for unloading would be handy. Something like:
FString LevelName = LevelStreamKismet->GetWorldAssetPackageName();
LevelName.RemoveFromStart(FString("/Game/<I keep my levels here>/uedpie_0_"), ESearchCase::IgnoreCase);
UGameplayStatics::UnloadStreamLevel(this, *LevelName, LatentInfo);
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?
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
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!
One wish would be that it were a latent node though
Thank you for this awesome function!
But, can somebody please make another one to unload this levels?
It will be really useful, cause on the moment, there is no simple solution to do unloading.
The function returns “level streaming kismet object reference”.
I think it would be cool to have a way to remove the level by specifying a function on it with this reference.
Thank you for your attention.
P.S. Sorry, for bad English.
You can use UGameplayStatics::UnloadStreamLevel node from this doc:
All you have to do is pass level name. I guess you can use
ULevelStreamingDynamic::GetFName() as level name.
Not sure this is the right place to ask, but does anyone know what information one can get from a level before loading it?
Could you possibly get the bounds somehow?
And this is probably way out of scope, but say if you have an L-shaped level… what would be the strategy to Tetris fit it into what you’ve already loaded?