Week of October 28th, 2018 Devlog Update: Grinding the AI

Hey all! Sorry for the dearth of info/updates on this blog, we’re just getting our feet under us concerning what the routine is for blogging and so on. In fact, most of the blog posts up to now, you’ll notice, have been categorized as “articles”. The reason being, there hasn’t been a lot of great new stuff happening directly related to the game, since school has been keeping all three of us incredibly busy.

However, I recently finished off transferring the AI from a simple finite state-machine based AI to a full goal-oriented action-planning (GOAP) AI. This means that the AI, instead of having a complex web of interacting state and rules for going from state to state, and special cases for certain goals if something goes wrong/is missing, the AI now can just build its own  list of states/actions and exceptions from what it knows about its goals and surroundings, on the fly and in a totally modular way. This cuts down on code size and complexity and means that it’ll be much easier to add new functionality to the AI.

The holdup is, however, that although the new action-planning AI is almost up to the level of the previous AI (and slightly above in areas such as performance, flexibility to not having materials, and some new building capabilities that weren’t there before), there are a few bugs that are, er, bugging me. Right now, AIs are having trouble pathfinding to the second half of the blocks in an area designated for mining. This seemed to be an issue with the fact that the AIs can’t path find to places next to them, thus holding up the carrying out of steps. But when I allowed them to just mine out blocks directly next to them, they still were stuck. It seems like there’s an issue with pathfinding making them dumb. This wasn’t a problem before because the previous AI just “tried” to path find to the block they were destroying, and whether they could make it there or not, destroyed it. This was obviously wonky but I was waiting until we finished the GOAP AI, but now fixing it has revealed another issue! This is holding up finishing getting the building done, and until building commands are done, gameplay videos would be no beuno.

In any case, development speed has been pretty slow but I’m hoping it’ll pick up soon, especially since winter break is approaching quickly and my next semester looks like it’ll be much easier.

On a side note, we’ve changed the theme of the game based on input from everyone and we all agree on it now. Will is also learning to program in Lua (using LÖVE 2D right now) so that he’ll be able to script animations when we start using Lua as our scripting language.

We had a false start with the devlog awhile back, and I am contemplating adding those back issues to the website, but I’m not sure it’ll even be worth the trouble.

Finally, this is what the new action-planning interface looks like:

self.steps.append(&mut vec![
       stock.unwrap(), stockpile, sid,

Obviously, you have to determine the paths, and positions beforehand, but that’s simple sightline searches and the like, so that’s no big deal. Eventually, this’ll be Lua-scriptable as well.

If you’ll notice in the featured image above, the editor screenshot looks different. I’ve switched back to Emacs, having replaced my (broken) Emacs config with Spacemacs, which is amazing beyond belief. It is a structured way to program and manage Emacs plugins, plus a great default setup to make it look beautiful. Plus the leader-key idea (stolen from VIM) is amazing and the way the help menus pop up if you start a key command and hesitate makes things so much more discoverable, I find myself using the keyboard much more often.

Anyway, Chris signing off for now.

Leave a Reply

Your email address will not be published. Required fields are marked *