How do I hide adjacent rooms in a top-down view game?

HI everyone,

I guess my questions is more of a game development/game design question than UE4 specific, but after researching it for some time I found no answers (maybe I’m using wrong terminology).

I’m currently working on building a prototype based off of the top down template, and have decided to extend it with additional rooms. I wanted to find out what would be the best way to prevent the player from seeing what is in those rooms (or only show a small fogged fraction of what is in the room) until they are in the room. Just wondering if there are some best practices on how to do this or what is the exact terminology so I could look further into the topic.

Just off the top off my head I was looking at the location based material opacity which i could use to maybe cover the level and drive the location through the player actor location and use that to only show a certain area of the map that the player is at. But this kind of prevents me from having the player only see the room that they are in at the moment (I mean it’s possible but might seriously limit the room shape design creativity :smiley: ). Is there some other way of doing this?

Thanks in advance.

I have a clever trick to achieving this effect that you may be able to employ depending on your camera angles and level design. Try placing black walls extending upwards from the tops of the normal rendered walls, which have the interesting effect of obscuring everything that wouldn’t be in line of sight to the player, when viewed from a top down perspective. The effect makes for a very effective ‘dynamic’ line of sight mechanic without any real rendering expense, since a pure-black unlit material costs very little to use.and the same walls can be used effectively for occlusion culling.

Difficulties arise if your camera angle has a lower angle of incidence, or you want to stack a lot of floors on top of one another. This comes down to your design, and if so, you’ll either want to solve these problems or look for another technique to employ :slight_smile:

Hi mzmiric5,

I believe what you are looking for is called Level Streaming. It’s a volume that if the player is overlapping with then a specific section of the level is loaded. When the player is not overlapping the volume the level is unloaded. Level Streaming volumes can even overlap one-another to allow for better transitioning.

Another option could be to use Fog of War. This effect give the player a line of sight, but it’s more taxing because you are essentially masking out what you don’t want to see instead of unloading it.

I hope that gives you some ideas.

Thanks, TJ

Thanks a lot TJ, these are all very helpful. I was thinking about Level Streaming, and this actually seems to work just fine for the story mode of the game where the levels are designed by hand and we can set up the streaming on them. But the game has an additional random mode in which the levels are randomly procedurally generated during runtime, and I’m not really sure that level streaming would work here. Also Since the rooms could potentially be shaped in non regular shapes, the streaming volumes might be hard to fit in with these.

As for the fog of war, as you say it might be taxing, but also probably not the effect that I’m trying to accomplish here.

Maybe this might help a bit though. I remembered that I while ago I saw a post on the UDK forums by Solid Snake who did something similar. On the image below you can see the effect hat I’m trying to accomplish:

Reading Solid Snake’s post, he states he accomplished this by creating back facing walls so you can’t see into the room from the outside, but I’m not really sure what he means by that. If anyone could explain what this actually means and how it’s done, I would really appreciate it.

Thanks again :slight_smile:

Thanks ambershee, this is a cool trick, and it looks good while the player is not moving, but when going from room to room, it’s quite visible that the camera goes through the wall and it just doesn’t look good. I guess it’s due to my setup but I’m not sure it would be viable for what I’m doing anyways