top of page

- Funfair Folly -

Team Size : 8

Role : AI Programmer

Engine : Unity

Time : Feb. - June 2021 (4 months)

Main Problems

A more context-sensitive AI

2D scripting for a 3D world

Help finding the Fun

  • For my previous projects, the AI was not very complicated : you see the player once ? Walk toward him and attack when at range. No questions asked. But for this project, there where much more variables : the player could hide, he could go out of your aggro zone, or he could destroy your precious rolling ball.. One enemy even had a sub-state transition, which could not be expressed with the kind of State Machine I had previously worked with.

  • 3D scripting has it's own considerations, but for the most part it is very close to 2D scripting (at least at my beginner level). However, there was a big challenge for this project : build an animation framework for patrolling that could scale well as new enemies and animations would be added.

  • This was mostly a challenge during the first week, though I still had to keep it in mind through the whole duration of the project. How to allow my designers to iterate on gameplay ideas during pre-production phase to find the combination of mechanics and game element interactions that have the most fun potential ?

And their solutions

Use Hierarchical Finite-State Machine

Leverage the power of Enums and Dictionaries

Script a Gameplay Tool

  • After spending some time researching the web, I remembered an article from Game AI Pro about different architectures, and felt that HFSM solved exactly my kind of problem. I even got the chance to find a very nice C# implementation on GitHub, that worked pretty well after learning of its API.

flowchart.png
dictionary.png
repair-tools.png
brain.png
search.png
cube.png
  • I felt that the easiest way to select the proper sprite sheet according to the enemy's facing position was by using its Direction as a dictionary value, the key being the state he was currently in (like walking, attacking, hurt, and so on). By then comparing it to the Direction that was assigned to each animation sprite sheet, I could get back the right AnimationClip and play it. With some minor tweaks, I was also able to reuse the same logic for the audio system.

  • It was clear that we could not test every possible nuance of a combat during our (very short) pre-production phase, so we picked very broad ones : closed-combat, ranged combat, defense and repositionning. This allowed us to feel how combining simple mechanics would turn out. We thus quickly realised that focusing on ranged-combat and repositionning was the best compromise between a fun and doable project, and we gave up on any defense or close-combat gameplay.

My Social improvements

  • Delivering content as specified by the production pipeline and Management

  • Communicating with Art or Design in a clear way and helping when needed

  • Estimating feasability an duration of a feature to help Management come up with realistic schedules

My Technical improvements

  • Documenting features so that Art and Design team could use them with as little slowdowns as possible

  • Focusing on a very specific part of scripting (AI) while working on anything related (gameplay, audio, animation, vfx)

My Creative improvements

  • Breaking down designs into usable prototypes to help iteration
  • Empowering designers with technical knowledge

bottom of page