[Unity/C#] Making a RTS game
Mina Pêcheux • March 2021 - March 2022
📕 Discover the series as an ebook and get bonus material on Gumroad!
This repository contains the code for my on-going series of tutorials on how to make a real-time strategy (RTS) game in the well-known game engine Unity! Throughout this series of tutorials, I explore C# scripting for games, GUI building, event systems, behavior trees, sound optimization...
To run this project, make sure you play it from the "Core" scene! ;)
→ For more info, see Tutorial #41
You can find the list of all tutorials on Medium, or right below:
- Tutorial #1: Placing buildings
- Tutorial #2: Adding a very basic UI
- Tutorial #3: Setting up in-game resources
- Interlude #1: Introducing an event system
- Tutorial #4: Selecting units
- Tutorial #5: Transforming our data into Scriptable Objects
- Tutorial #6: Improving the UI
- Tutorial #7: Polymorphism, take 2!
- Tutorial #8: Boosting our selection feature
- Tutorial #9: Implementing character units and skills
- Tutorial #10: Moving the camera
- Interlude #2: Refactoring the event system
- Tutorial #11: Adding a day-and-night cycle
- Tutorial #12: Moving Character Units
- Tutorial #13: Adding a minimap and fog of war 1/3
- Tutorial #14: Adding a minimap and fog of war 2/3
- Tutorial #15: Adding a minimap and fog of war 3/3
- Tutorial #16: Introducing a sound system 1/2
- Tutorial #17: Introducing a sound system 2/2
- Tutorial #18: Preparing our game parameters
- Tutorial #19: Displaying our in-game settings!
- Tutorial #20: Saving the player’s data properly
- Tutorial #21: Adding players and unit ownership
- Tutorial #22: Producing some resources with our buildings
- Tutorial #23: Implementing behaviour trees for our units 1/3
- Tutorial #24: Implementing behaviour trees for our units 2/3
- Tutorial #25: Implementing behaviour trees for our units 3/3
- Tutorial #26: Levelling up our units! 1/2
- Tutorial #27: Levelling up our units! 2/2
- Tutorial #28: Adding some shortcuts
- Tutorial #29: Improving our players system
- Tutorial #30: Refactoring our save/load system with binary serialisation 1/2
- Tutorial #31: Refactoring our save/load system with binary serialisation 2/2
- Tutorial #32: Creating a debug console
- Tutorial #33: Using Unity’s terrain tools
- Tutorial #34: Improving unit navigation & adding unit formations 1/2
- Tutorial #35: Improving unit navigation & adding unit formations 2/2
- Tutorial #36: Using workers to construct buildings 1/3
- Tutorial #37: Using workers to construct buildings 2/3
- Tutorial #38: Using workers to construct buildings 3/3
- Tutorial #39: Boosting our game scene
- Tutorial #40: Fixing our minimap
- Tutorial #41: Preparing for a main menu...
- Tutorial #42: Designing our main menu 1/2
- Tutorial #43: Designing our main menu 2/2
- Tutorial #44: Importing models & animating our characters 1/2
- Tutorial #45: Importing models & animating our characters 2/2
- Tutorial #46: Saving our game scene data...
- Tutorial #47: ... and loading back our game scene data!
- Interlude #3: Showing our updated minimaps in the menu
- Tutorial #48: Various fixes, improvements and clean-ups
- Tutorial #49: Optimisation tips & tricks
- Interlude #4: Improving the healthbars
- Tutorial #50: Implementing a technology tree 1/3
- Tutorial #51: Implementing a technology tree 2/3
- Tutorial #52: Implementing a technology tree 3/3
- Article #53: Final words, thanks… and an ebook!
Known issues
About installing / upgrading
The project was written in Unity 2020.3. This implies that, when loading it up with different recent versions of Unity, you'll need to "upgrade" the project. This usually goes without a hitch, but there is for now 2 bugs that have been spotted by the followers and I:
-
incorrect lighting: upgrading to some Unity 2020+ might lead to some strange lighting of the scene (because of pipeline render defaults and lighting settings changes). To get a similar lighting to the original project, make sure that you remove all baked lighting data, that all your (directional) lights are set to "Realtime" and that you ignore the environment lighting.
To do so, open the Window > Rendering > Lighting panel, go to the "Environment" tab, and set the "Intensity Multiplier" variable to 0 both in the Environment Lighting and Environment Reflections sections.
-
FOV shader bug (thanks to @Oarcinae): upgrading to Unity 2019.4 might lead to unexpected behaviour for the FOV shader (because of pipeline render defaults changes); to fix the issue, you can try modifying the
AlphaProjection.shader
and comment out the line:#pragma exclude_renderers d3d11 gles
(still an open issue #2, any help is welcome 🙂)