Greetings contractors!

We’ve been making great strides towards making Project Black Binder these last several weeks. One of the things I was tasked with was to create a dynamic line of sight system for players to be able to see what their characters see.

This has been a problem that nearly all isometric action RPGs have had to tackle in the past, and our game is no different in that respect. Since our camera is static, the player can very easily position themselves in a way that puts obstacles between them and the camera. The solution that was proposed by Kris, however, was a very unique one that I haven’t actually seen implemented in games before.

He came up with the idea of masking off meshes in realtime based on what is actually visible to the player. This means the first problem we had to solve was to be able to raycast in a 360-degree circle to detect obstacles in realtime. We found a plugin on the UE4 asset store that does just that. It raycasts around the player and uses the collision data to create a procedural mesh on the fly.

Raycast-Line-Of-Sight

The next issue we had to confront was how to use our procedural mesh to create the effect we were going for. I opted to use a scene capture component to render just the procedural mesh to a texture, and then go through in materials and overlay that texture on the screen.

This method worked quite well, but I immediately noted a few key issues. While we were in fact masking off meshes the player was to go up against a wall in between two buildings, for example, the building behind would block the top of the player. The easiest solution for this was to add the ability to render the character to the masking texture. Doing this ensured the player would always have a player shaped hole cut out for them.

Blocked-Player
Unblocked-Player

Additionally, since we were using the alpha channel of the texture as the mask, we couldn’t have antialiasing on the texture. The only options available to us that render the texture in final color, where the post-processing and other image-enhancing effects are applied, do not have alpha channels. They are RGB only. I will be experimenting with other solutions for this later on. For now, the easiest solution was to just upscale the masking texture.

Of course, when you’re rendering every frame to a texture twice the size of the screen resolution, it tends to be a bit performance hungry. Before I upscaled we were adding 1.6ms to each draw call and now we’re adding even more than that. It’s not exactly the performant game-ready solution I was hoping for. It is still something that I thought was neat enough to share with you all and I certainly look forward to perfecting it in the future.

There is a lot of things going on in parallel for the development of the game right now, and we will no doubt have many big announcements coming up for other features very soon. Be sure to check back from time to time to get the latest news on Project Black Binder development. In the meantime, I will leave you with this video showing off the newest effect in action.

-Kenny W.