ImGui Prototype

Smoothly sliding settlers

New workshop graphics

Now that the holidays are behind me, I’m back in the development saddle – and riding hard! πŸ™‚ After last weeks abbreviated update, here’s a full one. I’m at 70 items in the “done but unreleased” column now (and I’ve exceeded 2,000 commits!), so it’s probably about time to start packaging up a 0.11 release soon!

Some stats, courtesy of cloc:

  • RLTK is now 2,725 lines of headers and 2,546 lines of C++. There’s also 284 lines of CMake. There are no goto statements! (In reference to a Twitter thread that amused me)
  • Black Future is now 14,924 lines of C++ code, 3,228 lines of C++ header, 2,249 lines of CMake and 4,440 lines of Lua. It also has no goto statements. The CMake stuff is huge because it includes all of the dependency building code – so there’s code to download and build Boost, build SFML, build Lua, build zlib, build FastNoise, build Sqlite and ensure that everything is available for static linking and lto/whole program optimization on a release build. The first compile takes a really long time, but once all of the libraries are done it’s a pretty fast build.

I actually went looking for some places where goto would be a worthwhile optimization, but apparently I just don’t write that way (probably from years of “no goto for you, unless we’re using pure C!”). Most of the time, where gotoΒ would make breaking out of a loop easier, I’m avoiding the issue by either iterating with a lambda callback that includes the logic to stop (thus avoiding the “I wish I could break twice” issue), or using maps and not iterating at all.


  • Ran into a really odd, humorous bug. While working on the new cooking code, a settler shuffled off to hunt down an antelope. I watched as she opened fire, damage was applied, blood splattered everywhere – so far so good. The fallen antelope, oddly enough, turned into a pair of cargo pants. The settler scooped up the pants, took them to the butcher’s shop, and carved them into Bronze Ringmail Meat (and bones and a few other things). That was odd. Meanwhile, a battle broke out, and my brave settlers fired frantically at the invaders. Once again, satisfying carnage happened – and fallen baddies correctly dropped their stuff. An armadillo wandered into the firing line, and was turned into ketchup by an angry cat-person with a sword. The body turned into a spandex blouse! I noticed that a couple of settlers were now naked, also. My first debugging instinct was to make sure that the AI hadn’t gone crazy, and people weren’t throwing clothes at monsters – nope. So I traced a lot, and finally discovered that the ECS was losing the “next id” number for entity creation. Rather than creating a new corpse_harvestable entity, the ID # was being recycled and the corpse properties added/updated to an existing item. So a poor settler’s shirt would teleport to the site of the death, transform into a body (but retaining the material properties of a shirt!). Harvesting was even worse, as random items were transformed into meat – with the material properties and location of the meat applied, but keeping their names (with “meat” appended). Sometimes, really crazy stuff was happening such as rayguns firing another settler, launching them across the world, gravity kicking in, and bits of them going everywhere. Yuck! Anyway, I found and fixed the culprit, and modified RLTK to not let me do that again.
  • Offsetted, sliding movement is complete. Here are some settlers moving
  • Stockpiles are working. You can designate a stockpile, and your settlers will move appropriate items into it.
  • Plants now have a lifecycle. They start as germinating, then progress into sprouting and flowering, and then either start the cycle over (for most vegetables) or remain flowering (for grass types). Grasses can spread. SCREENSHOTS. It doesn’t take into account seasons yet, but that will happen eventually.
  • You can now designate plants for harvest. Settlers will path to the plant, cut it, and spawn the resul. This resets them to their germinating phase (so you get new plants to harvest in 60-90 game days, depending upon species). There are about 30 types of plant with various results (from hay to usable vegetables).
  • You can now cook meals on the nuclear campfire. Simple meals use one food input, normal meals three, and lavish meals use three and a spice. Food name is generated from the components and cooking process (more to come when kitchens are implemented). For example, my settlers just made a Tomato Eggplant Armadillo Garlic Roast – which doesn’t sound too bad. There’s no accounting for taste, so if the settlers really want to make a Tomato Lavendar Roast – they can. There’s also a bug that lets them roast things again, but that’s on the list to fix.
  • You can build a distillery, and process plants into booze. This results in such lovely sounding concoctions as Avacado Wine. There’s a bug that lets them brew meat right now; Armadillo Wine just sounds horrible. Again, that’ll be fixed shortly.
  • I haven’t implemented actually eating or drinking the results yet, but the structure is ready for it.
  • Implemented a generic Dijkstra Map class, and use it for hunting and butchering. It’s really fast, so it is updated whenever huntable creatures move or corpse status changes. Hunters and butchers use it to find the nearest target, and also to easily know when there is nothing to do. It will soon be used in other parts of the game.
  • I added Cotire – the compile time reducer – into my CMake setup. It does a decent job of making normal builds faster (mostly by precompiling boost and SFML headers), and an amazing job with “unity builds” (where it copies everything into one giant source-code file).
  • Fixed spandex blouses covering part of the face.
  • Lightened shadows a bit.
  • All workshops now have graphics. A selection of workshops in action, and the new ImGui log panel
  • Fixed the possibility to get stuck in a loop when hunting.
  • Lots of replacing tabs with 4 spaces, to keep CLion happy.
  • Applied the cooking special case to other organics, so instead of “Skull” you spawn “Antelope Skull” (or bones, hide, leather, etc.). It doesn’t make any difference to the game, but provides flavor.
  • Redid the bed-time code to be significantly more efficient.
  • Sentients who decide that it is time to hunt down and kill settlers now use a Dijkstra map to do so (and to determine whether the action is possible). It cut down on failed A* searches a lot, which removed another case of stalling. Previously, sometimes a sentient would become angry but not have a route to anyone to kill – so it would burn a bunch of CPU cycles on failed path-finding.
  • Rivers are a bit smarter about remaining at reasonable altitudes without causing a flood.
  • Experimented a bit with ImGui, because I could use a quick/easy way to display prettier windows. The SFML bindings I ran into weren’t compatible with more recent versions of SFML, so I set about forking/fixing them! ImGui prototyping