It’s been a pretty productive week:

  • Entertaining bug: I accidentally gave archers heat-seeking missiles instead of arrows. A flub in the AI code for ranged weaponry did the wrong type of path/line-of-sight check when firing. The intended behavior is that if the archer can’t see the target, they can’t fire arrows at it. Instead, they got into range and launched – the missile carefully (and very fast!) pathed through a winding maze of corridors, hunted down the target and shot them. This led to a funny situation of my settlers hiding in a basement while missiles worked their way through (including negotiating staircases) and picked them off one at a time (no survivors!).
  • Rocks now spawn where you mined them from, rather than on your tile. Small change, but looks better.
  • The Dijkstra map system now won’t route settlers through underwater tiles, leading to their likely death.
  • Water is much faster now. Water that doesn’t have anywhere to go is marked as stable – and won’t be unflagged until the terrain changes or nearby water changes. This reduced the number of calculations per frame by a massive amount. You can still damage your framerate by trying to drain an entire ocean. This let me simplify the thread code a bit, which makes debugging easier.
  • You can now have more than 10 settlers! Periodically, the game announces that the auto-repair on the ark has succeeded in restoring the teleporter sufficiently for a new batch to arrive, and more settlers spawn in your escape pod. As a test, I set “periodically” to “every day”, and batch size to huge. The game still chugs along with 200 settlers, but performance issues starting to kick in around 150 (the game really isn’t ready for that many settlers – they mostly pathed around randomly with nothing to do). I commented out a section of code that has been extremely problematic lately (finding a better melee weapon if one is available), and it handled all 200 with ease. So that’s good to know. I’ve restored the resupply of settlers to a trickle, but it helps apply some pressure to get a good base built by continually adding strain to your facilities. I plan to have the rate at which they arrive be modified by things you can build (such as a teleport beacon), and still want to have settlers land in other world tiles (when travel is up…), but it’s a big milestone.
  • Fixed an issue with log entries losing letters after a color change. I noticed that I was seeing messages along the lines of Elder Herbalist attacks ild boar with their ar hammer, dug into the (nasty!) code that translates that into ImGui text elements and found that I was skipping the first letter after a color change.
  • Settlers who want to go to sleep, start pathing towards a bed, and cannot complete the task because the bed became unavailable no longer get confused and wander back and forth. Instead, they path towards the next available bed – and if there are none, they complain and go to sleep on the ground.
  • Added status markers next to settlers heads. For example, a sleeping settler gains a little “Z” badge, or a settler going to be a lumberjack (and he’s ok) gain a little tree icon. There’s more to come, but it gives a quick/easy visual indication as to what’s going on – especially the sleep indicator (a settler remaining stationary for hours of game time looked odd; now it’s clear that they couldn’t find a bed and took a nap where they were standing).
  • Blood stains no longer just turn the tile background red, but add an alpha-blended bloodstain graphic to the tile. (They wash away eventually).
  • Settler life histories can no longer raise a skill above level 3 (so settlers can’t be super good at something, just competent). Likewise, settler life history won’t give them super-human attributes anymore. Also fixed a type-conversion error that was resulting in a skill level of 1 being loaded as 51 (leading to settlers who could one-shot anything in the game if they had 1 point of ranged weaponry skill, you saved and then re-loaded).
  • A new workshop: the mechanic. You can use this workshop to build mechanisms (from any block) or simple circuitry (which requires silicon, which in turn requires raw sand). There’s more workshops to do before you can start to build more interesting circuits. For now, circuits don’t do anything – but they are an important component of a number of planned additions ranging from turrets to radar, via robots and more advanced weaponry.
  • Implemented the long-planned entry_trigger_t component. A building can have a trigger component attached to it (they are efficiently indexed in a location map, lazily rebuilt when triggers change). Triggers can be active/inactive, and set to fire for wildlife, hostiles, or everyone (more to come). This was the precursor for a number of other elements.
  • By combining a mechanism with a boulder, you can build a stonefall trap. When a hostile (or wildlife) enters the trap, they take damage, a message appears in the log, and the trap self-destructs (you have to rebuild it after each use; trying to avoid the DF syndrome of all-powerful traps).
  • At the carpenter’s workshop, you can turn wood blocks into cages. Combine a cage with a mechanism, and you can build a cage trap. These fire for hostiles and wildlife for now, and trap them in the cage (destroying the trap in the process – again, trying to avoid making it too powerful). There’s hooks/notes in place to provide a chance to dodge, but they aren’t there yet. Once trapped, an entity will stay in the cage. For now, they are stuck in there forever – but the plan is to let you place the cage (to taunt them or build a zoo!), strip captives of their gear, kill them (and eat them, in the case of wildlife), and possibly persuade them to join your civilization. That’s for a whole next batch of code dealing with prisoners.
  • At the primitive forge, you can take metal bars (made at the smelter) and forge trap blades. Combined with a mechanism, this gives you a blade trap. Blade traps inflict damage on hostiles/wildlife who enter them. Unlike other trap types, they don’t reset (but may eventually jam – not implemented yet).
  • You can now build beds. That was an oversight on my part, I thought you could before.
  • Extensive playtesting while I test the new features have expanded my bug-list again. Nothing really fun this week, but lots of tiny quality-of-life issues to resolve (and a merciful lack of crashes!).

Combined with the new architecture sytem from last week, you can now get a pretty decent base up and running relatively quickly. For example, it took me 25 minutes (real time; about 4 days game time) to chop down some trees and dig out some terrain, build a sawmill and stonecutters, build a perimeter wall with a corridor entry, place traps in the entryway, and get a basic set of workshops up and running.

Next week should add levers and pressure plates, able to be linked to doors and bridges. I’m hoping to also get the food/drink clocks going, but that’s still rather poorly planned!