In the previous developer log I talked a bit about the new objects being added for colonist training. These new objects will allow you to train colonist attributes as well as transfer job experience from one colonist to another. While developing these new mechanics there was a bit of an issue when it came to when colonists would train vs. other activities.
My initial plan was to have colonists perform training actions when they didn’t have other activities, such as work, to perform. While this worked it was awkward and didn’t allow a lot of player control. So I decided to add in something that has been on the list of a while, but didn’t feel critically important until now.
In order to have more control over what activities a colonist is doing, I’ve added a new colonist schedule system. You can have multiple schedules and assign colonists to a given schedule. In each schedule you can define, per hour, what activities are performed during the day.
Colonists assigned to a schedule will determine what actions they can or can not perform based on their assigned schedule. This also means that you will need allow for sleep and recreation time as colonists will no longer perform these automatically during work hours.
In addition to specific activity types there is also free time which provides no restriction to what a colonist can do. This means that during free time they will behave as they do currently without a schedule.
The benefit of schedules, of course, is more control over what colonists can do and when. This also means that you can define training time for colonists which resolves my initial concerns regarding the new training mechanics.
The colonist AI uses GOAP, Goal Oriented Action Planning, to generate a chain of actions to satisfy a goal. Every action has preconditions, effects and conditional validation to determine if an action can be performed. For example the FindWork action has an effect of StayAlive and a precondition of DoWork. The StayAlive effect will satisfy a colonists primary goal, but some other action will need to satisfy the precondition of DoWork.
In the above example the Construct action has an effect of DoWork that can satisfy the FindWork action. If the Construct action passes it’s conditional validation (has a valid target, low enough action cost etc.) then we can chain these actions together and have the colonist perform them.
Actions can now define a schedule activity and if the defined activity doesn’t match the colonists current schedule activity then the action can’t be performed. Since all of the work actions will chain through the FindWork action then I can add the work activity to the FindWork action. This means that colonists can only perform work actions if they are inside of a work activity block in their schedule. This same method is used for the other actions such as recreation, sleep and training.
The scheduling system, as well several other new features, will be available in the coming experimental branch for Update 30.