SOL – Invictus

Unity | C# | 8 weeks | Group Project (6)

Project Description

SOL – Invictus is a game for mobile which was developed during a course in university. It is a tower defence strategy game where you can place out different kinds of turrets or more farms, on the grid system, and during the night you have to stand your ground against monsters.


My focus points

Camera Movement

Building a camera movement script which feels smooth when used on a mobile phone and that will not interrupt turret placement or moving.

Json save files

Saving the whole game level and the players progress in json files that autosaves to bring a smooth experience for the player on mobile.


Camera Movement
Goal

My goal for this project was to create a smooth experience for the player. This meant that I wanted to create a camera movement system that the player would be able to use with ease. This meant that I had to make sure it would not interrupt other types of inputs and make sure it feels natural for the player to use.

Solution

To be able to create a smooth experience for the player I started with creating a code where the player could move around by pressing down on the screen and then move in the preferred direction. The issue I stumbled upon was that it interfered with placing out towers on the grid. The decision I made here was that the camera would move around if the player pressed down with two fingers on the screen which would work out with a zoom in and out feature as well. The camera was also restricted to the background and not go beyond it, and these restrictions were to change if and would adapt if the background were to change.

Iterations for the future

The solution with the camera movement was to save time since it was a rather short project. The implementation of using two fingers to move around the camera does not feel natural for the player. Instead what could be done is doing a raycast to see if the player has selected a tower and if they have the camera movement script will not play.


Json save files
Goal

The goal for this was to make sure that the saving is hidden for the player. This since most of mobile application players do not pause to save the game before they close it so it was highly relevant to implement this.

Solution

I created a SaveGame method were it gathered all variables necessary to save and converted it as text in Json files. I also made a LoadGame method where it went through all the text and set all necessary variables. One issue with this was that the towers did not load the towers correct if you loaded it through the main menu which could be solved by only running the LoadGame method once the whole scene had loaded in. Since this game was developed for mobile it was also important for me to use the .persistentDataPath to make sure that the game would save every single time.

Iterations for the future

This was the first larger project I’ve been working on so the script that it currently uses is very excessive and it could be shortened down. This could easily be done by putting all the objects in an array and go through them doing different things depending on what the object is.

You can look at the SOL – Invictus by going to github.