Hello there! I am not sure when this blog post will go up but I have decided to start writing dev blogs for my currently in the works 2D platformer that will be a donationware game. It currently doesn’t have a title. It’s interesting getting back into programming an actual game. My last game was a text based adventure and before that I was just working on a Breakout clone following an online lesson too much. Speaking of which, this too started out as an online lesson. However, I didn’t like how the instructor was making the game. This caused me to forge my own path throughout most of the class.
I’m sure you’ve heard this before. People who will take a class and then add 1 or two basic features and then try to sell the game on their own. Even though they don’t have the right to the assets. That’s where I decided to be a bit different. First, the core aspects like running, jumping, climbing, and shooting are from that class. Same with picking up coins and some of the enemy movements. For the assets I decided to purchase the assets and modify them myself to help make them look a bit more original. I didn’t just apply a Unity sprite filter over them. I actually took the time to go through and make new color pallets for them. Even though the game is going to be free, and you can choose to donate if you’d like, I still wanted to put in the effort to make it perfectly legal to sell and stand out.
Speaking of standing out. I wanted to add more features to the game too. I didn’t just spam my questions on Stack Overflow either. I took the time to write my own pseudo code and implement it. Then do some bug testing. I even made some of my own enemies. It’ll be obvious which ones are mine since they’re nowhere near as well animated. What features did I want to add? Swimming, upgrade mechanics for the gun, a way to increase your lives, new GUI elements, a knife to attack underwater, more death traps, an exit that isn’t just an exit sign, and tons more! Note, not all of these are implemented yet. That’s why I am making this dev blog. I’d like to share the experiences I am going through with this and how fun it is getting back into the joys of programming after taking an insanely long break and random breaks between starting up again.
So what did I do today? Today I took the time to learn how to make my own sprites and sprite JSON files for TextMeshPro in Unity. See, I didn’t like that the UI just said, “Lives: 3” I like having a picture/icon for it. I am not sure if the current icon will stay, but it is there now and can easily be swapped. I have the knowledge to do this now. What’s interesting is everyone just told you to make a 512X512 picture with a bunch of 128X128 pictures and just use TextMeshPro’s Emoji JSON file. I found this weird because even other programmers were telling you to do this. So, I popped on some Butthole Surfers and began digging into this JSON file. Trying to understand each line and figuring it out. If others were going to tell me just to use it and abuse it I figured I would at least learn how to abuse it. In doing so I was able to make my own and made my own TextMeshPro sprite system that doesn’t follow their 512X512 system. This one may not have been a lot of work but I still felt proud of myself for doing something everyone just took the easy way out on, even if that caused bloat in the project.
Next I tidied up some of the code leftover from the class. I tend to hate classes for programming, but they’re useful for random bits of knowledge. Some people will ask me why and it’s simple. In this class they never had the bullets despawn unless they hit a wall or enemy. I didn’t like that at all. I wanted the bullets to go so far and then poof. Gone. I made that system without an issue. However, a thing I noticed is when others in the class tried to do this people were telling them to do all of this in the update function. To check every frame if the bullets lasted long enough yet. It was mind boggling. Then I noticed when going through the class they were creating variables in functions that were called via the update function. Every frame people were calling stuff like Vector2 playerSpeed = new Vector2. Sure to some people this may seem like nothing, especially for a small project, but it’s just a waste of data. Every update making a new Vector2 called playerSpeed just hurts your performance. Now throughout the entire class I had been avoiding this. However, what I never noticed was the people who ran the class repeated lines of code so much! I found like 5 functions each with Destroy(gameObject). Sure it’s 1 line repeated but if you ever repeat a line make it a function.
This actually caused bugs today when I was working on limiting how many bullets can be on screen at once. Since I added the bulletOnScreen– just to where the bullets despawned for going so far. When I hit a wall or shot an enemy it never went down. I began copying this line and then stopped myself. I made a DestroyEnemy() function and added Destroy(gameObject) and bulletOnScreen– to it. Now I just replaced each Destroy(gameObject) with this function call blamo! I saved lots of work. This, kiddos, is why you should always go through and tidy up your code. Remember to add comments too while you’re at it!
Next I added gaining lives for getting a score of X and then increasing it by X to get a new life. Sure, this compounds as it becomes X+X and then 2X+2X and then 4 X+4X….. but I feel it stops the players from getting too many free lives. I can change the system to X *numLivesUps where numLivesUps starts at 2 then increments by one each time if I find players aren’t getting lives fast enough. However, I noticed something while doing this! I had put my score and life update functions already in place! I decided to check the class and as you could have guessed they didn’t. They wrote each line multiple times. What would’ve added extra time added 0 simply because I fixed the code during the class.
I know this sounds like I am shitting on the courses. I’m not. They’re pretty good at explaining the logic. The issue is they do so many intro to programming no-nos. Shit that would’ve gotten me F’s in school for doing. It’s annoying is all. Of course all of this wouldn’t be happening without them.
Features I added in the past but can’t recall what happened due to it being a few days ago, going through shit so my mind’s busy.
I added swimming. I don’t really like the way swimming works,, but it works for now. It’s hard to make it a jump based swimming mechanic when Unity’s gravity is compounding because it’s meant for 3D games and not 2D games. 2D games jump very differently then 3D games.
I added a 1 up to the game. It is currently a white capsule, but it’s there! I need to get the right sprite for it.
I added different enemy variants. This one counts right? They’re variants but I took the time to make sure they work and stand out game play wise.
I added the ability for enemies to start facing left or right. See the people in the class wrote a script that only works if the enemies are facing right. IF they start out going left it borked up and you’d have people moonwalking into the walls. Speaking of which. I still gotta fix them walking into walls if there’s an interactable object near it.
I added a swimming enemy. I then had to give him a special hitbox and movement system because again the class wrote stuff specific to their baddies.
You change colors when going underwater! Just looks nice.
I added toxic waste so that way when you jump into water it’s not a, “Why the hell does this water kill me but not that one!?” type of deal. Now it’s clear this one kills you and that one doesn’t. They look different.
It’s been fun working on this. I am hoping to finish it by the years end. I want to make 5 more levels and get a few more things implemented before then. Every day I am either checking away or designing stuff from my “Custom Features to add” list. I am also adding some new ones, but if they get out of scope I have to remove them or put them as “maybe, if time”. Scope and time restraints are important! Even in indie game dev. Especially in indie game dev. No producer is beating down our necks. I just wanted to talk about what I am working on since I am enjoying it. It just kind of popped up. Originally I had 0 plans to even add features or continue working on it. However, I added the bullet timer and then wanted to see what I could do on my own. Now it’s been 2 weeks, there’s been medical delays, and I am loving it. Next time I will try to upload some pictures to go along with it.
Hopefully this inspires others who are taking game dev classes to not just blindly follow your teacher but make your own game! Expand. Get out there! Don’t just upload your finished game class project. Make it yours!