Summer School 2016 Report #3: Programming 2D and 3D games in Unity
Hanada here, TECH PARK’s rockstar engineer/curriculum leader.
Targeting the older-elementary summer school students, we tried out using Unity programming to make real 2D and 3D games. Many popular games, including Pokemon GO, were made with Unity. By having the kids use Unity to make 2D and 3D games, they could get a feel for coordinates while building maps, deal with physics settings like gravity and opposing forces, and try out using the C# programming language.
Today, I’d like to showcase part of this activity.
For 2D programming, we started by placing blocks along the X-axis and Y-axis to create a map.
The block won’t actually fall until we configure physics settings like weight and gravity. Let’s fill in those settings!
By configuring gravity, opposing forces, and other physics, we tried making a pinball-style game. Then, by copying the teacher’s code, we made action games where you can control the movements of a character.
For the characters, we found images online we liked and created animations.
As with 2D programming, our 3D games also started with creating maps. However, things get a bit more complicated with the addition of the Z-axis.
First, we had the kids try out placing blocks into a 3D space. Since the computer screen is flat, it can be a bit tough to place things exactly where you want.
To help with this, I’ll explain how to think about a three dimensional space in terms of just two dimensions at a time. If we look at a 3D space directly from the front, we lose a sense of depth (Z-axis) and only see the X and Y axes.
By looking directly from the side, we can no longer see the X-axis, and only see the Y and Z axes.
Finally, we can look at the space from straight above to see only the X and Z axes while losing perception of the Y-axis.
For example, let’s take the shape shown below:
Excluding the Z-axis gives a view from straight in front.
Excluding the X-axis makes it a direct side-view.
Finally, excluding the Y-axis give a top-down view, like a map.
Actually, we told the kids that building in this view is a bit easier, since it’s similar to a map.
By changing around the vantage point, the children made their own maps. Once done, they had fun controlling characters to move around and explore the worlds they had created. Some kids even made their own 3D mazes using the information we just learned about as a base.
Of course, these 3D programs also required copying some C# code from the teacher. There was actually a bug somewhere in the teacher’s code, so we also had to find that and fix that! Beyond just copying code, we tried to predict “what will this programming do?” while we wrote.
It seemed like this activity may have been a bit too tough, seeing as we had so many hands raised with questions. Maybe we’ll need to do something a little simpler next time. Still, the children kept at it and figured things out.
An impression we received from the children who attended was, “I didn’t realize making games was this tough!”
I hope the children were able to get a sense of all of the technology that goes into the games they enjoy, as well as the way arithmetic, math, science, and the other subjects they study each day make up their base.