Portals and Level Streaming

by | Sep 28, 2018 | Blog, Show Off, Unreal Engine 4

That past 6 month gone fast. I have spent a great amount of time learning even more blueprints. My latest effort is a portal, however a portal to another place in the same level would have been easy enough. I want to load another level/dungeon into the portal. I set this up with level streaming. There are some rules that applies when building the main level, and the dungeon though. Look at the result in the video above

Its hard to tell from the picture, but if you look at the portal you can see the dungeons/main level load in and out depending on how far away you are from the portal. What is really happening is that the dungeon is spawning in another place in the level, and you are looking trough the portal I have placed in that level. The portals are placed in the levels that are loaded/streamed in as well, they are not placed in the root level (persistent level, the level that streams all the levels). So you can build an entire dungeon, place portals, and then later type in where the portals are coming from and where they are going. You can also teleport to a portal that has no return point, just a normal teleport. The portal is just not visible.

The rules are simple. Rule 1, the portals cant overlap with each other (the dungeons load into the same place in world, and would be overlapping if they are both loaded at the same time.) Rule 2, the dungeons and the main level should be in different locations. So they as well don’t overlap with each other.

I have not tested this with larger levels, might be some stuttering when loading in the dungeons/levels. I might need to make some changes later, but I do believe it is not going to be any loading time. You can have as many dungeons as you like, and it would be a seamless world which is great.

The blueprint is pretty simple, on overlap actor you you load the level (if the level exists). Then you search up the portal. The reason you need to search for the portal, is because you can not find a reference to the portal when the level is not loaded. I’ve got a variable where I type in the portal name (the one I want to teleport to), and I have also a public variable of the level I want to load/unload (depending on distance from the portal). When the portal is found and the level is loaded. I update the render target and start the tick for the render target. The tick updates the image you are looking at trough the portal.

It is great fun and it opens up a lot of possibilities fast.