Hey Everyone! Stephanie here. Desktop Tuesday’s a bit late today because everyone at the office is working so hard, but here’s a peek at the contents of my monitor:

pathfinder_cropped

Note: If things look a little flat, it’s because my test world has various rendering effects turned off.

This week, I’ve been working with Tony on the pathfinder and in particular, on what we call the “worker scheduler.” In the screenshot above, the blue things on the ground are our temporary, debug way of illustrating where each person thinks they’re about to go BEFORE they go there. This way, when the pathfinder is having issues, it’s really easy to see that someone’s about to go off into the middle of the woods and never come back. Other things on the ground are debug entities to visually represent where people should stand when they get where they’re going.

Pathfinding is always complicated, but the way our AI intersects with our pathfinder makes what we’re trying to do in Stonehearth sometimes feel especially challenging. Right now, Stonehearth is a very command-focused game. You, the player, designate things you want to have happen, and the appropriate people spring into action to perform your will.

But how do all the people in the world decide who will do which actions? That’s where our schedulers come in. Whenever the player selects an action, the appropriate scheduler for the job creates a task for all the people registered with that scheduler. If the job is something that can be accomplished by a group of people, like chopping a tree, all available people head over. If the job is suitable for only one person, like carrying one particular piece of furniture from one side of a house to another, they all compete to figure out who is closest to the relevant entities and whichever one wins grabs the item. Everyone else then goes back to whatever task is next on the queue.

When I added per-worker logging to help me figure out who was deciding to do what at any given time, our workers ended up sounding like a really loud, pro-active volleyball team:

<Stephanie> ::Puts a log in the world::
<Sean> ::notices:: A log!
<Brom> ::notices:: Whoa, a log?
<Nol> ::notices:: Really, a log!
<Mer> ::notices:: A log!!!!
<Brom> ::is closest:: Mine! I’m taking it!
<Sean> Ok FINE, guess it’s yours.
<Nol> Drat, you can have it
<Mer> ::sigh:: It’s your log
<Stephanie> ::clicks:: Ok, guys, Chop a tree!
<Sean> A tree! I’m chopping!
<Brom> A tree! But I’m still taking this log to the stockpile! Guess I’ll pass but I’ll be baaaaaackk!!
<Nol> A tree! I’m so there!
<Mer> A tree! Mine!!!
<Brom> ::deposits log in stockpile:: Oh hey, a tree!
<Tree> ::upon chop, deposits logs on the ground::
<Sean> Whoa, now there’s logs and this tree I wanna chop. Which should I go for? Log’s closer. Log, GET!
<Brom> Tree’s closer, Tree GET!
<Nol> Log! No, Sean’s got the log.
<Mer> Tree!

And since the worker scheduler and pathfinder are both still buggy, and people sometimes randomly forget what they’re supposed to be doing, eventually this devolves into:

<Nol> What? Me? Logs?
<Mer> I’ve got this log, but I’m lost.
<Sean> Guess I’m going to stand here, looking into the clouds
<Brom> My log! Where is it? ::existential angst::

Coincidentally, I hear goldfish have a memory of about 40 seconds.

Back to the bugs!