Welcome back to another Cowzy Friday update! This week, we’ve made great progress on construction mechanics, allowing buildings under construction to advance through different construction stages. Let’s take a look at the latest improvements!
Advancing Construction Stages
Buildings can now progress through multiple construction stages, making town development feel more dynamic and rewarding. Each stage updates the building’s appearance, bringing it one step closer to completion!
How does it work?
We created a component called BP_ConstructionComponent to manage the construction of our building.
The static meshes representing the build progress, including completion, our DT_BuildingData data table.

Construction requires energy. The more energy spent on a building, the closer it gets to being finished.
We have an index that holds which part in the array we are at. This is defaulted to 0, as 0 is always the first element in an array
We determine how many meshes we update during construction. This is equal to the amount of meshes in the BuildProgressMeshList minus 1, as the last mesh is added at 100%
As we add energy, we check the % based progress and check it against the index. If the % base is greater than our current index, we iterate our index and update our mesh.

A neat way to manage our memory is that we've stored all of our buildings as soft object references, meaning that as we update, we need to dynamically load our objects as needed. This saves on us loading in a bajillion objects into the scene. This is done through the Async load node.

It's all dynamic!
The best part is that our current system is designed so when we add or remove meshes, it will dynamically adjust in our equation. For example:
Houses has 3 meshes that represent progress and takes 100 energy to build.
Townhall has 4 meshes that represent progress and takes 130 energy to build.
If we change the meshes or energy, it will automatically change the required energy!

This means we can easily add or remove construction meshes without manually updating scripts. This kind of future proofing will make our lives much easier!
What’s Next?
Experimenting with static mesh sockets to add more randomness and variation to how buildings look.
Developing the Builder job so villagers can do the construction instead of me spamming the G key.
Implementing this with the current place a building feature.
That’s all for this week! Stay tuned as we continue expanding the town-building experience in The Cowzy Game! 🏗️🐄🏡
Commenti