top of page

Specialization: AI behaviours

I created 2 enemy types that work together in attack patterns against a player. First one is a  spider, acting like a captain, and second one are several bats acting like the crew, listening to the spiders command, and protecting it.

Spider.gif

Spider - The Captain

The bats serve the spider, who's only mission is to stun the player. The Spider wanders as it's idle behaviour, but when alerted, it runs towards the player and tries to stun the player. The Spider then tells the bats whether it succeeded or failed with it's stun. 

Bats - The Crew

The bats listen to the spider. If the spider succeeds with stunning the player, the bats all attack together, unstunning the player in the process. If the spider misses, they attack one at the time.

If the spider is not already alerted, and the bats are (since their range is longer), they will alert the spider to the players location.

BatsAttacking-ezgif.com-video-to-gif-converter.gif
BatsAttackingOne-ezgif.com-video-to-gif-converter.gif
sss.png

Bats's Behaviour Tree

The bats follow the spiders command, if there's no command, they circle around the spider as their idle, until it's action time.

The order of the behaviours have varied, but this is how it looks in the end, some behaviours were even shared with the spider.

The priorities were getting the attack patterns to work, when spider has attacked, the bats should know which attack to execute, and execute it accordingly.

Spider's Behaviour
Tree

The spider decides what happens, and the execution of it's attack (stun) affect the other attacks, decides whether player should be unstunned, or punished.

If the spider is hurt, the bats will protect it, but if the bats are hurt, the spider WONT protect them, it's a captain, but not a loving one...

aaa.png
Skärmbild 2024-04-01 112412.png

Post Master

All entities used a Post Master in order to speak with each other, including player.

In general I had events where the attack happened, and then events for when the attacks were done, to time the enemies attack patterns more correctly.

Blackboard

In order for the behaviours in the behaviour tree to know of both messages sent by the postmaster, and the transforms of the entities, a blackboard was used.

With the blackboard I could create a variable as a string and attach it to another class variable and adjust it both from the behaviours and the entities classes.

Skärmbild 2024-04-01 112733.png
Week 4 showcase.gif

Further ideas

During the creation of this project, I got many ideas from other colleagues, though only one idea made it through (bats attacking one at the time).

 

There were some ideas that could have made it through if the scope was expanded, like if player climbs to a location the enemies couldn't reach, or if one of the enemies could die, what would their behaviours look like?

Summary

This project focused on making different enemy types speak with each other, working together against a player in different attack patterns.

The Spider acting as the captain, determines which attacks will be executed, depending on the execution of it's own attack. If the Spider stuns the player, the bats unstun the player by attacking together, if the Spider misses, the bats attack the player one at the time, to instill the damage missed by the Spider.

EnemiesIdle2-ezgif.com-video-to-gif-converter.gif
bottom of page