Download - Tools – not toys
Tools – not toys
Vesa Lappalainen, Lecturer PhD Antti-Jussi Lakanen, University teacher MScDepartment of Mathematical Information Technology, University of Jyväskylätrac.cc.jyu.fi/projects/npohttps://trac.cc.jyu.fi/projects/comtest
Vesa Lappalainen
• PhD 1985 in Mathematics• Teaching programming since 1982• Research activities:– InSitu: Interaction possibilities on a mass lecture– ComTest: Making test-driven development
(TDD) simple– Students’ perceptions of programming– Early recruitment in ICT
• My gaming background– Two teenager boys
2
Antti-Jussi Lakanen
• MSc 2010 in Mathematical Information Technology
• Teaching programming, recruitment, tutoring freshmen
• Research activities– CS1 and games, effect on study success– K-8/K-12 programming
• My gaming background– Commodore 64, Amiga 500, ... – More of fun, less of “useful” activities
3
Tools - not toys
• Many times things are left too complicated in real tools
• Not even beginners but also more experienced programmer
• This forces to use toys instead of real tools• Why not go a bit further with real tools?• We show two examples to simplify things:– Jypeli – event driven game framework over
XNA– ComTest – make unit testing easier
Our presentation in a nutshell: Part 1• We are worried about the
decline in IT, science and math students• We 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
5
Our presentation in a nutshell: Part 2• Ohjelmointi 1 (CS 1) with a game theme– Started in 2010– Strong learning outcomes– TDD (ComTest for C#)
• As of autumn 2011 game theme will be a common denominator in the majority of the courses of the IT faculty
6
Part 1: Game programming course for teenagers (12-16 years) using Jypeli
• Each of these has its’ own important role in the process
• If we change some part, we affect the ensemble
8
• The course concept introduced is a combination of
1. department staff (teachers),
2. tools (Jypeli etc.), 3. content and 4. motivated
participants
Disclaimer
Links
• https://trac.cc.jyu.fi/projects/npo • https://www.jyu.fi/it/laitokset/mit/opiskelu/n
uortenkurssi
• Facebook group: http://www.facebook.com/#!/group.php?gid=114345435260705
9
Acknowledgements
• University of Jyväskylä / Department of Mathematical Information Technology– Funding courses in 2009, Jypeli development
• Technology Industries of Finland Centennial Foundation– Courses in 2010—2011
• Agora Center– Research in game development
• Microsoft– Software, Xbox controllers
• Physics2D.NET physics library
10
Introduction
• Student decline in ICT and science fields (economics still get students)
• Amount of students passing the courses has gone down 50 % since 2004
• How to get youngsters to choose science courses in high school? – And hopefully to continue
their studies later in university
11
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 games• Why 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)
12
Finnish educational system
13
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
puls
ory
ed
uca
tion
50.2 % 41.2 % (8.6 %)
Pre-school, 1 year (Esikoulu in Finnish), starts at the age of 6
Motivation and learning outcomes1. Motivation to physics concepts– Quantities: time, distance,
speed, acceleration and force– Causal relationship: dependencies between
objects– Gravity, friction, motion, balance– Mass and its effects– Particle kinematics
14
Motivation and learning outcomes2. Motivation to math concepts– Problem solving– Function, interpretation and drawing– Coordinates– Geometry: straight line, scaling, shapes– Vectors– Equations and solving them– Probability and random numbers– Boolean value, logic– Angle, degrees and radians
15
How to program games
• Two mainstream options1. 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)
16
Alice
17
Kodu Game Lab
18
•
Jypeli library -- Why and objectives• “Real programming” by mainstream
tools• First game should not be many lines of code• “Realistic” physics built-in• Event-driven for controls and collisions– Less structures, as few as zero loops and ifs
• Endless possibilities for advanced programming
• Possibility to transfer games to game consoles and mobile phones
19
Choosing the tool – Motivation to building a new library
• Lack of Finnish material• Xbox 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. 20
Example game:Galaxy Trip
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); }
23
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; }}
Course instances in 2009—2010
2009 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 %)
24
”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 %
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
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
28
30
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
31
32
33
34
35
36
37
Student output
• Video compilation of the ready games
38
Hardest things on the course
• 42 % 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”
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 course– Thought it was harder– Programming games was more fun than expected– Programming was more fun than expected
• Conclusion: It’s hard, but fun, and less hard than expected
41
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 43
Challenges of the concept
• How 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 course• Post-course communication– Facebook
44
Part 2: CS1 using Jypeli and ComTest (university and senior high school students)
Game theme in theUniversity of Jyväskylä• Ohjelmointi 1 (CS 1)
with a game theme (Jypeli)– Started in 2010– Strong learning outcomes– TDD (ComTest for C#)
• As of autumn 2011 game theme will be a common denominator in the majority of the courses of the IT faculty
46
Studies for senior high school students• We offer university courses for
senior high school students– E.g. Programming 1 (CS 1) with a game-theme– Students are fully credited when they entry
university– Give advantage in entrance examination
47
ComTest = Comments for Testing• Unit testing more simple– In CS2 the threshold to make JUnit tests is
quite high
• Tool for design– Serve as both code examples and test cases
• Tool for documentation• https://trac.cc.jyu.fi/projects/comtest/wiki/ComTestInEnglish
48
49
/// <summary>/// Microsoft Academic Conference 2011 – ComTest example/// </summary>public class MAC2011{ /// <summary> /// Is a given year a leap year. /// </summary> /// <param name="vuosi">Year in question.</param> /// <returns>true if is a leap year, otherwise false.</returns> /// @example /// <pre name="test"> /// MAC2011.IsLeapYear(1900) === false; // divisible by 100 /// MAC2011.IsLeapYear(2000) === true; // divisible by 400 /// MAC2011.IsLeapYear(2003) === false; // odd number /// MAC2011.IsLeapYear(2004) === true; // divisible 4 /// MAC2011.IsLeapYear(2010) === false; // not divisible 4 /// </pre> /// @endexample public static bool LeapYear(int vuosi) { if (year % 400 == 0) return true; if (year % 100 == 0) return false; return year % 4 == 0; }}
50
ComTest = Comments for Testing• Suits for functions and objects• Java, C++, C# implementations• Plugins for Eclipse and VS2010• “Preprocessor” that translates ComTest
test to JUnit or NUnit tests• Tabular format simplifies more complex
testing– See ComTest vs. JUnit
51
52
Questio
ns