Runes of Kalevala – Splitting the screen

Runes of Kalevala is a game that I have been working on together with the rest of Tasteful Games:  Filip FrandsenAnders HagströmThom Hujanen, Sebastian RingvolTara Sundström and Erik Ögren.

It is a 2D game made in Unity with a focus on cooperative gameplay with action, platforming and exploration. For the vertical slice we are developing the Big Game course we have decided to focus on making the game for two players to be played at once. To allow the players explore the game world in their own pace we had to implement a split screen functionality. We decided to go with a dynamic split screen that helps the players find where they are in relation to each other.

Bild1

When the two players are close to each other, there is only one camera active that has its position determined by the position of the player characters.

Bild2

After Player 1 (White) has moved a bit away from Player 2 (Red) the camera “splits”.

bild3

Another example of the split screen.

Creating this split screen feature has for this game has been quite a challenge since there is no built in feature for it and simply searching for dynamic split screens only took me to some premade assets that had the functionality that I needed.  It took some researching but I finally found a helpful video on YouTube that help explaining masking in Unity that I used to achieve the effect desired.

Now that I had a way I could mask part of the screen from one of the cameras all that was left was manipulating an object with the masking material so that it could rotate around a point relative to the position of the players, which took some finagling but was finally achieved by creating a reference point that the object was bound to, rotated to face the other player then rotated to face the camera. I then added two canvases in Unity, one for each screen and then on each canvas made an UI element that was a line that I scripted to line up with the camera seam. Two canvases were needed as the cameras would only draw part of the line since they were too far apart to see the canvas that was following one camera.

About Anton Classon

2014  Programming