After getting tsrl released, I was excited to get back to Black Future. Not a lot to show off this week, most of the work has been on the back-end or needs more time to mature:
- I finished getting it to work in CLion on Windows, Linux and OS X. It’s nice to have the same environment on all three.
- I did some static analysis with clang-tidy and removed some “dead code” – code that wasn’t used anymore.
- Refactored the “raws” system into a bunch of different files/compilation units, and continued the quest to remove global access to them and force them through access functions which include error checking.
- Added a compiler define option, BOUNDS_CHECKED. If enabled, all accesses to the map are checked for valid coordinates and the
mapidxfunction checks every range. This function is used thousands of times, so there is a performance hit for this – but it helped me find a number of subtle bugs, which are now fixed.
- Played enough to find some more bugs, and fixed them. An off-by-one was causing deer to randomly transform into elephants if you could trigger the right set of circumstances. There are now checks in place to prevent that from happening.
- Fluid dynamics remain a pain point, so I played with a few different strategies. I haven’t settled on one yet (what i have works, but doesn’t support pressure – so some of the cool DF tricks won’t work), but I did manage to bump fluid calculations into their own thread (concurrent with the rest of the tick) – which fixed performance nicely.
- The “collapse” code is smarter about floors and ramps now – they don’t support the tile above them (but tiles can still be supported by adjacent, supported tiles – so ceilings don’t come crashing down). The test for this is fun: find a building, dig down and dig out the area underneath it. Then, dig channels in all of the tiles around the building. BOOM – particles everywhere, the building deconstructs into components, the occupants fall to death or serious injury, and any solid tiles become boulders. It’s a great way to wreak havoc, or speedily mine – if you don’t mind losing the odd miner. (When supports are in, it’ll be possible to do it safely).
renderablesonto their own “sparse layer”, so you can still see the background behind them. This had the side-effect of making a couple of buildings look terrible, so started fixing them.
- Inspired by my pixel-art work in TSRL, I started adding some extra graphics to the game. It’s sitting in a local branch right now, while I decide if I really want to do this – but it’s going really well so far. If it works out, I’ll screenshot next week.