Gas Expansion and NEO Scavenger Bugs
Continuing yesterday's thrust toward faster prototyping, I worked on some more gas expansion code today.
First, however, I had to fix something I broke in my haste. I accidentally made all UI overlays use a material for tinting, and it caused selection brackets and AI thought bubbles to be washed out. Splitting the GUI items into tile and not-tile allowed me to restore the different materials for different usages.
Once that was done, I made a few more tweaks to the gas expansion code, and I think it's functional enough to use. The next step will be tricky, though: making use of this simulation.
At first, I was thinking I should make an atmospheric processing unit to spew gas into the surrounding areas. But that isn't very realistic, as a life support system would have the unit pipe air into distant rooms and back again, with various ducts and filters along the way. And my gas expansion code seems to break down at long range. E.g. as soon as you get 15-20 tiles away from the source, the gas takes forever to expand.
This is a limitation of the expansion code, which uses a type of cellular automata code. It checks each tile's neighbors and averages the tiles' pressures so they are more alike. As a result, gas can only move so fast through a system, while in reality, it can move close to Mach 1 (and usually does).
More than a few of you have suggested steering away from per-tile calculations and using a room-based system instead. I've been resistant until now since it's a sometimes complicated problem to solve. However, this may be the straw on the proverbial camel's back. It's come up enough times that maybe I should just do it. Everything seemingly might use it, including gas expansion, lighting, privacy, and designated social usage (e.g. head, canteen, storage, etc.).
Before I go down that route, though, I need to do something about doors. Without them, there are no discrete rooms (unless you have a ship of ghosts or teleporting Trekkies). And doors...well, doors are a famous problem in games.
For now, I'm going to create a simple sliding door. 5x1 tiles in size, 3x1 opening. One version closed, the other open. I'll figure out some quick and dirty way to toggle the different modes, some way for pathfinding to cooperate with them, and then, some way for the game to figure out what a room is. Then, convert my tile-based gas expansion code to room-based, and see if that helps speed, performance, realism, and eventually, hooking up an HVAC/Life Support system.
In other news, I'm also trying to figure out an oft-reported NEO Scavenger bug. People say that Autosave is causing all kinds of issues when enabled.
The trouble is, I can't seem to reproduce it in my debugger. Hours of play on vanilla produce nothing. I've just tried an hour of playing with a mod, and still nothing. If anyone can help pin down the trigger, let me know! I'd love to get this sorted out once and for all.
Have a good night, all!