top of page

Terrate

Project Description

A second year project for Falmouth University, made by a small team of students including myself.  

COMBAT

How and Why?

 When the player holds right click they start to aim, this forces their character to face forward and enables the player to perform a melee attack by pressing left click.

​

This implementation has been a bit controversial, as some players find it intuitive and others find it a bit uncomfortable. The reason I implemented it this way is mainly due to mostly playing FPS's and also trying to make combat as easy as possible for less experienced gamers. 

​

Feedback on the original prototype said combat was a bit too difficult, so I made a zoom in button to make smaller creatures such as rabbits and wolves easier to see and track, I moved the camera further to the side so the player's character takes up less screen space, and finally I increased the number of line traces used from 1 to 81 so that aiming is more forgiving. This makes it so the difficulty stems from the player's ability to manage distance between them and the threat.

Knockback

 

Originally, there was no flinch animation for the wildlife so I implemented a knockback mechanic to act as a hit confirmation. 

​

The players health, also known as the existence bar value in code, dictates many aspects of the players gameplay such as how much damage they deal, their movement speed, how much they glow and their physical size. So naturally, it makes sense for the amount wildlife gets knocked back to be affected by the player, hence line 37.

​

The guard clauses between line 42 and 51 exist to stop unnecessary maths from taking place in the rare instance the player and the animal are perfectly aligned on either axis. 

​

Villagers

How and Why?

The generic villagers aren't meant to serve any gameplay purpose, they are there to help the player get immersed in the world. They are also the very first thing I've worked on in this project. 

​

They have 3 simple behaviours, either go to a random location in the village and stand for a brief second, go to the benches near the camp fire and take a seat, or go back to their house and take a nap. They also go home to sleep when it turns night time and starts raining. 

​

There is also a specialized villager at the back of the village which does serve a gameplay purpose, more on him below.

Crafting Villager

​

The crafting villager stands at his station throughout the day allowing the player to come to him with resources and craft some items in return, the first mission in the game has the player leave the village, complete a little tutorial, collect enough resources for an axe and come back to craft it.

​

Just like the rest of the generic villagers, the crafting villager goes to sleep at night and therefore can't be interacted with until the morning. 

​

Sleeping/crafting behaviours are implemented using a behaviour tree due to being quite simple. The actual crafting system is mostly implemented using blueprints and the math parts are supported using C++.

​

Wildlife

How and Why?

There are 3 different types of wildlife in the game,  rabbits ("prey" in code), wolves ("predators" in code), and bears ("apex predators" in code).

​

Rabbits have two behaviours, they either peacefully roam around or they run away from potential threats (anything that isn't another rabbit).

​

Wolves have the same two behaviours as rabbits except they have an extra behaviour where they hunt rabbits or players tagged as hostile. Players are hostile if they attack any wolf and don't break line of sight for at least 10 seconds continuously.

​

Bears either roam or hunt anything, including other bears. Bears deal the most damage, move the fastest and have the most health, they also only spawn in the second section past the bridge so the player only encounters them when they're on the last mission.

 

This is so the player has time to get accustomed to the controls, and by that point the player might've engaged in combat with wolves as practice, though this is optional since wolves by default won't attack the player. 

​

Wildlife AI Controller

The full AI controller for the wildlife is too large to take a single screenshot off so here's an example which illustrates quite well how the whole system works. 

​

This function is ran on tick if the animal is of "predator" type which is a wolf. First off, the function has access to an array of all currently perceived actors called grabbedActors. Most of the time the animal won't see any other animals anyway, so the code ends here at the beginning. 

​

However, if there are any animals around it, it checks if the animals are of any significance to it. It does this in order of distance, so it checks the closest animals to it and if they're not of any significance ( for example other wolves or none hostile players) then it'll remove them from the array and keep on searching the array until it either finds a significant actor or there's only one actor left in the array. This provides a simple behaviour of only reacting to the closest actors.

​

Finally, it checks weather the actor is a threat or prey and sets the "isHunting" or "isHunted" bools accordingly, or in the case that there's only one "insignificant" actor in the grabbed actors list, it'll reset those bools.

​

The predator function also has the important job of notifying a hostile player if they've been seen by a wolf so that their hostile status can remain active.

​

WildlifeAIControllerCode.png

Other Contributions

On top of everything I shard here, I worked on numerous of other smaller systems such as the crafting system, mission markers/compass system and anything related to the players health. I was the only C++ programmer so anything written in C++ in this project is my own. As for blueprints, our team had another blueprint only programmer, who worked on the inventory system, missions and UI. A good rule of thumb is that anything related to my contributions is mostly made by me, for any clarification regarding my contributions feel free to get in contact with me and I'll be happy to explain further.

Reflection 6 Months Later

After reviewing this project 6 months after officially stopping all work on it, it's great to see how far I've come. I used this project to get to grips with UE5 and C++ and as a result was too too scared to take advantage of things like Object Orientated Programming (to create a base animal class and inherit and override behaviours from it) or using interfaces (to create a character interface which would have taking damage or healing functions). But this still served as a perfect foundation from which I built my knowledge on over the summer, if you do want to see my enhanced skills taking advantage of polymorphism to create a scalable gadget/ability system check out my page on Endless Vendetta 

Play our Game!

You can check out our game on itch and play it yourself, or check out our git to see for yourself how the project works :)

bottom of page