# Tower VR

## Info

Project Type: Unreal Engine VR Game

Project Timeframe: 2022

## Video

## Product Overview

A VR tower defence game where the player can fight enemies with their sword, or build towers by drawing patterns on a magic circle.

## Project Overview

The game was made at a 'Hybride Leeromgeving' (Eng: Hybrid Learning Environment) or HLO. Which gives students the opportunity to work in an environment closer to that of a professional game company. The game was made with a team of five programmers and one artist.

## Code

### Tower Selection

One of the mechanics I was responsible for was the tower selection circles. The code calls them spell circles as they were initially supposed to cast spells. Spell circles spawn a pattern of orbs with colliders, these orbs have their own logic to send a message to a 'spell map' contained within the spell circle.

spell circle - interface declaration
spell circle - implementation

These 'orbs' all know their own index within the spell circle's list of orbs. When an orb is hit, it sends its own index to the spell map component of the spell circle. This number is then converted to a string and appended to the spell map's pattern string. Because of the way the system works, only 1 digit indexes are used, though the code does not enforce this. Whenever a new character is added, the spell map compares the formed string to a list of 'correct' patterns. If the string produced after the last addition does not match a substring of the same length in a 'correct' pattern, the pattern is considered failed and the corresponding event is triggered. When the string produced is equal to a 'correct' pattern, the event signalling a correct pattern is triggered. Because a large part of the team prefered working with blueprints, a lot of the C++ architecture was designed with an eye on its blueprint interface. This lead to some odd decisions regarding the "success" event, as blueprints were unable to interact with the map of delegates to patterns that was used in the initial version of the spell map (hence the name).

spell map - interface declaration
spell circle - implementation
spell orb - interface declaration
spell orb - implementation