Art Stream

Usually we’re doing a live stream at the end of the month, but due to the holidays we’re shifting it to January this time. Same for the next Pre-Alpha update.

Devlog

I made a simple change this week that improves the staff/guest AI quite a bit and helps with performance as well.

Imagine a worker who’s tasked with grabbing a delivery crate from the stack and bringing it to a shop. First of all the worker needs to figure out how to get to the delivery crate stack, if he even can get there at all. This is done using a pathfinding algorithm. Once the worker reached the crate and picked it up he needs to figure out how to get to the shop, again using a pathfinding algorithm.

But what if there is no path from the position of the crate to the shop? The worker unnecessarily went all the way to pick up the crate and wasted time that he could have used to work on something else. It would be better if the game checked whether the crate can be delivered before the worker goes to get it. Pathfinding is relatively fast, but doing a lot of it would quickly get too expensive. So this needs to be done slightly differently!

The solution is that the game simply knows at all times which paths are interconnected. This can be calculated very fast (and only needs to be recalculated if a path gets added/removed) using Flood fill, so now we can essentially check for free whether the crate and shop are reachable before doing the more expensive pathfinding calculation for how to get to these locations.

Here’s a debug view of this connectivity information:

It visualizes which paths are interconnected, so for example any path tiles with a dark green cube can only be reached from other path tiles with a dark green cube. If you’re on a path tile with a dark green cube you can’t reach tiles with a blue cube.

The game keeps separate versions of this for the guests and employees, since guests can additionally use rides to move around the park.

This can be used in a couple of other scenarios too: for example employees who are assigned to a zone will now immediately return to that zone if they’re outside of it (e.g. Janitors who transported a trash bag out of the park). It was previously too expensive to find a reachable path tile within the zone.