Another productive week. The engine revamp is starting to get into that lovely stage where everything “clicks”, and things start to come together nicely and rapidly.

  • The cursors system is in place. It really does more than just cursors, since it also handles highlighting selected tiles. A step in the “geometry builder” phase puts together some dynamic geometry (generally cubes) highlighting the current mouse position, and things like “which trees are designated for chopping” in lumberjacking mode. The render phase then applies these after the lighting pass (but retaining the z-buffer from the earlier phases) with transparency. There are different highlight icons for different things – a highlighted tree looks different from a mouse selection, which looks different from a mining operation, etc. This turned out to be easier than I expected, which makes a nice change!
  • I ported over, and started cleaning up, the basic design mode UI – and started getting keyboard controls working. You can enter design mode by pressing D, or selecting Design from the pull-down menu and selecting a mode. The base Design UI shows you a window listing available design modes, and highlighting the current one. It points you towards keyboard shortcuts (T for chopping trees, M for mining, etc.) and gives a one-click option for changing mode for mouse users. It also ensures that you can use escape to get out of design mode, or click a unified button to achieve the same result. It still needs some visual enhancement, but I’m happy with the overall effect. There’s likely to be a few more design options beyond the current Mining/Building/Tree chopping/Guarding/Stockpiles/Harvesting/Architecture selections – so it needs some flexibility. It also needs to be attractive, since it’s something with which players will interact all the time.
  • Lumberjacking is now completely ported. You can enter tree chopping design mode (with D-T, or the menu). Text explains that you can click a tree to mark it for chopping, or right-click to clear it from the chop list. Clicking trees highlights them with “chop” cursors – so it’s really obvious what you’ve done. Once I found a single line of code I’d forgotten to uncomment, the original AI code worked perfectly: settlers go and find axes, pick them up, travel to designated trees, chop them down, spawn logs and either drop the axe or move to the next tree.
  • To support this, I made voxel models for wood logs and axes (so you can see the results on the ground). While I was at it, I made a graphic for defense turrets (there are temporarily quite a few of them when you start, so help test the shooting code).
  • Fixed a bug that cabinets were spawning without a building_container component tag, so tool-tips weren’t listing their contents on mouse-over.
  • I ran into some issues with terrain chunks updating after a tree was removed. As a test, I removed some threading (suspecting a race condition) – and to my surprise it ran faster. So at least for now, chunk updates are single-threaded again. They are also quite a bit faster than they used to be, and it wasn’t my doing; the most recent Visual Studio compiler update suddenly optimized part of the chunking code much better than it used to be – so that was a happy surprise (Clang also gets it right; GCC not so much).
  • Worked a bit on the tone-mapping code (it takes HDR color spaces and turns them into a color map one can see). This came from reading an interesting article, and suddenly being really aware of messed up dark colors. I’m a long way from a good conclusion, but I’m experimenting…
  • Started work on the particles system, but didn’t finish it in time for this Sharing Saturday. So many things cause particle effects that it has to be done well…

I still have the occasional problem with chunks updating, but I’m solving them one at a time.

Screenshots

  • The design mode GUI, in tree chopping mode. I’ve highlighted a couple of trees for destruction. The lumberjacking information is destined to live inside the design window, but isn’t there yet.