Posted May 12, 2024 by Cablel
Biig week this week. I knew there was going to be a lot to add, but to no-ones surprise, it took more time than I hoped it would. But here we are, at the end of the week, and with lots to show. Unfortunately I had a doctors appointment on Friday, and wasn't able to share my game progress then. I will be posting my game into the game feedback channel on the KIT109 discord soon to hopefully get some feedback on peoples interactions with everything I have added this week. Speaking of which, the things that have been added are: four enemy types, proper shooting with raycasts and object instantiation, damage for both enemies and the player, several rounds of enemy waves, custom wave creation, and weapon upgrades. Lets get into it!
So as mentioned before, I added the four (technically five) enemies I had planned for the game. These enemies are:
Hopefully these four enemies will provide some nice variance over the course of the game. All of their stats and behaviour are subject to change upon feedback, and most definitely need balancing on many fronts, like their speed, damage, resource drops, and more. Really, all the numbers currently are just rough estimates for a vague idea of what each enemy should specialise as. This will be a theme throughout pretty much all of this devlog, as balance is really minimal right now on all fronts. Anyway, Moving on, enemy waves!
The thing that generates all the action, waves of enemies making their way to your house. There was a decent amount of technical work to get this all done, but its mostly boring. The highlights are that each wave is an object, and the main part of each wave object is a list of group objects that it steps through one by one, spawning the listed enemies in each group by their given interval time. A group also has a property that is used once the final enemy in that group is spawned, "endInterval", where a different, often longer, interval can be set for in between groups in a wave. This setup provides a lot of flexibility and specificity in how a wave can generate enemies, the possibilities are pretty much endless. Large waves do get a little clunky, and I might look into a more elegant way of doing that. Oh, I was entering all of this information into those lists in the inspector, and I just kept getting terrified about the thought of all the information I had entered into the inspector getting erased if I changed something in the code too drastically. So I learned about Unity's JSONUtility class, and created a JSON file that holds all of the data for each wave inside it! Neat!
And in action this looks like:
All the waves created so far are, again, subject to change. My vague idea is to, within the 20 waves I have set for myself to make, introduce a new enemy every five waves. With four enemies, and the first being introduced as the basic zombie on round one, the final enemy will be introduced around wave 15-16. The waves prior to each introduction of a new enemy should be progressively harder, with a pause in intensity upon introducing a new enemy, before ramping up again. The final wave (wave 20) should also be the most challenging by far, and be a test of stats and skill. Achieving all of this may be difficult as there is an incredible amount of work to go into balancing everything. Moving on...
I finally implemented damage for the player, and the enemies follow a very similar behaviour. Basically, upon taking damage, the entity is knocked back based on the direction of the incoming attack, and they lose some health. Upon reaching zero health, they die, and either the enemy entity despawns or the game is over. The house also can take damage, but unfortunately doesn't get knocked back. The player deals damage to enemies by shooting, which occurs differently depending on the weapon. For example, the player's shotgun fires multiple "projectiles" (raycasts) in a cone, the rifle fires singular rays in a straight line repeatedly, and the launcher instantiates a physical "rocket" that explodes on impact or after a certain distance.
Next up on the list of things added is the weapon upgrade system that shows after a wave has been defeated. The player is presented a choice of three upgrades. Each upgrade improves a certain stat on a certain weapon, and costs an amount of scrap. If the player doesn't have enough scrap to afford an upgrade, the upgrade will not be interactable. Similarly, there is a button that allows the player to refresh all of their upgrades for the price of 12 scrap. Multiple upgrades can be purchased at a time, as long as the player has enough scrap. An upgrade will be regenerated upon purchase.
The numbers aren't final, as per usual. 5% is probably too little an increase to stats, and costs need to be adjusted. I also wonder if some upgrades should be rarer than others.
So, as you can see, a lot was added this week, and there is now an actual game to play. It is a very unbalanced game, and there is much to be done in terms of visuals, audio, and game feel (the goals of next weeks work), but the gameplay is essentially all there, and it just needs a lot of polish. I know I went a good bit over the word count for this devlog, but there was just a lot of stuff to cover. Heaps of fun to work on as usual, and the end is in sight! I wonder how much polish I will be able to achieve in these last two weeks.