In today's blog post we will talk about one of the game features you will encounter on the maps: Portals. Similar to the ones from the game with the same name, in Classified Stories, a portal is a magical doorway that connects two locations.
Visually, the effect is awesome and if you enhance it with some eye candies (like particles) you obtain quite great results.
Here is a preview on how a portal works and looks in Classified Stories:
*For this demonstration we removed any other particles
As you can see, the player enters the small garden shed only to smoothly teleport himself to another building, the main farm house.
How did we achieve this effect?
First, here is a screenshot of how the garden shed (location A) actually looks like. A small room, where you can barely move:
And here is the farm house main hall (location B).
In order to trick the player, we added a 2D plane right before the entrance. To draw what player sees, we render the world from the second camera perspective, then render a depth/stencil mask in the location of the portal (the white rectangle):
Basically, we take a screenshot of the second camera POV and we draw it on the white plane. Each frame. :)
Besides that, we have a simple script which is used on the camera to control it. When player rotates or moves, we also rotate or move the 2nd camera.
The last part is the player's teleportation. This is simple. When player collides with the white plane, we move him to the second location. You can see that door frame from the previous picture. In the full game, the frame is not rendered but we use it to store the new player's position.
Wishlist on Steam:
And follow us on: