In my game I have a big apartment building and you can randomly find keys to apartments and scavenge them. This is a lot of props though, and I haven’t even added everything I want yet. So, it takes a while to load and I get really low FPS. When I turn on wireframe the whole level is visible no matter where I go. My walls are brushes and I have tried switching them to static prop models but nothing seems to block visibility. I tried messing with Precomputed visibility but couldn’t figure out how to get it to work. I didn’t notice any FPS improvement from adding precomputed visibility volumes to the playable area and turning it on the world settings. (I tried messing around with it on a separate level but couldn’t figure it out.)
So, right now I have level streaming. Each apartment is its own level except player apartment which is part of the persistent level. But I am having little trouble with level streaming system.
I would like to:
- Have all the apartment levels NOT be loaded when the game starts
- Have the apartment level load when the front door is unlocked the first time
- Have the apartment visibility turn on and off from a trigger or the level streaming volume (but only after the apartment is unlocked the first time)
- Have all the items in the apartment continue to have collision even when they go invisible
- Have items that are removed from the apartment not go invisible outside it
In the set up in this video I am using the “Always Loaded” streaming method. Meaning the levels are loaded from the beginning and the initial load time is a bit longer. Every apartment door has their own Level Streaming Volume with the “Loading And Visibility” setting. It works fine as for visibility. My FPS is back to normal and everything inside the apartment, including static props, goes invisible when I move away from the level streaming volume. But the problem, like shown in the video, is that everything also stops colliding.
I tried other settings too. If I didn’t set it to “Always Loaded” the level would reset itself if I would walk away from the level streaming volume and then back. Doors would close themselves, closets that spawn items when they are first opened would reset themselves and then respawn the items when I would revisit the apartment (ending up in double items).
The Level Streaming Usage settings are really confusing. Here’s how I understand the names:
- SVB Loading (This would only load the level, but not turn on visibility)
- SVB Loading and Visibility (This will load the level and set visiblity)
- SVB Visiblity Blocking On Load (No idea what this means, though I assumed it would mean it only sets visibility)
- SVB Blocking On Load (No idea what this means)
- SVN Loading Not Visible (No idea how this would be different from SVB Loading)
In a lot of places “Blocking On Load” is just explained with “well, it means if you want to block it on load”.
I tried having the level “Initially Loaded” and then use either “Visibility Blocking On Load” or “Blocking On Load” but the streaming volume seems to override the “Initially Loaded” flag and will unload and load it when I step into the volume. I have no idea how to control just the visibility right now with streaming volumes. Also, if you have the Streaming Method as “Blueprint” then there’s two options “Initially Visible” and “Should be Visible” in the “Level Details” and I am not sure how they would be different.
In my current set up I have removed the Level Streaming Volumes and replaced them with Collision Boxes on the apartment door blueprint. The levels are not initially loaded, rather they are loaded with the “LoadStreamLevel” function when the apartment is unlocked the first time. Then I use the collision box on the apartment door to hide everything inside when the player steps away from it. I haven’t been able to get this work perfectly yet (something about the collision channels I must be doing wrong since it wont register the closets inside the apartment) but my fear is that it wont work perfectly. If something like the window prop was to be touching the collision box wouldn’t it still register as overlapping and hide when the player steps away? Also, since I am using the SetActorHiddenInGame input, it might create some problems. Some of my items might already want to be invisible (if they are for example inside another item). Using SetActorHiddenInGame would make them visible when not wanted when the player would step back inside the trigger.
I would like to use level streaming volumes rather than the collision boxes since it seems rather messy. It would help if I would be able to detect what level each item was originally from so that I could make sure nothing from outside the apartment can never be accidentally set hidden by the blueprint.