Chef Line’s Journey
A chef ends up in a world made of food and has to fight or cook his way out. Made during my first internship, at game studio Ember Glitch.
What I did
- Scrum master for two developers and four artists, with mentors from the studio.
- Wrote a big part of the 30+ page game design document before we built anything.
- Built the enemy AI: idle, roaming, chasing, attacking and fleeing, each as its own state.
- Did most of the UI, the health system and the interactive objects.
Why state machines
My earlier enemies had everything in one script. Splitting each behaviour into its own state made the code readable for the other developer, and a new enemy became mostly a matter of reusing states. This is the base every enemy runs on:
public void GoToState(Type type)
{
_currentState?.Deactivate();
var next = GetComponentInChildren(type) as State
?? new GameObject(type.Name).AddComponent(type) as State;
next.Machine = this;
next.Activate();
_currentState = next;
}