For the Capstone project, I and two other students are working on a 3D Tower Defense game in Unity. The basic premise is this – orcs and other fantasy creatures are working their way along a snaking path toward the player’s castle, intent on destroying it. The player is tasked with strategically placing various types of towers along the path to destroy the enemy invaders before they can destroy the castle. It’s a popular game format found in many games, and creative variations of the format can also be found in popular games, such as Plants versus Zombies.
I have prior experience working in Unity, but it’s been about five years since I spent any time significant time with it. Back then I was modeling real-time 3D assets for a virtual reality application and had not yet started the CS program. I enjoyed Unity at the time, but my coding skills were “exploratory” at best. While I was able to get things to work eventually, thanks mostly in part to online forums and tutorials, I didn’t have a good grasp on what was going on. If I couldn’t find a good example via Google, then I often couldn’t go much further. It was frustrating, to say the least.
Now, as I near the end of this program, I have at least some understanding of what is going on with Object-Oriented Programming and C-style languages, and I’m having a great time working with Unity. It’s a lot of fun.
Unity is a great environment to work in, providing a central hub that ties all the disparate pieces of a game together. I think of it as a really great Integrated Development Environment, like PyCharm or WebStorm, but even better. It has a Scene view as well as an Inspector to view exposed variables and connections between assets and scripts. It will compile the C# code every time you make a change, and when you press “Play” in the editor it executes the program and you can see the game in action. It’s a visual testing environment, with a layer of abstraction that I find very helpful when learning to code for games. I think it is a great tool for beginners to experience the joy of coding and seeing the effects quickly and visually.
One of the most time-consuming parts of game development is building assets. These are the meshes, animations, materials, textures, rigs, sound effects, and other visual and audio components that constitute the “material” the game is made from, all optimized for real-time rendering. This is no easy task to undertake. Fortunately, we could download our game assets from the Unity Asset Store, immediately removing that hurdle. With the assets complete we could focus on programming, developing scripts that we can attach to the assets in the Unity Editor, and building out the overall game behavior.
Our Assets
While Unity is a great environment for piecing together all the assets and code into a cohesive program, it’s not ideal for editing the code itself. I do the actual coding in a companion IDE called Ryder (from JetBrains) that attaches to the Unity process. This allows me to edit the code in an environment specifically for C#, run Unity from Ryder, set breakpoints, and even debug the game at runtime.
Another great aspect of working in Unity is the community support and extensive online resources. Because it is such a widely-used game engine, there is no shortage of coding examples and instruction built around it. One interesting avenue I went down in the course of this project was learning about ScriptableObjects in Unity. These are project-wide serializable assets, created by scripts and adjusted in the editor, that can be accessed in any scene, preserving state across scenes. At a basic level, they can act as novel data containers, but others have built entire game architectures around them, greatly modularizing the various component of a game. Here are a few videos I found useful for learning about ScriptableObjects:
So for now I’m really enjoying this Capstone project and playing around inside Unity. It is very accessible and easy to get started but has tremendous potential for powerful and complex applications. There are also many other applications you can build with Unity that aren’t conventional games, such as Interactive Experiences, Simulations, or Architectural Visualization. This experience has made me even reconsider what jobs I might pursue when I graduate. At the very least, I highly recommend trying it out if you have ever been curious about game development or just trying out new methods to make something.