Progress Made! Strong Start and Still Going


Welcome to my second post! Both this post and my first post were posted late and I apologize for that. The state I reached in the game development at the time of writing both this and the previous post is a lot further than the state of game development mentioned within both this and the previous post. This is a result of me trying to migrate my blog from another location. It does not make sense to start blogging and releasing game dev blogs from the middle of the game as it wouldn't make sense to readers. 

For a timeline, I started the development of this game during the Winter Break of 2020, approximately on the 21st of December. My first post reflects the state of game development around January 31st. And this post reflects the state of game development around February 8th. I do intend to start blogging 2-3 times a week, mainly about game dev progress, features, planning, and everything else related to the game!

NOTE: Please note that I DO in fact plan on changing the name of the game, currently Basic Libgdx Game, to a more suitable game name in the future. I just haven't come up with a great name for it.

What did I accomplish!

Again, quite a lot! It is almost hard to believe that just a little over a week has passed! Now, as to not bore you all with a giant paragraph of text, I will attempt to list in smaller paragraphs what I accomplished and then explain in detail exactly what all does that entails.

Score Screen 

I created an additional screen in my game as I stated I would in my last post. This screen is shown after the user dies. After the user/player hit an obstacle, the game would stop rendering (meaning the whole screen would be blank) except for the score label/text centered at the top which now instead reads “GAME OVER” in red text, when the game ends. Upon clicking the screen an additional time, the user is then taken to this new screen which displays both a “High Score: ” and a “Last Score: ” label. 

If you couldn't tell, the high score label displays “High Score: #” where # is the highest score any player has achieved on that device, and this value is stored on the device. This means that you can close and open the application as many times, however, the number will be stored regardless. And whenever a score higher than the high score is achieved, the high score is immediately updated. Put simply, if the player gets a new high score, the value for the user's high score and the last score will be the same. 

The last score label simply shows what score was achieved just recently in the game playthrough right before reaching the score screen. Under these labels is a button labeled “Home” which takes the user back to the home screen, from where the game can be played again.

Distance-Based Generation + Obstacle Difficulty

It may look complicated, so let's break it down. What the first part means is is that the system for generating my obstacles was changed. Originally, the game used to generate obstacles every 3-5 seconds ish. The problem with this system was that if the game ever got a pause feature(which I hope one day it will), the timekeeping system would still continue, resulting in an instant obstacle generation the moment the user unpauses. This would be troublesome if the user paused just after an obstacle was generated because then two obstacles would be right next to each other. 

On top of that, the other problem with it is that the obstacles might just move slower on a slower-operating device, putting the obstacles much closer than those on a faster-operating device. Taking these issues into consideration, I just switched to the much easier-to-implement distance-based generation. Now, the obstacles are generated when an obstacle is a certain distance away from the location that it is spawned from. 

After making this alteration, I also coded it so that over time, the distance between the last-generated obstacle and the spawning location decreases over time. This results in obstacles getting closer as the user progresses, making it harder and less boring for the user. Now, having a fixed distance EACH TIME an obstacle was to be generated seemed a little boring and plain to me. For more diversity, I altered the distance generation so that instead of a fixed distance, a random distance that is close to the fixed distance is generated. The way I implemented this, without getting into too much detail, is: 

distance generated = random number between: (fixed distance - 10) units  and (fixed distance + 10 units)

Changed Application Icon

This was a non-coding change that I was also able to accomplish. Using pixel art online, I made a pretty rough icon for my game and then used an online icon generator to create the properly sized images required. These images were then put into Intellij (the IDE I am using) and made some changes to some files to use my new icon, instead of the original Libgdx Icon. On my mobile / phone, the icon is now what I wanted it to be, however, the background of the icon is still white when I wanted it to be black. Regardless, this is a minor issue that I can fix later as I accomplished the main task, change the icon.

Created More Classes & Cleaned Code A Little

Exactly as stated, I spent a little time cleaning up a little code. This mostly meant creating additional classes (Java classes) to store a lot of my variables and data of the game, along with the data that needs to be stored on the device itself, like the High Score. For those of you who don't know what classes are, it is basically a file with text and that text is code. This had no visible impact on the game, however, it organized a lot of things for me. Now, to experiment with certain things, I know where to look for and can change the numbers to find a perfect balance. It even includes a variable called DEBUG, which has an on/off value. The DEBUG variable, when turned on, shows the lines around a table: The red box outlining the buttons and text on the home screen as well as the score label/text on the game screen.

Game Music + Asset Managing + Loading Screen

A simple feature I wanted to add to the game was game music. This was the music that would play when you play the game and would stop as soon as you hit an obstacle and the game ends. This simple addition turned out to be quite complex, as I need to write code to handle the management of my assets: images, files, .mp3 audio sources (music), etc. I felt that if I was to do it at all, I better do it right now so I don't have to do it later. 

I had a lot of questions while I was doing this, and some of them were not answered by the Github wiki of Libgdx which guided me on how to use their AssetManager class along with other Libgdx stuff. Links to any and all sources and credits will be posted at the bottom. Back on topic, I turned to the members of the Libgdx discord server for help. I have been asking a lot of questions on the server, including little ones, and the members were more than happy to help me out with them. Without them, I wouldn't be able to make the progress I was able to make.

While working on the asset manager, I figured that I would need some Game Music. Now I knew how to code, not how to make music. And I felt that learning how to make my own game music is a skill that I should work on later. For this reason, I went to find some free copyright / royalty-free music that I could use in my game. That is when I stumbled upon SilentCrafter and his discord server. I requested if I could use one of his songs in my games (I would credit him of course), and thankfully he said yes. Now I wouldn't have to worry about copyright claims and all that stuff that I probably shouldn't be even worrying about right now. Better safe than sorry.

I combined all the asset loading stuff into a loading screen. This screen requires a lot of work still. When the user clicks on the start button on the home screen, the poorly designed (look wise) loading screen is displayed and loads the game music. Upon the completion of the loading, the game screen is displayed, thus starting the game as well as the music.

After finishing the aforementioned features and additions, I built the APK and installed it on my personal mobile. Basically, I ran the application on my personal mobile and it works like a charm! When I play the game, the music starts and each time the game ends, the music stops perfectly!

What's Next? Goals & Plans

My current plan and list of to-dos feel like it has increased. First, I will attempt to clean up my code as a lot of my code is messy without many comments and I would like to fix this first. That way I can get a nice and smooth feeling from my application. My main goal to achieve or at least make progress on by my next post is to make a Preferences Screen, or as most of you know it as a “Settings Screen”. This will be on the home page/screen and allows the user to change settings like music volume, music on/off, SFX volume, SFX on/off, etc. Speaking of SFX (Sound Effects), that is another thing that I plan to add to the game. 

The three main sound effects that I am going for is: 

  • The jump sound- is played when the player jumps.
  • The swish sound- is played when the user quickly accelerates down (a result of the user tapping while the player is mid-air).
  • And the click sound-played when the user clicks on the different buttons.

One last change that I would like to make is to add 2-3 more music options for the user to choose from within the Settings Screen. Since music files are large, I should only have one loaded and ready to be played at a time (which is where the asset manager is useful). This will require me to make some modifications to my loading screen as I intend to allow the user to test the song that they selected within the settings screen, and I would like to do this without having to switch to a loading screen. The implementation may differ when I actually start. But yeah, that is it! Hope you all enjoyed this post, please follow this blog for recent updates on my game! And last but not least, I will put the links and sources I used as well as some people I would like to credit. Below these links and credits will be posted some snapshots and pictures of my game. I plan on making a recording of a run-through of my game so stay tuned for that!

Links / Sources / Credits

Note: Not only did this server help answer my libgdx questions quickly, but it also introduced me to software and helper programs contributors made. I had never even known about these things until I had joined the server.  

Snapshots & Pictures

What the game over message looks like.

Leave a comment

Log in with itch.io to leave a comment.