AI Walk, Use, Wait

Hey Folks! Today was a much more productive day, as I was able to spend most of it working on code. And so, I focused on making the AI and its feedback UI better.

The first thing I did was to shore-up the dialogue UI a bit more for better debug output. I added some activity timer info to it so I could see the countdown as an AI was acting on something. And after a bit of watching and stepping through code, it turned out there were a handful of bugs in there that made the AI behave a bit strangely.

First of all, there was a bug that caused an AI to clear it's own queue if it walked to a target, instead of doing the next action in the queue. Normally, the AI would tell the target to stop it's current action (waiting, since it was an action's target) when it arrived. But in the case of walking, the actor and target are the same AI, so it told itself to stop doing the next action.

Once that was fixed, AI behaved a bit more predictably, and the next bug came more easily. I was able to fix an issue that caused the animator to get stuck walking/using when it should revert to idle. Now, the AI would play a walking animation as it approached the target, then switch to "use" animation when it got there, and finally, "idle" when it finished.

After the above, I decided to also start working on migrating the message log data from the scene into each AI. This way, the messages would be recorded on each AI in case the user (or in my case, developer) wanted to check the history. The scene version would only show messages if the AI said them while selected, resulting in data being missed by the user.

And to go hand-in-hand with this, I also changed the message log UI to appear as soon as an AI was clicked, and to fill it with the AI's message log. Now, the user can click around to see what each AI has been up to recently.

It still needs some work, both in terms of bug fixes and refinement. But this is a big step forward in peeking "behind the curtain" on these AIs, and being able to test them in a more macroscopic way. I.e. "are they behaving like crew should?"

I think that last series of bugs had me in a rut, and it feels liberating to be past those now. Hopefully, this is a sign of more progress to come!

Have a good night, all!

Comments

Malacodor's picture
Malacodor

Could you please let the program write all the AI logs into a text file that gets properly closed, even in case of a crash? This would be extremely helpful for reporting bugs, once a playable version is published.

Ran around with a clown mask before it was cool

ra1's picture
ra1

If only flushing to a file dozens of times a second wasn't so resource intensive.

dcfedor's picture
dcfedor

As ra1 implies, this may be prohibitively intensive to do depending on the number of messages and AIs active at once.

On the other hand, now that I'm using Unity instead of Flash, I may have more tricks I can use to help with debugging and logging.

One thing at a time, though. There needs to be something worth playing before I add end-user debugging to it :)

Dan Fedor - Founder, Blue Bottle Games

Malacodor's picture
Malacodor

Better asking too soon than too late. ;-)

Ran around with a clown mask before it was cool

ra1's picture
ra1

Perhaps you could set up a separate (optional) logging process that could use some form of IPC to send log messages. This would only write to file at periodic intervals - but could survive a game crash.