Konstruisto: Update #9 – Trees!

It’s been a long time since the last update – exactly 993 days. Luckily, there are new features coming in, what lead to implementing… trees!

We’re almost there now.

I pushed 122 new commits since the last update, current total 282. What has changed?

Trees

A completely new feature, you can paint trees over terrain. Brush supports modifiers:

  • Shift increases brush radius
  • Ctrl decreases brush radius
  • Alt will switch to single tree placement mode

Placing building or a road will remove all trees on affected tiles.

A group of trees placed on the ground.

New rendering pipeline

I spent majority of time implementing a new rendering pipeline for objects. After engine loads models through Assimp, new renderer packs them up to a single buffer for static geometry. It also holds definitions of materials (basic Phong shading right now). On flush() renderer sorts all draw commands to minimize state changes and sends OpenGL batches to GPU. Instancing is supported with transform matrices per instance.

Terrain chunk full of trees rendering at 62 FPS.

New collision system

I created a new, simpler collision system where bodies are separate from game object representation. With layers, you can for example place a road which crosses another one, but not a building. This also fixes a few weird quirks when placing roads.

Buildings and roads in the forest.

Game saves

Combinations Ctrl+S and Ctrl+L will save/load buildings, roads and camera position. This is a feature from 2018, I’m yet to port it to new collision system (in February?).

Code repository

Go and see https://github.com/kantoniak/konstruisto. There are Star and Watch buttons in the sidebar (right). Repository contains setup scripts for both Visual Studio and makefile/clang++. Have fun!

1 thought on “Konstruisto: Update #9 – Trees!

Leave a Reply

Your email address will not be published. Required fields are marked *