Having colonists presents an unique challenge as they need to track many events across the game world. For example:
- where is the nearest resource type ?
- where is the nearest stockpile ?
- where are the nearest ice cubes waiting for transport ?
- nearest processing plant ?
- nearest building object ?
- nearest resource of any type ?
The approach I took relies mostly on using Groups. Resources, Stockpiles, Building Objects, and other object are placed in the corresponding group. Then actors simply scan for the nearest object and feed it into the state machine.
As there are potentially many actors scanning for items across the game world I did want to measure how expansive are these actions beyond the data presented in the built in debugger. For this purpose I am running simple tests as seen below and the results are at around 5 – 10 MS per action on 1000 iterations, which is completely fine for now.
Subscribe to be notified when the new game launches !