compiler integration into computer science learning games amanda chaffin [email protected] advisor:...
TRANSCRIPT
Compiler Integration into Computer Science Learning Games
Amanda [email protected]
Advisor: Dr. Tiffany [email protected]
Chaffin - G2L platform October 29, 2008
2
OutlineBackgroundGame2LearnEleMental : The
Recurrence ImplementationThe StudyConclusionFuture Work
MotivationSolutionGame CreationLearning Games GoalHypotheses
Chaffin - G2L platform October 29, 2008
3
MotivationRising demand for CS majors (Vesco, 2007)
But enrollments are falling! And many enrolled students leave after CS1-2
Why? (Beaubouef, 2005)
Lack of problem solving skills Miscommunication Homework, lecture, code
Chaffin - G2L platform October 29, 2008
4
SolutionGames for learning computer scienceLess abstract, more familiarProven results –
Students creating games Students learning from games
Chaffin - G2L platform October 29, 2008
5
Game CreationMineSweeper and Asteroids (Becker, 2001)
ASCII based graphics Turn Based Strategy Excellent Learning Payoffs
Game Programming in CS1 (Bayliss, 2006)
RAPT Summer Course (Rochester Institute of tech)Capstone Course - Colby College (Jones, 2000)
Design and create their own gameCapstone Course - North Texas (Parberry, 2005)
Parallels with an art course Design and create their own games
Chaffin - G2L platform October 29, 2008
6
Learning GamesRevolution (Jenkins 2003)
Teaches the American Revolution
MUPPETS (Bierre, 2004) Developed at Rochester Institute of Technology Written in Java Allows students to program 3D game objects
Tactical Iraqi (Losh, 2006)
Teaches soldiers• Culture• Language proficiency
Learning Games Con’tAlice (Mullins, 2008)
Created at Carnegie Mellon University 3D programming environment
• Story telling animations and game playing Teaching tool for introductory computing
Scratch (Maloney, 2008)
Programming language - allows for stories, animations, games,
Teaches design, mathematical and computational ideas
Wu’s Castle (Eagle, 2008)
Teaches arrays and loops
Chaffin - G2L platform October 29, 2008
8
GoalTo have students learn computer science
While playing games With maximal skill transfer Without breaking the sense of being in game
In other words, students should write code, if at all, inside the game
Chaffin - G2L platform October 29, 2008
9
HypothesesStudents who play a learning game where
The main game mechanic is a direct metaphor for how programs work, and
Students can write and compile code inside the game
Will effectively learn computing conceptsStudents who make a learning game where
other students write code will Learn the coding concepts better Be able to teach the concepts
Chaffin - G2L platform October 29, 2008
10
OutlineBackgroundGame2Learn (G2L)EleMental : The
RecurrenceImplementationThe StudyConclusionFuture Work
History of G2L Saving Sera The Catacombs Squee StormHaven3
Limitations
Chaffin - G2L platform October 29, 2008
11
History
Chaffin - G2L platform October 29, 2008
12
Saving Sera/The CatacombsRapid prototypingSaving Sera
RPG Maker 3 ways of writing code Multiple concepts
The Catacombs Neverwinter Nights (NWN) Code through dialogue For loops
1st Study Students receptive,but No learning gains
2nd Study Learning gains
Chaffin - G2L platform October 29, 2008
13
Squee/StormHaven3Squee! – Methods
RPGMaker Maybe a little overcomplicated for the engine
StormHaven 3 – Parameter passing NeverWinter Nights Interactive lecture
Study showed learning gains
Chaffin - G2L platform October 29, 2008
14
LimitationsNeverwinter Nights Limitations
Cannot change the GUI Compiler integration possible but limited to NWN
Script
RPG Maker 2D platform; not modular enough for robust
development Compiler integration might be possible but would be
limited to Ruby
Chaffin - G2L platform October 29, 2008
15
OutlineBackgroundGame2Learn (G2L)EleMental : The
RecurrenceImplementationThe StudyConclusionFuture Work
Video Designing G2L Games DarkWynter Code Design Game Design : Recursion Pre/Post Test Interface Interfaces
Instructions Compiler Heads Up Display (HUD)
Video
Chaffin - G2L platform October 29, 2008
16
Designing G2L Games (Barnes, 2007)
Choose target concept Design code to illustrate conceptGet players to construct target codeMight need to provide scaffolding codeNeed instructions
How to use interface About learning concepts
Chaffin - G2L platform October 29, 2008
17
DarkWynter Code Design Methods needed in-game coding
GetScaffolding()• Support code to get students started
CompileCode & RunCode()• Explained with CompilerController
ValidateStudentCode()• Parsing
• Output RunVizualization()
• Updates game events
Chaffin - G2L platform October 29, 2008
18
Game Design – RecursionDesigned by Wicked Fly GamesGoal: Teach recursion, leverage engineUses Depth First Search Walkthroughs
Build bridges (edges between nodes) Collect thoughts to motivate traversal Watch visual walkthrough Stacks and Dialogues
• Explain how recursion is handled
Chaffin - G2L platform October 29, 2008
19
Chaffin - G2L platform October 29, 2008
20
Pre and Post Test
Game GUI - Overview
Chaffin - G2L platform October 29, 2008
22
OutlineBackgroundGame2Learn (G2L)EleMental : The
RecurrenceImplementationThe StudyConclusionFuture Work
DarkWynter Engine Modifications Nuclex Game Control Architecture
In-Game Compilation CompilerControls Challenge Objects Event System HUD Redevelopment Custom Game Objects AI Modifications Survey Controller Instructions Control
Chaffin - G2L platform October 29, 2008
23
XNA Microsoft’s hobbyist game development
platform using C# and .Net Allows development with Visual Studio
Used to develop DarkWynter In UNCC’s Game Studio Class (2007) More of an engine than a game Allowed for procedural terrain modification
Chaffin - G2L platform October 29, 2008
24
DarkWynter ModificationsGoal
Build games that allow for writing and running code within them
DarkWynter allows complete controlModified to allow addition of
Editing window & other forms needed Compiling and running code in the game
Chaffin - G2L platform October 29, 2008
25
Forms: Nuclex Game ControlOpen source XNA modificationAllows multiple form use in XNA
This is not built in; XNA games run in a single form Controls multiple forms through Forms User Control XNA runs in one form, allowing others to be made
Disconnects code window from game update()Overrides onPaint() and controller methods
http://www.nuclex.org/news/2007/05/14/xna-windows-forms-usercontrol
Chaffin - G2L platform October 29, 2008
26
In-Game CompilationRuntime compilation with .Net CodeDom
Code Document Object Model Graph (tree) representation of code
CSharpCodeProvider Implements the ICodeCompiler
• Compiles a CodeDom Tree with C# CompilerParameters.GenerateInMemory
• Allows in-game code to run from memory CompilerParameters.ReferencedAssemblies.Add()
• Allows in-game code to access engine
Reference: http://support.microsoft.com/kb/304655
Chaffin - G2L platform October 29, 2008
27
CompilerControls Architecture
Chaffin - G2L platform October 29, 2008
28
Challenge ObjectsObjects that represent educational activitesXML will determine activitiesCompilerControl will read XML -> ChallengesMethods
GetScaffolding()• Gets the preset scaffolding code
ValidateStudentCode()• Parses the code
RunVisualization()• Changes the CurrentGameConditions in the Event System
Challenge Objects Code
Chaffin - G2L platform October 29, 2008
30
Event System Created by WickedFly Games (Katelyn Doran, UNCC and
Drew Hicks, Marietta College) and modified by DarkWynter Turned the Engine from a FPS to an RPG Loads from Engine.cs using XML Events triggered by changing CurrentGameConditions
(CGC) CGC changes from
• Collision with objects• Challenges (runVisualization())
CGC change calls update() in GameEventHandler.cs If CGC matches GameEvent’s trigger conditions – FireEvent()
Event System Architecture
Chaffin - G2L platform October 29, 2008
31
Events : XML SettingsEach Event has
TypeID Parameters Triggers
HUD RedevelopmentDarkWynter was a 4-player game
4 Humans each had own HUD Did not have an update()
For G2L Decoupled from Human, coupled with Renderer Changed to Public Static Added an update loop Changed all add methods to return list location Changed all graphics and text
Chaffin - G2L platform October 29, 2008
33
HUD Updates Con’tRedesigned for Dialogue Events
Update() with a timer that controls the rest ShowDialogue() RemoveDialogue()
Dialogue Events redesigned To accept textures from XML
Chaffin - G2L platform October 29, 2008
34
Chaffin - G2L platform October 29, 2008
35
Custom Game Objects Thoughts()
Collectible items Models created by Wicked
Fly Games
Arrows() Indicators of location Created by Wicked Fly
Games
WaterPlane() Water plane to keep
students on island Custom built Shader
• Blends two textures
AI ModificationsThoughtAI()
Walk in a straight line algorithm Had problems with
• Rotation• XML position loading• Walk speed
Chaffin - G2L platform October 29, 2008
37
Survey ControllerIntegrates pre and post test into gameWhat it does –
Creates a new Form Loads data from XML into the Form Validates answers Writes results to a log
Instructions ControlEducational instructions for the student’s
use to guide through code developmentWhat it does –
Creates a new Form Loads the InstructionSet for the Level from
XML into Form Can be used to prevent students from
compiling code until read
Chaffin - G2L platform October 29, 2008
38
Chaffin - G2L platform October 29, 2008
39
OutlineBackgroundGame2Learn (G2L)EleMental : The
RecurrenceThe StudyConclusionFuture Work
DesignResultsPre and Post TestCompiler ErrorsQualitative
Comparisons to other G2L Games
Chaffin - G2L platform October 29, 2008
40
Pilot Study DesignPilot Study
Current CS 2214 and 2215 students recruited via the professor
Study consists of – Demographic survey & pre-test Play game Post test & survey
Data logged by game and automatically (non secure) FTPed
Chaffin - G2L platform October 29, 2008
41
Study Results31 total participants
27 took incorrect pretest 16 took valid pre and post test 1 non computing major 1 freshman, 1 sophomore, 10 juniors, 3
seniors, and 1 post Baccalaureate 13 men, 3 women 5 casual gamers, 4 hardcore, 7 neither
Chaffin - G2L platform October 29, 2008
42
PreTest/PostTest
0
1
2
3
4
5
6
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
Pretest
Posttest
Chaffin - G2L platform October 29, 2008
43
Pre/Post/Compilation Attempts
0
1
2
3
4
5
6
7
0:01:18 0:03:38 0:05:20 0:05:42 0:06:14 0:08:29 0:08:38 0:10:32 0:11:03 0:11:09 0:12:11 0:12:39
Average Time
PreTest
Posttest
Attempts
Chaffin - G2L platform October 29, 2008
44
Qualitative Comparisons
Favorite Aspects of EleMental?
In Game Coding18%
Visualization39%
Education24%
Hints12%
Game Play7%
In Game Coding
Visualization
Education
Hints
Game Play
Suggested Game Improvements
Add Audio6%
Improve Mini Map24%
More levels & challenges
9%
Improve Instructions24%
Improve Visualizations
8%
Improve Engine29%
Add Audio
Improve Mini Map
More levels & challenges
Improve Instructions
Improve Visualizations
Improve Engine
Traditional Vs. Game Assignments
Neutral5%
Game73%
Traditional20%
Chaffin - G2L platform October 29, 2008
48
Conclusion What we learned
Code concepts – abstraction, recursion, Forms, polymorphism, CodeDom, Compilers
Agile development – rapid iterations through software cycle• Teamwork• Communication• Self organization• Accountability
Good code no substitute for proper design! Parsing is HARD!
Limitations Needs Shader 3.0 graphics support Cannot run on laptops
Is downloadable through SVN If XNA and DirectX installed, can immediately run
Future Study Hypothesis – students who play EleMental: The
Recurrence with access to the in game compiler will show significantly higher learning gains than a comparison group that plays without the compiler. Crossover study –
• Half play the game with compiler
• Half play without
• Swap
Chaffin - G2L platform October 29, 2008
49
Future Engine Work Level Creation currently at 5 hours for 2 people – want to
drop that to 2 XML loading of Challenge Data DarkWynter level editor to create XML Can add new levels through mostly XML edits, plus minor code
changes (code parsing) Maps already easy (greyscale image)
Database MySQL connect Design finished More robust
Chaffin - G2L platform October 29, 2008
50
Chaffin - G2L platform October 29, 2008
51
Works Cited1. Barnes, T., A. Chaffin, E. Powell, H.Lipford. Improving the motivation of CS1 students
through games for learning. Submitted to the Journal of Game Development. Boston, MA. January 2008.
2. Barnes, T., H. Richter, A. Chaffin, A. Godwin, E. Powell. (2007). Game2Learn: Building CS1 Learning Games for Retention. ITiCSE2007: 121-125
3. Barnes, T., H. Richter, A. Chaffin, A. Godwin, E. Powell, T. Ralph, P. Matthews, and H. Jordan. (2006). Game2Learn: A study of games as tools for learning introductory programming. Submitted to SIGCSE2007, Kentucky, USA, March 2006.
4. Barnes, T., H. Richter, A. Chaffin, A. Godwin, E. Powell. (2006). The role of feedback in Game2Learn. Submitted to CHI2007, San Jose, CA, April 2006.
5. Vegso, J. Continued Drop in CS Bachelor's Degree Production and Enrollments as the Number of New Majors Stabilizes. Computing Research News, Vol. 19, No. 2, March 2007.
6. Beaubouef, T., & Mason, J, 2005. Why the high attrition rate for computer science students: Some thoughts and observations. ACM SIGCSE Inroads Bulletin, 37(2), 2005, 103-106.
7. Becker, Katrin. Teaching with games: the Minesweeper and Asteroids experience, Journal of Computing Sciences in Colleges, v.17 n.2, p.23-33, December 2001.
8. Bayliss, Jessica D and Sean Strout, Games as a "flavor" of CS1, Proceedings of the 37th SIGCSE technical symposium on Computer science education, March 03-05, 2006, Houston, Texas, USA
Works Cited Con’t1. Jones, Randolph M. "Design and Implementation of Computer Games: A Capstone Course for
Undergraduate Computer Science Education", Proceedings of the 31st SIGSCE Symposium in Computer Science Education, March 2000, Austin, TX. p260-264
2. Ian Parberry , Timothy Roden , Max B. Kazemzadeh, Experience with an industry-driven capstone course on game programming: extended abstract, Proceedings of the 36th SIGCSE technical symposium on Computer science education, February 23-27, 2005, St. Louis, Missouri, USA
3. Jenkins, Henry, Eric Klopfer, Kurt Squire, and Philip Tan. "Entering the Education Arcade." Source Computers in Entertainment, Volume 1, Issue 1. (October 2003): 17-17. August 27, 2006.
4. Kevin J. Bierre , Andrew M. Phelps, The use of MUPPETS in an introductory java programming course, Proceedings of the 5th conference on Information technology education, October 28-30, 2004, Salt Lake City, UT, USA
5. Losh, Elizabeth. "In Country with Tactical Iraqi: Trust, Identity, and Language Learning in a Military Video Game." Virtualpolitik. 2006. August 3, 2006. http://virtualpolitik.org/DAC2005.pdf
6. Mullins, P, Whitfield, D., and Conlon, M. 2008. Using Alice 2.0 as a First Language. To appear in CCSC 24th Annual Eastern Conference 2008 (Hood College, Frederick, Maryland, October 10 and 11, 2008).
7. Maloney, J. H., Peppler, K., Kafai, Y., Resnick, M., and Rusk, N. 2008. Programming by choice: urban youth learning programming with scratch. In Proceedings of the 39th SIGCSE Technical Symposium on Computer Science Education. Portland, OR, USA, March 12 - 15, 2008. SIGCSE '08. ACM, New York, NY, 367-371.
8. Eagle, M. Barnes T. (2008) Wu’s Castle: Teaching Arrays and Loops in a Game. Proceedings of ACM’s Innovation and Technology in Computer Science Education (ITiCSE 2008), Madrid, Spain, June 30 –July 2, 2008
DarkWynter Architecture
Engine (d ll)
M enu Controller
M enu System
Gam e Controller
Object Library
Collision
Renderer
On Level Changedelegate
Heads Up Display
Gam e Event Handler
Application (d ll) G am e (dll)
Entry Point (exe)
Gam e FormUCAD
User-Control Assembly (XM L) Definition
Compiler Control
Gam e-Object Control
Survey Control
Nuclex Gam e Control
Terrain : GameObject
Player : GameObject
AI: GameObject
Content (z ip)
Level / Object Xml
Gam e Event Xm l
M odels, Textures, Audio, Shaders
Gam eEngine
Com ponent D iagram
Shell (in Engine dll)
Program.cs
DelegateCallbacks
Public S taticM ethods
and VariablesUser-Defined Objects
0... nUser-Defined Controls
0... n
DarkWynter Architecture
Controller
MenuController
GameController
AI/LogicController
// Associate Keys with Delegate functions, using keytimer to control input refresh rate.public GameController( int playerNumber): base(playerNumber){ Add(new KeyboardControl (Keys.W, MoveForward, 10)); Add(new MouseControl (Enums_Engine .ControlType.Motion, Rotate, 0));}
private void MoveForward( ControllerBoolEventArgs args){ args.objectLibrary.humans[playerNumber].Translate( new Vector2(0, 10));}private void Rotate(ControllerVec2EventArgs args){ args.objectLibrary.humans[playerNumber].Rotate(args.value);}
Logical Controllers
Keyboard Control
Mouse Control
Xbox Analog Control
Xbox Digital Control
Hardware Controls
Add call associates Keys with Delegate functions.Any combination of Hardware Controls can be included in a Logical Controller.
DarkWynter ArchitectureMenu System
Engine
MenuSystem
GameScreen GameMenuElement
GameMenuButton
GameMenuLabel
GameMenuValueInput
GameMenuRandomImageDisplay
GameMenuImageScroller
GameMenuOption
GameOverScreen
PauseScreen
SorryScreen
OpeningCreditsScreen
LoadingScreenGameSetup
TitleScreen
InstructionScreen
Cera1
Cera2
Cera3
Cera4
Cera5
GameMenu GameMenuController
Can Have
Handles Current GameMenu'sLoad, Update, and Draw
DarkWynter Architecture
G am e O bjects
G am e O bjectM eta representation of an object in 3D space.
G am eO bject d lls are loaded into the engine abstractly.O verridable default procedures a llow rapid deploym ent and custom ization.
O bject L ibraryM ainta ins type specific lis ts of a ll G am eO bjects.
Regulates the G am eO bject's Load and Update functions.
PlayerTerra in
Load()
Porta l
A rrow
Bom b
C oin
Skysphere
W aterP lane
TriggerP laneLandscape
G PU O bjects
Prop
BulletPartic le
B illboard
Update()
Draw ()
PostDraw ()
ObjectTerrainCollisionResponse()
ObjectObjectCollisionResponse()
XmlNodeObject
MassObject
DrawObject
CollisionEvent-based response to
O bject and Terra in co llis ions.
RenderRegulates G am eO bject D raw
and Postdraw ca lls
Exam ple
G am eO bjectVirtua l Functions
DarkWynter ArchitectureHeads Up Display
Engine Heads Up Display ObjectLibrary
HumanGameEventHandler
HUDMapEvent
StackEventDialogueEvent
Initialize&
Update
Create and UpdateHuman Specific Objects
Draw
Manages Scripted Hud Events
Engine initializes and drives HUD updates through static accessors. Human creates HUD and updates it's own elements. GameEventHandler initializes and handles updates for scripted HUD Events, Scripted events attach to player through object collision response functions (see EventSystem).
DarkWynter ArchitectureEvent System
GameEventHandler
GameEvent
EventConditions
DialogueEvent
TerrainEvent
HUDMapEvent
AIEvent
LevelChangeEvent
StackEvent
Loaded from Xml
Game-Event Types
Events are triggered by modifying the public static CurrentGameConditions .
Updating CGC conditions auto-checks potential matches between CGC and the Xml-defined GameEvents..(aka - Static Board Evaluation)
The Event System fires matched events, then removes them from the list.
Updates the HUD with the new dialog
Sets the new position for the AI to go to
Builds the terrain between a predetermined set of points
Builds the stack on the HUD based on Player.mass.CurrentPosition
Updates the location map on HUD to reflect Nodes traveledDrops events and reloads level
CurrentGameConditions
Set by Runtime
<-- Comparison -->
DarkWynter ArchitectureRenderer
Engine
Render
Draw
ObjectLibrary
GameObject
Attach Delegates to ObjectLibrary.Update Graphics Device Settings.
Execute Draw Sequence
Calls order-dependent Draw delegates.Return all GameObjects drawn in the current frame.
Independent draw component
Renderer manages graphics device setup and shutdown operations for Engine through delegates, allowing Engine to manage the internal draw order of the following order-dependent categories.
Object Library - GameObjects or 3D World-space objectsSprites - Billboards or 2D World-space objectsHeads Up Display - 2D Screen-space objects
DarkWynter ArchitectureCompiler and Challenges
CompilerControl
Engine
XML
ChallengeAbstract
Challenge0
Challenge1
Challenge2
Challenge3
Public static accessorsused to control
Engine mechanicsfrom Application.
CSharpCompiler
Compile andreturn Results
The CompilerControl loads the Challenges from XML. Compilation is triggered by user button-click, which sends the student code to the CSharpCompiler. The CSharpCompiler compiles the code in memory (though it canbe compiled to an exe or a dll) and returns the CompilerResults to the CompilerControl,
Running the compiled code is also triggered by user button-click which calls the CS harpCompiler.execute() function, invoking the code in memory.
Aside from compilation, Challenges may verify student code through parsing (it will not run unless the code matches the parsing) allowing validation of code-style before triggering the first set of Events.
DarkWynter Architecture
UCAD
Main
GameControl
Bottom
Default and User-Defined Control Toolkit
Left
CompilerControl
Right
LevelEditor
Instructions || Levels || Tools || Get Involved...