Escola Tècnica Superior d’Enginyeria Electrònica i Informàtica La Salle

Treball Final de Màster

Master in Advanced Videogame Development

Alumne Professor Ponent Joan Guillem Castell Ros-Zanet Alun Thomas Evans

ACTA DE L'EXAMEN DEL TREBALL FI DE MASTER

Reunit el Tribunal qualificador en el dia de la data, l'alumne

D.

va exposar el seu Treball de Fi de Master, el qual va tractar sobre el tema següent:

Acabada l'exposició i contestades per part de l'alumne les objeccions formulades pels Srs. membres del tribunal, aquest valorà l'esmentat Treball amb la qualificació de

Barcelona,

VOCAL DEL TRIBUNAL VOCAL DEL TRIBUNAL

PRESIDENT DEL TRIBUNAL

1 Forsaken, The last Remnant

Abstract

This project consists in making a souls like game prototype.

We get inspired to make that game in three different rpg souls like game, obviously Dark Souls is the main reference of any game of souls like style like his name reflects, then we got inspired by Ashen, and Little Devil Inside, both are some kind of action adventure rpg.

From Little Devil mostly we got inspired by the art, and from Ashen the playability taking the best from each game to try make an excellent prototype.

Our main idea is release Frosaken beta at itch.io, a free platform to publish games, and if has enough acceptance try to release a finished game in differents platforms like Epic or .

The attachments of this project consist in the artificial intelligence of the video game, this was the part I was responsible for developing in the prototype.

2

Resumen

Este proyecto consiste en hacer el prototipo de un juego del estilo souls like.

Fuimos inspirados para hacer este juego en 3 diferentes rpg soul like, obviamente Dark Souls que es la referencia principal de cualquier juego soul like como su nombre indica, también nos inspiramos en Ashen y Little Devil Inside, los dos son del tipo aventura/acción rpg.

De Little Devil Inside mayormente nos inspiramos en la parte artística, y de Ashen en la jugabilidad, intentando coger de cada uno de los 3 la mejor parte para intentar hacer un prototipo excelente.

Nuestra idea principal es publicar la beta de Forsaken en itch.io, una plataforma gratuita para publicar videojuegos, y, si tiene suficiente aceptación intentar publicar una versión acabada en plataformas como Epic o Steam.

El anexo de este proyecto consiste en la parte de la inteligencia artificial del videojuego, que es la parte en la que yo me he encargado de desarrollar en el prototipo.

3 Forsaken, The last Remnant

Resum Aquest projecte consisteix en prototipar un joc de l'estil souls like. Ens inspirem en fer aquest joc en 3 diferents soul like rpg, òbviament, Dark Soul que és la principal referència de qualsevol soul like com el seu nom indica, també es van inspirar per Ashen i Little Devil Inside, tots dos són del estil acció/aventura RPG. De Little Devil Inside ens vam inspirar sobretot per la part artística, i Ashen en la jugabilitat, tractant d'obtenir de cada un dels 3 la millor part per tractar de fer un prototip excel·lent. La nostra idea principal és publicar la beta de Forsaken a itch.io, una plataforma gratuïta per publicar videojocs, i, si te l'acceptació suficient, intentar publicar una versió acabada en plataformes com Epic o Steam. L’annex d’aquest projecte consisteix en la part de la inteligencia artificial del videojoc, que es la part en jo em vaig encarregar de desenvolupar en el prototip.

4

Acronyms

AI: artificial intelligence

RPG: Role playing game

CrowdFunding: crowdfunding is a collective founding of people towards a project or idea by providing irrelevant amounts of money but which together can become very large, usually in exchange for ”prizes” or very varied rewards.

PEGI: Pan European Game Information, Age ratings are systems used to ensure that entertainment content.

These age ratings provide guidance to consumers, parents in particular, to help them decide whether or not to buy a particular product for a child.

The PEGI rating considers the age suitability of a game, not the level of difficulty.

UE4: 4

GDD: Game design document

SQ: Sequence

RPG: Role Playing Game

BT: Behaviour Tree

BB: Blackboard

5 Forsaken, The last Remnant

Índex

Abstract 2

Resumen 3

Resum 4

Acronyms 5

Índex 6

1.- Introduction 9 1.1.- Scope and Goals 9 1.2.- Main features 9 1.3.- Synopsys (Storyline) 10 1.4.- Environment and Context 13 2.- Theoretical framework 14 2.1.- What is an RPG game? 14 2.2.- Most known RPG games 14 2.3.- State of the art 15 2.4.- Tools 17 2.4.1.- Unreal Engine 17 2.4.2.- Maya 17 2.4.3.- Substance Painter 18 2.4.4.- Photoshop 18

3.- Game Design and Mechanics 19 3.1.- Game Script (Story) 19 3.2.- Playability 23 3.2.1.- Keyboard inputs 23 3.2.2.- Controller inputs 24 3.3.- Player mechanics 25 3.3.1.- Character Stats 25 3.3.2.- Talent Tree 26 3.3.4.- Actions 27

6

3.3.5.- Attacks 28 3.4.- Enemy Mechanics 28 3.4.1.- Enemies 28 3.4.2.- Boss 30 3.4.2.1.- Boss Attacks 31 3.4.2.2.- Boss Fight 32 3.5.- Characters 34 3.5.1.- Main Character (Player) 34 3.5.2.- Liza {|laiza|}, your sister 34 3.5.3.- Deity 34 3.5.4.- Ethereals and aberrations 34 3.5.5.- Major Servant 34 3.5.6.- Minor Servant 35

4.- Art 36 4.1.- 2D Art 36 4.1.1.- Concepts 36 4.1.2.- Character design 38 4.2.- 3D Art 43 4.2.1.- First Cell Shading tests 43 4.2.2.- Final Shader 44

5.- Results 48 5.1.- Future Lines 48

6.- Personal Conclusion 49

7.- Bibliography 50

9.- Attachment 1: Behaviour Trees on UE4 51 9.1.- AI Controller 51 9.2.- UE4 AI 51 9.2.1.- Blackboard 51 9.2.2.- Behaviour Tree 51 9.2.3.- Composite Node 52 9.2.4.- Task Node 53 9.2.5.- Decorator Node 53

7 Forsaken, The last Remnant

9.2.6.- Service Node 54

10.- Attachment 2: Forsaken AI 55 10.1.- Enemies 55 10.1.1.- Parent Enemy 55 10.1.1.1.- Enemy Animation 55 10.1.1.2.- Enemy Base Class 55 10.1.1.3.- Enemy Base AI 57 10.1.1.3.1.- AI Controller 57 10.1.2.- Physical Enemy 58 10.1.2.1.- Physical Enemy Class 58 10.1.2.2.- Weapon Class 59 10.1.2.3.- Physical Enemy AI 60 10.1.2.3.1.- AI Controller 60 10.1.2.3.2.- Behaviour Tree 60 10.1.3.- Magic Enemy 63 10.1.3.1.- Magic Enemy Class 63 10.1.3.2.- Magic Spell Class 64 10.1.3.3.- Magic Enemy AI 65 10.1.3.3.1.- AI Controller 65 10.1.3.3.2.- Behaviour Tree 65 10.2.- Boss 68 10.2.1.- Boss Animations 68 10.2.2.- Boss Class 69 10.2.3.- Boss Magic Attacks 74 10.2.3.1.- Explosive Fire Meteorite Class 74 10.2.3.2.- Fire Missiles Crawlers Class 75 10.2.4.- Boss AI 77 10.2.4.1.- AI Controller 77 10.2.4.2.- Behaviour Tree 78

11.- Table of Content 81

8

1.- Introduction 1.1.- Scope and Goals

Our purpose is to make a simple but flexible game in where people can develop their own playstyle. We’re aiming for a stylized aesthetics and organic growth in the level in order to stand out in the market.

Our main goal is to present a solid action RPG game which is fun to play, and to create a demo gameplay to show the result and its possibilities.

Furthermore, we pretend to innovate in a trendy genre (post-apocalyptic RPG) searching for a more unique and personal style, and also give a deep background to the game through the storyline.

With that in mind, the project scope will be the following:

● Creating a Game Design document (GDD)

● Develop the graphic style (Cell Shading tests)

● Creating a 10 minutes Demo Gameplay 1.2.- Main features ● Project Title:

Forsaken, The Last Remnant

● Genre/Theme:

Action RPG / Post-Apocalyptic, Fantastic

● Format:

Videogame (Demo)

● Duration:

10 mins (Demo gameplay)

● Logline:

You are a young survivor who must scour a post-apocalyptic city for your missing sister before she is consumed by a plague of soul devouring creatures.

● Tagline:

Die Hard, PLAY HARDER.

9 Forsaken, The last Remnant

● Target audience:

Young adults (PEGI 16), RPG experienced players, either men and women.

● Profile:

o The main profile will be killer, being a soul like game it is focused on battles

o As secondary profile will be explorer and achiever, because we want they explore all Forsaken world and play all different endings.

● Characters:

o Main character (Player)

o Sister (Liza. She will appear in Flashbacks)

o Deity

o Ethereals and Aberrations

o Major Servant

o Minor Servant ● Style:

We aim for a dark and post-apocalyptic PlayStation 2 look (low poly objects, hard edged and with simple shaders and textures) but with great graphics, and we will get it thanks to the Cell Shading options in Unreal Engine and some lighting effects. 1.3.- Synopsys (Storyline) You and your sister Liza, who is badly ill, are spending the night inside an unused subway station. Your sister has developed an increased weakness during the last year. She will die in a few days. After setting up the camp and having dinner, they go to sleep. During the sleep, you wake up at a disgusting sound made by an unknown creature and you see a shadow running out of the hall. You find out then that Liza is not there with you. Supposing that an aberration, the monsters that you’re constantly fighting, has kidnapped her, you follow the footprint trail left by the creature. The trail goes out the subway station and crosses through an underground street in ruins. At the end of the street you go into a cave. At the end of the way you find that the trail left by the monster is blocked by a huge aberration. It is a big and fat creature carrying a weapon. After the fight, the aberration smashes the weapon onto the floor and, in consequence, it breaks down.

Falling down like a slide you enter by accident in a portal. The portal redirects you to another world beyond the limits of physics and time. There, is hard for you to breathe. Your surrounding seems like an old temple. In the middle, a shadow appears in front of you. That shadow, close in appearance with some kind of Deity, greets you and asks you why are you there. After telling her that you lost your sister, the Deity tells you that she had lived a situation like that and offers you her help. The Deity knows where Liza is, because she has a connection with all dead or alive creatures and feels that she is safe. Unfortunately, she is in

10

a locked chamber. In order to open the way to Liza, the Deity needs to be in a certain place with a certain number of souls, so she will command you to pick up those souls who seem to be inside horrible and big creatures around the world. The deity informs you that she is very weak to do it by herself because her world (the else world) is tearing apart due to the souls, or commonly called Ethereals, escaping from her.

However, she warns you that the souls will be not easy to catch and so she needs to make sure if you’re worthy enough to face such an adventure. For the rest of the trip, the Deity will give you a little soul like creature that will give you advices and translations.

After that you cross another portal just to appear in the cave where you fell down. The mission is to escape the cave where you were by collecting the two keys, which are two big skulls of the cave guardians. The first guardian is located in one of the two passages that comes before the exit gate. You fight with him and obtain from his corpse the first skull to open the exit. While walking through the corridors, the little soul that the deity gave you identifies himself as “the minor servant” and explains that he is so weak that wouldn’t hurt anyone, not like his brothers explains. He says that the souls that escape from his world are violent and try to get into people’s bodies to possess them and transforming them into aberrations and to maintain an aberration alive, it has to kill other humans to feed on their souls. After defeating the second guardian, you will tear off his skull and collocate it into the gate. The gate opens and you get out of the caves.

After that, you see an open sight of what’s left of the world. The minor servant explains to you that the world suffered a nuclear and geological catastrophe. The world was dragged down to the subsurface and a few million people survived. Then, going towards a canyon at the end of the horizon, your soul partner is kidnapped in an energy trap by some bandits who will try to kill you for your objects and weapons. They are many of them and they’re wearing some kind of masks, granting them magical powers. You finally defeat them, rescuing your little companion, who is indebted to you and grants you his confidence.

At the canyon, you find a portal, and the minor servant asks you to enter. It redirects you to the Deity’s temple in the other world. She congratulates you for escaping the caves and also notices that you have increased your power during the trip to the canyon. The Deity tells you that she has discovered that Liza is safe but still trapped. That’s why you need to hurry and collect the five souls needed to open the portal to her. After exiting and returning to your world, the minor servant seems different. It is like something wrong is happening.

Three of the souls are in your dimension, the other two are in the other world.

In a cave you find a very tall aberration, which contains the first soul. First you’ll have to attack its legs, so it will fall and you'll be able to attack his torso and head.

In a humid tunnel full of stalagmites and stalactites you find an aberration made of several bodies attached together. In order to defeat it you’ll have to make a big rock fall over him, liberating and collecting the second soul.

An ethereal in a kid’s body. It's faster and more agile than you. It contains the third soul.

After collecting the three first souls, you are guided into another portal by the minor servant. The other world exists beyond time and physics, and the gravity does not apply there. Also, the air contains particles that are not compatible with the inhabitants of the other world, and

11 Forsaken, The last Remnant it will be poisonous to you. You have a permanent state of dizziness and imbalance. There you will meet a tribe who, due to spatial-temporal anomalies, they have no notion of time.

This tribe has been partially dominating the ethereals around them but, accidentally, one of their shamans has absorbed one of the middle servants. After killing him, you catch the soul. The last ethereal is huge. It can break through walls and disappear.

When you have collected the five souls, you gather in a mountain with a portal. The Deity talks through it and conjures a magic spell with the five souls. The portal gets brighter and the Deity invites you to enter. There, you find Liza chained and transformed into an aberration, but it slightly conserves the human look. After you have entered, the portal closes behind you and, of course you demand an explanation to all of that. The Deity shows up and explains that an ethereal possessed Liza a year ago. It was a very special ethereal for the Deity, her major servant, her right hand, or even more. She swore to protect it at all cost and she had to look for a weak body (Liza) to install him and make him survive.

Now she grabs the five souls of the creatures without your consent and makes Liza feed on them. The deity tells that the major servant was weak in your Liza’s body, but thanks to you it will be stronger. You realize that you have been betrayed and the Deity has used you all the time to collect those souls just to feed them to your sister.

After feeding on those souls, Liza experiments a huge transformation into a grotesque figure. Following this, the Deity wants you to disappear from existence because you have earned enough power to face it during the journey and she orders Liza/monster to kill you. The battle will be bloody and you will be left completely weakened, as well as your sister. When you both are just a hit away from dying, there are three options to get an ending. Two of them are primary and the third can only be unlocked if you have completed a specific secondary mission.

● First ending: you decide to kill Liza and ending the life of both her and the major servant and the five more souls that live inside her. The Deity is so mad at you that tries to kill you but, after having a final battle, you defeat her. After killing the Deity, both the ethereals and the aberrations, including also the minor servant, disappear. Because the deity controlled the souls’ world and with no deity the cannot sustain themselves. You save humanity by doing that because there are no more inhuman threats but you lost your sister.

● Second ending: you decide to beg the Deity to swap positions with Liza just to let her alive. The Deity accepts knowing that you are so powerful that you could be the definitive aberration and trespasses all the ethereals into your weakened body. But while assuming your new parasites, you take advantage and confront the Deity while you have conscience. You defeat her. After killing the Deity, both the ethereals and the aberrations, including also the minor servant, disappear. That includes also you, because you have assimilated the souls and you will disappear with them. You save humanity by doing that because there are no more inhuman threats but Liza will live alone without you.

● Third ending: You decide to give the experimental serum that separates humans from Ethereals, which you obtain in a side quest in the other world, and it works. After that the Deity and the six souls will fight with both of you. You both will kill the

12

Deity and the souls will disappear, as well as the minor servant and the aberrations. You both live to watch how humanity is safe from this inhumane threat. 1.4.- Environment and Context Between 200 and 300 years ago there was a nuclear disaster in the Earth (slightly different to the real one). Until that catastrophe, the planet was an overpopulated mess, full of concrete buildings which were built so close to each other that they even mounted up. The efforts of the ecologists weren’t capable to make the society change, so the renewable energy and the sustainability didn’t make much of an impact.

After the nuclear disaster, the Earth changed dramatically. At first, most of the island complexes and small peninsulas disappeared: Indonesia, Central America, Western Europe, Eastern Asia. The oceans ate away coasts and straits. Middle East was wiped out for the first fifty years. The Eurasian and the North American tectonic plates cracked in half. Restless old and new volcanos added dust and ashes to the already dark and dense layer that covered the sky.

Not to mention the evident physical repercussion of the bombs themselves. First, the “controlled” cobalt bombs, which made the survivors of the unfortunate target cities to move out to safer zones. And then, the “Trinity”, three hydrogen nuclear bombs thrown by three different military and governmental forces in three key locations.

The world’s population before the bombs? 9 billion. And after? Well, much less than a million. Humankind almost extinct, they gathered in small tribes. Due to this catastrophe and the overall pollution and deforestation, there is no sign of flora in the world. An envelope of ashes surrounds the word.

13 Forsaken, The last Remnant

2.- Theoretical framework In this chapter we will review in the first sections, which is a role-playing game and which are the most known games, we will give some examples.

In section 2.3, the state of the art will be explored, reviewing the current games that present offers similar to that of this application.

Finally, a brief introduction will be made to Unreal Engine, the engine chosen to perform the prototype of this project and the other tools used for the development. 2.1.- What is an RPG game? A role-playing game (RPG) is a genre of video games where the player controls a character that has a principal quest followed by some secondary quests in different imaginary world or real based world in a possible future. [2]

Traditional rpg games shares some basic elements.

● Levels and character statics that player improves over the game.

● A central quest that runs in the whole game as storyline

● Menu-based combat systems by turns

RPG games have a huge wide of variations and due the fact rpg games are so popular. [3]

Some people love playing rpg games because they can evade his own real monotone live and become a hero to defeating the evil that ravages the world.

Others love to collect and explore different and extraordinary worlds.

Our game is and Action/rpg where battles are real-time instead of turn based games, but it takes some part of adventure/rpg style, where the player can collect different items to evolve.

It's based on Dark souls [4], a genre of rpg known as soul’s like. 2.2.- Most known RPG games ● World of Warcraft [5]: the most known actual rpg for excellence, is a game based in warcraft universe, developed in the world of Azeroth, divided in 2 factions, Alliance and Horde.

Currently it has 6 expansions in which the number of races and classes has augmented which each one. It’s an MMORPG in which the player controls and avatar in third person, where you

14

have to explore the world, complete missions and kill monsters to earn gold, level up and advance in the game.

● The Legend of Zelda, Breath of the Wild [6]: is an open world single player rpg developed by Nintendo [7], where isn’t a traditional level system. The player has to overcome different dungeons that are spread all over the world, each time the player complete a dungeon the player can chose increase life or stamina capacity.

Despite of being an open world, has a very clear main quest and a large number of side quests that provides better weapons or increase backpack size. The game has 2 different endings, if the player hasn’t completed all side quests has one ending and the game reloads in the last point before the games ends and appears a log with the progress, but if the player has finished all side quests the end is different.

2.3.- State of the art Our game has told before is a soul like games, the interest in the matter has been evident in many crowdfunding and souls like forum’s. Some of our references are:

15 Forsaken, The last Remnant

● Dark Souls [4]: Is an action RPG developed by From Software and published by Namco Bandai. A spiritual successor from Demon’s Soul. It’s considered one of the greatest videogames ever made, for his level design, world lore and combat system, however the game difficulty has mixed reviews, while someone's love his challenge others criticized it for being unnecessarily unforgiving. But, for us this complexity and difficulty is the main goal to achieve, because in our opinion is why this game is excellent.

● Little Devil Inside: Little Devil Inside [5] is a truly engaging 3D action adventure RPG game where you are thrown into a surreal but somewhat familiar setting with humans, creatures and monsters to interact with, learn and hunt - journey, survive and discover the world that exists beyond.

This game is not just about killing arch-demons and saving the world. Take in the atmosphere and live a realistic life in an unrealistic world. This is a game that tells stories about people with 'unusual' jobs such as hunting monsters and what happens in their everyday life doing so.

We focused on this game as art reference, we love his style and we want to have something like it for our game.

● Ashen [6]: Is an action RPG developed by A44 and published by Annapurna Interactive. Set in a low fantasy environment. The game is set in a sunless world and tells the story of a character seek in a home.

16

The core of ashen is about relationships, each character you can find has unique knowledge and crafting abilities that the player will learn. Has a passive multiplayer where you can play as cooperative for work together in quests or dungeons or ignore them and go in your own way.

Has a stamina-based combat which we want to use in our game and his style and gameplay are inspirations for our game.

2.4.- Tools 2.4.1.- Unreal Engine Unreal Engine [10] is the we decided to use for the development of that game, is a very powerful engine provided by Epic, has a lot of advantages in front of Unity3D [11] or other engines, such as have a great amount of free assets and 5 pay assets per month free, and a lot of paid assets that are great and has a nice integration with Mixamo [12], where we take a nice amount of animations for our game.

By the other hand his powerful system of node based programming are awesome and relative easy to use when you understand how work, but at the start we had a lot of troubles with that powerful system, despite of we use it in the master we didn’t have enough knowledge to work smooth and fast as we have in Unity3D (the other option for the engine to develop this game) but finally we managed to do more or less what we tried to do.

Also, UE4 has many post process and shader options, so we could explore them and find the general style we wanted more easily. 2.4.2.- Maya

For the modelling part we used mainly Maya [13]. We did all the layout In Maya to see the proportions of the objects and to be able to do the blocking of the level.

17 Forsaken, The last Remnant

From there we exported all the objects one by one so we can import them in Unreal. 2.4.3.- Substance Painter For all the textures we created for the level, props, characters and environment. [14] 2.4.4.- Photoshop We used it to design all the characters from scratch, proportions, masks, colours… We also create the concept art from the whole environment showing the look we want to show. [15]

18

3.- Game Design and Mechanics 3.1.- Game Script (Story)

Awakening: You and your sister, who is badly ill, are spending the night inside a cave. Your sister has developed an increased weakness during the last year. She will die in a few days. During sleep, you wake up at a disgusting sound made by an unknown creature and you see a shadow running out of the tunnel. You find out then that your sister is not there with you. Supposing that an aberration has kidnapped her, you follow the footprint trail left by the monster.

SQ1: You can branch off the main trail to find a little entrance to a high chamber where you must do parkour and climbing to reach the summit and loot a special potion that gives you more speed than your enemies for a limited time. You will also find a gold tooth if you go even higher.

Boss 1: At the end of the cave you find that the trail left by the monster is blocked by a huge aberration. It is a big and fat creature carrying a weapon. After the fight, the aberration smashes the weapon onto the floor and, in consequence, it breaks down. Falling down like a slide you enter by accident in a portal.

Encounter: The portal redirects you to another world beyond the limits of physics and time. There, is hard for you to breathe. Your surrounding seems like an old temple. In the middle, a shadow appears in front of you. That shadow, close in appearance with some kind of Deity, greets you and asks you why you are there. After telling her that you lost your sister, the Deity tells you that she had lived a situation like that and offers you her help. The Deity knows where is your sister, but in order to open the way to her, she needs to be in a certain place with a certain number of souls, and then she will command you to pick up those souls who seem to be inside horrible and big creatures around the world. The deity informs you that she is very weak to do it by herself because her world (the else world) is tearing apart due to the souls escaping from her.

However, she warns you that the souls will be not easy to catch and so she needs to make sure if you’re worthy enough to face such an adventure. For the rest of the trip, the deity will give you a little soul like creature that will give you advice and translations. After that you cross another portal just to appear in the cave where you fell down.

19 Forsaken, The last Remnant

ACT II: The mission is to escape the cave where you were by collecting the two keys, which are two big skulls of the cave monsters.

Boss 2: The first guardian is located in one of the two passages that comes before the exit gate. You fight with him and obtain from his corpse the first skull to open the exit. While walking through the corridors, the little soul that the deity gave you identifies as the minor servant and explains that he is so weak that wouldn’t hurt anyone, not like his brothers explains. He explains that the souls that escape from his world are violent and try to get into people’s bodies to possess them and transforming them into aberrations. This explanation is useful to know the nature of the enemies. It also explains that to maintain an aberration alive, it has to kill other humans to feed on their souls.

SQ2: In the other corridor you are told to look at any detail by the minor servant. If you search each room of the corridor, you will find a locked room with two enemies guarding an old chained hermit, if you liberate him, he will give you a weapon to affect multiple enemies at the same time and slow them down. Then the hermit escapes the room and will flee once you open the door.

Boss 3: This creature has the same battle system as the other one but is slightly more powerful, so you would think that using a potion or the speed ability is a good idea. After defeating it, you will tear off his skull and collocate it into the gate. The gate opens and you get out of the caves.

ACT III: You escape the caves and after that, you see an open sight of what’s left of the world. The minor servant explains to you that the world suffered a nuclear and geological catastrophe. The world was dragged down to the subsurface and a few million people survived.

Boss 4: Then after going towards a canyon at the end of the horizon, your soul partner is kidnapped in an energy trap by some bandits who will try to kill you for your objects and weapons. There are many weak bandits and some brutes that have their own little souls like you. They use them to pronounce magic and aethereal powers against you. After seeing how many enemies you face you think that using the multiple attack ability is a good idea. After defeating them, your minor servant will be indebted to you and your relation will improve after this.

SQ3: you arrive at a nomad tribe camp of survivors. These are very rude and arrogant people living in the dirtiest way. In the centre of the camp you find a weakened man standing in his knees and suffering from and internal pain. People start to gather around him. The minor servant explains to you that when a human body is weakened, the souls that have escaped the other world (the ethereals) enter in the body and begin the transformation into aberrations. So, he informs you that the man is going to transform because he has been invaded by and ethereal and will kill everybody in the village if do not stop him. You are given the option of letting him transform and killing it after the transformation or killing him in his human form. Despite taking one option or the other man in the camp will thank you and letting you enter his tent. There he will show and give to you a kind of serum that is under experimentation. That serum is supposed to separate the ethereals from the human bodies, but it requires something that only the ethereals possess, and encourages you to search for that item.

20

SQ4: You find a dead body in the side of the path. It contains a map that is unfinished, so you decide to explore that area. In the map, this unknown area has an X marked. After exploring and getting objects, you will enter in a cave where it is supposed to contain the X. But a monster appears and fights with you.

Boss 5: It is a medium size monster with a lot of speed. It is related to lizards because it has a scaled tail. After defeating it, you enter the chamber that he was guarding and you find an ability to become like a spectre for a short period in battle, so no attack can touch you.

EVENT 1: At the canyon, you find a portal, and your minor servant asks you to enter. It redirects you to the deity’s temple in the other world. She congratulates you for escaping the caves and also notices that you have increased your power. The deity tells you that she has discovered that your sister is safe but still trapped. That’s why you need to hurry and collect the five souls needed to open the portal to her. After exiting and returning to your world, the minor servant seems different. It is like something wrong is happening.

ACT IV: In order to save your sister, the deity demands 5 major souls (its middle servants’ souls). Three of them are in your dimension, the other two are in the other one. In this act the minor servant is considering the option of abandoning your quest to save your sister in many times. He claims that the deity is not someone to be trusted and that maybe the sister was not kidnapped but transformed into an aberration by some ethereal.

SQ5: You find two explorers like you, who will ask you if you have 5 different ingredients/materials. 4 of them are average loot that you can find, 1 is a reward from SQ1. If you give them the items they will give you something apparently useless (cat fur).

Boss 6: In a cave you find a very tall aberration. First, you’ll have to attack its legs, so it will fall and you'll be able to attack his torso and head.

Boss7: In a humid tunnel full of stalagmites and stalactites you find an aberration made of several bodies attached together. In order to defeat it you’ll have to make a big rock fall over him.

Boss8: An ethereal in a kid’s body. It's faster and more agile than you. To kill it you'll have to use the cat fur you got previously. The boy is allergic to it and it will become bigger and slower.

Event: The minor servant (your sidekick) will guide you to the other dimension (this option will be available only after the event on act 3). In the other dimension you have a permanent state of dizziness and imbalance. There you will meet a tribe who, due to spatial-temporal anomalies, they have no notion of time.

Boss 9: This tribe has been partially dominating the ethereals around them but, accidentally, one of their shamans has absorbed one of the middle servants. After killing him, you catch the ethereal.

SQ6: You get informed in the village about a mask that can filter the air of that atmosphere. The air in that world is sometimes incompatible with yours and you need that mask to be more efficient in the battles of that world.

Boss 10: Another huge ethereal. This can break through walls and disappear.

SQ7: you can get a very useful weapon to face the ending.

21 Forsaken, The last Remnant

ACT V: When you have collected the five souls, you gather in a mountain with a portal. The deity talks through it and conjures a magic spell with the five souls. The portal gets brighter and the deity invites you to enter. There, you find your sister chained and transformed into an aberration, but it slightly conserves the human look. After you have entered, the portal closes behind you and, of course you demand an explanation to all of that. The deity shows up and explains that an ethereal possessed her sister a year ago. It was a very special ethereal for the deity, her major servant, her right hand, or even more. She swore to protect it at all cost and she had to look for a weak body (the sister) to install him and make him survive.

Now she grabs the five souls of the creatures without your consent and makes your sister feed on them. The deity tells that the major servant was weak in your sister’s body, but thanks to you she will be stronger. You realise that you have been betrayed and the deity has used you all the time to collect those souls just to feed them to your sister.

Boss 11: After feeding on those souls, your sister experiments a huge transformation into a grotesque figure. Following this, the deity wants you to disappear from existence because you have earned enough power to face it and she orders your sister/monster to kill you. The battle will be the most difficult of the game and you will be left completely weakened, as well as your sister.

Boss12: When you both are just a hit away from dying, there are three options to get an ending. Two of them are primary and the third can only be unlocked if you have completed a specific secondary mission.

● First ending: you decide to kill your sister and ending the life of both her and the major servant and the five more souls that live inside her. The deity is so mad at you that tries to kill you but, after having the hardest encounter of the game, you defeat her. After killing the deity, both the ethereals and the aberration, including also the minor servant, disappear. Because the deity controlled the souls world and with no deity the cannot sustain themselves. You save humanity by doing that because there is no more inhuman threats but you lost your sister.

● Second ending: you decide to beg the deity to swap positions with her just for the sister to be alive. The deity accepts knowing that you are so powerful that you could be the definitive aberration and trespasses all the ethereals into your weakened body. But while assuming your new parasites, you take advantage and confront the deity while you have conscience. You defeat the her. After killing the deity, both the ethereals and the aberration, including also the minor servant, disappear. That includes you, because you have assimilated the souls and you will disappear with them. You save humanity by doing that because there are no more inhuman threats but your sister will live alone without you.

● Third ending: You decide to give the experimental serum that separates humans from ethereals and it works. After that the deity and the six souls will fight with both of you. You both will kill the deity and the souls will disappear, as well as the minor servant and the aberrations. You both live to watch how humanity is safe from this inhumane threat.

22

3.2.- Playability 3.2.1.- Keyboard inputs Action mapping:

● Jump: Space bar

● LightAtack: Left Mouse Button

● LightMagic: Right Mouse Button

● SheathSword: Tab key

● Dodge: Q key

● HeavyAttack: Left Mouse Button + Left Shift key

● HeavyMagic: Right Mouse Button + Left Shift key

● Pickup: E key

● ThrowObject: R key

Axis mapping:

● MoveForawrd

○ Move forward: W key and Up key

○ Move backward: S key + Down key

● MoveRight:

○ Move right: D key

○ Move left: A key

● TurnRate:

○ Turn right: Right key

○ Turn left: Left key

● Turn: Mouse X axis

● LookUp: Mouse Y axis

23 Forsaken, The last Remnant

3.2.2.- Controller inputs Action mapping:

● Jump: Left Thumbstick button

● LightAtack: Right Trigger

● LightMagic: Left Trigger

● SheathSword: Face button top

● Dodge: Face button right

● HeavyAttack: Right shoulder

● HeavyMagic: Left shoulder

● Pickup: Face button bottom

● ThrowObject: Face button left

Axis mapping:

● MoveForawrd: Left thumbstick Y-Axis

● MoveRight: Left thumbstick X-Axis

● TurnRate: Right thumbstick X-Axis

● LookUp: Right thumbstick Y-Axis

24

3.3.- Player mechanics This game is based in a level up fighting system, where the character only can level up by killing enemies.

Also kill enemies are used in the weapon skill system, that means that, players can play as they like, where on more you use some kind of weapon, the better you become using it, this is also applied not only on melee weapons also on magic and ranged weapons. 3.3.1.- Character Stats ● Life: the amount of life the player has, when it runs to zero, player dies. The life is recovered by time, but is slow, or consuming items like food

: the amount of mana player has no mana no spells. Mana recovers by time also like life, but a little bit faster, or using some items

● Stamina: the amount of stamina player has no stamina no physical abilities, such as dodge or heavy attacks. Stamina recovers same as Mana

● Weapon skills: depend on character level on weapon skill you can use better weapons more efficiently, if the player tries to hit enemies with a higher level of weapon that player has, there are more probability to miss the attack

○ Pointed weapons: such as spears pikes …

25 Forsaken, The last Remnant

○ Edged weapons: such as swords, axes, daggers….

○ Blunt weapons: clubs, maces, hammers...

○ Distance weapons: guns, bows...

3.3.2.- Talent Tree The talent tree, which is one of the main features of a role game, is focused on adapting the game to the player style.

Each style will have advantages and disengages in different points of the game but all of them will be funny and give a nice challenge to the player.

He can focus on magic based game upgrading Mana and Intelligence, melee style with heavy damage but low speed attacks focusing on Strength and Life or the opposite side faster attacks but lighter or even a mix of all of them.

● Life: augment the life capacity and augment regeneration.

● Strength: is used both for physical power for melee weapons, carry capacity and augment life regeneration.

● Intelligence: is used for magic power and augment mana regeneration.

● Mana: augment mana capacity and regeneration.

● Agility: is used to augment attack speed and augment stamina regeneration.

● Stamina: augment stamina capacity and augment regeneration.

26

3.3.4.- Actions ● Walk: normal movement player uses to move around the world

● Run: faster than walk but it consumes stamina

● Attack: different kinds of attacks, explained after

● Dash: player can dash in 4 directions for dodge enemies attacks, consumes stamina

● Climb: used for climb some short distances

● Jump

● Pick-up objects: player can pick up differents kinds of objects, such as weapons, utility objects like food and drinks, or “inutile” objects that only can be used to throw as distraction.

● Use objects: use objects explained before

● Throw objects: you can throw all objects you have including your weapons. Some of them are going to do a lot of damage like pointed weapons, others weapons can do dmg but not as much as pointed ones, and then small objects that only distract enemies or do a little damage.

● Receive damage: you can receive damage by enemies or by the environment (such as fire or fall long distances)

● Die: when a player runs out of life he dies, and can revive in last checkpoint player has achieved

27 Forsaken, The last Remnant

3.3.5.- Attacks

● Magic:

○ Magic blast: small and cheap magic but only hit one enemy.

○ Magic area attack: hughe and costly magic attack but hits an area and deals more damage.

● Physical attacks, one or two handed

○ Light hit: fast and light single atack no stamina cost

○ Light combo: fast combo, no stamina cost

○ Heavy hit: single slow heavy attack with low stamina cost but high damage

○ Heavy combo: slow heavy combo with higher stamina cost but very high damage

● Ranged:

○ Shoot: can shoot different weapons like guns or bows, or throw weapons like spears 3.4.- Enemy Mechanics 3.4.1.- Enemies For the game we designed 2 different kinds of enemies. The first enemy uses physical attacks, and the second uses magic attacks.

28

To make the enemies less repetitieve we tried to give every enemy differents personalities. Every enemy can have random given nature. An Enemy can be:

● Passive:​ The enemy will attack the player only when the player is on range. Depending on the class of the enemy, the range of the attack may change.

● Aggressive:​ Once the enemy sees the player it will start to attack without hesitation. So the player must look for a different way to approach the enemy.

● Coward​: If the enemy finds himself low of health point, it will try to run away from the player.

● Brave:​ The enemy will not care if it is low on health, it will continue attacking the player.

So, in this way, the player must approach every enemy in different forms, and will not feel repetitive every time if face the enemies.

Another way to force the player to approach the enemies in different ways is the initial state the enemy starts. The enemy can start in two different states:

29 Forsaken, The last Remnant

● Still:​ The enemy will not move until the player enters inside it’s field of view. Once it sees the player, it will start to pursue and attack the player.

● Patrolling:​ The enemy will be patrolling the area, walking to random points, until it the player enters into its field of view.

The enemies are also able to detect from where they are they are hit. When it feels the hit, it will rotate to face the point where it felt the hit.

For the enemy to have the ability to see the world we will give it a sight radius of 30 meters and a peripheral vision angle is 90 degrees. This way the player will still be able to sneak behind, but the enemy will also be able to have a big field of view of the world to make it a little difficult the sneaking.

When the enemy is patrolling around the map, its walking speed will be slow, but once it started pursuing the player its speed will increase drastically. 3.4.2.- Boss The boss is a floating skull of a deity. This boss can only be hurt by physical attacks on its skull. While magic attacks will only make the boss faint after losing all its magic shields.

To show the deity’s health point, we tried to make it as organic as possible, using the smoke that comes out off its skull. By losing health points, the smoke will start to get hotter making

30

the boss look angrier. To show also its magic resistance, the boss will have some spheres orbiting around its head. This sphere represents the deity’s magic shields.

3.4.2.1.- Boss Attacks This boss will have three different attacks. One is a physical attack, and the other two are magic attacks.

● Infernal Horns​: this physical attack consists of the boss trying to charge against the player. When the boss arrives to the ground it will stay there for two seconds, giving a chance to the player to hit it. While the boss is charging, it will be immune to magic attacks. To give a hit to the player that the attack starts, the boss is going to rotate a little bit before charging. This attack takes 20 basic health points from the player.

● Explosive Fire Meteorite:​ this is the basic magic attack of the boss. The boss throws a fast projectile to the player that explodes on impact. It is a fast and precise attack, difficult to avoid. This attack takes 30 basic health points from the player.

● Fire Missiles Crawlers​: this attack is the special magic attack of the boss. Consist on the boss throwing 10 missiles that follows the player, even if the player moves. The missiles go leave the boss in an unorganized formation to trick the player where it is going to hit. Every missile take 10 basic health points from the player Iife very missile hits the player the damage can go up to 100 health points.

31 Forsaken, The last Remnant

3.4.2.2.- Boss Fight When the player sees the boss, it will be in the ground. Once the player gets near enough, it will start to rise and spread its smoke and activate its magic shields. The player will have to make the boss falls to the ground to be able to hit it and cause some damage to the boss.

Every time the boss receives a magic hit, a sphere will disappear. After losing all its spheres, the next time the boss gets hit, it will faint and fall to the ground. Once it recovers from the fall, the boss will restore its magic shields, and the player will have to destroy again all the shields with its magic attacks.

While the boss is lying down on the ground, the player will have to take advantage of it and try to hit it with its physical attack. The boss is only going to be on the ground for 2 seconds, if the player takes too long, the boss will rise again without receiving any damage.

Depending on its health points, the boss will go through three phases. Every phase will change the boss behaviour.

● The first phase will take the first 20% of the boss health points. Through this phase the boss will only attack with the Infernal Horns attack. This way we can show the player that the boss can be hurt will it is on the ground. The deity will attack randomly between every 7 and 10 second, so the player can not exactly predict when the boss will attack every time. This will be the shortest phase.

● In the second phase, the boss will combine some basic magic attacks with some physical attack. It will attack more often with its Explosive Fire Meteorite, but from time to time the boss will use the Infernal Horn attack. The physical attack will decrease so that the boss can avoid being hit be the player. The boss movement speed will increase, and also the frequency of the attacks will be shorter, between 5 and 7 seconds. This phase will go through the next 30% of the boss’s health points.

● The third and last phase of the boss, will be the last 50% of its health points. In this phase will also increase the boss movement speed and make even shorter the time between the attacks. This time the attacks are going to be between 3 and 5 seconds. In this phase the boss will stop attacking its physical attack, the Infernal Horns, and it will only use its magic attacks Explosive Fire Meteorite and Fire Missiles Crawlers. This way the boss will avoid the possibility of being hurt by the player when it is on the ground.

Once the boss gets defeated, it will ascend will exploding and once its on top it will make a bigger explosion.

32

Designing the boss fight this way allows us to show the player all the basic attacks the main character is able to use. The player must be able to switch fast between physical and magic attack through all the fight against the boss. Making the boss fly in the air and only reachable by magic attacks, will force the player to learn aiming the magic spells. And giving a small window of time to attack the boss when it is on the ground makes the player to get used to change from magic to physical attack fast, and prepare different strategies to defeat the boss.

33 Forsaken, The last Remnant

3.5.- Characters 3.5.1.- Main Character (Player) You are the main character, you in charge of every decision you make. Being born after the catastrophe and left alone with his sister, you both were raised by a small tribe. At the beginning his abilities are average and they keep increasing while you progress in the game. 3.5.2.- Liza {|laiza|}, your sister Raised by a small tribe, with you. She is a bit smaller than you, but that doesn’t stop her from being brave, and rather reckless. While having fever, she was “possessed” (a bit more than a year before the story starts) by a minor spirit (which is in fact a servant of the deity), which is slowly controlling her body, but without reaching the completion thanks to the lack of souls intake. 3.5.3.- Deity It’s still in the Otherworld, so you can only see it going through an interdimensional gate. Due to its ancient and unbreakable connection with the living creatures, it’s currently very weak, with its power diminished at half. Before the nuclear disaster, it was powerful but rather impartial, and it had a frequent souls income because of the natural life cycles of the living creatures.

In order to survive now, it needs the souls that the aberrations are trapping inside themselves (or humans). It doesn’t speak your “vocal” language; it speaks to your soul directly. 3.5.4.- Ethereals and aberrations Ethereal beings that need a physical body to be able to stay at the humans’ dimension. After getting a human body, they turn into aberrations and have to feed on souls, otherwise they can’t completely control the body they’ve taken, because the entities aren’t compatible. They either kill or take dead bodies. The bodies start deforming as soon as they start feeding on souls. Repetition of random elements (bells, eyes, horns) means rank. Two of the enemies (shown in the game) are occupied bodies, and the third one hasn’t found a body yet, so it’s desperate to find a body, therefore more aggressive and impulsive. 3.5.5.- Major Servant The ethereal that’s inside Liza. It’s one of the most important servants of the deity, who wants the Major Servant to survive, either in the Otherworld or in our dimension, by filling a human body. It’s been practically lethargic but some months ago it started to wake up, and

34

it’s pretty hungry. As soon as it got expelled from its dimension, the deity guided it to the nearest weakest living body, which was your sister’s, in order to have a sustenance until it wakes up completely. 3.5.6.- Minor Servant As it’s a minor form of an Ethereal (therefore weaker and less aggressive), the deity didn’t put it in a body, but in a conglomerate of objects. Despite being marginalized and underrated, it is quite intelligent, and has learnt some tribes’ language, including yours, as well as information from both dimensions. It will be your sidekick (not directly the comedic type, but it will use wrong words sometimes (another language or a word out of context)) and will be the messenger between you and the deity.

35 Forsaken, The last Remnant

4.- Art 4.1.- 2D Art

4.1.1.- Concepts

36

37 Forsaken, The last Remnant

4.1.2.- Character design

38

39 Forsaken, The last Remnant

40

41 Forsaken, The last Remnant

42

4.2.- 3D Art 4.2.1.- First Cell Shading tests

43 Forsaken, The last Remnant

4.2.2.- Final Shader

44

45 Forsaken, The last Remnant

46

47 Forsaken, The last Remnant

5.- Results

The results showed have achieved the objectives we have set and draw a clear line of growth for the future.

Just to remember them were design an RPG soul like games, make a small prototype, learn a lot of the workflow in Unreal Engine and work in a team.

Despite all the problems we have found along the way, we are happy with the results we have obtained.

We managed to have our main goals done, a playable prototype that we can show as portfolio on a job interview, win experience as game developers and work with a huge team. 5.1.- Future Lines Once the TFM is finished and delivered, our objective is to finish the prototype with some more content and release it on Itch.io, and share it in our social media networks, like Twitter, Instagram and personal LinkedIn to get feedback and opinions. Also, this will also help the artist team to deliver this project for their TFG.

When we have enough feedback, we are going to see what we do next, there are two options, try to finish the game or give up.

If we see that there are interest in our project and it can have acceptance we plan to launch a crowdfunding campaign on Kickstarter, IndieGoGo for example. Then use this founds to do a great push and have more or less finished game to search for a partner that helps us in the release with some inversions and know how.

But, if we see that our project has 0 impact or no one is interested in that game, we thought to do some final polish and keep it as small prototype for demo real purposes.

48

6.- Personal Conclusion

My main objective for this were inquire more about Unreal Engine, work on a video game AI and work with a team. Personally I think all this objective were full fill during the project.

For the first objective, I wanted to continue learning about UE4 after starting learning it in class. I felt the need to continue improving on this subject because this engine is one of the most used in the industry and learning more about it could impulse my career. During this project I think I’ve been able to continue learning about this engine, and so checking this objective.

On the second objective, I’ve been always interested in Artificial Intelligence, especially in video games. So this was a great opportunity to start learning about it. With UE4 I could work with behaviour trees to set an AI for the enemies , so this way I could work on the first two objectives at once.

For the last objective I set for myself was to work on a team to deliver a video game, gratefully I found Marc and the artist team to work on this project. It was a challenge the work together because of the different schedules we all had, but, at the and, I think we manage to create a simple pipeline that made possible to finish it.

At the and we probably didn’t made an extensive game, but we manage to finish a playable level that showcase the main gameplay I wanted for it.

49 Forsaken, The last Remnant

7.- Bibliography

[1] «Pegi,» [En línea]. Available: https://pegi.info/

[2] «Wikipedia rol game,» [En línea]. Available: https://en.wikipedia.org/wiki/Role-playing_video_game

[3] «Techopedia,» [En línea]. Available: https://www.techopedia.com/definition/27052/role-playing-game-rpg

[4] «Bandai namco Dark Souls,» [En línea]. Available: https://es.bandainamcoent.eu/dark-souls

[5] «Wikipedia World of Warcraft,» [En línea]. Available: https://en.wikipedia.org/wiki/World_of_Warcraft

[6] «Wikipedia Legends of Zelda BOW,» [En línea]. Available: https://en.wikipedia.org/wiki/The_Legend_of_Zelda:_Breath_of_the_Wild

[7] «Nintendo,» [En línea]. Available: https://www.nintendo.es/

[8] «Kickstarter Little Devil Inside,» [En línea]. Available: https://www.kickstarter.com/projects/ldi/little-devil-inside

[9] «Ashen,» [En línea]. Available: https://www.ashen-game.com/

[10] «Unreal Engine,» [En línea]. Available: https://www.unrealengine.com/en-US/

[11] «Unity 3D,» [En línea]. Available: www.unity.com

[12] «Mixamo,» [En línea]. Available: www.mixamo.com

[13] «Maya,» [En línea]. Available: https://www.autodesk.es/products/maya/overview

[14] «Substance painter,» [En línea]. Available: https://www.substance3d.com/

[15] «Adobe Photoshop,» [En línea]. Available: https://www.adobe.com/es/products/photoshop.html?gclid=CjwKCAjwldHsBR AoEiwAd0Jybf_oI2bPxbOBaXNhuEzB9Nl8kIf5T0T83sGavkWlrjnynEPACjy7MRo COCAQAvD_BwE&sdid=8DN85NTQ&mv=search&ef_id=CjwKCAjwldHsBRAoEiw Ad0Jybf_oI2bPxbOBaXNhuEzB9Nl8kIf5T0T83sGavkWlrjnynEPACjy7MR

50

9.- Attachment 1: Behaviour Trees on UE4 9.1.- AI Controller

The job of the AIController is to observe the world around it and make decisions and react accordingly without explicit input from a human player.

In this project the AI Controller will run the BT of the enemies. 9.2.- UE4 AI UE4 has a powerful tool for creating Artificial Intelligence. This tool consist in the combination of two assets types: Blackboards and Behaviour Trees. 9.2.1.- Blackboard The Blackboard is the AI's memory. It stores key values for the Behavior Tree to use. 9.2.2.- Behaviour Tree The Behavior Tree is the AI's processor. It makes decisions, and then acts on those decisions.

51 Forsaken, The last Remnant

The UE4 Behaviour trees are event-driven. It mean that instead of constantly checking whether any relevant change has occurred, the behavior trees just passively listen for "events" which can trigger changes in the tree. This way it avoid doing lots of work every frame.

The UE4 behavior tree systems contain four types of nodes. Composite nodes, Task nodes, Decorator nodes and Service nodes. 9.2.3.- Composite Node

52

Composite nodes are the most basic nodes included in the BT. Every tree starts with one root node which can only have one connection to another node. This node does nothing but work as the root of the tree. Connected to this is, in all but the most basic of behavior trees, another composite node. In the Unreal Engine’s case this second node can be one of three kinds:

● Selector node: This nodes execute their children from left to right, and will stop executing its children when one of their children succeeds. If a child succeeds, the Selector succeeds. If all the children fail, the Selector fails.

● Sequence node: This nodes execute their children from left to right, and will stop executing its children when one of their children fails. If a children fails, then the Sequence fails. If all the children succeed, then the Sequence succeeds.

● Parallel node: This node executes a task until completed and at the same time it can also run a subtree of nodes simultaneously.

Using these nodes as the building components of the tree, it is possible to have the tree grow quite complex once conditions other than tasks failing or succeeding are being set to determine which branches of tree the current program traverses down. 9.2.4.- Task Node

These nodes are the end of the path. These nodes contain either the functionality itself or call other classes functions. In addition to containing functionality they also return a true or false Boolean value indicating whether or not it succeeded or failed. The tree can be structured so that the execution path changes based on this, either continuing down another branch or going back further up the current branch. 9.2.5.- Decorator Node

53 Forsaken, The last Remnant

This nodes are used as conditionals for the nodes below. The result of this nodes, true or false, determine whether or not the execution of the path can continue down the subtree. It also determine if the node is successful or not. At the end, the decorator nodes are where most of the functionality of the BT is located. 9.2.6.- Service Node

Their main purpose is to update values within the BT. They can only be placed below composite nodes. This nodes are useful for handling values are constantly being updated, and so we can avoid using task nodes for changing some specific values.

54

10.- Attachment 2: Forsaken AI 10.1.- Enemies

10.1.1.- Parent Enemy

10.1.1.1.- Enemy Animation The enemies have the next base animations:

● Walking animation​: This animation is played when the enemy is walking in a slow speed.

● Running animation:​ This animation is played when the speed of the enemy increase. This animation is blended with the walking animation, so the enemy can have different moving speeds animations.

● Idle animation​: This animation is played when the enemy is not moving.

● Melee attack animation:​ This animation is played when the enemy try to hit the player with a physical attack. It throws a notification that indicates when the weapon can cause damage and when it should stop causing damage.

● Magic attack animation:​ This animation is played when the enemy cast a magic spell to attack the player. It also throws a notification that indicates when the magic spell should be spawned.

● Hit Animation:​ This animation is played when the enemy receive a hit.

● Falling animation:​ This animation is called when the enemy is in the air falling.

● End falling animation​: This animation is called when the enemy touches the ground after falling.

● Death animation​: This animation is played when the enemy dies.

10.1.1.2.- Enemy Base Class Core Functions:

● SetSpeed​: Function that sets the enemy speed. It also controls if the enemy is dead to set the speed to zero. It is called when the speed of the enemy changes.

55 Forsaken, The last Remnant

● SetBlackboard:​ Function that set the blackboard variable, so the class can access to its Blackboard to change the variables of the behaviour tree that controls the enemy.

● StartDying​: This function controls the tempos of the death of an enemy. It give time to the death animation of the enemy to finish, before destroying it from the game.

● AnyDamage: This function is called when the enemy receive any damage. It starts the hit animation and change some variables from the behaviour tree. These variables are the “IsInvastigating”, “ImpactPoint” and “PlayerObject”. And at the end of the function, the TakeDamage function is called.

● HitReceived:​ This function starts the hit animation of the enemy.

● TakeDamage​: This function subtract the damage received from the HP. The if the HP goes 0 it will set the “IsAlive” variable to false. If the HP is still above 0, then it will check if the HP is below the MinHP threshold and setting the “LowHealth” variable of the behaviour tree.

● SetPersonality:​ This function sets the different natures of the enemy. If is set to set the personality randomly it will call the SetRandomPersonality function. If not it will set the variables responsible to tell the behaviour tree the personality of the enemy that are given by default.

● SetRandomPersonality:​ This function sets the variables responsible to tell the behaviour tree the personality of the enemy randomly.

● IsViewBocket​: This function will throw a line trace to detect if there is something in front of the enemy at a given distance. It returns a boolean, true if there is something in front or false if there's nothing in front.

● DoJump​: This function calls the Unreal Engine function “Jump” that add an impulse to the given character, this case or enemy character, to make it jump.

Variables:

● Hand​: This is a scene component that is attached to the enemy hand bone. If the enemy uses physical attacks, here is where the weapon would be attached.

● ArrowFW:​ This arrow component is used to show where the enemy body is facing. It will help to determine if something is in front of the enemy.

● Weapon​: If the enemy holds a weapon, this is where the reference of the weapon will go.

● HP​: This float variable represent the actual health points that the enemy still have.

● MaxHP​: This float variable tells the maximum health points the enemy can have. It is used to tell how many HP has the enemy when it is deployed.

● MinHP​: This float variable tells us where the low health starts in the enemy.

● Dead?​: This boolean variable tells us if the player is dead. If is set to true it means the enemy is dead, if it is set to false, the enemy is still alive.

56

● MagicPower:​ This float indicates the base damage of the magic spell that the enemy can invoke.

● Strength​: This float indicates the base damage of the enemy that can induce with a physical attack.

● BlackBoard​: This blackboard component is a reference to the blackboard of the behaviour tree that controls the enemy.

● BB_IsInvestigatingName:​ This string contains the name of the key “IsInvestigating” of the blackboard.

● BB_ImpactPointName​: This string contains the name of the key “ImpactPoint” of the blackboard.

● BB_IsAlive:​ This string contains the name of the key “IsAlive” of the blackboard.

● BB_PlayerObjectName​: This string contains the name of the key “PlayerObject” of the blackboard.

● BB_WaitToStartName​: This string contains the name of the key “WaitToStart” of the blackboard.

● BB_ScaredName:​ This string contains the name of the key “Scared” of the blackboard.

● BB_AggressiveName​: This string contains the name of the key “Aggressive” of the blackboard.

● BB_IsViewBlocketName:​ This string contains the name of the key “Name” of the blackboard.

● WaitStart​: This boolean indicates if the enemy starts waiting before moving or start patrolling right away.

● Scared:​ This boolean indicates if the enemy is a coward or if it is brave when facing the player.

● Aggressive:​ This boolean indicates if the enemy approaches the player in an aggressive way.

● RandomPersonality​: This boolean indicates that the personality of the enemy is set randomly.

● LineDistance:​ This float indicates the minimum distance an object can be in front of the enemy before considering if that object is blocking the view of the enemy.

10.1.1.3.- Enemy Base AI

10.1.1.3.1.- AI Controller To control the enemies of the game with the behaviour tree given by Unreal Engine, we will need an AI controller to be able to control the enemies. These are the functions and variables of this controller.

57 Forsaken, The last Remnant

Functions:

● OnTargetPerseptionUpdate:​ This function jumps when the enemy sense an Actor in front of it. If what the enemy is sensing is the player, then it tells the behaviour that the enemy can see the player with the blackboard variable “CanSeePlayer”. Also, this function, after setting that it has seen the player it will set the variable of the blackboard “WaitToStart” to false.

● SetOwnedPawnSeed:​ This function its called to set the controlled enemy speed.

● StartController​: This function is called when an enemy starts in the game to initialize all the controllers components. First, a reference of the controlled enemy pawn is saved, and after that it sets that enemy blackboard with the blackboard this controller uses to communicate with the behaviour tree and then sets the blackboard “IsAlive” variable as true, to indicate that the enemy is alive.

● SetWaitToStart:​ This function sets the blackboard variable “WaitToStart” by the given value.

Variables:

● AIPerception​: This AIPerception component is use to define what sense the enemy is using, in our case is using only the sight sense. Here we define the enemies sight radius where the enemy can see the player. Right now the enemy can sense the player in a radius of 30 meters. Also we defined the lose sight radius at 35 meters, so if the player leave that radius the enemy will lose sight of the player. And we also defined the peripheral vision of the enemy at 90 degrees, so the enemy can see almost everything except its back, so the player can sneak behind.

● MyPawn:​ This variable has a reference to the controlled enemy. 10.1.2.- Physical Enemy The physical enemy is an aberration that only attacks with physical attacks. As a weapon they usually use draining pipes to hit the players. It inherit from the Base Enemy all its functions and variables.

10.1.2.1.- Physical Enemy Class Core Functions:

● BeginPlay:​ This function is called when the enemy starts playing. The first thing the function does is spanning the controller that will control it and call the “StartController” function, that we defined in the previous section, to initialize all the controllers components. Then we set the enemy health points and set its personality. After that we spawn the enemy weapon, set all the weapons parameters, and, to finish the initialization we attach the weapon to the enemy hand.

● MeleeAttack​: This function is called when the enemy wants to attack. First it checks if the enemy is not still playing the melee attacking animation. If is not playing the animation it will start it.

58

Variables:

● IsAttacking:​ this boolean value indicates if the enemy is in the middle of a melee attack animation. When the enemy attacking animation is playing the value is true, when is not animating then is false. This function also controls the notifications that the animation throws, to indicate when the weapon can cause damage.

10.1.2.2.- Weapon Class This class consist in the weapon that the enemy will hold when it attacks the player.

Functions:

● BeginPlay:​ This function starts the weapon by setting the IsAttacking variable to false, meaning that the weapon is not use to attack right now.

● SetWeaponOwner​: This function save the reference of the owner of the weapon in the Owner variable.

● SetWeaponDamage​: This function set the damage the weapon could cause. It adds the weapon base damage with the owner’s power and is saved in the WeaponDamage variable.

59 Forsaken, The last Remnant

● StartAttack:​ This function sets the IsAttacking variable to true, this will mean that the weapon is being used to attack.

● EndAttack​: This function sets the IsAttacking variable to false, this will mean that the weapon is not being used to attack anymore.

● ComponentBeginOverlap​: This function jumps when the Capsule component is overlapping an object. First it will check the isAttacking variable to see if the weapon is being used to attack, if not it will stop here. If is being use to attack, it will check if the object that is being overlap is itself. If is not itself it will call the function ActorBeingHit and finish the hit by setting to false the isAttacking variable.

● ActorHitBegin:​ This function calls the ApplyPointDamage of the object that is being overlap by the weapon, and will send it the WeaponDamage variable value.

Variables:

● OwnerActor​: This is a referent of the object that is holding the weapon.

● IsAttacking:​ This boolean checks true if the weapon is being used.

● WeaponBaseDamage​: This float constant holds the base damage that the weapon can produce.

● WeaponDamage:​ This float contains the total damage that the weapon could produce.

● Scene:​ This scene component is used to set the pivot point of the weapon.

● Capsule​: This capsule component is used to detect if the weapon is hitting something.

● Mesh​: This mesh component contains the mesh of the weapon.

10.1.2.3.- Physical Enemy AI

10.1.2.3.1.- AI Controller This AI controller inherit all the functions and variables from the Base Enemy AI Controller.

Function:

● BeginPlay:​ In this function we set the enemy behaviour tree that will control the behaviour of the enemy.

60

10.1.2.3.2.- Behaviour Tree

For the physical enemy we have the following BT:

First we check if the enemy is dead or alive. If the enemy is alive it will check if the enemy can see the player or not.

If the player can see the player, it will check its health. While the enemy is healthy and has seen the player, depending of its nature giving at the beginning, it will start attacking aggressively or less aggressively. If its aggressive it will start attacking in the moment it sees the player.

When the enemy is not aggressive by nature, it will wait to attack until it is in range to hit the player. If it is not in range it will not attack, but if it is in range, it will.

If the enemy is low in health, then it will check if its a coward or tough. If the enemy is tough it continue fighting like when it is healthy. But if it is a coward it will run away from the player.

61 Forsaken, The last Remnant

If the enemy can not see the player, then it will search the player after a receiving a hit, that will make the enemy look its back to see if the player is there. If the enemy has not receive any hit it will be searching for the player.

If the enemy has lost the player it will run to three different location as fast as possible looking for the player. After looking for the player and not finding it the enemy will not look for it anymore. If the enemy has not saw the player it can be idling by patrolling around the map or just waiting still.

If the enemy is dead it will start all the death sequences and destroy the enemy.

BT Nodes

● Task Nodes

○ BTTask_BP_ChangeState:​ change the actual state of the enemy.

○ BTTask_BP_FindPlayerLocation​: get the actual players location in the world and save it on the TargetLoaction key.

○ BTTask_BP_ChasePlayer​: use the TargetLocation key to move the enemy to that location.

○ BTTask_BP_MeleeAttack:​ throws the enemy attack action.

○ BTTask_BP_GetRetreatLocation:​ get a location for the enemy to retreat. It takes the enemy position and the players forward vector, adds them and from that point takes a random point of a radius of 5m form the point and save it on the TargetLocation key.

○ MoveTo:​ use the TargetLocation key to move the enemy to that specific location.

○ BTTask_BP_SearchForPlayer:​ set the TargetLocation key with a point inside a 3 meters radius from the players position.

○ RotateToFaceBBEntry:​ rotate the enemy until facing the giving point inside the TargetLocation.

○ BTTask_BP_GetRandomWaitTime:​ get a random time in a given range and save it on the WaitTime key.

○ WaitBlackboardTime:​ use the WaitTime key to wait the given time.

○ BTTask_BP_FindRandomLocation​: get a random point inside the radius around the enemy and save it on the TargetLocation key.

○ BTTask_BP_Die​: start the enemy death sequence.

● Decorator Nodes

○ BlackboardBasedCondition

■ IsAlive​: this condition checks if the enemy is alive or is dead. If it’s alive does stuff, if not just stay still and do nothing.

62

■ CanSeePlayer​: this checks if the enemy can see the player in the distance.

■ LowHealth​: this condition checks if the enemy has low health.

■ Aggressive​: this checks if the enemy is aggressive and attacks even though the player is out of range, or just attacks when the player is in range.

■ Scared:​ this checks if the enemy is scared when it on low health. If it’s scared it tries to run away from the player, if not, it attack normally, just depending if it’s aggressive or not.

■ IsInvestigating:​ this checks if the enemy has been hurt and starts to investigate where the hit came from.

■ WaitToStat:​ this condition checks if the enemy starts resting or starts patrolling.

■ State equals to Chase:​ check if the state of the enemy is Chase.

○ Loop:​ loops the sequence of searching the player three times.

● Service Nodes

○ BTService_BP_SetSpeed:​ service that change the walking speed of the enemy.

○ BTService_BP_GetPlayer​: service that get the object reference of the player.

○ BTService_BP_IsInRange​: service that sets the IsInRange key if the player is in the attacking range of the enemy.

● Blackboard keys

○ IsAlive:​ is a boolean that checks if the enemy is alive.

○ CanSeePlayer:​ is a boolean that checks if the enemy is seeing the player.

○ IsInRange:​ is a boolean that check if in range for an attack.

○ WaitToStart:​ is a boolean indicating the enemies start condition. If it starts still or if it start patrolling

○ Scared:​ is a boolean indicating if the enemy gets scared from the player when it’s health is low.

○ Aggressive​: is a boolean that indicates how the enemy approach the player. If is set, the enemy does not wait to be in range to attack the player. If is not set, waits to be in range to attack the player.

○ LowHealth:​ is a boolean that check if the enemy has low health.

○ IsInvestigating​: is a boolean that indicates if the enemy is investigating where the player is.

63 Forsaken, The last Remnant

○ State:​ is an enum with the state of the enemy. The states that the enemy can have are:

■ Patrol​: this state is when the enemy is patrolling through the world.

■ Chase:​ this state is when the enemy is chasing the player.

■ Beaten:​ this state is to indicate that the enemy has received a hit from the player.

■ Rest​: this state is for when the enemy is resting after waking from a point to another.

■ Retreat:​ this state indicates that the enemy is running away from the player, because it saw the player and it is low in health.

■ Search​: this state is indicates that the enemy is looking for the player after losing it from sight.

○ TargetLocation:​ is a vector variable with a position in the world.

○ WaitTime:​ is a float that indicates the time to wait.

○ IsViewBlocked​: this boolean will tell us if there is any object blocking the enemy view.

○ PlayerObject:​ is an object reference to the player.

○ SelfActor​: is an object reference to the enemy. 10.1.3.- Magic Enemy The magic enemy is an aberration that only attacks with magic attacks. It cast spells and throw them at the player. Like the Physical Enemy, it inherit from the Base Enemy all its functions and variables.

This kind of enemy needs to cooldown after casting a magic spell. So it will only be able to throw magic spells every few second.

10.1.3.1.- Magic Enemy Class Core Functions:

● BeginPlay:​ Like in the Physical Enemy, this function is called when the enemy starts playing. The first thing the function does is spanning the controller that will control it and call the “StartController” function, that we defined in the previous section, to initialize all the controllers components. Then we set the enemy health points and set its personality. In this case we don’t need to spawn its weapon like in the Physical Enemy.

● MagicAttack:​ In this function we control the magic attack. It is called every time the enemy starts attacking with magic attacks. First of all it start the magic attack animation and set the variable “Cooldown” of the blackboard, so the behaviour tree

64

knows that the enemy is cooling down after casting the magic spell. When the animation throw the notification “Attack”, we are going to spawn the magic spell with the function SpawnMagicSpell and start the timer of the cooldown. When the timer ends, it will call the function CooldownEnd.

● SpawnMagicSpell​: This function will spawn the magic spell and throw it to the player by adding it an impulse. The direction of the spell is calculated by the function GetMagicSpellDirection.

● GetMagicSpellDirection:​ To calculate the direction of the magic spell we subtract the location of the player to the location of the enemy. After the subtraction we normalize the result and that is the direction vector of the spell.

● CooldownEnd:​ This function is called once the cooldown time ends. It restart the variable “Cooldown” of the blackboard, so it can tell the behaviour tree that the enemy is not cooling down anymore.

Variables:

● MagicSpell​: This variable save the reference of the spawned magic spell.

● SpellImpulse​: This float is use to set the magic spell impulse when the magic spell is thrown.

● BB_Cooldown​: This string saves the name of the blackboard variable “Cooldown”.

● CooldownTime:​ This float contains the time it takes to the enemy to cooldown after throwing a magic spell.

● CooldownHandler:​ This variable is the handler of the timer that set the cooldown time of the spell.

10.1.3.2.- Magic Spell Class This class consist in the magic spell that the enemy will throw to the player.

65 Forsaken, The last Remnant

Functions:

● BeginPlay:​ This function is called when the spell is cast. It starts the timer that controls the lifetime of the spell:

● DestroySpell​: This function is called when the lifetime of the spell ends. It clears the timer handler and destroys the spell.

● EnableOverlap​: This function is called to set the OverlapEnable variable to true. So the spell can hit objects.

● SetSpellOwnerr:​ This function save the reference of the owner of the spell in the SpellOwner variable.

● SetSpellPower​: This function set the damage that the spell could cause. It adds the spell base damage with the owner’s magic power and is saved in the SpellDamage variable.

● BeginOverlap:​ This function is called when the spell overlaps an object. If the OverlapEnable is true, it will check if the object hitted is the player. If it’s not the player and neither the spell owner, it will call the Hit function. If the hitted object is the player it will call the ApplyDamage function to apply the SpellDamage to the player and the function will end by calling the Hit function.

● Hit​: This function will span an explosion particles and will destroy the spell.

Variables:

● SpellOwner​: This is a referent of the object that spawned the magic spell.

● SpellBaseDamage​: This float constant holds the base damage that the spell could produce.

● SpellDamage​: This float contains the total damage that the spell could produce.

● OverlapEnable​: This boolean checks true if the spell can overlap objects.

● DestroyHandler​: This handler handles the timer that destroys the magic spell.

● ParticleSystem​: This particle system is the visual representation of the magic spell.

● HitBall:​ This sphere component is used to detect if the spell is overlapping something.

10.1.3.3.- Magic Enemy AI

10.1.3.3.1.- AI Controller This AI controller, like in the Physical Enemy, inherits all the functions and variables from the Base Enemy AI Controller.

Function:

66

● BeginPlay:​ In this function we set the enemy behaviour tree that will control the behaviour of the enemy.

67 Forsaken, The last Remnant

10.1.3.3.2.- Behaviour Tree

For the magic enemy we have the following BT:

First we check if the enemy is dead or alive. If the enemy is alive it will check if the enemy can see the player or not.

If the player can see the player, it will check its health. While the enemy is healthy and has seen the player, depending of its nature giving at the beginning, it will start attacking aggressively or less aggressively. If its aggressive it will check if the enemy is cooling down

68

after an attack. If the enemy is still cooling down it will not cast a spell, but if is not cooling down anymore it will attack.

When the enemy is not aggressive by nature, it will wait to attack until it is in range to hit the player. If it is not in range it will not attack, but if it is in range and like before, it will check if is still cooling down, and depending on it, it will attack or not.

If the enemy is low in health, then it will check if its a coward or tough. If the enemy is tough it continue fighting like when it is healthy. But if it is a coward it will run away from the player.

If the enemy can not see the player, then it will search the player after a receiving a hit, that will make the enemy look its back to see if the player is there. If the enemy has not receive any hit it will be searching for the player.

If the enemy has lost the player it will run to three different location as fast as possible looking for the player. After looking for the player and not finding it the enemy will not look for it anymore. If the enemy has not saw the player it can be idling by patrolling around the map or just waiting still.

If the enemy is dead it will start all the death sequences and destroy the enemy.

BT Nodes

● Task Nodes

○ BTTask_BP_ChangeState:​ change the actual state of the enemy.

○ BTTask_BP_FindPlayerLocation​: get the actual players location in the world and save it on the TargetLoaction key.

○ BTTask_BP_MagicAttack:​ throws the enemy magic attack action.

○ BTTask_BP_ChasePlayerWithDistance:​ get the actual players location in the world and save it on the TargetLoaction key, but in this case it always stays at a given distance from the player.

○ BTTask_BP_GetRetreatLocation:​ get a location for the enemy to retreat. It takes the enemy position and the players forward vector, adds them and from that point takes a random point of a radius of 5m form the point and save it on the TargetLocation key.

○ MoveTo:​ use the TargetLocation key to move the enemy to that specific location.

○ BTTask_BP_SearchForPlayer:​ set the TargetLocation key with a point inside a 3 meters radius from the players position.

○ RotateToFaceBBEntry:​ rotate the enemy until facing the giving point inside the TargetLocation.

○ BTTask_BP_GetRandomWaitTime:​ get a random time in a given range and save it on the WaitTime key.

○ WaitBlackboardTime:​ use the WaitTime key to wait the given time.

69 Forsaken, The last Remnant

○ BTTask_BP_FindRandomLocation​: get a random point inside the radius around the enemy and save it on the TargetLocation key.

○ BTTask_BP_Die​: start the enemy death sequence.

● Decorator Nodes

○ BlackboardBasedCondition:​

■ IsAlive​: this condition checks if the enemy is alive or is dead. If it’s alive does stuff, if not just stay still and do nothing.

■ CanSeePlayer​: this checks if the enemy can see the player in the distance.

■ LowHealth​: this condition checks if the enemy has low health.

■ Aggressive​: this checks if the enemy is aggressive and attacks even though the player is out of range, or just attacks when the player is in range.

■ Scared:​ this checks if the enemy is scared when it on low health. If it’s scared it tries to run away from the player, if not, it attack normally, just depending if it’s aggressive or not.

■ IsInvestigating:​ this checks if the enemy has been hurt and starts to investigate where the hit came from.

■ WaitToStat:​ this condition checks if the enemy starts resting or starts patrolling.

■ State equals to Chase:​ check if the state of the enemy is Chase.

■ Cooldown​: this condition checks if the enemy is still cooling down from a magic attack.

■ IsViewBlocked:​ this checks if there is something blocking the view of the enemy.

○ Loop:​ loops the sequence of searching the player three times.

● Service Nodes

○ BTService_BP_SetSpeed:​ service that change the moving speed of the enemy.

○ BTService_BP_GetPlayerr:​ service that get the object reference of the player.

○ BTService_BP_IsInRange​: service that sets the IsInRange key if the player is in the attacking range of the enemy.

● Blackboard keys

○ IsAlive:​ is a boolean that checks if the enemy is alive.

○ CanSeePlayer:​ is a boolean that checks if the enemy is seeing the player.

70

○ IsInRange:​ is a boolean that check if in range for an attack.

○ WaitToStart:​ is a boolean indicating the enemies start condition. If it starts still or if it start patrolling.

○ Scared:​ is a boolean indicating if the enemy gets scared from the player when it’s health is low.

○ Aggressive​: is a boolean that indicates how the enemy approach the player. If is set, the enemy does not wait to be in range to attack the player. If is not set, waits to be in range to attack the player.

○ LowHealth:​ is a boolean that check if the enemy has low health.

○ IsInvestigating​: is a boolean that indicates if the enemy is investigating where the player is.

○ Cooldown:​ this boolean tells the behaviour tree that the enemy is still cooling down after a magic attack.

○ State:​ is an enum with the state of the enemy. The states that the enemy can have are:

■ Patrol​: this state is when the enemy is patrolling through the world.

■ Chase:​ this state is when the enemy is chasing the player.

■ Beaten:​ this state is to indicate that the enemy has received a hit from the player.

■ Rest​: this state is for when the enemy is resting after waking from a point to another.

■ Retreat:​ this state indicates that the enemy is running away from the player, because it saw the player and it is low in health.

■ Search​: this state is indicates that the enemy is looking for the player after losing it from sight.

○ TargetLocation:​ is a vector variable with a position in the world.

○ WaitTime:​ is a float that indicates the time to wait.

○ IsViewBlocked​: this boolean will tell us if there is any object blocking the enemy view.

○ PlayerObject:​ is an object reference to the player.

○ SelfActor​: is a float that indicates the time to wait.

71 Forsaken, The last Remnant

10.2.- Boss 10.2.1.- Boss Animations For the animation of the boss we did not created any animation. All the movements are based on the UE4 Timeline component. This is because the only thing that moves is the boss head.

● Start animation​: This animation is played when the boss is waking up. It rise the head from the ground to the air, and while it is rising the magic shield appear.

● Bouncing animation:​ This animation simulates that the heat is floating in the air, making the head bounce up and down.

● Following player animation:​ This animation rotates the head to be facing always the player. This animation is different from the others because is executed from the behaviour tree that controls the boss and not from a timeline component.

● Movement animation​: Like the Following player animation, this animation is executed from the behavior tree. It move the boss head from a point in the map to another.

● Prepare Attack Movement Animation:​ This animation rotates the head of the boss to show the horns to the player. This way it give a hint to the player before being attacked.

● Infernal horns animation​: This animation is the physical attack of the boss. The boss is charging to the player.

● Magic Faint animation:​ When the enemy loses its magical shield, after receiving a forth magic attack it will fall to the ground fainted and will stay there 2 seconds.

● Stand up animation​: After being 2 second in the ground the boss will rise again. During this animation the magic shield will appear again.

● Death animation​: Once the enemy is defeated it will rise to the top while leaving small explosions behind, and will finish with a big explosion. 10.2.2.- Boss Class Core Functions:

● BeginPlay:​ This function starts all the parameters of the boss. It sets the boss at its initial position with the function “SetStartPosition”, then it sets its HP and set its “IsAlive” state true. It will also make the boss immune to any attack, so the initial animation does not receive any damage will is playing and sets its initial material of the smoke. To finish all the parameters, this function also starts the animation of the magic shields that orbits around the boss head.

72

● StartBouncing​: This function starts the animation that simulate the bouncing of the boss head.

● StopBouncing​: This functions stops the bouncing animation. This way it will not overlap any other animation.

● StartFight​: This function calls the initial animation where the boss starts to rise before the fight begins. During this animation, the magic shields will also appears. Once the animation ends the function calls the “PrepareToFight” function to start the battle against the player.

● PhysicalAttack:​ This function controls the physical attack, the Infernal Horns attack. It starts setting all the parameters for the attack. It sets the “IsAttacking”, “MagicImmunity” and “OverlapEnable” variables to true. Then it stops the bouncing animation, so the attacking animation and the bouncing animation do not overlap, and then it start the prepare to attack animation to give a hint to the player that the enemy will start its attack. Once the animation ends it calls the “PreparePhysicalAttack” function to prepare the attack and just after that it starts the physical attack animation. When the animation ends it disable the overlap and spawn an impact particle that simulates a shockwave. When the enemy is on the ground it will stay there for 2 seconds giving a chance to the player to hit the boss. If the HP of the enemy isn’t below 0 then the enemy will start to retreat to its initial position. Once it finish getting back to its initial position it will restart the initial parameters to their default value by calling the function “RestartAttack”.

● PreparePhysicalAttack:​ This functions prepare the physical attack by saving the initial position of the head, so we know where to move the head once the attack ends. And we also calculate the position where the head has to go to strike the player. To calculate that position we get the player position in the world and its forward vector, this way we know where the player is going. To try to predict where the player is going to be, we multiply the normalized forward vector by 2,5 meters and add it to the players position. This way we also give a change to the player to avoid the attack by changing its direction before the attack occurs.

● Retreat:​ This function is called to reverse the attack animation and bring back the boss head to its initial position.

● OnComponentBeginOverlap:​ This function is called when the boss enemy is overlapping a different object. Before checking what object is overlapping, it checks if the overlap is enabled, if is enabled it checks if that object is the player. If that object is the player, then it will cause the given damage by the “PhysicalPower” variable to the player. After causing the damage, the overlap will be disabled, so it can not cause anymore damage to the player.

● ReversePrepAttMov​: This function reverse the prepare to attack animation to set the boss head to its initial position.

● Die:​ This function will start the death animation of the boss. Will the boss is rising it would be spanning explosions, and once it is on the top it will end with a bigger explosion and destroying the boss.

73 Forsaken, The last Remnant

● MagicAttack:​ This function is called when the boss wants to us its magic attack, the Explosive Fire Meteorite attack. It starts setting the “IsAttacking” to true, and then it spawns the magic spell. When the spell is spawned we will add to i an impulse with the direction to the player and set all the spells parameters. We will set its owner, in this case the owner is the boss, and its spell power. Once the spells parameters are set we enable its overlap function so it can detect were it hits. And to finish the magic attack restart the boss initial parameters to their default value by calling the function “RestartAttack”.

● SetSpeed​: This function is used to set the boss speed.

● ExtraMagicAttack​: This function is called when the boss wants to us its special magic attack, the Fire Missiles Crawlers attack. It starts setting the “IsAttacking” to true, and then enters in a loop where it start to spawn the 10 missiles that the boss launches to the player. The missiles are launched between every 0.1 and 0.5 seconds. To continue launching the missiles we use the function “NextLaunch”.

● NextLaunch​: This function is after a missile is launched, until the last missile is launched. When the last missile is launched we call the function “RestartAttack” to restart the boss initial parameters to their default value.

● RandomAttack​: This function is used to select randomly the next attack of the boss. It is only used in the last two phases of the boss fight. If the boss is in the second stage it will have a 70% chance to use its Explosive Fire Meteorite and a 30% chance to use its Infernal Horns attack. And in the last stage it will have a 30% chance of using the Explosive Fire Meteorite attack and a 70% chance of using its Fire Missiles Crawlers attack.

● AnyDamage:​ This function is called when the boss has been hitted by the player. First check if is immune to any attack, if its immune nothing happens. If its no immune, first it will check if it was a magic attack that hitted the boss. If it was a magic attack, it will check if the boss is immune to magic attack in that moment. If the boss is immune, it will not receive any damage and will spawn some particles to show it was hitted. If the boss is not immune to magic attacks it will call the “TageMagicDamage” function to handle the damage and then spawn some particles. And if the attack was physical, the “TakeDamage” function will be called to manage the damage and also some particles will be shown.

● GetDown:​ This function will start the Magic Faint animation and make the boss fall to the ground. It also stops the bouncing animation to avoid overlapping the animations.

● GetUp​: This function will start Stand up animation, and while the boss is getting up, the magic shields will start to appear again. Once the boss is up, the bouncing animation will start again.

● SetShield1​: This function sets the visibility of the magic shield1.

● SetShield2​: This function sets the visibility of the magic shield2.

● SetShield3​: This function sets the visibility of the magic shield3.

74

● SetStartPositions​: This function will set the boss in its initial position in the ground. It will also save the boss initial position and rotation.

● CooldownEnd:​ This function is called when the cooldown time of the boss ends. It will call the controller function “SetCooldown” and setting the cooldown to false, so the controller knows that the boss is not cooling down anymore. After that it will clear the handler of the timer of the cooldown.

● TakeDamage​: This function manage the damage when the boss receive a physical attack. It will subtract the damage points to its HP and after that it will change the color of the smoke. The color of the smoke is calculated by the total damage that the boss has received multiplied by 10. The result is set on the red channel of the”StartColor” vector parameter of the smoke material. Once the color of the smoke is changed it will recalculate the state of the boss and send it to the controller and check if it is still alive. If the boss it dead it will notify the controller.

● SetInitialMaterial​: The function sets the initial material of the smoke of the boss. It also save the reference of the material of the smoke for later use.

● PrepareToFight:​ This function is called after the initial animation ends. It sets the boss parameters ready for the fight. And it also starts the bouncing animation.

● RestartAttacking​: This function is called after an attack of the boss ends. It restarts all the parameters of the boss and starts the cooldown timer.

● PrepareMagicAttack:​ This function is used to predict where the player is going to be before send a magic attack. The player position is predicted by getting the last updated velocity of the player multiplied by 2,5 meters inthe X and Y axis and added to the actual player location.

● GetMagicSpellDirection:​ This function calculates the direction of the magic attack. The direction is calculated by subtracting the result of “PrepareMagicAttack” to the position of the boss and normalizing the final result.

● GetState:​ This function gets the actual state of the boss. If the player is below 50% of the HP it will be the Third State, if the Player is between 85% and 50% of HP it will be in the Second State, and if is above 85% it will be in the First State.

● GetRandomCooldownTime​: This function sets a random cooldown depending on the state of the boss. If the boss is in the first state, the cooldown will be between 3 and 6 secons. If the boss is in the second state it will be between 2 and 5 seconds. And if the boss is in the third state the cooldown will be between 1 and 4 seconds.

● TakeMagicDamageThis ​function manage the damage when the boss receive a magic attack. After every hit a magic shield will disappear. Once all the magic are gone and receive one more hit, it will tell to the controller that the boss fainted and it should go down by calling the controller function “SetGetDown”.

Variables:

● Shield1​: This component is the reference to the shield1.

● Shield2​: This component is the reference to the shield2.

75 Forsaken, The last Remnant

● Shield3​: This component is the reference to the shield3.

● ShieldsPosition​: This scene component sets the position of the shields above the head of the boss.

● ParticleSystem​: This particle system is where the smoke of the boss is spawned.

● ImpactRadius:​ This sphere collision is where the player overlaps will receive some damage.

● Horns​: This component is the mesh of the horns of the boss.

● Head:​ This component is the mesh of the head of the boss.

● BossHead:​ This scene component sets the boss head position.

● ShieldRotation:​ This Timeline component is used to orbit the shields above the boss. This Timeline is set in loop, so the shields are orbiting all the time. The duration of this timeline is of 1 second, and the output goes from 0 to 360.

● StandupAnimation:​ This Timeline component is used to animate the Standup aniamtion. The length of this Timeline is 1 second, and the values goes from 1 to 0. It also sends 3 events used to activate the shields.

● FallAnimation​: This Timeline component animates the Magic Faint animation. The length of this timeline is of 0.75 second and the value goes from 0 to 1.

● PrepareAttackMovement​: This Timeline component animates Prepare Attack Movement Animation. The lenght of this timeline is 0.1 second and the values goes from 0 to 1.

● DeathAnimation:​ This Timeline component animates Death animation. This timeline is 8 seconds long. It sends some events to spawn explosion when the boss is moving. Then between the second 0 and 5 it will send values between 0 and 1 to move the boss to its final position. Also, to simulate a head rotation it will return some random given vectors.

● AttackAnimation:​ This Timeline component is used to animate the physical attack animation. It goes for 0.72 seconds and send values between 0 and 1.

● MoveHeadAnimation​: This Timeline component animates the Start animation. The length of this Timeline is 10 second, and the values goes from 1 to 0. It also sends 3 events used to activate the shields.

● BounceAnimation​: This Timeline is used to simulate the bouncing of the head of the boss. Is 1 second long and the values go between -0.35 and 0.36.

● HeadRelativePosition​: This vector saves the relative position of the head of the boss.

● HeadStartPosition:​ This vector is a constant that has the relative start position of the head of the boss.

● HeadRotation:​ This vector saves the relative initial rotation of the head.

76

● HeadStartRotation​: This vector is a constant that has the relative start rotation of the head of the boss.

● HeadWorldPosition:​ This vector saves the world position of the head of the boss.

● DeadHeadPosition​: This vector saves the relative position of the head when it dies.

● HeadFallRelativePosition​: This vector saves the relative position of the boss head before it faints.

● CooldownHandler:​ This handler handles the cooldown timer.

● CooldownTime:​ This float saves the time that the boss is going to be in cooldown.

● OverlapEnabled:​ This boolean checks if the Impact Radius is activated or not.

● PhysicalPower:​ This float is a constant contains the base damage that the physical attack of the boss can make.

● MagicPower:​ This float is a constant contains the base damage that the magic attack Explosive Fire Meteorite of the boss can make.

● MaxHP​: This float constant contains the maximum health points that the boss will have at the beginning of the fight.

● HP​: This float saves the actual health points the boss has.

● Immunity:​ This float checks if the boss has immunity on every king of attack.

● SpellImpulse​: This float constant contains the impulse the boss adds to the Explosive Fire Meteorite spell.

● SmokeMaterial:​ This object contains the reference to the smoke material of the boss.

● ChangeToState2:​ This float constant contains the percentage where the boss changes from state one to state two.

● ChangeToState3:​ This float constant contains the percentage where the boss changes from state two to state three.

● MinMissileDelay​: This float constant contains the minimum time between the spawn of the missiles.

● MaxMissileDelay​:This float constant contains the maximum time between the spawn of the missiles.

● MaxMissiles:​ This integer constant contains the maximum of missiles the boss will spawn when using the Fire Missiles Crawlers attack.

● MissilesCount:​ This integer counts how many missiles have been spawned.

● MaxMagicHits​: This integer constant contains the maximum magic hit the boss will receive before fainting.

● MagicHits:​ This integer counts how many magic hits has the boss received.

77 Forsaken, The last Remnant

● MagicImmunity:​ This float checks if the boss has immunity on any magic attack.

● isAttacking:​ This boolean checks if the boss is attacking. 10.2.3.- Boss Magic Attacks

10.2.3.1.- Explosive Fire Meteorite Class This class consist in the Explosive Fire Meteorite attack that the boss will throw to the player.

Functions:

● BeginPlay:​ This function is called when the spell is cast. It starts the timer that controls the lifetime of the spell:

● DestroySpell​: This function is called when the lifetime of the spell ends. It clears the timer handler and destroys the spell.

● EnableOverlap​: This function is called to set the OverlapEnable variable to true. So the spell can hit objects.

● SetSpellOwnerr:​ This function save the reference of the owner of the spell in the SpellOwner variable.

● SetSpellPower​: This function set the damage that the spell could cause. It adds the spell base damage with the owner’s magic power and is saved in the SpellDamage variable.

● BeginOverlap:​ This function is called when the spell overlaps an object. If the OverlapEnable is true, it will check if the object hitted is the player. If it’s not the player and neither the spell owner, it will call the Hit function. If the hitted object is the

78

player it will call the ApplyDamage function to apply the SpellDamage to the player and the function will end by calling the Hit function.

● Hit​: This function will span an explosion particles and will destroy the spell.

Variables:

● SpellOwner​: This is a referent of the object that spawned the magic spell.

● SpellBaseDamage​: This float constant holds the base damage that the spell could produce.

● SpellDamage​: This float contains the total damage that the spell could produce.

● OverlapEnable​: This boolean checks true if the spell can overlap objects.

● DestroyHandler​: This handler handles the timer that destroys the magic spell.

● ParticleSystem​: This particle system is the visual representation of the magic spell.

● HitBall:​ This sphere component is used to detect if the spell is overlapping something.

10.2.3.2.- Fire Missiles Crawlers Class This class consist in individual missiles of the Fire Missiles Crawlers attack that the boss will throw to the player.

Functions:

● BeginPlay:​ This function is called when the missile is spawned. It initialize the missile parameters. It sets its physical linear velocity and its initial rotation speed. Once the parameters are set, the missile will stay in standby for between 0.01 and 0.05

79 Forsaken, The last Remnant

seconds. When the standby ends it will set the missile angular damping at 0.5 and disable its gravity and set the Tracking variable to true, so the missile can start to track the target. To finish the initialization it will start the target tracking by calling the function TrackTarget.

● TrackTarget​: This function will fix the velocity will the missile is tracking the target. This function it set in a loop that lasts ten iterations, then it will lose the track of the target.

● Tick​: This function is called every tick and will fix the rotation of the missile and its physics linear velocity.

● OnComponentBeginOverlap:​ This function will be called when the missile hits something. If it hits the target it will cause damage to it and then the missile will be destroyed. If it hit something else, the missile will just be destroyed.

● Destroyed:​ This function is called when the missile is being destroyed. It will spawn some explosion particles.

Variables:

● ParticleSystem​: This particle system is the visual representation of the missile.

● Sphere​: This sphere component is used to detect if the missile is overlapping something.

● ProjectileMovement:​ This projectile movement component is what controls the movement of the missile.

● Target:​ This is a reference to the target object.

● RotationSpeed:​ This float represents the rotation speed of the missile.

● LaunchCone:​ This float constant is used to calculate the initial random direction that the missile will take from a cone. It contains the cone half angle in degrees.

● ConstantThrust​: This float constant represents the constant thrust of the missile.

● VelocityAdaptSpeed:​ This float contains the actual velocity of the missile.

● FinalVelocity​: This float constant contains the maximum velocity that the missile can take.

● Tracking:​ This boolean is true when the target is being track and it is false when the missile stops tracking the target.

80

10.2.4.- Boss AI

10.2.4.1.- AI Controller Functions:

● BeginPlay:​ This function is call at the beginning of the game. It starts all the parameters of the controller, it sets the behaviour tree, saves the reference of the pawn that is controlled in a variable and at the blackboard of the behaviour tree and finally it set the initial state of the boss.

● ChangeState:​ This function changes the state of the boss at the blackboard to the actual state of the boss.

● SetCooldown:​ This function sets the Cooldown variable of the blackboard depending if the boss is cooling down or not.

● SetIsAttacking:​ This function sets the IsAttacking variable of the blackboard depending if the boss is attacking or not.

● SetIsAlive​: This function sets the IsAlive variable of the blackboard depending if the boss is dead or alive.

● SetOwnedPawnSpeed​: This function sets the seed of the boss.

● SetGetDown​: This function sets the GetDown variable of the blackboar to tell the behaviour tree that the boss is falling to the ground.

● SetPlayerToBB:​ This function saves the reference of the boss to the blackboard.

● SetMyPawn:​ This function save a reference of the pawn the controllers is controlling.

● SetInitialState​: This function sets the initial state of the boss in the blackboard.

Variables:

● MyPawn:​ Reference to the pawn the controller is controlling.

● BB_PlayerObjectName​: This string constant contains the name of the blackboard key “PlayerObject”.

● BB_CooldownName​: This string constant contains the name of the blackboard key “Cooldown”

● BB_IsAttackingName:​ This string constant contains the name of the blackboard key “IsAttacking”

● BB_IsAliveName​: This string constant contains the name of the blackboard key “IsAlive”

● BB_GetDownName​: This string constant contains the name of the blackboard key “GetDown”

81 Forsaken, The last Remnant

10.2.4.2.- Behaviour Tree

The boss behaviour tree goes like:

First it will check if the boss is alive or not. If is alive, it will check if is down or up. When the boss is down, it means that the boss has lost all its shield and is falling down. If it is still up, it will check in which state it is.

If the boss is in the first state it will check if the boss is attacking or it is cooling down after an attack. If is attacking it will attack only using the Infernal Horns attack. If it is cooling down it will be moving around the map.

If the boss is in the second state it will check, like in the previous state, if the boss is attacking or it is cooling down after an attack. If is attacking it will attack using the Infernal Horns attack or the Explosive Fire Meteorite attack. If it is cooling down it will be moving around the map.

And if the boss is in the third state it also will check like in the previous state if the boss is attacking or it is cooling down after an attack. If is attacking it will attack using the Explosive Fire Meteorite attack or the Fire Missile Crawler attack. If it is cooling down it will be moving around the map.

If the boss is death it will start the death sequence of it.

BT Nodes

● Task Nodes

○ BTTask_BP_GetDown:​ This function calls the boss function GetDown to start the Magic Faint animation.

82

○ Wait​: This function waits on this node until the wait time is up.

○ BTTask_BP_GetUp:​ This function calls the boss function Getup to start the GetUp animation.

○ BTTask_BP_ChangeFlag​: This function will change the value of the given boolean variable of the blackboard to the given value.

○ BTTask_BP_RandomNav​: This function gets a random position where the boss is going to move and save it on the blackboard variable TargetLocation

○ MoveToo:​ use the TargetLocation key to move the boss to that specific location.

○ RotateToFaceBBEntry:​ rotate the boss until facing the PlayerObject.

○ BTTask_BP_GetRandomWaitTime:​ get a random time in a given range and save it on the WaitTime key.

○ WaitBlackboardTimee​: use the WaitTime key to wait the given time.

○ BTTask_BP_PhysicalAttack:​ This function calls the PhysicalAttack function of the boss to start the Infernal Horns attack.

○ BTTask_BP_RandomAttack​: This function calls the RandomAttack function of the boss to start a random attack.

○ BTTask_BP_BossDeath:​ This function calls the boss to start the Dead animation.

● Decorator Nodes

○ BlackboardBasedCondition

■ IsAlive​: This condition checks if the boss is alive or is dead. If it’s alive does stuff, if not just stay still and do nothing.

■ GetDown:​ This condition checks if the boss is fainting. If it is true, it starts the fainting animation of the boss, if it is false the boss continues normally.

■ State:​ This condition checks in what state the boss is. Depending the state, the boss will do different things for every state.

■ IsAttacking:​ This condition checks if the boss is attacking. If it is true, the boss is attackin, if not, the boss is moving around the map.

■ Cooldown​: This condition checks if the boss is cooling down. If it is true, the boss will not attack, if it is false, the boss could start an attack.

● Service Nodes

○ BTService_BP_SetSpeed:​ service that change the moving speed of the boss.

● Blackboard keys

83 Forsaken, The last Remnant

○ IsAlive:​ is a boolean that checks if the boss is alive.

○ Cooldown:​ this boolean tells the behaviour tree that the boss is still cooling down after an attack.

○ IsAttacking​: This boolean check if the boss is attacking or not.

○ GetDown:​ This boolean checks if the boss is going down or the is still standing up.

○ State:​ is an enum with the state of the enemy. The states that the enemy can have are:

■ InitialState​: This state is when the boss is still lying down before starting the fight against the player.

■ FirstState​: This represents the first state of the boss, where it only attacks with physical attacks.

■ SecondState​: This represents the second state of the boss, where it attacks with physical attacks and the magic attack Explosive Fire Meteorite.

■ ThirdState​: This represents the third state of the boss, where it only attacks with magic attacks.

○ TargetLocation:​ Is a vector variable with a position in the world.

○ WaitTime:​ is a float that indicates the time to wait.

○ PlayerObject:​ is an object reference to the player.

○ SelfActor​: is an object reference to the bos.

84

11.- Table of Content

Figure0: Game Poster Page 0

Figure1: Environment inspiration Page 13

Figure2: World of Warcraft Page 15

Figure3: The Legend of Zelda: Breath of the wild Page 15

Figure4: Dark Souls Page 16

Figure5: Little Devil Inside Page 16

Figure6: Ashen Page 17

Figure7: Keyboard and Mouse Page 24

Figure8: Controller Page 25

Figure9: Character Stats Page 26

Figure10: Talent Tree Page 27

Figure11: Weapon Enemy Page 29

Figure12: Magic Enemy Page 30

Figure13: Boss Health Points Evolution Page 31

Figure14: Boss Fight Page 33

Figure15: Concept 1 Page 36

Figure16: Concept 2 Page 36

Figure17: Concept 3 Page 37

Figure18: Concept 4 Page 37

Figure19: Character Design 1 Page 38

Figure20: Character Design 2 Page 38

Figure21: Character Design 3 Page 38

Figure22: Character Design 4 Page 39

Figure23: Character Design 5 Page 39

Figure24: Character Design 6 Page 40

Figure25: Character Design 7 Page 40

Figure26: Character Design 8 Page 40

Figure27: Character Design 9 Page 41

85 Forsaken, The last Remnant

Figure28: Character Design 10 Page 41

Figure29: Character Design 11 Page 41

Figure30: Character Design 12 Page 42

Figure31: Character Design 13 Page 42

Figure32: First Shader 1 Page 43

Figure33: First Shader 2 Page 43

Figure34: First Shader 3 Page 43

Figure35: First Shader 4 Page 44

Figure36: Final Shader 1 Page 44

Figure37: Final Shader 2 Page 44

Figure38: Final Shader 3 Page 45

Figure39: Final Shader 4 Page 45

Figure40: Final Shader 5 Page 45

Figure41: Final Shader 6 Page 45

Figure42: Final Shader 7 Page 46

Figure43: Final Shader 8 Page 46

Figure44: Final Shader 9 Page 46

Figure45: Final Shader 10 Page 47

Figure46: Behaviour Tree Page 52

Figure47: Composite Nodes. Selector Node, Sequence Node and Parallel Node

Page 52

Figure48: Task Nodes Page 53

Figure49: Decorator Node (Blue Node) Page 53

Figure50: Service Node (Green Node) Page 53

Figure51: Pipe Weapon Page 59

Figure52: Magic Spell Page 65

Figure53: Boss Meteorite Page 78

Figure54: Boss Missile Page 79

86