top of page

Logic Breakdown - Garden Snakes

On this page I will be looking at one of the major problems I faced during this project, I will look at how I handled it, my thought process and how I came to a solution.


Example Problem Breakdown: AI worms acting as "players"

​

This project had a vast number of turning cogs at any one moment as each system was interlinked to another. Numerous problems arose throughout the project that required research, fixes, iteration and workarounds.

 

Aim: Create AI to appear and play as though they were players.

​

This all started with a design of AI logic as seen below:

​

​

​

​

​

​

​

​

​

​

​

​

​

​

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Through this design I attempted to catch potential issues in advance, such as through blacklisting targets that the AI cannot reach. The final product in-game does not perfectly reflect this design and does not have all of the features listed. This is naturally a part of design as changes occur all the time during development.

​

I started to implement the logic into unreal and started to develop an AI. I created it so it would locate the closest enemy on the map, aim their weapon towards it and fire.

​

Problem: The AI takes it's turn on the players turn.

​

This was a simple communication issue where the turn manager was not correctly initialising the AI on it's turn. This developed into having a "dormant" state for the AI to be within where it would not react or move so long as it was not the selected AI worm on the AI teams turn.

​

ProblemThe AI finds the closest enemy but it's through a wall, when there is further target in line of sight

​

This is where implementing a blacklist mentioned in design was included. The AI worm would search for all enemies that are not obstructed by view and would only fire at them if  there was a clear line of sight.

​

Problem: The AI has no line of sight with any targets. 

​

To enable the worm to see new potential targets the worm would locate targets and if finding none, it would proceed to move in a direction towards the potential target. The worm would then perform the same check to find a target to fire at.

​

Problem: The AI just walked off into the water (instant death)

​

Whilst moving the worm would now fire a line trace in front of it to ensure that there was solid ground underneath, otherwise the worm would abort the movement and proceed to the rest of it's turn.

​

Problem: The target is up a slope/ across a gap

 

This required the AI to jump. Due to the destructive nature of the game the check for the AI to jump would have had to have been very complex to simulate a player. It would require the AI to check for any overhead obstacles as well as the distance of the jump and the size of any slope. This is possible however for the sake of the prototype release time I decided it was best to simply remove the AI jumping, focusing on other core systems, as it would more often cause the AI to break immersion rather than to simulate a player.
 

Problem: The AI is can't jump and/or is boxed in

​

The fact the AI could not jump caused quite a headache when wanting to simulate a player. If I was a player who couldn't reach my targets the next step I would take would be to tunnel my way to them or shoot the ground out from underneath them. Therefore this was what I developed next. I had the AI  search for targets, move to find new targets and if this still didn't happen then the AI would try blast their way to the target. This made gameplay so much more interesting and also made the AI feel quite intelligent at times.

​

Problem: The AI worm now blows itself up trying to tunnel sometimes.

​

If the tunnelling decision was taken by the worm then it would proceed to find the wall it was going to tunnel towards, move away from it, outside of the blast radius, select the bazooka weapon and proceed to fire at the target.

​

​

AIDecisionMakingWorms.drawio.png

2024

Thomas Wilkinson - Technical Designer

bottom of page