Jere-Joel Henrik Hannula
Bronto Run Mobile Game for Android
Bronto Run Mobile Game for Android
Jere-Joel Henrik Hannula Bachelor’s thesis
Oulu University of Applied Sciences
Oulu University of Applied Sciences Information Technology
Author: Jere-Joel Henrik Hannula
Title of the Thesis: Bronto Run Mobile Game for Android Thesis examiner: Lasse Haverinen
Term and year of thesis completion: Autumn 2021 Pages: 23
The purpose of this thesis was to use the Unity game engine software to produce a working game for Android devices and publish the game at Google Play Store.
The thesis goes through the tools used in the project, and how to setup the Android working envi- ronment. The later section of the thesis tackles on the methods for creating each section of the game and gives an insight for code examples found in screenshots. At the end there is the link to the game itself where the results can be seen.
In conclusion, developing a mobile a game using the Unity game engine software can produce working Android games, using the C# language, art assets and sound effects.
Keywords: sprite, component, endless runner, mobile game, Android, programming, GIMP, Unity game engine software
1 INTRODUCTION ... 5
2 UNITY GAME ENGINE ... 7
2.1 Console Window ... 7
2.2 Script Inspector ... 8
2.3 Game and Scene View ... 9
2.4 Project Window ... 10
2.5 Saving and Loading ... 10
2.6 Platform generation ... 11
2.7 Leaderboard ... 11
3 GIMP ... 12
4 ANDROID ENVIRONMENT ... 13
5 GAME DEVELOPMENT ... 16
5.1 Player character ... 16
5.2 Platforms ... 18
5.3 Data Manager ... 19
5.4 Inventory... 20
5.5 Sound effects and music ... 21
5.6 Leaderboard ... 22
6 CONCLUSION ... 24
7 REFERENCES ... 26
The aim of this thesis is an endless runner mobile game. I chose this subject to see how well I could develop a game for an Android device using the Unity game engine. I have had the basic knowledge of this game engine, but this was the first project I made with it.
The purpose was to use the Unity game engine to produce a working game to Google Play Store.
In this project I used Unity for the game engine since I were more familiar with C# compared to Java. This led me to learn how to create applications for Android devices using Unity.
The projects graphics was made with GIMP. GIMP was the logical software of choice for this project because it is open source, and you can create sprites and sprite-sheets with it. The theme of this game, dinosaurs, were requested by a member outside of the project.
The premise of this game came from the idea, that it should be simple yet uphold fun game me- chanics. The genre that was chosen was an endless runner since it is mechanically simple while offering a great replayability. The development began with the planning phase where it was decided that the game should at least have:
• Platforms where to jump, which means that the platform needs to have collision detection, so that the player does not fall off.
• A data manager to handle data without it being destroyed after scene changes. Since the data is kept in every scene, saving it during specific states would allow the data to update as much as possible.
• An automatic movement as found in side scrollers combined with double jumping, which keeps the game mechanics simple while allowing other aspects of the game to be designed around it, such as specific jumping timings on platforms and double jumping.
• Items which give different benefits. A point booster which gives extra points, a life booster which gives more health if the player has lost any and an invulnerability booster which removes a damage taken for a small amount of time.
• Enemy characters with different behaviors. Planned enemies are a raptor, which moves fast on the ground, a crocodile which jumps upon detecting the player, and a pterodactyl which flies in a specified pattern.
• The possibility to customize the character with hats and outfits. These cosmetics could be found and bought in the inventory found in the main menu.
• Sound effects for different actions and background music with the ability to change the volume in the settings menu which could be found in the main menu and in the pause in menu in-game.
• A Leaderboard where the score is sent when the game ends if the score is higher than the previous one. The comparison should be done locally and if the score turns out to be higher, it gets posted.
2 UNITY GAME ENGINE
Unity is a game engine released in June 2005 by Unity Technologies. It uses C# as its primary coding language and Scripts to control objects. The software itself is very beginner friendly. Unity offers free licensing for users or companies that earn less than $100,000 annually.  Unity’s Script- ing API document is well made and maintained. You can export your project to other platforms.
such as Android, while working with C#. 
The game was done by combining the following functionalities of the Unity game engine; console window, script inspector, game view, animator, scene view and project window.
2.1 Console Window
The console window allows the user to keep track on errors and data specified in the code. This comes handy when a reference variable cannot find a game object or if the user wants to know exactly what data is being transferred.
FIGURE 1. Console Window with logs from the game end state Screenshot 
As seen in figure 1, console window was utilized during the development to determine when the game end state is called and if the point count is correct.
2.2 Script Inspector
The script inspector shows the scripts attached to the game object and lets the user interact with them. By default, every game object has access to the transform script which determines the loca- tion, rotation, or the scale of the object. The other attached scripts can be either user generated or Unity’s own, such as the Sprite Renderer.
FIGURE 2. Script inspector view of the platform generator script Screenshot 
The elements of the scripts can be set a default value from the inspector or changed retroactively from the scripts code. In figure 2. the default values are set for the spawn point and the list of spawned platforms. The timer for the platform spawning is done in game retroactively.
2.3 Game and Scene View
The game and scene views bring forth the visual side of Unity. The scene view lets the user to modify game objects on the screen. This can be done by clicking them on the scene view, allowing the user to move them by dragging and giving the user access to the game objects script inspector.
These functions can be done while the game is running.
The game scene shows the user what the game looks like from the camera’s point of view. The game scene has the option to let the user choose its display aspect, allowing for simulations of different devices.
FIGURE 3. Game View of the game Screenshot 
Figure 3, shows how the game showed on the aspect ratio of an Android device. This helped to determine how it would look even before deploying it on a phone.
2.4 Project Window
The project window is used for keeping the project organized. Functionally, it works like a file ex- plorer and is there for the user to help them track the location of the files used in the project.
FIGURE 4. Project Window Screenshot 
Figure 4, shows the file structure which was used for making this game. Following a specific struc- ture is essential for knowing where to put files and where to find them.
2.5 Saving and Loading
To continue the progression, the game data from the data manager needs to be saved that it can be loaded later. This can be done either by locally to the device or saving it into a database. Saving locally can be done by serializing the data currently found in the data manager into a file and saving it into the folder specified in Unity, which differs from a desktop and Android.
If you want to save the data in a database, you can use the Google’s saved games service, which is available for applications through the Google Play Console and the calls are free. You can also create your own database where you get and put the data using HTTP with the logged in Google
would be attached to that. The local saving is fine in this use case since the game is a single player one, so the data does not need to verify if the data is right. And the last method is like the first, but you are required to handle the costs yourself.
2.6 Platform generation
For the game to function as a side scroller, it needs the platform to be endlessly generated. This can be either done by moving the player character constantly and attaching a trigger to each plat- form, which upon detecting collision generates a new platform to the end of the platform. Another method is to move the platforms and enemies but keeping the player in place whilst still animating the walking and jumping.
The leaderboard is a user interface which holds the scores made by the players. The shown score is the highest one the player has gotten, and the comparison should be done at the end state of each game session. The way to store this new value could be done by either using the Google Play Console’s leaderboard integration or creating your own database where the data can be stored.
With the leaderboard extension found in the Google Play Console, you are automatically connected to the API with the Google login session. The API allows the ability to create your own endpoints for the data and it lets you decide what data is being sent there. For this project it allows the new high score value from the data manager to be sent to the high score variable in the API after it has been compared.
The own database method lets you create a table that contains the new high score value, ID, rank, name. The high score value comes from comparing the found in the database from the one from the data manager. The ID and the name used are found in the Google login session. The rank is determined by ordering the high score value.
GIMP is a free image editor, which was used for creating the art assets for the project. The software has a 1x1 pixel wide pen which helps creating pixel art. It also has layering functionality, the ability to draw on top of an image without it affecting the former image, which speeds up the animation process. GIMP also allows to make images transparent which makes them easy to use in projects after exporting.
FIGURE 5. Sprite Sheet made with GIMP Screenshot 
In figure 5, you can see how one of the sprite sheets used in the project looked before exporting it as a PNG image and using it for animations.
4 ANDROID ENVIRONMENT
Setting up the Android environment in Unity starts by navigating to Unity Hub to the Installs section as seen in figure 6. From there it should be checked that the Android Build Support is marked as seen in figure 7. After the installation is complete, the project should now have access to the An- droid Build Support. This can be checked by opening the project and going to Edit – Preferences and finding the External Tools section as seen in figure 8.
FIGURE 6. Add module option in Unity Hub Screenshot 
FIGURE 7. Android Build Support module location Screenshot 
FIGURE 8. External Tools section in the Unity Preferences Screenshot 
When the Android setup is done on the Unity side, it is time to configure the device in which the
When you are in the developer mode, navigate to advanced settings – developer settings and find the USB debugging switch that needs to put on. When the device and Unity is ready, all there is left to be done is to switch to the Android project building in the build settings. Like in figure 9, set the platform to Android and the game can be now tested on the device after you have plugged in via USB and selected build or build and run.
FIGURE 9. Android build settings Screenshot 
5 GAME DEVELOPMENT
When the methods and goals were set, it was time to start the development process. This chapter goes through the methods used for creating different aspects of the game. Also, it offers insight to why the specific methods were chosen.
5.1 Player character
The most important aspect of the game is the player game object, the scripts attached to it and how it interacts with the rest of the game. For this reason, the first things to create and test were the player sprite and the player controller script where the functions, which control the player char- acter, are put.
FIGURE 10. Basic game object movement Screenshot 
The first iteration of player controller was there to handle the basic movement of the game object as can be seen in figure 10. Additionally, the game object requires Rigidbody 2D with a body type set to dynamic and Box Collider 2D scripts attached to it. To ensure that the player does not fall endlessly, it also needs game objects beneath it. They also have Box Collider 2D scripts.
Later during the development, the platforms went from static to generated . During that time the new platform was generated when the player collided with the end of the previous. It was changed because the game would produce camera errors with the constant player movement, since it is attached to the player. This meant that the player went from moving to being still, giving the illusion that the player is moving.
FIGURE 11. Revised player controller code snippet Screenshot 
When the game developed further and it went from side scrolling to staying still, the player controller needed adapting as well. The movement was taken of the player game object, and it was given the double jumping functionality, in which the ground is checked with ray casting to see if the player has left the layer which is set to ‘groundLayer’. Tapping on the screen on an Android device calls the jump function. The player controller was also made to handle sound effects and animations depending on the state of the player and the action which is being taken. The player controller also checks the location of the player on the y-axis to see if the game object is considered out of bounds and ends the game when the condition is met. The condition is there to ensure that the player is not falling endlessly. The new player controller is shown in figure 11.
FIGURE 12. Cosmetics on the player Screenshot 
Upon starting a game, the data manager checks if you have selected any outfits or hats from the inventory and if there is any selected. They are instantiated on the player character as a child, making it look like you have equipped them. Instantiated items on the player character are shown in figure 12.
The platforms work as the base where the player must travel since it contains the box collider 2D required to keep the collision intact. The platforms contain enemies, items, and environment ele- ments. The list of enemies consists of an alligator which can spawn in the water where it uses ray casting to see if player the is above. If it finds the player, it jumps towards the player. Also, one the enemies is a raptor which runs along the platform and jumps upon being on a ledge or next to the player and lastly there is a pterodactyl which patrols in the sky along its path.
The items spawn on the platform on specific locations and are there to help the player but the content is randomized. The effects of the items are health restoration, which gives back 1 lost life point, point boost, which turns into bonus gold at the end of the game, and lastly the invulnerability buff, which makes the player immune for a small amount of time.
The elements the player can find on the platform are a tar zone, which is made to slow the player down to expose it mistakes, and pieces, which destroy after a small amount of time, which is there to force the player make precise jumps quickly before the platform disappears.
FIGURE 13. Platform generation logic
As seen in the figure 13, upon the start of a game, the first platform is generated, and a timer is created. The timer is affected by a speed modifier, which depending on the value, slows or speeds up the timer. For example, a speed modifier of 10, which is two times the base value, makes the timer tick twice as fast. When the timer goes to zero, a new platform is created at a location of a game object and a new timer starts. The game keeps checking if the game has ended and acts upon it. If it has not, the loop continues but if the game has ended, the generation loop is stopped.
5.3 Data Manager
The data manager contains all the data which can be referenced by other game objects or data, which needs to stay between each scene. The data that needs to be kept is the music and sound volume, equipped items, coin count and ad count. The data, which is referenced, is a speed mod- ifier, a platform spawn timer and a damage done to the player. For this project the chosen method was the one where the data manager data was saved locally into the device. It was chosen because it is a single player game. So, constant calls to the database are not necessary and the performance is better since the player does not have to be in sync with the data from the database.
The inventory can be accessed in the main menu from a user interface object, but it is not accessed in-game since it does not bring gameplay benefits. It contains cosmetic items which can be equipped by the player. Before an item can be equipped, it must be bought using the coins that are earned by playing the game or being purchased from the shop. The inventory displays how the player character would look in-game on the right side of the UI. The inventory UI is shown in figure 14.
FIGURE 14. Inventory UI with the hat items Screenshot 
FIGURE 15. Item purchase code snippet Screenshot 
Each of the inventory item checks if the item is owned or not, and then it functions accordingly. As
informs that they have the option to buy more coins or turn back. If the item is owned, the game sets the item as equipped and saves it into the data manager.
5.5 Sound effects and music
Sound effects were made jsfxr which is a free to use sound effect generator. The software allows to pick from a list of example sound effects and allows the user to modify the chosen sound with various things, such as decibel, speed, and the length of sound clip. After creating the preferred sound effect, it can be downloaded and imported to a project. 
FIGURE 16. Audio source where a sound effect is used Screenshot 
Figure 16, shows an example where a sound effect is attached to the player character with the jump sound, which is called every time the character jumps. The calling can be found in the code snippet in figure 11.
The music creator that was used was bosca ceoil, a free to use software which has a variety of options for making 8-bit music. The usability of the software was good since the visual guide found upon opening the music creator teaches every aspect of the software clearly and quickly. 
Both sound and music volume can be altered by changing the value from the settings canvas, which can be accessed from the main menu and in-game in the pause menu.
The leaderboard holds the high score of the player and how it compares to other players. The method used in the project was the Google’s own API, since the used database would have been Google’s Firebase which has mostly the same setup as the API. The decision came down to the UI, which was provided by the API, which cut down the design time. For the leaderboard to work, it needs to be initialized in the Google Play Console. The user must establish a connection with their Google account, and the leaderboard with the right ID needs to be shown.
FIGURE 17. Leaderboard management in Google Play Console
The leaderboard is initialized in the Google Play Console. While creating it, you need to choose the name and number formatting. And optionally, you can choose a minimum and maximum accepted value. When the leaderboard is created, it takes some time to become active. After it activates, it can be used during development to test the environment. The Google’s leaderboard management UI is shown in figure 17.
Figure 18, shows how the game handles the games score after the game has ended. The score is compared to the previous high score. And if the score is higher, it becomes the new high score and will be shown on the leaderboard.
FIGURE 19. Player authentication and leaderboard activating code snippet Screenshot 
Figure 19, handles the Google Play login and activating the leaderboard which is made for this project. In the configurations the connection to the game is made and they are signed in when the game is loaded. And when the player wants to access the leaderboard by clicking the game icon, it shows the leaderboard specified by its ID.
This Thesis was done to find out how well you could make mobile game using the Unity game engine. Unity allowed the creation of an Android game with using its own compiler and C#, thus allowing the focus to be put more towards to the project itself instead of making sure that it is compatible with Android devices.
The community surrounding this work environment had faced the same limitations which appeared during this development. It greatly helped me to read about their problems and integrating solutions to work for my situation. The documentation in the Scripting API website  was well maintained and had snippets for many use cases to help the reader understand their purpose and how to use it in their scripts.
Unity is a great game engine for beginners for its usability and simplicity. It is also being used by many game companies as well. Their compiler allows the user to export their game to many plat- forms, which gives the ability to focus on one platform and expand later if the demand is there. So, this game engine can produce games for Android and it works well for users with little experience in the field.
The aim of this project went according to the requirements I set for myself on the technical side.
The side where it lacked was the art and music. The art was made with zero experience, and it has reflected on the models and background. Although the art was feasible, it could have been im- proved. Music is lacking in quality as well, but due to the lack of talent, it is what could be done for this project stage. The sound effects on the other hand were great, but it is only due to free to use tools, which were specifically made to create them. Also, in hindsight the saving could have been done to a database or at least an option could have been offered, since the data is lost if you delete the application or if you empty the cache.
For future development of the game, there could be following improvements. For example, there could be the possibility to expand the platform generation. Also, at the start of the game there could
outsourced to an actual artist. This would free up time from making new assets, which could be used to create more platforms and change the background depending on the game state.
The game, Bronto Run can be found in the Google Play Store .
1. Platforms compatible with Unity [Online]. Accessed 12.08.2021, https://unity.com/prod- ucts/unity-platform.
2. Unity game engine [software]. August 11.08.2021, Version 2020.3.1f1.
3. Visual studio code [source-code editor]. August 12.08.2021, Version 1.53.
4. GIMP [graphics editor]. August 12.08.2021, Version 2.10.22,
5. Endless platform generation loop [online]. Accessed August 11.08.2021, https://fo- rum.unity.com/threads/how-to-get-loop-a-level-in-endless-runner-game.917594.
6. Unity Individual Plans [online]. Accessed August 11.08.2021, https://store.unity.com/#plans-individual.
7. Unity ScriptRefence API [online]. Accessed 12.08.2021, https://docs.unity3d.com/ScriptReference.
8. 8-bit sound effect creator [online]. Accessed 12.08.2021, https://sfxr.me.
9. Music editor [online]. Accessed 12.08.2021, https://boscaceoil.net.
10. Google Store page of the game [online]. Accessed 12.08.2021, https://play.google.com/store/apps/details?id=com.SeitaStudios.BrontoRun.