TECH PARK | 福岡市 天神にある、テクノロジーと遊ぶアフタースクール(学童保育)

JA

News

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.dsc01139

For 2D programming, we started by placing blocks along the X-axis and Y-axis to create a map.

%e3%82%b9%e3%82%af%e3%83%aa%e3%83%bc%e3%83%b3%e3%82%b7%e3%83%a7%e3%83%83%e3%83%88-2016-09-20-15-09-02

The block won’t actually fall until we configure physics settings like weight and gravity. Let’s fill in those settings!

%e3%82%b9%e3%82%af%e3%83%aa%e3%83%bc%e3%83%b3%e3%82%b7%e3%83%a7%e3%83%83%e3%83%88-2016-09-20-15-11-18

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.

dsc01140

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.

%e3%82%b9%e3%82%af%e3%83%aa%e3%83%bc%e3%83%b3%e3%82%b7%e3%83%a7%e3%83%83%e3%83%88-2016-09-26-19-29-06

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.dsc01227

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.%e3%82%b9%e3%82%af%e3%83%aa%e3%83%bc%e3%83%b3%e3%82%b7%e3%83%a7%e3%83%83%e3%83%88-2016-09-26-19-29-12

For example, let’s take the shape shown below:

%e3%82%b9%e3%82%af%e3%83%aa%e3%83%bc%e3%83%b3%e3%82%b7%e3%83%a7%e3%83%83%e3%83%88-2016-09-20-16-18-46

Excluding the Z-axis gives a view from straight in front.

%e3%82%b9%e3%82%af%e3%83%aa%e3%83%bc%e3%83%b3%e3%82%b7%e3%83%a7%e3%83%83%e3%83%88-2016-09-20-16-19-47

Excluding the X-axis makes it a direct side-view.

%e3%82%b9%e3%82%af%e3%83%aa%e3%83%bc%e3%83%b3%e3%82%b7%e3%83%a7%e3%83%83%e3%83%88-2016-09-20-16-19-41

Finally, excluding the Y-axis give a top-down view, like a map.

%e3%82%b9%e3%82%af%e3%83%aa%e3%83%bc%e3%83%b3%e3%82%b7%e3%83%a7%e3%83%83%e3%83%88-2016-09-20-16-19-56

Actually, we told the kids that building in this view is a bit easier, since it’s similar to a map.

dsc01231

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.

dsc01423

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.

dsc01422

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.

dsc01250

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.

dsc00805-1