Alchemist: The first 6 months
I’ve been working on a game about being an alchemist in a bustling town for the last 6 months and wanted to have somewhere to post my progress; hence, this blog!
The game is being built using Godot master branch with Mono C#.
The Idea
The current plan is for the player to inherit an alchemist shop where they must gather ingredients, recipes, and other items to advance the story. NPCs have quests that involve problem solving (what potion could help me here?) and exploration that lead to hidden or new areas.
NPCs & Schedules
Being in a town you’d expect to see a lot of NPCs. To help design them all I identified key differences in the NPCs and designed a plugin to allow for quick iteration.
The NPC Designer and a Bartender character
Different panels within the NPC Designer
Body
Most of these panels only expose enough options to test out the underlying mechanics. The Body panel will eventually allow for different clothing and body builds.
Dialog
Alchemist uses the Ink scripting language for it’s dialog. When a conversation is initiated by either the player or an NPC the current world state is updated in Ink and the NPC starts to process the dialog from line 13 below.
The Dialog panel allows me to set ‘overrides’ on dialog branches. Using this NPCs can have specific greeting (Welcome to my pub!) with generic fallbacks (Hi!, Good to see you!).
The Ink script also has functions for calling animations, on line 21 there is a function call to play the animation ‘wave’.
Schedules
Static NPCs can be pretty boring, and a city doesn’t feel very alive without movement. I decided early on to give the NPCs a schedule to follow which gives them a reason to move around.
Using the ScheduleDesigner in my plugin allows me to quickly define a schedule and the events in it.
Events comprise of:
A location
An action like ‘Work’/’Wander’ or ‘Relax’
A time range
The days of the week the event is valid
The bartenders schedule
Telling the bartender to go to work
Once the schedule is defined it is applied to an NPC via the NPC Designer and serialized.
In game the schedules are processed using Behaviour Trees.
Items
A game about crafting and collecting needs interesting things to find and play with. I continued to expand on my editor plugin so I didn’t have to design all of these objects via json.
The ItemDesigner Plugin
The Item Edit window
The Item Edit window is split into two sections, Base Properties and Extensions. The base properties live on the Item class and determine how the item should look to the game. This includes a mesh that represents the item in 3D, and an icon for inventories and menus.
The Item Extensions provide a way to attach data to an Item that can be interpreted by the game. In the example above there is a Tag Extension which allows arbitrary strings or key/value pairs to be attached to an item. This is useful for irregular meta data on an item, if a tag is being used too often it’s probably worth splitting out into it’s own extension.
The Uses Item Extension allows an Item to be interacted with in a particular way. The ConsumeItemUse referenced in the new item applies the Effects to the character doing the consuming. The label override changes how the action is displayed in the inventory, instead of the default ‘Use’ it can be changed to Eat/Drink etc.