Hey all! I’m finally back to trying to write some of these articles! The past couple months have been jam packed with finishing up the GameDevHQ intensive training program, then immediately following that up with two game jams and building a website!
First, to recap the GamedevHQ intensive program. In 8 weeks, I learned a ton of C#, from monosingletons to scriptable objects, to event driven systems, custom editor tools, and the Paypal API using JSON, it has been an information overload taking all that in in just a short amount of time. Throughout the course, I worked on a Tower Defense game that I had shown in a couple of the previous posts. Since then, much has been added, including tower upgrades, an anti-air tower, multiple more enemies, health bars, a fully functioning UI, item powerups, and random events that occur between enemy waves. I even added a first person controller and a way to fly around the map in first person and still play the tower defense below as if you were in a UFO.
Throughout the course and project I really started taking a liking to scriptable objects. I ended up using scriptable objects for enemy waves, tower base stats, between wave events, and global powerup items. Scriptable objects allow for so much flexibility and really help to speed up development of any kind of thing with stats, from towers, to items, to cards in collectible card games.
You can even create custom editors around the scriptable objects that can make it even easier to add or create them. For the items, I had a kind of nested scriptable object system. You can see in the screenshot above, we have a SalvagedItem scriptable object called Tougher Walls. This object has an array of references to two other scriptable objects of type powerup and I can add as many powerup types to the original item as I’d like. This gives the flexibility to have items that effect multiple stats and an easy way to tie them together. Below you can see what these objects look like, and how they also reference another scriptable object which is essentially being used like an enum, but with the advantage of being more easily able to add or delete options.
With a scriptable object system like this set up, I was then easily able to add a Unity custom editor to even more easily add new items quickly as you can see below. The powerups stored in a certain folder of the project, are output on the screen with a checkbox, and can be easily added to a new item along with info like the item sprite, price, name, and description.
When clicking the save new item button, the new scriptable object of type SalvagedItem is created with references to the powerup scriptable objects, and then automatically added to another scriptable object that holds a list of items, which is then referenced by the scene. This kind of setup can be especially useful for items like in this example, cards, towers, you really can use scriptable for just about any kind of data and it allows easy reference between multiple scripts.
That’s it for today. Next time I’ll talk about the end of the intensive training program, and a project I did based on a programming challenge that had to be done in 48 hours.