Programming to Engage - The Creation Process of Making an Educational Game.
How can we use video games to make science more engaging for kids?
Why I chose this Question:
I hadn’t participated in science fair since grade 4. This year, there were only a few kids in junior high that signed up for science fair. Many of my friends had stopped doing science fair as they had lost interest. Knowing this, I decided I wanted to try to change kids’ motivation towards science. My initial brainstorming led me to either a board game or a video game. The decision was a no brainer as I had just learned how to do programming on my own with my extra time due to the pandemic and I had finished making my second full video game just weeks before.
My background knowledge for this project was about 6 months of experience or testing in Unity3d, a free software on which many professional games are created. My self taught programming skills had massively improved as I went from basic Java Script all the way to making a webcam in python and learning C# which Unity runs in. I also had experience using 3d modelling with Blender and art with Krita. I was excited to use my new skills for science fair. This project was supposed to be a quick and fun experience trying to develop a game to make school subjects more fun. In the process, I ended up learning and creating so much more than I expected.
I completed this project by writing my own code to go along with the Unity3d software to create a game that can be run in a web browser. Below is a simplified explanation of the process I took to make this game from the reasoning for a video game to the code in each individual script.
- Impact of video games in learning.
- Why a video game or a game in general you may ask? I have read countless articles on the subject and most come to the conclusion that video games have great potential to be great learning tools but most are only mediocre with its learning capabilities and lean more towards the experience. One article by acer explains the benefits of video games from the physiological benefits of increased self esteem to the social interactivities to critical thinking and teaching algebra, biology and other academic skills while also explaining their project on the subject. https://acerforeducation.acer.com/education-trends/gamification/the-benefits-of-gaming-in-education-the-build-a-world-case/
- From my own experience, I remember when I was a third grader and my friends and I would love to play video games on the computer even if it was learning software such as prodigy or mathletics. These past memories motivated me to continue on this project as I knew the younger kids would enjoy more educational games.
- Grade 3/7. Why?
- The main target grade was grade 3 because as mentioned before, grade 3 was when I felt most excited about computer games. After researching the topics in grade 3 science, I landed on rocks and minerals. Not only was it an interesting topic, it left lots of opportunity for game ideas to make learning about rocks even more exciting. I remember it felt like a short unit and could use some content. By chance, grade 7’s (which is my grade) also do a rocks and minerals unit, so I could also have some information for the grade 7 level, which I am more familiar with.
- The first step in making the game was coming up with and idea and planning the game format. Basically, what I am building? I landed on a idea for a factory game where you build something and try to make as much money as possible. This idea is based off of popular games such as World Chef and Dyson Sphere program. My plan was to create a short but fun little factory builder, but I knew little about the challenges I would face along the way.
- The next part was figuring out who I was building this for. I knew this was for entry in to the CYSF but this game is aimed at school aged kids for the purpose of enhancing learning. I decided to on grade 3 (see above).
- Part of the planning was deciding what programming language I would be using, what platform the game would be on and how the game would be hosted. I decided on a HTML as then it could be played online in a website. I used Unity (which uses C sharp) as I had learned that over the summer, it is a free app on my macbook air and it is capable of making any level even professional software.
- The next part of my plan was how much time I had to make this game. I based this on the science fair deadlines and a couple of meeting dates with my teachers. I made a list of things I would need to do and used an organization tool called Trello to stay organized and keep track of the tasks I need to complete.
- The next step was planning out the details of the game. This is called storyboarding in game development. I started by coming up with a main character for the game. My initial idea was to create a 3D game, which I did, because I had seen few games in 3D for this topic. I designed a 3D bunny that was going to be the main character but I scrapped it as it was not needed and didn’t match the theme. Eventually, I decided to make the student the main character so the game now navigates in first person view to make it more interactive and engaging.
- The next sections go through the creation process of the game. There was planning just before starting each section. This included deciding on what feature I wanted to create, researching anything I didn’t know how to do and then creating and correcting as I went along.
- Creating main part of game
- Camera control
- The first script I wrote was a camera controller script because I knew the movement would play a key role in the playability of the game.The camera is the point where objects are rendered from and takes the virtual 3d points and displays them on a 2d screen. The basics of the script is that it takes the inputs from your keyboard and transforms that into an integer. Positive 1 if one key is down and negative 1 for the other. The 3d rotation on the camera would then add that variable multiplied by a speed variable to the existing rotation on the y axis (up and down) every frame, causing it so when a key is down, the camera would rotate. I also did that with the x axis, making sure to clamp the numbers between two set variables to remove the chance of rotating off the scene.
- Grid System
- The next thing I did was make a grid system to build machines on. This was the only code I based on a tutorial, which I am ok with as this was some of the more complex code I have written. To keep it simple, the grid system is based off a class (a script that is not run directly from the Unity engine and is not derived from monobehaviour) that houses a function to create a grid by making an array of Vector2’s (Unity’s way of writing two numbers like coordinates, eg. (2.4, 3.5), also written as float) to keep the x and y coordinates of each square on the grid. This array keeps a boolean (true or false) that keeps track of the availability of each grid. The class also has functions to get world coordinates and turn points in space into spaces on the grid.
- To run the grid class I used a building script I wrote myself. The script starts by building the grid in the starting function. Next, the script checks if the player is in build mode, represented by a bool. If so, it checks if the player either presses one of the number keys or an icon and runs a function. The object needed to be built is represented by a sort of template which is copied and moved onto the grid. A raycast (A physics ray or line that shoots out of the camera towards a selected point and checks for collisions with objects along the way) is sent out and the object is locked onto the nearest grid location by rounding the position values of the raycast hit. After this, the script checks for input from the mouse and then checks the value of the current money (in a separate script) and if the money is more than the set price of the object, the build is finalized and is permanently placed. I also implemented some nice features such as rotating with right click and destroying objects with right click when not building. This was one of the harder scripts to get functioning without errors and took almost 5 straight days or 30+ hours.
- Save and load system
- This script was a little out of my comfort zone as I could find little documentation on the topic and I had to customize it to my game as I had to save certain elements so when the player leaves to travel in the game, the factory state is saved. To save the game, I had to turn all of Unity’s premade functions into base system operations. The variables I had to convert were a list of objects on the grid, which I did by making an enumerator (list of set string variables) which each machine is assigned to and then converted to a string array. A bool array keeps the grids availability and the money is saved with integers. The code is then converted to binary and saved with a java script function, which I had to copy from a documentation as I do not understand much java script. The values are then converted back and loaded in with a separate script.
- The next step was to make the machines produce rocks. This was pretty simple as Unity has a function with IEnumerators that have a wait for second function allowing them to produce rocks at a set pace. Each machine has two types of rocks they can produce and are picked at random.
- Even though my original plan was just to create a rock factory game, I thought I could expand the scope of the game to include more facts about rocks and increase learning. I create three different areas, one for each type of rock that was scientifically correct. For each area I had a function in a script which would load the scene in. The factory is saved and loaded before and after going to a location. In the locations, there are two places to get rocks, which are added to your inventory and tell you one of three different facts for each type of rock. An info board in each location is placed to tell the player many facts about the rocks such as type, how they are formed, luster and hardness.
- The shop is where you get orders and sell your rocks. The shop uses the same ui system as the inventory and displays the order on a wall in the factory and on a HUD when travelling. The shop randomly picks an order length between 1 and 10 rocks and gives higher money for the higher amount of rocks. To check if you completed your order, the script loops through every rock in the order and checks if it is in your inventory with a for statement. The statement is broken if the inventory does not have the correct number of rocks.
- For the inventory, I used a UI system which takes a template icon and duplicates it while changing the picture and text for each rock. The script loops through each icon and has a variable for x and y. When an icon is added the x location is determined by multiplying the size of each icon times x and y multiplied by the y variable. X is then increased by one until enough icons fill a row and y goes up and x resets, starting another row. Each item in the inventory has a custom class with an enumerator controlling what items can be added.
- Rock Facts
- For each rock at the three locations, I added facts to inform the students of how these rocks are formed, their luster and other fun tips. I used a system to cycle the facts so the last fact seen is stored in a variable and then the the next selection is guaranteed to be different from the last by making a new array of facts each time but excluding the last seen one.
- The final step was changing the graphics from a boring row of lines and dots to a more colourful, lively game. I decided to use pixel art as it takes the least skill and time to make. The software I used was Krita, a free drawing software. I also used Blender, a free 3d modelling software to create the meshes. In Krita I made icons for rocks, machines, walls, grounds, background, you name it. I even made icons and banners for the games page. In blender I made a canyon for the sedimentary rocks, a mountain for metamorphic rocks and a volcano for igneous rocks. The graphics were really the finishing touch on the game.
- Timer and tutorial
- At the last moment, my family had a great idea to make the game timed, creating an endpoint and challenge to the game as well as giving the game a set time period for teachers. This was really simple to implement as I just made a circle fill with unity’s ui system based on the seconds left in the ten minute time restriction. Also last minute, I added a tutorial system which takes the student step by step through the process of playing the game in an easy to understand manner.
- Camera control
- Bug fixing main part
- Bugs, Errors, Glitches! Bug fixing was by far the most painful process of this whole project. I’ll save you the details, but for every improvement I made, there were at least ten errors. From negative time to exploding rocks to visual glitches, I had every error possible. This is just a part of any software project, or any project really; nothing ever goes just as planned.
- First prototype online
- A big step in the games development was getting it online. It was the most relieving moment when I uploaded the game to itch.io, a platform where game developers can publish their games. All the work had paid off as I finally had a product that showed my almost 280 hours of work. I have now uploaded 16 different updates to itch.io but that first upload will always be the most important.
- I tested every aspect of my game when building it from game testing to code testing. I was always making sure there was no bugs that would get by me. But I knew I needed more perspectives in my testing so I arranged with Ms.Hobart to ask some teachers questions with a descriptions and demos of the game.
- Though I could not test with students in school as I would need to get a waiver signed by each individual child's guardian, I was able to test with family members of different age ranges, especially those who were in a similar age range as my target audience. The game was well received. Testing on family members was helpful because when they ran into issues playing the game, it showed me what needed to be fixed and when they couldn’t figure out how to do things, I had to figure out if there was a problem with the coding, if there were better ways for the game controls to work, or if it was just more user tutorial was needed. I figured out how the tricky parts could be better and if I researched how to do it if I didn’t already know.
- An important part of testing involved the teachers in our school, as they were my target audience. I created a survey and Ms.Hobart helped me send it out to a sample of teachers. I asked a few questions before I finished the game which included a brief description of the gameplay. Most teachers gave great ideas and feedback on how to engage students better. After the game was done, I asked the teachers to test a demo of the game. Unfortunately, due to time constraints, I was only able to get a limited amount of feedback, but it was helpful as it helped me improve the user instructions for the game. This led to my development of an in-game tutorial system. The feedback also identified some errors with the build mode which I tackled by adding a simple indicator to tell players when they cannot build. Overall, user feedback was very helpful.
The product as a whole was more than I could ask for, but there are some things I would change. Time constraints and procrastination held me back from implementing some useful features, such as some aesthetic changes like better graphics, sound design and adding some nice animations. Another idea I had was to make the factory customizable with money to change the colours and backgrounds to keep the players engaged but I was unable to due to the time contraints. From here, the project can be taken down two routes: either make it a full course with different subjects and topics or make it open ended and allow students to make their own game in an easy to edit format. I don’t have a personal preference over the two, but I think the full course might be more beneficial as making the game customizable could allow students to fool around and waste time.
In the end, I think this project was a huge success not only for what I have learned, but also the final product ended up a lot more advanced than expected. The progression from a hobby I would do for fun to creating a full, high quality project is just mind blowing to look back at. I put a huge amount of time into this project as I spent about 46 days with an average of six hours per day, totaling a final time investment of nearly 280 hours. Seeing the commitment pay off was a massive relief. The skills I learned could also be translated into many different careers or hobbies as computer development is becoming more necessary as our lives turn to digital systems. Jobs that these skills could translate to are software development, computer programming and game development for living.
The project has turned out well and has been well received by all of the testers. I am extremely satisfied with the end result of a fun, interesting game with many elements that inform students on real science facts and curriculum, making it an engaging way to learn science.
The software I use was:
- Game developer: Unity3d - Unity.com
- 3d Modelling: Blender - Blender.org
- Graphics: Krita - Krita.org
Tutorials I used:
- Code Monkey building system - https://www.youtube.com/watch?v=dulosHPl82A
- Code Monkey Inventory - https://www.youtube.com/watch?v=2WnAOV7nHW0