Docked Gas Exchange Is Go

Hey Folks! Hope everyone had a good weekend. Ours included a harvest festival with pony rides, hay bail maze, farm animals, and a pumpkin trebuchet. All on a day with what seemed like the utmost perfect weather. Not bad!

Back at the office, I resumed work on the docked gas exchange problem. Last week's proposed solution did the trick, but not without a few bumps along the way.

Getting the room to include the airlock door's tiles turned out to be easier than expected. I actually had that part solved just after I posted Friday's blog. But getting the gas exchange code to recognize the difference between an adjacent room vs. adjacent airlock into a room was trickier. I tried a few attempts using my trigger system as a filter, but was foiled by either the room or tile entity either way I tried to filter.

In the end, I needed to use two filters to check separately for a room to gas exchange with, and any closed doors in the way. Once I did that, gas would stay in each room even if one airlock opened, and when both did, it flowed freely across ships!

The next task is a related one: pathfinding across docked ships.

Before this afternoon, AI wouldn't even try to pathfind across a ship's threshold. It could be told to walk to the docked ship, but its pathfinding failed at the airlock. It turns out this was due to a simple typo in my code that gets a ring of adjacent tiles. I basically found the other ship's tile correctly, but then just ignored it :)

So that was an easy fix, but it didn't do the trick. As of now, the pathfinding correctly crosses ships and I can see the path weights add-up as they should across the threshold. However, the AI stops at the threshold as if something is blocking it.

And worse, it quite frequently freezes the game and crashes Unity.

This smells a bit like an infinite loop somewhere in the code. And it's going to be tricky to pin down since Unity crashes (which prevents me from seeing the call stack). But there are ways. There are always ways :)

Tags: Ostranauts


Asthepanda2iscool2's picture

Maybe the AI is just scared of boarding a foreign ship? :D
I would be too, given that I probably wasn't invited, and that it appeared out of essentially nowhere.

Rar! Rar rar rar! Thanks for reading :)

dcfedor's picture

That must be it. Though, it would also mean the AI is capable of crashing the game at will!

Dan Fedor - Founder, Blue Bottle Games