<<

International Research Journal of Engineering and Technology (IRJET) e-ISSN: 2395-0056 Volume: 08 Issue: 07 | July 2021 www.irjet.net p-ISSN: 2395-0072

Game Development with Unity Engine and

Bhavishya Kumar1, Mrs. Nidhi Sharma2

1Student, Department of Computer Science and Engineering, Delhi Technical Campus, Greater Noida, U.P., India 2Professor, Department of Computer Science and Engineering, Delhi Technical Campus, Greater Noida, U.P., India ------***------Abstract - Developing a game is a complex process, full of 1. Main Development: - Which could be divided into steps in which different team members contribute to the final further subparts such as, Content Development, product in order to be appreciated by the public. To control the Connection Development between server and client, steps and maintain everything guided towards the same Story Development, Level Development, NPCs objective throughout the entire development there are several Development, Character Development and much Tools and Frameworks that help in the organization during the more as required for the game creation flow of games. The aim of this paper is to contribute 2. Graphic Designing: - Which involves all kind of an easier way to design and implement a fully fleshed working graphics you see such as UI/UX Designing, game using the latest technologies and showing that a Characters, Level Designing, Animations and much complicated process such as game development could be done more in a much better and efficient way possible, this paper will 3. Audio Implementation: - Audio is usually designed evaluate process with using Unity and some of the external by computer or sung by live instruments but there software with Google Firebase to show how the whole software are multiple open sources where you can get Audios could be development with some efforts in the right direction. and Sound effects for free. Key Words: SuperTiled2Unity, Google Firebase, Tiled And there are multiple platforms these games can be played Map Editor, Unity Engine, Game Development, C# on, there was a time when games could be only played on Programming. either their supporting consoles or a Personal Computer, now days these games can be played on multiple platforms 1.INTRODUCTION and each platform have their own community and each platform has their own sales. From 2014 onwards Mobile Game Development has been a major break in the Software gaming has been growing really fast and have revolutionized Development, where there are not many Software the whole industry for gaming where there was the only few developers who actually choose Game Development as their gaming communities which were growing as mentioned main path to build their career there are only 2% of actual above mobile gaming have established its own spot in software developers who choose this path. But there’s other gaming, According to Newzoo statics says there’s been an a side of coin as well where there are not as much game really big hype in development side for mobile gaming developers but according to Newzoo there are over 2.69 where the mobile gaming have not beaten the PC but it has Billion users of Gaming Software widely known as beaten one of the most outstanding industries in consoles. Games.

Figure-1-: Bar Graph Showing the population of game software users all over world in amount of billions

It’s been a long time since people are enjoying and playing Figure-1-: Bar Graph Showing the most popular electronic games and companies have been working on platform for game development among the various kind of games with multiple teams a single game developers could take relevantly 2-5 years to build depending upon the team and game complexity. Majorly, game development is There’s been multiple researches on games, how efforts can divided into few sub-streams be reduced on game development this paper is another contribution in that field. With the current technologies its

© 2021, IRJET | Impact Factor value: 7.529 | ISO 9001:2008 Certified Journal | Page 1868 International Research Journal of Engineering and Technology (IRJET) e-ISSN: 2395-0056 Volume: 08 Issue: 07 | July 2021 www.irjet.net p-ISSN: 2395-0072 much easier develop a game this thesis covers few really understanding of whole structure you can do anything in this good examples to implement effortless game development. documentation I have used and studied the official programming patterns and queries which helped me to 2. LITRATURE SURVEY structure the whole backend of this project in google There’s been multiple researches on games, how efforts can firebase I have used multiple services such as Firestore, be reduced on game development this paper is another , Google Cloud Functions and last not least contribution in that field. With the current technologies its Firebase Authentication. These services helped me to much easier develop a game this thesis covers few really structure the whole backend serverless and almost fulfilled good shorts to implement effortless game development. every requirement needed for client to work as a proper game.[9] Thesis on unity game development been a really [1] have shown a great example of unity 3d game good help since it shows how the whole unity actually works development they have shown how vectors and 3d lights and how both 2d and 3d systems are implemented in it work and how you can use various features like unity’s own where they start from why you should work with unity to its dependency injection how you can find a file anywhere you development, testing tools and publishing. This thesis also want easily. [2] This study shows how firebase real-time suggests using Unity Tile System which I did not use directly, database can compete with the real DBs like MySQL and Unity tile system is really advance system which let’s you NoSQL Firebase which uses and how they easily can be script your tiles and use it according to your needs but, the implemented. And how they are implemented using JSON original system is really complicated to use this study made and multiple formats to use firestore and firebase according me realize how can I use the Tiled Map Editor with to user needs.[3]Real-time Communication Application SuperTiled2Unity plugin for unity which helped me by a lot Based on Android Using Google Firebase April 2018 have it cuts down your efforts divided by ten. I will explain more shown a great communication between android application about the tiled map editor in upcoming section. [10] This is and client they have used the firebase for chat the most recent study I found on unity which helped me a lot communication how a simple message transfer could be since I am using the most latest technologies for project, and used with Google Real-time Database and how many Users this project is in the same field as I am contributing in they are using the application which is really an great example of are trying make game development easier for more people using these.[4] Explained how we can implement User as possible they gave a really good attempt on developing a Interface easily with unity and how it is so easy to design and non-coding interface for game development using unity implement levels, they have shown that how with some which was really interesting. Their aim shows that you don’t simple scripting and work we can implement the whole need to write a single line of code for development in game with some efforts.[5] This Study has shown exactly exchange of few dynamic abilities but you can develop a fully what I am doing for my project using lowest efforts possible fleshed game using their studies without even writing a on game development, they have used real-time database single line of code. They used direct script templates to and unity integration for the development which was a really implement a whole structure of code into a single click good implementation.[6] They have shown a really good use where a few values are taken as inputs and they are directly of firebase with their application they have implemented the implemented game with few single clicks. I was inspired by firebase authentication and password reset user this study for this project.[11] Google Sign-In auth this management etc. They have shown a really good use of documentation gives a few example and source to firebase storage for the user data which helped me to implement Google Sign-in in this project where I take the realization of using Firebase Auth with Google Sign-In in whole data by accessing the data from the google and Unity Engine. Where this study does not involve google sign implement it in the game directly.[12] This official in exactly, they have used firebase auth implementation documentation helps to use and simulate the Tiled Maps or where in this project I have used Firebase Auth with Google game levels into unity directly by importing them like an Sign in library.[7] 2D Game Development using unity by asset this documentation helped me to understand the Dave Calabrese has been a great help their explanation of internal working of plugin and helped me to write some code using Triggers and collisions been really helpful for for custom importers, ill be explaining about custom understanding how they can be used and how and 2D game importers. could be developed step by step properly, they also have some great examples on Physics2d Ray-Cast which I have used in detecting empty area between two points of map horizontally I’ll be explaining about this further in upcoming sections. This book not just helped me in understanding basics of unity but also how a 2D game should be developed and what program patterns can be used to easier the work used in this project. [8] Google Firebase Documentation helped me to understand needs and working of the official firebase structure google firebase where it is to use but it’s very complicated to understand at first once you have a

© 2021, IRJET | Impact Factor value: 7.529 | ISO 9001:2008 Certified Journal | Page 1869 International Research Journal of Engineering and Technology (IRJET) e-ISSN: 2395-0056 Volume: 08 Issue: 07 | July 2021 www.irjet.net p-ISSN: 2395-0072

3. REQUIREMENT ANALYSIS 3.4 Google Firebase

3.1 Unity3D Engine Firebase is a platform developed by google for development of Mobile and web app, firebase majorly focuses on Unity is the real time game development platform, this is one Serverless app development where it provides multiple of the most advanced tools out there for game development services such as: along with Unreal Engine, Cryo Engine and others. The Specialty about unity is, it is a cluster development engine it  Google Auth can develop a really advance game alone without having  Realtime Database need of any external requirement. Unity is a cross platform  Firestore Database game development engine which is developed by Unity  Google Analytics Technologies it was first introduced to work in June 2005 at  Crashanlytics Apple’s worldwide developer conference. In 2018 the unity  Cloud Messaging started supporting more than 25 platforms. The engine can  Cloud Storage be use=d for creating 2d and 3d games with VR and AR  Google Cloud Functions support, as well as simulations and multiple other experiences. The engine has been adopted by multiple And many more services to make your work efficient and as industries not just video games but as film studios, serverless as possible even though some of the services are automotive, architecture, construction and engineering. paid but google provides enough services for a small efficient project. 3.2 Tiled Map Editor 3.4 Google Sign-In API Tiled map editor is a classic level editing tool been in development since 1st sept 2009 its been in level designing It is a Google Sign-In API Plugin for Unity Engine which industries from a long time where it is public funded project supports Android and iOS this plugin gives an exposure to it’s been a popular project among game developers from a Google Sign-In API inside unity. This plugin is specifically long time, because of its handy drag and drop design its developed for unity which requires OAuth ID tokens or possible for it to make Orthogonal, Isometric, Staggered, server auth codes. This project uses google sign in for the and Hexagonal very easily and efficiently. Types of maps it is authentication and this plugin developed by Google makes it a 2d map editor which makes it ideal map editor for this possible. project. 4. PROPOSED METHODOLOGY 3.3 Super Tiled2Unity The proposed system to save the most efforts possible SuperTiled2Unity is a library for communication between focuses on least game designing and most auto-generating Tiled and Unity it is a library which is written in C# code so levels. Basically, there are 3 levels in this game’s architecture It could translate Tiled’s TMX & TSX which are basically where the first one focuses on resource development in this XMLs to unity’s Tile Map Integrity which gives you a dynamic project ill be going with hyper-casual game methodology where the game doesn’t require any story but some random interface for your levels and lets you dynamically bend the generating maps and hurdles to generate a whole new rules of the maps according to your needs. experience on each and every attempt, 3.3 C# Programming Language

C# Programming language was developed by Microsoft in 2000 for as a part of its .NET initiative and after that it was approved as an International Standard by ECMA-334 in 2002 and also ISO/IEC 23270 in period of 2003. It is Multi- Paradigm programming language encompassing static typing. Unity uses C# as it’s operating language in a scripting style where it can be operated/used/tweaked or developed by it. Figure-3: Workflow of the proposed system The Figure-3 shows the base work flow of the external structure how game is created and loaded.

© 2021, IRJET | Impact Factor value: 7.529 | ISO 9001:2008 Certified Journal | Page 1870 International Research Journal of Engineering and Technology (IRJET) e-ISSN: 2395-0056 Volume: 08 Issue: 07 | July 2021 www.irjet.net p-ISSN: 2395-0072

Approach

The idea is to develop a game with using total auto- generated maps and levels and most of the things possible without having a need of any level designer/game designer there are few criteria to be fulfilled which are as follows:

1. Reading the all maps as game object and saving them for further usage.

2. Loading the map into the game scene and casting a ray on every tile size to check if a tile exists on the position in this case it is 128x128.

3. Getting the empty positions.

4. Generating platforms on empty positions by using Figure-4: Game Map Manager Structure an array of sprites which are loaded in the first Game Map Manager tracks every map’s edges when player criteria. exits previous map current next map is set to current map 5. And generate next map position it at exactly below and current map is set to previous map so it creates a cycle the current map so it creates an illusion of forever of forever running maps sequentially, and on every exit from running platformer. current map the previous is destroyed to save the object memory. 6. Generate enemies on the randomized rate as well on every platform. 4.3 Game Platform generator

7. And destroy previous map sequentially on every Game platform generator works with Unity’s Physics Ray map’s exit. Cast and random numbers, Unity’s physics ray cast casts a ray on every single tile of the map then it gives a output if a 4.1 Game Resource Loader ray hits the map object if it doesn’t hits the object the X,Y points of the position of that ray cast adds to a list lets call it Game resource loader or game asset loader is an separate K = {p1,p2,p3…..pn) where k is a list which contains points p of script which loads whole game assets on game startup and every empty tile per row. gives all the resources I need accordingly. Unity have its own resource folder manager which loads all the resources from the resource folder all I need to give an URI and it directly loads the resources its an external part to improve the overall performance of the game and so it doesn’t load the resources in-between gameplay.

4.2 Game Map Manager

Game Map Manager works on a algorithm with a Figure-5: Tracking of empty spaces by Physics collaboration of unity Game Object Triggers. Ray Casting on Game map

Once we have the whole generated list of the empty spaces in map we generate the platforms row wise and according to empty space I decide how long should the platform be, algorithm generates a platform size from p1 size to pn-2 totally randomized size it could select any number in between negative 2 because so it doesn’t the cover the whole path. So, each tile size of 128x128 generates the platform with p1 and pn being the edges of platform. Now, with the edges I put 2 game object points for Enemy Patrolling and I generate the enemy in center of the platform by Platform Width/2 position and that’s the work of platform generation.

© 2021, IRJET | Impact Factor value: 7.529 | ISO 9001:2008 Certified Journal | Page 1871 International Research Journal of Engineering and Technology (IRJET) e-ISSN: 2395-0056 Volume: 08 Issue: 07 | July 2021 www.irjet.net p-ISSN: 2395-0072

saved as its unique email id retrieved by google sign in.

Figure-7: A display of google firestore document showing stored recent score and high score from a random game client

Figure-6: Auto generated platforms according to 3. Google Cloud Functions: cloud functions are used to empty spaces implement backend services, in this project cloud functions are used to verify database inputs when a 4.4 Firebase Initializer value is passed from the client to firestore through Firebase API cloud function check the value of high score if its greater then it supposed to be it doesn’t The Firebase initializer, initialize firebase services which save the value in firebase at all the game sends the includes as follows: high score to firebase in every 10 seconds in every

10 seconds max value of the high score should be 50 1. Google Analytics: Google Analytics gives a precise for safe side I have taken max value of 100 if its statistic on users who are using this app on their greater then that it is not stored in firebase at all. phone including Time usage, Region, Last login, crash free users and even user loss 4. Firebase Authentication: In this project it is made sure that any value coming to firebase from the client is from authorized user any kind of value which is coming from outside suppose a man in middle attack will not be used or considered, client has a web key after login google firebase generate an authorization token which is sent to firebase it is auto encrypted and used by firebase itself which makes it safe and reliable for development of apps.

The whole firebase is used as BaaS or Back-end as a service which means the firebase handles the whole backend Figure-7: A display of google analytics showing hosting and additional services which doesn’t require this some recent usages of app and some user loss project to hire/handle any additional server all the work is done by some implementation of programs and queries. 2. Google Firestore: Google Firestore gives me a direct easy access to google database there’s another 5. IMPLEMENTATION database which is real time database which could be used to make games because of its low latency, this The game’s ideology is basically, to generate whole game by project does not include an multiplayer version so, lowest efforts possible without requiring any level designer it has just implementation of google firestore to or any kind of strategic story development this project is store the high score values and recent score values. majorly focused on hyper-casual game concept which is I have written a whole API which has prebuilt basically leads to Non-Story focused game, a game which queries to documents directly and the message is could be played for infinite amount of time and that concept sent by single method, a total recent score and high is also most famous of addictions there are multiple score message is sent and it is saved to firestore as examples of games like this and some of them has taken over well in a separate document. Where each user’s id is the whole gaming industry. and managing all the backend

© 2021, IRJET | Impact Factor value: 7.529 | ISO 9001:2008 Certified Journal | Page 1872 International Research Journal of Engineering and Technology (IRJET) e-ISSN: 2395-0056 Volume: 08 Issue: 07 | July 2021 www.irjet.net p-ISSN: 2395-0072 work by google firebase services without developing and hosting any server.

Figure-7: A working flowchart of a empty area list generator for unity tile system using ray casting

This is the working for generation of empty area list, this list of empty area inside of tiled map is used Figure-7: A display of whole project’s flow and to generate platform size and platform itself. structure, showing how the different services are  Enemy Generator: Enemy generation is based with connected together with Google Firebase and platform generator with platform size Unity randomization enemy is generated by random rate as well right now in this project enemy is generated 5.1 Game Client on every platform with rate of 40% and there’s 2  Resources Management: - there are various kind of patrolling points or empty game objects for resources which can be made/managed by the same transform positions to use enemy patrol around the programmer or developer the maps are made in platform. And the enemy is generated at the middle Tiled by simple drag and drop system with using point of platform so its (x = PlatformWidth/2 and y some sprite sheets or also called tile sets, then there -= PlatformHeight). game character, enemy character, music, game  Token Generation: - Tokens or Game points or game currency tokens and all the unity prefabs used in currency is generated with 3 different patters with a this project. same method as enemy random generations with  Map Loader: - the whole map generating/loading is the rate of 50% they are randomly generated on managed by SuperTiled2Unity which loads the every platform by using same method as enemies. whole map as prefab game object this map is directly dragged and dropped into the game scene 5.2 Game Back-end first map is placed directly to implement spawn point and main character.  FirebaseInit: - Firebase Init is a service which runs  Platform Generation: - Platforms is generated by on the main thread of the game it is used to initialize detecting empty areas with ray cast algorithm used firebase in the unity game in this generation is pretty standard by detecting  FirestoreAPI: - Firestore API is used to send and every single area with ray cast receive from the firebase in this project there are multiple queries which in this project are pre-made for repeatable usage.  Google Analytics: - Google analytics grant me ability to track my app user’s statistic like country region, usage time, etc.

6. CONCLUSIONS

This research and development was one of the most challenging task for me it safe to assume to reach absolute perfection it requires a lot of efforts but this research was

© 2021, IRJET | Impact Factor value: 7.529 | ISO 9001:2008 Certified Journal | Page 1873 International Research Journal of Engineering and Technology (IRJET) e-ISSN: 2395-0056 Volume: 08 Issue: 07 | July 2021 www.irjet.net p-ISSN: 2395-0072

successful and by using multiple technologies like Unity and [9] THESIS December 2013 Degree Programme In Business Tiled and Creature 2D, firebase, photoshop for sprites it’s Information Technology Karjalankatu 3 80220 JOENSUU safe to assume that it is totally possible to develop a game FINLAND p. 013 260 600 Author(s) Taavi Saarelainen, with new technologies and services. Where it has been Miika Pakarinen challenging to make the whole game alone but it was possible and doable to complete the whole game by myself [10] TOJET: The Turkish Online Journal of Educational usually a game takes about a team of more than 20-30 Technology – January 2021, volume 20 Issue 1 By [ people to achieve perfection in game but there are some Berkay Torun Istanbul Kultur University, Department of games which could be possible to develop alone, and that’s Computer Engineering, Istanbul/Turkey what this whole research and development was about and berkayk3211@.com Serdar Karakurt Istanbul what it represents. In the end I was able to develop a full Kultur University, Department of Computer Engineering, fleshed playable working game which could be enjoyed with Istanbul/Turkey [email protected] Taha Bilal people like you and me. Aydın Istanbul Kultur University, Department of Computer Engineering, Istanbul/Turkey It's safe to assume that a lot of efforts were reduced and a lot [email protected] Yusuf Altunel LC Waikiki, Istanbul of efforts were saved by new technologies. Kultur University, Department of Computer Engineering, Istanbul/Turkey [email protected]] REFERENCES [11] Google’s Official Unity Google Sign in GitHub [1] Pa.Megha 1 L.Nachammai 1,T.M.Senthil Ganesan2 U.G Students, Department Of Computer Engineering, [12] Official Super2Unity Documentation Velammal College Of Engineering And Technology, Madurai, India1 Associate professor, Department Of Computer Engineering, Velammal College Of Engineering And Technology, Madurai, India2

[2] Chunnu Khawas Department of Computer Applications Sikkim University Gangtok, India, Pritam Shah Department of Computer Applications Sikkim University Gangtok, India

[3] Real-time Communication Application Based on Android Using Google Firebase Nilanjan Chatterjee1 Department of Computer Science St. Xavier’s College (Autonomous) Kolkata, India Souvik Chakraborty2 Department of Computer Science St. Xavier’s College (Autonomous) Kolkata, India Aakash Decosta3 Department of Computer Science St. Xavier’s College (Autonomous) Kolkata, India Dr. Asoke Nath4 Department of Computer Science St. Xavier’s College (Autonomous) Kolkata, India

[4] Brett, Jack & Simons, Alain. (2017). Implementation of the Unity Engine for Developing 2D Mobile Games in Consideration of Start-Up/Student Developers. 271-278. 10.1007/978-3-319-65849-0_29.

[5] [Alain Simons,Jack brett International Conference on Technologies for E-Learning and Digital Entertainment] Spring 2019

[6] Divya Sharma and Hiren Dand. Firebase as BaaS for College Android Application. International Journal of Computer Applications 178(20):1-6, June 2019.

[7] 2D Game Development using unity by Dave Calabrese

[8] Google’s official Firebase documentation.

© 2021, IRJET | Impact Factor value: 7.529 | ISO 9001:2008 Certified Journal | Page 1874