WnS Feature Spotlight: The JobManager

Warriors and Serfs is an RTS game with a focus on Economy, there are lots of different items that are transported physically from one place to the next, and someone or something needs to make sure that this is done efficiently. Enter: The JobManager.


Before I can talk about the JobManager, I need to explain a little about Jobs themselves. Jobs are created by every Lot (buildings and construction sites), depending on their stockpile levels, and then added to the JobManager’s jobOffers.
Jobs can be either Pull Jobs, or Push Jobs. Pull jobs are created when a Lot needs more of an educt item, push jobs are created when the product stockpile is starting to fill up. When a job is created, no target for the job is found yet.

Job Object

If for example a sawmill has no more Logs, which it needs to produce planks, it will create a pulljob for one Log. The stockpile for this item will contain one “predicted” Log, so when attempting to create the next job, the building will be aware that it has already created one. The destination for this job will be the sawmill, and no source will be set yet.
In case of a push job, the source of the job is the sawmill, but no destination will be set.

What the JobManager does

When a Serf asks for a Job, the JobManager will look at the first job in the jobOffers list (which is the highest priority job), and see if it can be executed. To this end, the JobManager will try to find a source or a destination for this Job (depending on the type), by checking all Lots on the map. If one is found, for example a Woodcutter, that Lot is assigned as the source for the item in the Job, and the Job will be returned to the Serf, who will start executing it.

A Major part of increasing efficiency is the ChainJob feature. When a Serf finishes a Job, for example delivering the Log from the Wodcutter to the sawmill, the JobManager will try to find a Job that needs an item from that destination building, in this case a Plank from the sawmill. If it succeeds, that means the serf has already reached the source of his new job, and save a lot of time walking around between buildings.

There are plans to further improve the efficiency of the JobManager, like finding nearby Jobs for the serf, but as it stands the system is very reliable.

2 thoughts on “WnS Feature Spotlight: The JobManager”

Leave a Reply

Your email address will not be published.