
Hey everyone!
I finally finished the graphics optimisation this week (as far as I can tell right now), and as a side-product, I also changed the system by which trees fall.
Before this week, our trees used physics to fall. Considering we used to have very hilly landscapes, we wanted our trees to fall according to the angle of the hill they were on, according to the force applied to them by the axe, etc. However, while this worked fairly well in the beginning, as our game grew more complex and we had more and more different trees to put into this system, things started to break down a little.
Some trees would fall over quickly and lie on the ground for a while, others would never fully fall over before disappearing, yet others steadfastly refused to fall at all. Using the physics system to calculate such a simple (and frankly unimportant) part of the game became a computationally expensive and yet unpredictable process. As I was investigating where I could further optimise things, this quickly jumped out as a problem and I started thinking about alternatives that would look good enough, while being much faster to calculate.
As a result, I decided to write a little system that kicks in every time a tree gets cut down. The system checks if the tree is leaning in a direction to start with (and if so, lets it fall in that direction), if the tree is “growing” on a hill (and if so, lets it fall in that direction), or if the tree is on flat ground, in which case it chooses a random direction for the tree to fall in. The system also takes into account the size and weight of the tree, and changes the fall speed accordingly. While this isn’t quite as dynamic as our previous system, it is a lot cheaper to implement, and it makes the falling much more predictable, which will help us to implement sounds for the falling, as well as potential particle effects to having the tree hit the ground.
While the sound and particle effects aren’t the first priority on our minds right now, I am quite pleased that we have a good basis to create them from, and we will hopefully get around to some of that additional polish soon.
Before experimental 0.8, I still want to tackle a bit of optimisation of the villager pathfinding and the soldiers’ combat, but more on that next week.
Until next week!
