Quest for Valour A.I

Quest for Valour A.I

Status: Completed

Vancouver Film School | Programmer | ~1 Week


This project started in the midst of VFS's Quest for Valour assignment. In which it soon turned into a brief passion project where I re-wrote the deprecrated A.I system to function off of the Unreal EQS and Behaviour Tree Systems. Along the way learning many fruitful lessons.


Combat Orientated A.I Design

For the A.I I had to devise how I could create a series of behaviours that woudl allow for the player to both have an enjoyable challenge without absolutely destroying them. That thought process left me with 3 distinct designs. Although cliche, I thought they fit with the Quest for Valour hand-painted look.


Base Behaviour For the base melee behaviour the design based around the idea of a "bad guy" from a cartoon, somewhat buffoonish in nature.

Melee Behaviour Tree Concept

For the A.I's that were Melee, they all ended up having a main attack and a secondary with the vast majority also having a unique attack. Therefore I made that the basis of this specific behaviour tree with the ease to add in the two other variants to spice up the gameplay.

1. Main Attack   2. Secondary Attack   3. Smash Attack

Charger Variant This variant is based off of the "Has Target" node on the behaviour tree. If the distance happens to get past a certain metric, the A.I triggers a "charge" attack which paths in an absolute straight line towards the player.

Smasher Variant This variant was created to fit some of the faction's larger npc's who had another set of "smash-esc" animations. The behaviours for those animations were slotted in, before the main attack and secondary attack behaviours as they have a far larger cooldown to accommodate for their more area-of-effect attack pattern.


Base Behaviour For the Ranged A.I I wanted to create a behaviour that would walk the fine line between almost annoying yet fun to engage in combat with. In order to do this the Ranged A.I deviates from the Melee A.I by having evasive behaviours where it will run from its target as a start to establish a distance. Then afterwards if it has succeeding in creating that distance within a finite time, it'll check if there is a ranged ally nearby and ensure some distance from them as well to create a more entertaining fight. Other than that, the base behaviour is quite similar.

Ranged Behaviour Tree Concept

Ranged Attack Diagram

Machine-Gun Variant The machine gun variant has an extra ability where it will rapid fire arrows but have a far longer pause inbetween the attacks. This variant overrides the main and secondary attack to prevent the combat from becoming too difficult for the player as Quest for Valour wasn't designed for too intense combat.


Base Behaviour When it came to the Magic users in the factions, I planned on them being largely support mostly due to the odd animations which they already had. Therefore they have very similar behaviours to the ranged with the exception that they all had to be customed to the faction as to how they would position themselves in combat.

Magic Behaviour Tree Concept

Single Caster This type specifically refers to A.I's who fire a single projectile or do singular attacks. The Single Casters focus on finding a position that is flanking the percieved enemy as to force the player to move in more abstract and entertaining patterns.

Multi Caster This type refers to Magic A.I who on attack launch more than one projectie in one of the three patterns listed below. Multi-casters are even more picky when it comes to selecting an advantageous position to ensure that their projectiles are used in the most effective manner possible.

1. Three-Shot   2. Scatter-Shot   3. Wide-Shot

A.I Optimization

When it comes to A.I optimization there are two major points which I focused on, the "brain" aspect (how the A.I processes it's information and senses), and the pathing. I'm splitting the brain aspect in this section, the pathing in the section below.

When it comes to processing the information that the A.I is recieving, optimization at it's root is minimizing the amount of checks in any one time and situation. In other words keeping the A.I as simple as possible with as much percieved depth for the smallest process. One way which I optimized the A.I's "thought process" was by streamlining the 3 distinct modes of the A.I's. If the A.I was in the default Patrol / Guard mode, it would sit cob-webbed until it recieved an awaken call from the player or another hostile such as another A.I who was of an opposing faction. Then it would engage into Attack mode. Through creating a cob-webbed version of the A.I it allows in-active A.I to be far less expensive than they would be otherwise.

Efficent A.I Pathing

When it comes to Pathing, at least with the Enviroment Query System (EQS), it's all about filtering the pathing to reduce the amount of pathing tries and potential calculations on "desirability" of any given point. That being said outside of the EQS, making it run less times in an increment of time will likewise decrease the expense of the pathing.

Shared A.I Senses

In order to have the A.I operate in a more organic manner, I added the ability for the A.I to share their own senses with each other. For example, if a Skeleton Swordsman saw the player, it would call out to it's neighbours near it and alert them of the intruder and where it last saw the player. Therefore the Skeletons would go investigate the last seen location with their own random variance in pathing. Overall creating the illusion of a communicative and united enemy front who actually investigate the area around where the player was last spotted.


When it came to Shift, as we had many hands on the project we had to sort out some manner of testing things at a rapid pace and being able to ensure that our builds would be readily avaliable and accessable for our own team and even Mentors and Instructors. In order to facilitate this we were provided with a base script for automating the building procedure in Unreal. Past the base script I further expanded it in and tied it into our version control, backup management. Through which I had to re-write the script from scratch several times.

• Boss Demon
• Bomb Demon
• Demon Grunt
• Melee Imp
• Ranged Demon
• Caster Imp
• Winged Demon

• Skeleton King
• Skeleton Grunt
• Skeleton Swordsman
• Skeleton Archer
• Skeleton Mage

• Zombie Boss
• Zombie Commoner
• Zombie Slammer
• Zombie Snapper
• Zombie Murderer

• Human Boss
• Human Warrior
• Human Worker
• Human Archer

• Cat
• Cow
• Pig
• Rooster

• Micro Dragon
• Mini Dragon