“Black Bot” is a 3D platform game that was created as an end of semester project back in university. The player takes control over a spider-like robot tasked with the exploration of an ancient ruin on an alien planet. The gameplay is defined by varying sequences of stealth and puzzle elements, and the ability to defeat opponents by hacking them, challenging the player to accomplish the levels by avoiding threats, and defeating them through skill instead of combat and direct confrontation.
My main task within this project was to design the behavior of the enemy’s AI and implement it into the game as a state machine.
We decided on two enemy types:
A static turret robot covering an area within a fixed range, and another moving hostile robot that would engage the player with melee attacks and follow after them.
I created a framework based on the State Pattern:
Statemachine.cs (Interface): It contains the abstract class AIStates which sets the initial state, checks and executes the transitions. States are extended through this class to inherit the methods.
RangeBot.cs (Context): Manages the requirements. (Extended through Statemachine.cs to enable access to AIStates in order for it to function.)
As this was my first time being a programmer in a project, the greatest challenges to me lay in memorizing the syntax and debugging. Given amount of states and corresponding conditions to be checked within the RangeBot.cs script, I often lost orientation due to its length in the beginning, but eventually adapted to it once I understood how each element functioned.
Implementing AIs would have been a lot easier with the Mechanim System. Unfortunately, we were already in the middle of our project when Unity 4 was released and decided to stick to Unity 3, as Playmaker (which our game heavily relied on) wan’t yet tested on the newer version.
0 Comments
1 Pingback