42
K-12 Game Programming Course Using Textual Programming Vesa Lappalainen, Lecturer PhD Antti-Jussi Lakanen, University teacher MSc Department of Mathematical Information Technology University of Jyväskylä, Finland ACM SIGCSE 2011 Dallas, Texas Room Dallas A1 http://tinyurl.com/jypeli-paper 1

Vesa Lappalainen, Lecturer PhD Antti-Jussi Lakanen, University teacher MSc Department of Mathematical Information Technology University of Jyväskylä, Finland

Embed Size (px)

Citation preview

http://tinyurl.com/jypeli-paper 1

K-12 Game Programming Course Using Textual Programming

Vesa Lappalainen, Lecturer PhDAntti-Jussi Lakanen, University teacher

MScDepartment of Mathematical Information Technology

University of Jyväskylä, Finland

ACM SIGCSE 2011Dallas, TexasRoom Dallas A1

http://tinyurl.com/jypeli-paper 2

http://tinyurl.com/jypeli-paper 3

http://tinyurl.com/jypeli-paper 4

Vesa LappalainenPhD 1985 in MathematicsTeaching programming since 1982Research activities:

InSitu: Interaction possibilities on a mass lectureComTest: Making test-driven development (TDD)

simpleStudents’ perceptions of programmingEarly recruitment in ICT

My gaming backgroundTwo teenager boys

http://tinyurl.com/jypeli-paper 5

Antti-Jussi LakanenMSc 2010 in Mathematical

Information TechnologyTeaching programming,

recruitment, tutoring freshmenResearch activities

CS1 and games, effect on study successK-8/K-12 programming

My gaming backgroundCommodore 64, Amiga 500, ... More of fun, less of “useful” activities

http://tinyurl.com/jypeli-paper 6

Our presentation in a nutshellWe are worried about the

decline in IT, science and math studentsWe developed a week-long

game programming course for youngsters to motivate studying IT, science and math

Jypeli programming library was developed as a tool to reduce the cognitive load in beginning game programming

We have had 7 courses, 150 students, aged 11-17

http://tinyurl.com/jypeli-paper 7

DisclaimerThe course concept

introduced is a combination of

1. department staff (teachers),

2. tools (Jypeli etc.), 3. content and 4. motivated

participants

Each of these has its’ own important role in the process

If we change some part, we affect the ensemble

http://tinyurl.com/jypeli-paper 8

Linkshttps://trac.cc.jyu.fi/projects/npo  https://www.jyu.fi/it/laitokset/mit/opiskelu/nu

ortenkurssi 

Facebook group: http://www.facebook.com/#!/group.php?gid=114345435260705 

http://tinyurl.com/jypeli-paper 10

AcknowledgementsUniversity of Jyväskylä / Department of Mathematical

Information TechnologyFunding courses in 2009, Jypeli development

Technology Industries of Finland Centennial FoundationCourses in 2010—2011

Agora CenterResearch in game development

MicrosoftSoftware, Xbox controllers

Ville IsomöttönenCo-author of the paper

http://tinyurl.com/jypeli-paper 11

IntroductionStudent decline in ICT and science

fields (economics still get students)Amount of students passing the courses

has gone down 50 % since 2004How to get youngsters to

choose science courses in high school? And hopefully to continue

their studies later in university

http://tinyurl.com/jypeli-paper 12

Why this course?What are the young interested of?Something to excite!How to combine fun with “real things”We wanted to show that concepts of high

school math and science apply also in gamesWhy not to target senior high?

We wanted to influence what subjects they pick in senior high

With senior high students we would be late(ca 50 % doesn’t even go to senior high)

http://tinyurl.com/jypeli-paper 13

Finnish educational system

Elementary school, 6 yrs (Alakoulu in Finnish), starts at the age of 7

Junior High School, 3 yrs (Yläkoulu in Finnish)

Senior High School (lukio), 3 yrs

Vocational School (ammattikoulu), 3 yrs

University (bachelor), 3 yrs

Polytechnics (bachelor), 3.5 – 4 yrs

University (master), 2 yrs

Com

pu

lsory

ed

uca

tion

50.2 % 41.2 % (8.6 %)

Pre-school, 1 year (Esikoulu in Finnish), starts at the age of 6

http://tinyurl.com/jypeli-paper 14

Motivation and learning outcomes1. Motivation to physics concepts

Quantities: time, distance, speed, acceleration and force

Causal relationship: dependencies between objects

Gravity, friction, motion, balanceMass and its effectsParticle kinematics

http://tinyurl.com/jypeli-paper 15

Motivation and learning outcomes2. Motivation to math concepts

Problem solvingFunction, interpretation and drawingCoordinatesGeometry: straight line, scaling, shapesVectorsEquations and solving themProbability and random numbersBoolean value, logicAngle, degrees and radians

http://tinyurl.com/jypeli-paper 16

How to program gamesTwo mainstream options

1. Visual programming Alice, Scratch, Greenfoot, … Lego robots (compare to

industrial process programming, e.g. National Instruments, LabView, etc.)

Microsoft Kodu

2. Textual programming Java ACM Task Force XGC1 (UWB)

http://tinyurl.com/jypeli-paper 17

Kodu Game Lab 

http://tinyurl.com/jypeli-paper 18

Jypeli library -- Why and objectives“Real programming” by mainstream toolsFirst game should not be many lines of code“Realistic” physics built-inEvent-driven for controls and collisions

Less structures, as few as zero loops and ifsEndless possibilities for

advanced programming Possibility to transfer games

to game consoles and mobile phones

http://tinyurl.com/jypeli-paper 19

Choosing the tool – Motivation to building a new libraryLack of Finnish materialXbox currently only game

console with the possibility to transfer own games easily C# as the language

Lack of physics engines in available libraries out-of-the-box

Limited time available – It also takes time to study a library someone else has made

Faculty interests in bringing knowledge about building game engines, physics engines etc.

Example game:Galaxy Trip

http://tinyurl.com/jypeli-paper 22

using System;using Jypeli;using Jypeli.Effects;

public class Game : PhysicsGame{ static String[] lines = { " ", " ", " ", " X X ", "X ", " * ", " X X ", " ", " ", " ", " ", "* X X ", "X ", " * ", " X X ", " ", " ", " ", " * ", " X X ", "X ", " ", " X X ", " ", };

static int tileWidth = 800 / lines[0].Length; static int tileHeight = 480 / lines.Length; static Image playerImage = LoadImage("ship"); static Image galaxyImage = LoadImage("galaxy"); static Image sombreroImage = LoadImage("sombrero"); static Image explosionImage = LoadImage("bum"); ExplosionSystem explosionSystem; PhysicsObject player;

protected override void Begin() { Level.Background.Image = LoadImage("space"); Gravity = new Vector(0, -1000); NewGame(null); }

void NewGame(Touch touch) { ClearGameObjects(); ClearControls();

player = new PhysicsObject(50, 50, Shape.Circle); player.Image = playerImage; Add(player);

explosionSystem = new ExplosionSystem(explosionImage, 50); Add(explosionSystem);

Keyboard.Listen(Key.Up, ButtonState.Pressed, MovePlayer, "Move up", player, new Vector(0, 500)); Keyboard.Listen(Key.Down, ButtonState.Pressed, MovePlayer, null, player, new Vector(0, -500)); Keyboard.Listen(Key.Left, ButtonState.Pressed, MovePlayer, null, player, new Vector(-500, 0)); Keyboard.Listen(Key.Right, ButtonState.Pressed, MovePlayer, null, player, new Vector(500, 0)); TouchPanel.Listen(ButtonState.Pressed, NewGame, null); Accelerometer.Calibration = AccelerometerCalibration.ZeroAngle; Accelerometer.ListenAnalog(AccelerometerSensitivity.Realtime, ChangeGravity, null);

TileMap tiles = TileMap.FromStringArray(lines); tiles['X'] = CreateGalaxy; tiles['*'] = CreateSombrero; tiles.Insert(tileWidth, tileHeight); Level.CreateBorders(); Camera.ZoomToLevel(); }

public void MovePlayer(PhysicsObject player, Vector force) { player.Hit(force); }

PhysicsObject CreateGalaxy() { PhysicsObject galaxy = PhysicsObject.CreateStaticObject(tileWidth, tileHeight); galaxy.Color = Color.LightBlue; AddCollisionHandler(galaxy, CollidedWithGalaxy); galaxy.Image = galaxyImage; return galaxy; }

PhysicsObject CreateSombrero() { PhysicsObject sombrero = PhysicsObject.CreateStaticObject(tileWidth, tileHeight); sombrero.Color = Color.Yellow; sombrero.Image = sombreroImage; AddCollisionHandler(sombrero, CollidedWithSombrero); return sombrero; }

void CollidedWithGalaxy(PhysicsObject galaxy, PhysicsObject target) { PlaySound("blop"); }

void CollidedWithSombrero(PhysicsObject sombrero, PhysicsObject target) { PlaySound("exp"); explosionSystem.AddEffect(target.X, target.Y, 50); sombrero.Destroy(); }

void ChangeGravity(AnalogState s) { Gravity = s.StateVector * 2000; }}

http://tinyurl.com/jypeli-paper 23

Course instances in 2009—20102009 2010 Total

Courses 2 5 7

Instructors 1 plus 3-4 1 plus 4

Students 45 105 150

Girls / boys 7 / 38 6 / 99 13 / 137

Age• mean• median• youngest / oldest

13.813

12 / 16

14.214

11 / 17

Drop outs 3 (7 %) 6 (6 %) 9 (6 %)

http://tinyurl.com/jypeli-paper 25

”I have earlier programming experience” (2010)

None Somewhat little

Not little, not much

Somewhat much

Very much0.0 %

10.0 %

20.0 %

30.0 %

40.0 %

50.0 % 47.5 %

25.3 %

18.2 %

8.1 %

1.0 %

http://tinyurl.com/jypeli-paper 26

”I consider myself an experienced computer user” (2009-2010)

Disagree Somewhat disagree

Not agree, not disagree

Somewhat agree

Agree0.0 %

10.0 %

20.0 %

30.0 %

40.0 %

50.0 %

2.2 %4.4 %

33.3 %35.6 %

20.0 %

4.0 %6.0 %

31.0 %

41.0 %

18.0 %

2009 2010

http://tinyurl.com/jypeli-paper 27

”I play computer games…” (2009-2010)

1-4 times a month A few days a week Every day0.0 %

10.0 %

20.0 %

30.0 %

40.0 %

50.0 %

60.0 %

70.0 %

2.2 %

46.7 %51.1 %

3.0 %

37.4 %

59.6 %

2009 2010

http://tinyurl.com/jypeli-paper 28

More student demographicsThey have tried some languages, e.g. Java

(20), Basic (17), C++ (17) (numbers overlap)Most students are interested

in career in software engineering (57 %)

Conclusion: Students were interested and motivated, but did not know what to expect out of the course

http://tinyurl.com/jypeli-paper 29

Mon Tue Wed Thu Fri

9:00-9:50

Starting info

Functions Loops, random numbers, gravity

Classes and methods of Jypeli library

How to continue

10:00-10:50

Get to know with tools

Carrying on with the Pong game

Designing and implementing own game

Implementing own game

Finalizing own game

11:00-11:45

Making the first game (Pong-tutorial)

Finalizing the Pong game

Implementing own game

12:15-13:30

What are algorithms

Handling collisions

How to make a level out of a tilemap (grid)

Showcase

13:45-15:00

Carrying on with the Pong game

Designing own game

Implementing own game

Showcase and best game voting

http://tinyurl.com/jypeli-paper 30

http://tinyurl.com/jypeli-paper 31

http://tinyurl.com/jypeli-paper 32

http://tinyurl.com/jypeli-paper 33

http://tinyurl.com/jypeli-paper 34

http://tinyurl.com/jypeli-paper 35

http://tinyurl.com/jypeli-paper 36

http://tinyurl.com/jypeli-paper 37

Student outputVideo compilation of the ready games

http://tinyurl.com/jypeli-paper 38

Overall satisfactionOverall satisfaction: 4.71 (2009), 4.56 (2010) Fulfilled the expectations: 4.1 (2009), 3.9

(2010)85 % would recommend the

course to his/her friends (2010) (Scale: 1 Fully disagree -- 5 Fully agree)

http://tinyurl.com/jypeli-paper 39

Hardest things on the course42 % of the responses related

to new language and new syntax“learning a new programming language"“writing the code"“syntax of the language"“finding errors”“writing errorless code”

http://tinyurl.com/jypeli-paper 40

Is it hard to do programming?Majority of the students had none or only little

earlier programming experience (2009: 89 %, 2010: 73 %)

68 % said that programming was NOT harder than he/she had expected

49 % said their conception of programming had changed during the courseThought it was harderProgramming games was more fun than expectedProgramming was more fun than expected

Conclusion: It’s hard, but fun, and less hard than expected

http://tinyurl.com/jypeli-paper 41

Correlation analysis: Effect of earlier programming experiencePositive correlation with the question ”I will

study in the field of ICT/science in the future”

(Pearson correlation , )Negative correlation with the question ”The

given tasks were hard” (Pearson correlation , )

http://tinyurl.com/jypeli-paper 42

Interest towards ICT/science studies

Pre- questioning

Post-questioning

+ / -

Agree or fully agree

37.9 % 43.6 % +5.7 %

Disagree or fully disagree

27.9 % 17.9 % -10.0 %

Mean 3.16 3.41 +0.25

Std dev 1.19 1.16 -0.03

http://tinyurl.com/jypeli-paper 43

Challenges of the conceptHow much do they learn

Measuring this is challenging Is learning many things really

the objective? Is it enough just to “have fun

with programming”?What happens after the coursePost-course communication

Facebook

http://tinyurl.com/jypeli-paper 44

Game theme in theUniversity of JyväskyläOhjelmointi 1 (CS 1) with a game theme

Started in 2010Strong learning outcomesTDD (ComTest for C#)

As of autumn 2011 game theme will be a common denominator in the majority of the courses of the IT faculty

http://tinyurl.com/jypeli-paper 45

Studies for senior high school studentsWe offer university courses for

senior high school studentsE.g. Programming 1 (CS 1) with a game-themeStudents are fully credited when they entry

universityGive advantage in entrance examination