Real-Time Strategy Tutorial
This forms the beginning of a tutorial on building a real-time strategy game in Unity 3D. I will be using the free version of Unity 4.1 with C# scripting. There should be no difference between Windows, OSX, or Linux - and in fact I have done some of the programming for this using both Windows 7 and OSX. There will be a lot of programming, so it is assumed that you have an understanding of basic programming principles and at least a basic familiarity with C# (or a similar language such as Java, C++, etc). I will be covering why we are doing things a certain way, but I won't be stopping to discuss any language stuff in detail. It is also assumed that you have a basic knowledge of Unity - as much as is covered in the beginners tutorials anyway. Earlier posts will include a bit more detail on Unity (including some screenshots), but as we progress this will diminish.
All of the source code will be freely available on my github account. I will make a commit for each post, so you will be able to step through the revision history alongside each post. This will include the Unity project as well as the source code and all relevant assets.
The goal is to produce a game that includes all of the core mechanics needed to play a modern real-time strategy game. The core features we will be aiming for are:
- Multiple players, one of which will be controlled by the player
- Selection of game objects - whether units, buildings, or resources
- The ability to issue commands to any units / buildings that the player controls
- Basic movement (no pathfinding is planned at this stage sorry)
- The ability to create new units from specified buildings
- The ability for specified units to be able to construct new buildings
- The ability to collect resources, thus enabling a simple economy
- An interactive display that shows the player
- What resources they currently have
- What game object they have selected
- What options a selected game object has
- A functional menu system
- The ability to save and load games
- Simple audio playback
- Defining a number of different victory conditions
- Basic AI for world objects
- Basic AI for a computer player
- The framework for a single player campaign
- The ability to upgrade units and buildings, complete with a technology tree
Obviously this is no light undertaking. Just looking at that list is daunting ... but it is entirely possible to complete. I will attempt to keep things as short as possible, but I do not wish to skimp on any of the necessary details either so some posts will get quite long. As we progress I will also attempt to lay out my reasoning for certain design decisions. Please also note that this is a work in progress. Many of these objectives have been completed, but there is still quite a lot to come as well.
For those of you who are interested in trying things out before going anywhere I have built a version of the game for Windows, OSX, and Linux. Please note that the only version which I have actually tested so far is the one for OSX, so if you have any problems with these please let me know. I will also be updating these each time a new part is out (well, sometimes anyway), so the version being linked to should be the one for the latest part (or close to it).
Here are all of the parts that we will be covering over the course of this tutorial.
Like I said, this is quite a lot to cover. I do hope that you find the end result worthwhile though.
A quick note before getting started. Unfortunately, due to life taking over this tutorial is no longer under development. Despite that (and the fact that it is for an older version of Unity now) I still feel like there are some worthwhile concepts to be grasped. While the project you build will not end up completed, as such, I hope you find that it has given you a much better grasp of one way to approach a larger project. That was, after all, one of the primary goals for the tutorial as a whole.
Now it is time to begin ... Onwards to Part 1.