Trees have been an important part of both the visuals and the gameplay of Dark Surrounds since its inception at the 2012 Global Game Jam. While the green trees looked reasonable enough – albeit in a cartoony sort of way – those without leaves looked like a poorly designed umbrella after a strong gust of wind. I'm not sure they were even recognisable as trees; clearly something needed to be done. So I sat down with blender and subdivided and extruded away until I had something more closely resembling a tree but still a very long way from something I'd be happy with.
Modelling that one tree had taken longer than it reasonably should have done – and no doubt I'd get much faster as I modelled more – but knowing that I didn't want all the trees looking the same, I reasoned my time might be better spent writing code to procedurally generate a limitless selection of trees. That would also have the advantage that I'd be able to very easily make changes to all the trees as the art style for the game developed.
Creating trees with code is hard. Creating meshes procedurally is relatively straightforward, a few vertices here and there, a couple of triangles between them and suddenly there's something floating around in 3D on screen that you haven't had to model by hand. Normals, UVs, tangents and such are a little bit more work, but still nothing too strenuous. Trees though... they branch... and branching complicates everything. And it's not just that they branch, but when they do, they might branch into two, three or really any number of branches, and each of those might come off the main branch at a different angle, be of a different thickness and extend for longer before branching again. Some branch quite evenly, essentially just dividing in two again and again until finally giving up and making a leaf instead. Others have a thick trunk, from which only small branches protrude. The more you look at actual real life trees, the more you realise just how many ways they can vary and the subtle details that compound upon one another to make one species completely different from the next.
Perhaps more important than merely creating trees, is giving them life. Trees move constantly; they sway with the wind sometimes groaning with the strain, their leaves rustle and twist back and forth, and they grow. Given their central role in the game, it seemed not unreasonable to try to recreate at least some of those details.