Repository navigation
Functional Design
This project came from Lynx Interactive, a game company known for making social games that seek to connect people in unique ways. They asked us to make an online cooperative experience. They wanted this game to be always-live meaning players should be able to join an active server at any moment. They also wanted this game to connect people from all over the world, without language barriers forming. To this end they wanted the game to have no sort of verbal or text communication. Another core requirement was a sort of permanent, and persistent, progression. They wanted every minute of gameplay to offer some sort of reward for the player. Finally the game needed to load very quickly, so that dropping in feels smooth.
The client requested a proof-of-concept rather than an entirely finished product. For this reason some of the core pillars were not a hard requirement, specifically the Networking and the Load time.
Top-down/Isometric horde survival game In this game players need to defend a central base from waves of enemy hordes. Enemies continue to spawn in waves until the base is destroyed. The players need to keep defeating all the enemies until it becomes too difficult to keep up. If the base is destroyed the match will automatically reset after a short loss screen.
When the player first joins the game they will be prompted with a class selection menu. The classes all have different weapons and skills/spells. After the player selects a class they will be spawned into the level. The player can move along the x/z axis using WASD and can look and aim in a 360 degree radius using the mouse. Attacks can be performed with left mouse button. The player can attack and move at the same time. The executed attack depends on the player's selected class, weapon and projectile type. There are melee and ranged weapon type attacks. Players can non-verbally communicate with each other trough emotes (social) and pings (tactical). If a player dies they will respawn after a short time.
Enemies will spawn at predetermined spawn points on the map and move towards the base, if a player gets close enough to them they will move to attack them instead. There will be several enemy types, some melee and some ranged. Ranged enemies are significantly less common, otherwise the game would become a total bullet hell. Only the weakest enemies will spawn in the early waves but as the game progresses stronger enemies will begin to spawn. Enemies use the same weapon system that players do.
We wanted a system that allowed us to quickly add more weapons for players and enemies to use. The weapons needed to be easy to put together and easy to apply to an attack script. The weapons also needed to be usable by both players and enemies alike. for the ranged weapon we also need to be able to change what projectile is fired and for melee weapons the hitbox needs to be adjustable.
The unlocked weapons and projectiles/spells need to be bought in a shop during gameplay. The players start with no money on wave 1 and will gain money by killing enemies. When a player leaves or the game is lost and resets they will lose all bought items and money.
Players can build structures such as ballistas in order to help them hold back the horde. These structures will need to be built on pre-determined locations on the map. These structures can also be destroyed by enemies that get too close.
The player has to have the following features at its core:
-
Movement: The player needs to be able to move around using WASD, and turn around using the mouse. The player can only move on the X&Z Axis, they cannot go up or down. The player's speed should be ajustable. The player should always face the exact position of the mouse on the screen.
-
Attacking: The player should be able to attack using Left Click. The attack performed should be based on the weapon system, and can be either melee or ranged.
-
Emoting: We wanted to implement the universal communication core pillar using emotes that the players can perform in order to non-verbally communicate emotions and thoughts.
The player can spawn at any point which we desire. It will be flexible so it's adjustable to the map.
Health Features:
• Healing
• Setting max health
• Death
The universal health script has 3 main functions:
1: Setting the max health for objects which use the Universal Health script. The objects can differentiate in health so its required that we can set the health value via the inspector.
2: The amount of healing an object which uses the Universal Health script receives can differentiate per object and changes according to the healing source.
3: When an object reaches 0 health, the Death function will be called which causes the object with 0 health to die and either destroy or respawn depending on if its and enemy/structure or a player/structure.
The enemy has 4 main things to follow, like:
- Targeting
- Movement
- Attacking
- Dying

Targeting: The Enemy will target the nearest structure to attack, if the player is in range, despite the structure being the nearest target, the enemy will constantly follow the player and attack the player, because the player has the highest priority point to attack.
Movement: The Enemy is able to walk towards the target to attack them, which can be either the players or a structure. If they target the player, they will stop for nothing to catch the player, if the enemy is going for a structure instead, it will target and go to the nearest structure to destroy it.
Attacking: The enemy is able to attack the structure or player it's targeting, until the player or structure has 0 health which results in either killing the player or destroying the structure.
Dying: The enemy is able to die after the health of the enemy reaches 0 after the player or the structure that is attacking the enemy has shot them with a gun/ranged weapon or attacked them with a sword.

The health bar is a part of the Universal Health, because it shows how much health the Main Building/Enemies/Player/Structures still have. If the health bar reaches 0. The one with the health bar dies.
When the player comes upon an place that isn't occupied and on an placeholder in the map, the player gains the chance to place an structure there to defend the main base against the enemies that try to attack the main base.

If the player is upon the placeholder site where they can build, they can open the shop menu, by pressing E, they have an list with structures they can choose to place.

After the structure is spawned in, the structure will target the nearest enemy and shoot at it until it's dead.

The structure will constantly look for an target to kill. If the enemy is in range of the structure, the structure will shoot towards the enemy, until the enemy is killed, it will only focus on one enemy, so if an second enemy would enter it's radius, the enemy would be safe for at the moment. Until the enemy is out of range or killed by the structure.

The player animations play off after the player begins to move or attack with their respective weapon of class. Like for the archer, the archer picks first an arrow up and shoots it from his bow, while for the knight, it has an animation where the player just swings his sword to attack their enemies.

Zoals deze functie al zegt, dit geeft aan hoeveel experience de speler heeft gekregen door uit hun speeltijd in de game. Als de speler een enemy dood maakt, krijgt de speler experience, simpel als dat. De waarde wordt ook geupdated met hoeveel experience je hebt verdient, de speler kan ook een hoger level daarmee krijgen waardoor ze bijvoorbeeld sterker worden. De hoger de spelers level wordt, de hoger de maximale value voor de volgende level wordt, zodat er tenminste een idee is voor progressie.
As stated earlier when joining the game the player must make a choice which class he wants to play as. Each class has its strength and weaknesses which each class has a different type of playstyle. Classes will have different weapons depending on their type, ranged or close range for example. Classes have a progression aspect to them each level will give their stats a little boost aswell as unlock new weapons.

As you can see in this visualsheet the player selects the knight class. Its a close range fighter with high defense and the player is level 10 so he has some experience playing with this class when he loads he'll have the same base stats as a level 10 knight. The other classes also have their speciality written the wizard has long range and high damage with the player level being level 7. The archer class is also range with medium defense and the player level is 15.
When pressing a button you will place down a "ping" that is an object with a picture that will tell the other people that you need somethingg such as a warning sign to other players that the castle is under attack or that the you need healing. Also since we dont have any other players we can make the fake players walk towards the ping see the gif below for a preview of the ping menu.

The fake player walks around the mapin a random direction after a set amount of seconds he’ll pick another direction. This will loop the entire time untill an enemy is within range or the player has pinged. If Enemy is within its range the fake player will look at it and shoot the enemy. It will also walk a diffrent direction the enemy is coming from. This will give the fake player a longer lifetime as he manages to perfectly walk away however due to the enemy being faster than the players he will eventually get caught if there is no support. The real player can ping the fake player to come over for whatever reason they desire. All the fake players immediately ignore everything come to that pinged location as fast as they can. This gives the real player the sense of communication between his teammates.
Another feature the fake players can do is responding to emotes of the real player. The real player can emote with certain keybinds. The fake players will repond with the same emote to make the player feel as if they are talking to eachother. The client wanted communication within the game so this was the best solution for his desire.

The yellow exclamation point is an ping all the black dots are fake players which immediatly get a path to the ping. It will take the shortest path there no matter where they are.
A required core pillar is universal communication so we decied to fix this with emotes. Press an key and an emote will appear over your head. To make it feel like your actually talking to someone cause we didn't manage to implement multi-player an clever idea was to make the fake players respond with an emote. For now they will respond with the same emote.
I used an “Raycast” which shoots a line from my mouse to the floor. That position ill use and subtract it with the players current position to get the offset / direction. Then I set that direction on the players forward axis and it will turn to the specific position your mouse was hovering over.

At a determined distance of the base in each direction there will be enemies spawned. Then on each spawner location there will be an area where the enemies are allowed to spawn. In that area the enemies will be generated either randomly or strictly in a row depending on what we the developers want. The spawners will have access to all the enemies and with logic it'll spawn which enemy for which wave. After every enemy has been killed a new wave will occur. In the new wave there will be more enemies and the enemies themselves will have some extra health

In this visual sheet you can see the zones and the base(The distance between them and the zone size are not on the same scale as the image). In the green zones/the spawn zones the zombies are allowed to spawn in that region they are allowed to pick any range which is inside of the zone or every enemies will spawn in a row and drop down every collumn. They player isn't allowed to go inside of the enemy spawn zones.
Universal Health system
- Variabelen maximaleGezondheid: Dit is de maximale hoeveelheid gezondheid die een object kan hebben. bijGezondheidVerandering`: Een Unity-event dat wordt geactiveerd telkens wanneer de gezondheid van het object verandert.
bijOverlijden: Een Unity-event dat wordt geactiveerd wanneer het object sterft (wanneer de gezondheid nul bereikt). isvolledigeGezondheid: Een booleaanse waarde die bijhoudt of het object zijn maximale gezondheid heeft. huidigeGezondheid: De huidige hoeveelheid gezondheid die het object heeft. heeftSchadeGehad en huidige Transform Deze worden in deze code niet gebruikt, maar kunnen eventueel later worden uitgebreid voor extra functionaliteit.
- Functies
KrijgMaximaleGezondheid Geeft de maximale hoeveelheid gezondheid van het object
terug.
StelMaximaleGezondheidIn
Stelt de maximale gezondheid van het object in.
KrijgHuidigeGezondheid
Geeft de huidige hoeveelheid gezondheid van het object terug.
StelHuidigeGezondheidIn
Stelt de huidige gezondheid van het object in en activeert het bijGezondheidVerandering event.
Awake
Een Unity-functie die wordt aangeroepen wanneer het object wordt aangemaakt. Hierin wordt de huidige gezondheid ingesteld op de maximale gezondheid.
NeemSchade
Vermindert de huidige gezondheid met een bepaalde hoeveelheid schade en activeert het bijGezondheidVerandering
event. Als de gezondheid nul of minder wordt, wordt deOverlijdenfunctie aangeroepen. GeneesGezondheid: Verhoogt de huidige gezondheid met een bepaalde hoeveelheid genezing en activeert hetbijGezondheidVeranderingevent. Als de huidige gezondheid de maximale gezondheid bereikt of overschrijdt, wordt deze ingesteld op de maximale gezondheid enisVolledigeGezondheid wordttrue, anders wordt dezefalse. Overlijden Activeert het bijoverlijden event, wat aangeeft dat het object is gestorven.
Ping System
Deze code zorgt ervoor dat spelers in een spel specifieke locaties op de kaart kunnen markeren, vergelijkbaar met hoe je in sommige spellen een markering kunt plaatsen om je teamgenoten iets te laten zien. Hier is een eenvoudige uitleg van wat de speler ervaart:
Wat Gebeurt Er in het Spel:
-
Ping Activeren: Druk op de 'E' toets Wanneer je op de 'E' toets drukt, verschijnt er een klein menu op je scherm. Dit menu wordt gebruikt om een markering (ping) op de kaart te plaatsen.
-
Ping Plaatsen Selecteer een Type Ping Terwijl het menu zichtbaar is, kun je een type ping kiezen (bijvoorbeeld een waarschuwing of een richtpunt). De ping wordt dan geplaatst op de locatie waar je muis op de kaart stond toen je op 'E' drukte.
-
Ping Op Locatie Nauwkeurige Plaatsing De plek waar je muis op de kaart stond wordt geregistreerd, zodat de ping precies op die locatie verschijnt.
-
Ping Verwijderen Tijdslimiet De ping blijft een bepaalde tijd zichtbaar (bijvoorbeeld 5 seconden) en verdwijnt daarna vanzelf.
Hoe Gebruik Je Het:
-
Menu Openen Druk op de 'E' toets om een menu te openen op de plek waar je muis is. Dit menu laat je kiezen welk type ping je wilt plaatsen.
-
Ping Kiezen en Plaatsen: Terwijl het menu open is, selecteer je het gewenste type ping. De ping verschijnt dan direct op de plek waar je muis was toen je het menu opende.
-
Automatische Verwijdering: De ping blijft gedurende een ingestelde tijd op de kaart zichtbaar en verdwijnt dan automatisch. Je hoeft niets te doen om het te verwijderen.
Voorbeeldsituatie: Stel je voor dat je in een teamspel bent en je ziet een vijand op een bepaalde plek. Je kunt op 'E' drukken om het pingmenu te openen, een waarschuwing ping kiezen, en de ping verschijnt op de plek waar je de vijand zag. Je teamgenoten zien deze ping en weten precies waar ze moeten kijken. Dit systeem helpt je om snel en effectief te communiceren met je team zonder te typen of te praten, gewoon door pings op belangrijke plekken te plaatsen.
Experience System
Deze code zorgt ervoor dat spelers in een Unity-game ervaringspunten kunnen verdienen en hun voortgang kunnen zien. Stel je voor dat je een personage bestuurt in een avonturenspel. Telkens wanneer je uitdagingen overwint of taken voltooit, verdien je ervaringspunten. Deze punten helpen je om sterker te worden en hogere niveaus te bereiken.
De code doet het volgende:
Ervaring bijhouden Het houdt bij hoeveel ervaringspunten je hebt verdiend terwijl je speelt.
Niveau bijhouden Het houdt ook je huidige niveau bij, dat stijgt naarmate je meer ervaring opdoet.
UI-weergave Het toont deze informatie aan de speler via een tekstveld dat je niveau laat zien, een ander tekstveld dat je huidige ervaring en het maximale ervaringsniveau laat zien, en een schuifregelaar die je voortgang visueel weergeeft.
Level Up Telkens wanneer je genoeg ervaringspunten verdient om een nieuw niveau te bereiken, zal je niveau stijgen en zal de game je vertellen dat je sterker bent geworden.
Kort gezegd, het is een belangrijk onderdeel van de RPG (Role-Playing Game) ervaring in de game, omdat het laat zien hoe je personage groeit en sterker wordt naarmate je het spel speelt.