Floppy Ball

October 10th 2022

Learning Unity and Completing the One-Button Game Jam


Set-up

For the first two weeks of the course, I was randomly grouped up with a partner named Hollis Sayer, and we were tasked with creating a game using Unity. The twist, however, was that the game would only consist of one button being pressed, meaning we would need to come up with an idea which would fit into this requirement.

The first thing I needed to do, was come into contact with Hollis, so I emailed him asking for his socials. This took longer than expected, however, as after adding Hollis on Discord he never accepted the friend request, so I had to add him on Snapchat. Once that was done, we were able to communicate, and he had a cool idea for a game we would make. It would consist of holding a button to go up and down, staying in the green area, and avoiding contact with the red area. This seemed like a simple and good enough idea for the jam, so that was settled, and we arranged to meet in person on Tuesday the 4th, so we could begin development.

Neither of us had developed games before, so we would have to learn the very basics of Unity. We had some experience with programming, for example, I had created code for Minecraft maps in the past, and Hollis had created Terraria mods, so we had experience with coding which was helpful.

Learning Unity

We met on Tuesday, and we began watching YouTube tutorials to learn the basics of Unity. I watched a very long and detailed tutorial, which provided all the basics of Unity and led to the creation of a very simple tutorial game. I have linked the tutorial below. After finishing this tutorial, I had a good idea of many of the main Unity mechanics, such as:

I wasn't able to start progress on the actual game until Thursday evening, which I will admit was far too late. We should have begun learning and starting development the week before, so we would have more time to add polish to the game and not have to rush it in one night. For the next jam, I will definitely make sure I begin development as early as possible, giving me the maximum amount of time to develop the game I intend.

Development

Development went fairly smoothly, as I had gained enough knowledge through the tutorial that I didn't have to spend a lot of time looking things up.

I created the environment first, using long cubes for the roof and ceiling, and then also having a long cube for the background. Originally, I made these cubes 500 meters wide, but then I realised that if I wanted the game to last infinitely, then this would lead to issues and I couldn't have it go on forever. To combat this, I decided on having them be much thinner but still wide enough, so it covers the whole camera. I then used a script to have the X position of the objects match the X of the player, that way they are always present on the screen and with the player, giving the illusion of the game being infinite.

I also had to implement the player. For the model, I just used a simple sphere, with the idea in mind that maybe Hollis would be able to create a model or something so that he could have something to do. Within the player objects script, I added collision detection using the OnCollisionEnter() built-in function, which triggers if the object collides with another. In order to reliably check that the player is colliding with a red object, and not something else if I were to add additional objects, I set all the red objects within the unity editor to a specific layer, and then check if the player is colliding with an object on that layer. 

What I wanted to happen after that would be a death screen, showing text saying the player has died, and the score they obtained, as well as a retry button, so they can try again. The tutorial I watched sadly didn't cover any of the Unity UI features, or scene selection and menus, so I would have to learn myself. I decided it would be best not to attempt doing this as I had very limited time, so instead, I would just make it restart the whole game. Next time, I will certainly look into adding proper menus and screens, as they make the game feel much more polished and functional.

There was also player movement, where holding space would bring the cube up, and letting go would bring the cube down. This was very simple to implement, as I would only need to check if the user was holding space, and if so apply the Y motion to the player. This worked, however an issue was that the velocity would become very high if going in a single direction too long, where it became very hard to change direction. To fix this, I looked up a way to cap the velocity of an object and came across the ClampMagnitude() function, which was perfect. This way, controlling became a little bit easier.

At this point, the mechanics were done, so it was time to actually implement the obstacles for the player to avoid. I did some brief research into a good way to do this, and came up with a very rushed solution, as I was tired and had been doing this for hours desperately trying to finish. What I did was create an array, containing a variety of prefabs, randomly choose one and generate it ahead of the player at a random Y level to add even more variety. Looking back, this method seems very suboptimal, and if I were to improve the game, I would completely rework this system.

With this system, though, I would need a way to detect if the player had passed an obstacle so that the game could generate the next one. To do this, I used triggers, something I had learnt about in the Unity tutorial I had watched. I added a trigger to the end of each obstacle and then used the OnTriggerEnter() function to check if the player passes the trigger, then run the NewObsticle() function.

At this point, the game loop was done, and the game could be played as intended. There were some finishing touches I quickly added last minute, such as having the game begin only once the player pressed space, or displaying the score on the left-hand side. Once this was done it was 3 am so I saved, and handled the exporting and uploading the next day just before the deadline.

Feedback

When it came the next Monday, we spent the Code Studio session going through many of the submitted games, as well as giving and receiving feedback for each game. I was impressed with each game, and it was really interesting seeing such a variety of different designs and aesthetics.

Much of the feedback for my game was complaining of a major issue I had left in, which caused one of the obstacles to sometimes be impossible to pass. This was a game-breaking bug that I definitely should have spent more time fixing, and I believe was caused by the random Y distribution I had for each obstacle, adding more variation. Looking back, I definitely should have removed the random Y values in order to fix this bug, because everyone complained about it.

Another critique was the movement feeling slightly unresponsive, and while I got used to the mechanics and didn't really notice, I do agree, and I think this is caused by the velocity going up at a steady rate, meaning that if you start going up while the player is already going down quickly, it will take a while before that negative velocity becomes positive, making it feel unresponsive. If I were to improve the game, I would work on making that system more reliable and having the down velocity stop faster.

One user also critiqued the bright colours and how they may cause eye strain, and I completely agree and should definitely consider turning down the colours, so they aren't so abrasive.

Some positives from the feedback were people praising the random generation, which I was happy to see as, although I had implemented a very jank system, it was something I had done entirely alone without help from YouTube tutorials.

Conclusion

Overall, while I am disappointed in my final product as it feels very unpolished, and fails to properly function as intended, I am still proud of myself for managing to learn Unity and create my first-ever game all within a few days. 

I definitely should have allowed for more time to implement the game, as I had to rush it out very quickly in one night, which ended up leading to a lot of problems. There were also issues with my partner, as they ended up not contributing anything code/art related to the game, due to them being busy and unsure how to help. This meant I had to implement it entirely alone, which likely hindered my progress a lot compared to other teams.

Hopefully next time I will have a more reliable team and will dedicate my time much better, so I am able to add all the features I want.

Media