What a week! Last week I started GameDevHQ’s career intensive program to really dig into Unity and C# and take my C# coding to the next level. In just a week, I have learned a ton about various subjects like interfaces, dictionaries, events, singletons, object pooling, scriptable objects, and LINQ.
Throughout the course, we are building a tower defense game, and the objectives for the first week were to implement enemy AI functionality, a spawn manager with object pooling, and also an enemy wave system. I also looked ahead and added things like an IDamageable interface (for the enemy damage, that could also be used for towers or the player), a game manager to control game functionality (like game over), and also a couple additional enemy types (a drone and rocket tank).
I separated the enemy scripts, so I have an enemy mech class, an enemy tank class, and an enemy drone class that all inherit from a base enemy class. This allowed me to add functionality for certain enemies that is different from others. Since the drone is flying, it doesn’t need any of the nav mesh stuff, so implementing the inheritance allowed me to leave that bit off of the drone class and only include it for the mechs and tanks. Similarly, for the tanks, if there are no mechs in front of them in the wave, I added functionality to have them go faster. If there are any mechs already spawned in the wave, then the tanks slow down to the same speed as the mechs.
I also added an animation to the tank treads and wheels. For the treads I used a script to scroll the texture. For the wheels I made a simple animation to have them rotate. I also adjusted the origin points of the wheels in Blender to allow them to rotate correctly.
For the wave system, I used scriptable objects to control which enemies come out in a given wave. The waves are able to be set to random, or set with a specific array of integers that correspond with each enemy. I also just recently added a buff interface that is integrated into the enemy wave scriptable objects, so that for certain waves, I can have enemies with differing stat boosts that I can just pull right from the scriptable objects. I may want alert messages to go along with these enemy buffs, so I also added a string to the scriptable objects to be able to pull a message (I may have audio to go along with that later down the line).
Another thing I did this week, since I finished the week one objectives early, is I started playing around with Unity XR, and implemented a simple VR character controller. I also added an FPS controller for if you are not using VR. I am thinking of eventually having the player be able to go down to the towers and get into the action, and shoot the enemies along the path from the towers… But I may be getting ahead of myself on that! As I go along I am setting up functionality to allow for first person combat, but I am also balancing it with making sure that I get each week’s course objectives done and optimized, so we will see if the first person and VR stuff actually gets into the final project.
A simple VR test, and my cat Louie
Now onto week two, where we will be implementing an RTS style camera controller (which I have completed already but will save for the next blog post!), and a tower placement system. The tower placement system is definitely a little more complex than the week one objectives, but I should be able to get it done, I just need to put the thought and time into it!
Until next time!