470 likes | 542 Views
Tools – not toys. Vesa Lappalainen , Lecturer PhD Antti-Jussi Lakanen , University teacher MSc Department of Mathematical Information Technology, University of Jyväskylä trac.cc.jyu.fi/projects/npo https://trac.cc.jyu.fi/projects/comtest. Vesa Lappalainen. PhD 1985 in Mathematics
E N D
Tools – nottoys VesaLappalainen, Lecturer PhD Antti-JussiLakanen, University teacher MSc Department of Mathematical Information Technology, University of Jyväskylä trac.cc.jyu.fi/projects/npo https://trac.cc.jyu.fi/projects/comtest
VesaLappalainen • 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
Antti-JussiLakanen • 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
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
Ourpresentation 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
Ourpresentation in a nutshell: Part 2 • Ohjelmointi 1 (CS 1) with a gametheme • 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
Part 1: Gameprogrammingcourse for teenagers(12-16 years) usingJypeli
Each of thesehasits’ ownimportantrole in the process Ifwechangesomepart, weaffectthe ensemble The courseconceptintroduced is a combination of departmentstaff (teachers), tools (Jypeli etc.), content and motivatedparticipants Disclaimer
Links • https://trac.cc.jyu.fi/projects/npo • https://www.jyu.fi/it/laitokset/mit/opiskelu/nuortenkurssi • Facebook group: http://www.facebook.com/#!/group.php?gid=114345435260705
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
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
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)
Finnisheducationalsystem University (master), 2 yrs University (bachelor), 3 yrs Polytechnics (bachelor), 3.5 – 4 yrs Senior High School (lukio), 3 yrs Vocational School (ammattikoulu), 3 yrs 50.2 % 41.2 % (8.6 %) Junior High School, 3 yrs (Yläkoulu in Finnish) Compulsoryeducation Elementaryschool, 6 yrs (Alakoulu in Finnish), starts at the age of 7 Pre-school, 1 year (Esikoulu in Finnish), starts at the age of 6
Motivation and learning outcomes • 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
Motivation and learning outcomes • 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
How to program games • Two mainstream options • Visual programming • Alice, Scratch, Greenfoot, … • Lego robots (compare to industrial process programming, e.g. National Instruments, LabView, etc.) • Microsoft Kodu • Textual programming • Java ACM Task Force • XGC1 (UWB)
Jypeli library -- Why and objectives • “Real programming” by mainstream tools • First game should not be many lines of code • “Realistic” physics built-in • Event-drivenfor 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
Choosing the tool – Motivation to building a new library • Lack of Finnishmaterial • Xbox currentlyonlygameconsolewith the possibility to transferowngameseasily C# as the language • Lack of physicsengines in availablelibrariesout-of-the-box • Limited timeavailable– Italsotakestime to study a librarysomeoneelsehas made • Facultyinterests in bringingknowledgeaboutbuildinggameengines, physicsengines etc.
Examplegame: GalaxyTrip
using System; usingJypeli; usingJypeli.Effects; publicclassGame : PhysicsGame { staticString[] lines = { " ", " ", " ", " X X ", "X ", " * ", " X X ", " ", " ", " ", " ", "* X X ", "X ", " * ", " X X ", " ", " ", " ", " * ", " X X ", "X ", " ", " X X ", " ", }; staticinttileWidth = 800 / lines[0].Length; staticinttileHeight = 480 / lines.Length; static Image playerImage = LoadImage("ship"); static Image galaxyImage = LoadImage("galaxy"); static Image sombreroImage = LoadImage("sombrero"); static Image explosionImage = LoadImage("bum"); ExplosionSystemexplosionSystem; PhysicsObjectplayer; protectedoverridevoid Begin() { Level.Background.Image = LoadImage("space"); Gravity = new Vector(0, -1000); NewGame(null); } voidNewGame(Touchtouch) { 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, "Moveup", 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); TileMaptiles = TileMap.FromStringArray(lines); tiles['X'] = CreateGalaxy; tiles['*'] = CreateSombrero; tiles.Insert(tileWidth, tileHeight); Level.CreateBorders(); Camera.ZoomToLevel(); } publicvoidMovePlayer(PhysicsObjectplayer, Vectorforce) { player.Hit(force); } PhysicsObjectCreateGalaxy() { PhysicsObjectgalaxy = PhysicsObject.CreateStaticObject(tileWidth, tileHeight); galaxy.Color = Color.LightBlue; AddCollisionHandler(galaxy, CollidedWithGalaxy); galaxy.Image = galaxyImage; returngalaxy; } PhysicsObjectCreateSombrero() { PhysicsObject sombrero = PhysicsObject.CreateStaticObject(tileWidth, tileHeight); sombrero.Color = Color.Yellow; sombrero.Image = sombreroImage; AddCollisionHandler(sombrero, CollidedWithSombrero); return sombrero; } voidCollidedWithGalaxy(PhysicsObjectgalaxy, PhysicsObjecttarget) { PlaySound("blop"); } voidCollidedWithSombrero(PhysicsObject sombrero, PhysicsObjecttarget) { PlaySound("exp"); explosionSystem.AddEffect(target.X, target.Y, 50); sombrero.Destroy(); } voidChangeGravity(AnalogState s) { Gravity = s.StateVector * 2000; } }
”I considermyself an experiencedcomputeruser” (2009-2010)
Student output • Video compilation of the readygames
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”
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
Challenges of the concept • How much do they learn • Measuring this is challenging • Is learning many things reallythe objective? • Is it enough just to “have funwith programming”? • What happens after the course • Post-course communication • Facebook
Part 2: CS1 usingJypeliand ComTest (universityand senior highschoolstudents)
Game theme in theUniversity of Jyväskylä • Ohjelmointi 1 (CS 1) with a gametheme (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
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
ComTest = Comments for Testing • Unittestingmoresimple • 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
/// <summary> /// Microsoft Academic Conference 2011 – ComTest example /// </summary> publicclass 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 /// <prename="test"> /// MAC2011.IsLeapYear(1900) === false; // divisibleby 100 /// MAC2011.IsLeapYear(2000) === true; // divisibleby 400 /// MAC2011.IsLeapYear(2003) === false; // oddnumber /// MAC2011.IsLeapYear(2004) === true; // divisible 4 /// MAC2011.IsLeapYear(2010) === false; // notdivisible 4 /// </pre> /// @endexample public static boolLeapYear(intvuosi) { if (year % 400 == 0) return true; if (year % 100 == 0) return false; return year % 4 == 0; } }
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