top of page

Rudra: A Tale of Time

AI Engineer

Rudra: A Tale of Time is a 3rd person action RPG based on Hindu Scriptures where you travel through Yugas (Time) and fight Asuras to save the timeline. This is a melee combat game where I was the only AI engineer along with 2 Gameplay engineers. 

The game is going to be released on May 2023.

AI Architecture

The AI Architecture is made using Subclass Sandbox and Type Object programming pattern. I followed the industry standard code architecture and the architecture I learned at "Callisto Protocol".

Base Class: The enemy has a base class Ancient Enemy Character that is inherited from the Character base which is the base for both the Enemy and the Player. 

Gameplay Ability System (GAS)

Our Player and Enemy both are using Unreal's Gameplay Ability System Framework which is a different way to work in AI rather than the traditional way. The whole base class has to be set up in C++ first. So my first task was to set up our Enemy base class to have all the common functions and events so that we can call them from individual Enemy BPs.

As of now all our main functions and utilities are in the base class. Then all individuals are in Individual BPs.

Behavior Tree

The second most challenging task was to figure out how to use GAS and Behavior tree at the same time because there isn't good documentation on using them both. So I did a couple of trial-and-error and understood that both can work completely independently. So I used GAS to make Enemy abilities like Attacks, Health Regen, etc. & then called those functions to form Behavior Tree.

StateMachine

After finalizing the Design of our Enemis I needed to come up with an architecture where I can manage different states of Enemies using a Behavior Tree. So tried different types of solutions and a lot of them although giving the same results and were NOT scalable in long run. Then Finally after a couple of iterations, I fixed an Enum-based Behavior tree that resembles State Pattern but in a Tree Structure.
With that solution, things become very easy to add new states and manage them.

In this way, all States are managed by a behavior tree and a single State might have lots of different behaviors.  Here's a photo of 2 different ways of behavior tree.

AI Controller & Perception

All our enemies are using Unreal's AI Perception system (Sight, Hear & Damage) to detect the player's position in the environment. our AI controller is responsible for Run Behavior Tree, updating Blackboard, and Updating perception.
Our AI controller is also using a similar structure as character classes.

Enemies

grunt.png

Grunt

Grunt Enemy in our game is a type of Demon who has possessed human body and corrupted their mind, They are not very strong but they do have Agility and speed. 

- First, they patrol random locations from their origin if they don't see you.

- If they see you they will focus on you and go to a location given by EQS query.
- They from that location run and Attack with their single attack.
- If they got Hit, They go to the Hit react state.
- If their health goes to less than 40%, they go to a location far from the player (EQS) and regenerate health once by a certain amount.
- If they Die, they go to a death State.

They normally come together in large numbers.

Bruteloading.png

Brute

Brute is a type of Rakshasa, who are very strong and physically intimidating, They are very proficient in hand-to-hand combat and weapon like Mace. They are often very slow but their impact force is extreme.

- First, when they don't see you, they stay idle.
- Once they see you, they'll start chasing you and comes to a location near you to do a 2 attack Combo.
- At the end of 2nd Combo It decides based on your distance to him Do do another melee or Jump Attack.
- Jump attack is an AOE ground Smash Attack. Before a Jump attack happens the area of that attack appears.
- If his damage is more or equal to half health it goes to a stagger state for 4 seconds.
- Brute is slow in nature but they damage hard on impact.
- Finally, on Death, they go to Death State and unpossess an AI controller.

They normally come another Brute or with lots of grunts

Mage2.png

Mage

Mage is a Female Yaksha who is by blood cousins of Rakshasas (Above) but very opposite in nature. Where Rakshasa is very physically heavy and slow but powerful in Hand to Hand combat, Yaksha is very proficient in Dark arts and magic. They are very cheeky and formidable forces.
 

  • Until they see you, they stay idle.

  • Once they see you they'll start teleporting to a location at a certain distance (EQS) to attack you with her projectile which is very powerful.

  • After the attack, they'll stay there for certain seconds. This is the player's window to attack.

  • If they got hit 2 times, they'll teleport immediately.

  • If comes to a close range they can do Melee sometimes (chance-based).

  • After health goes to less than 50%, it heals itself Once.

  • When Health is less than 20% it tries to do a special attack and  Upon Successful  of that attack  It heals her self or tries to do it again, It's an AOE attack.

  • Upon Health Goes to 0, It plays the Death Animation and burns herself to ashes

Hiranyasimha.png

Boss

Boss is a Female Asura, who is 3x powerful as our protagonist and has the power of a Lioness. She'll be ferocious and impactful.
 I've designed the Final boss as well as engineered her, It has 2 Phases

There are a lot of systems and weapons Inside her that it's very hard to explain in words, so I'll add the code with these.

Let's talk about phases.

Health 100 - 75%: She'll focus on combo chaining with her claws and occasionally she'll do a roar attack which is a mid-range sound wave attack inspired by Gaurdian Ape roar in Sekiro.

Health 75 - 50%: Her giant claw ability unlocks and She'll focus on combo chaining as well as Roar and a Giant Claw attack where she summons a Giant Paw and Slams forward. If you get hit by it'll make a lot of Damage.


Health 50%: Her one Claw transformed into a tooth Blade and Another one becomes a Toothed Sword which she'll use for combo chaining. She'll also do Roar and Giant claw.

Health 20%: When her health is 20% or less she'll do a big Ground slam attack which is  her last try to kill the player. It's an AOE attack .


On Health becomes 0 or less She goes to a kneel animation and FInal CInematic Plays.

Here's a very brief explanation of Boss. Please Please watch the video above or look at the code below.

BP_Boss

BP_Claw

BP_Giant Claw

BP_Sword

BP_MorphedClaw

SHIV2.png

Spawner System

Our Designers wanted a spawner system that can accommodate various types of encounters and would be a breakable actor which gives the player Mana upon destroying.

The spawner can;
- Multiple enemies can be spawned in the given interval (Exposed for each instance)

- Enemies Wave system added to add multiple waves.

- Grunt Brute & Mage each have individual percentages to spawn. By default Grunt 50%, Brute 30% & Mage 20% But this is also exposed for designers and can be tweaked for each instance

- You can also specify No of Enemies to add in the next wave This is a single spawn system for all types of encounters (Single, multiple enemies, Wave based, etc)

bottom of page