Making a RTS game #22: Producing some resources with our buildings (Unity/C#)
On with our RTS game: today, we’ll make our buildings produce some resources!
⬅️ Tutorial #21: Adding players and unit ownership| TOC | Tutorial #23: Implementing behaviour trees for our units 1/3 ➡️
📕 Get the ebook and bonus material on Gumroad!
🚀 Find the code of this tutorial series on my Github!
In the last tutorial, we’ve worked on our units and we’ve implemented a system of ownership. In this article, we’ll start from there and focus more on our buildings: we are going to see how to have them produce some resources based on their position in the world.
Here, what I call “resources” are the three in-game resources we talked about a long time ago, at the very beginning of this series: gold, wood and stone.
For this project, I wanted my resource production system to have three characteristics:
- the type of resources a building can produce depend on its type
- the amount of resources a building produces depends on where it’s placed in the world: the surroundings impact the “production efficiency” of the building
- resources are infinite: instead of having units…