SlideShare a Scribd company logo
1 of 21
The Game Development
Process:
Debugging
Introduction
 Debugging is methodical process for removing
mistakes in program
 So important, whole set of tools to help.
Called “debuggers”
 Trace code, print values, profile
 New Integrated Development Environments
(IDEs) (such as Game Maker) have it built in
 But debugging still frustrating
 Beginners not know how to proceed
 Even advanced can get “stuck”
 Don’t know how long takes to find
 Variance can be high
 What are some tips? What method can be
applied?
Outline
5-step debugging process
Prevention
Game Maker specifics
Debugging tips
Step 1: Reproduce the Problem
Consistently
Find case where always occurs
 “Sometimes game crashes after kill boss”
doesn’t help much
Identify steps to get to bug
 Ex: start single player, room 2, jump to top
platform, attack left, …
 Produce systematic way to reproduce
Step 2: Collect Clues
 Collect clues as to bug
 Clues suggest where problem might be
 Ex: if crash using projectile, what about that code
that handles projectile creation and shooting?
 And beware that some clues are false
 Ex: if bug follows explosion may think they are
related, but may be from something else
 Don’t spend too long - get in and observe
 Ex: see reference pointer from arrow to unit that shot
arrow should get experience points, but it is NULL
 That’s the bug, but why is it NULL?
Step 3: Pinpoint Error
1) Propose a hypothesis and prove or disprove
 Ex: suppose arrow pointer corrupted during flight. Add
code to print out values of arrow in air. But equals same
value that crashes. Hypothesis is wrong. But now have
new clue.
 Ex: suppose unit deleted before experience points added.
Print out values of all in camp before fire and all deleted.
Yep, that’s it.
Or, 2) divide-and-conquer method (note, can
use with hypothesis test above, too)
 Sherlock Holmes: “when you have eliminated the
impossible, whatever remains, however improbably, must
be the truth”
 Setting breakpoints, look at all values, until discover bug
 The “divide” part means break it into smaller sections
 Ex: if crash, put breakpoint ½ way. Is it before or after?
 Repeat.
 Look for anomalies, NULL or NAN values
Step 4: Repair the Problem
 Propose solution. Exact solution depends
upon stage of problem.
 Ex: late in code cannot change data structures.
Too many other parts use.
 Worry about “ripple” effects.
 Ideally, want original coder to fix
 If not possible, at least try to talk with original
coder for insights.
 Consider other similar cases, even if not yet
reported
 Ex: other projectiles may cause same problem
as arrows did
Step 5: Test Solution
Obvious, but can be overlooked if
programmer is sure they have fix (but
programmer can be wrong!)
So, test that solution repairs bug
 Best by independent tester
Test if other bugs introduced (beware
“ripple” effect)
Outline
5-step debugging process (done)
Prevention (next)
Game Maker specifics
Debugging tips
Debugging Prevention
 Add infrastructure, tools to assist
 Alter game variables on fly (speed up debugging)
 Visual diagnostics (maybe on avatars)
 Log data (events, units, code, time stamps)
 Indent code, use comments (in Game Maker)
 Use consistent style, variable names
 Ex: spr_boss, obj_boss
 Avoid duplicating code – hard to fix if bug
 Use a script
 Avoid hard-coded values – makes brittle
 Always initialize variables when declared
 Verify coverage (test all code) when testing
Outline
5-step debugging process (done)
Prevention (done)
Game Maker specifics (next)
Debugging tips
Game Maker – Print Messages
Display a Message
 object  main2  info
Or, in code (control  code)
 show_message(“Executed this code“)
 show_message(“num:“ + string(num_here))
Beware if done every step!
 Save code ahead of time
 Use task manager to kill
 Ctrl-Alt-Delete  Task Manager
 Process is name of game file, not
GameMaker.exe
Game Maker – Debug Mode
 Ex: easy
 obj_hero.y
 obj_hero.can_shoot
• Save/load
• Look at instances, global
variables, local variables
• Execute code
• Set speed
Game Maker – Print Debug Messages
 Like show_message()
but in debug mode
only
 Note, doesn’t pause
 In code
 show_debug_message
(“Executed this
code“)
 Need to run in debug
mode
 Debug information
 Tools
 Show messages
Game Maker – Log Messages
 Write messages to file
 Example:
 At beginning (maybe create log object)
 global.log_name = “logfile“;
global.fid =
file_text_open_write(global.log_name);
 Then, where needed:
 file_text_write_string(global.fid,”Debug message here”)
;
 Close when done (object  event other  game
end):
 file_text_close(global.fid)
 More file operations (look online) possible
 Note: files also useful for save/load game, etc.
Game Maker – Script/Code
Syntax
Game Maker – Error Messages
(1 of 2)
 Help pinpoint problem
 Refer to object and method and offending code
Pay attention!
Refers to:
-Object
-Event
-Line number
-Variable name
Game Maker – Error Messages
(2 of 2)
 Can write messages
to log file
 Can ignore messages
 Use “error_last” and
“error_occurred” for
custom handling
 Typically, use only
in release
Debugging Tips (1 of 3)
 One thing at a time
 Fix one thing at a time – don’t try to fix multiple
problems
 Change one thing at a time – test hypothesis.
Change back if doesn’t fix problem.
 Start with simpler case that works - then add more
complex code, one thing at a time
 Question your assumptions – don’t even assume
simple stuff works, or “mature” products
 Ex: libraries and tutorials can have bugs
Debugging Tips (2 of 3)
 Check code recently changed – if bug appears,
may be in latest code (not even yours!)
 Use debugger – breakpoints, memory
watches, stack …
 Break complex calculations into steps – may
be equation that is at fault or “cast” badly
 Check boundary conditions – classic “off by
one” for loops, etc.
 Minimize randomness –
 Ex: can be caused by random seed or player
input. Fix input (script player) so reproducible
Debugging Tips (3 of 3)
 Take a break – too close, can’t see it. Remove
to provide fresh prospective
 Explain bug to someone else – helps retrace
steps, and others provide alternate
hypotheses
 Debug with partner – provides new techniques
 Same advantage with code reviews, peer
programming
 Get outside help – tech support for consoles,
Web examples, libraries, …

More Related Content

Similar to debugging.ppt

Testing & should i do it
Testing & should i do itTesting & should i do it
Testing & should i do itMartin Sykora
 
debugging (1).ppt
debugging (1).pptdebugging (1).ppt
debugging (1).pptjerlinS1
 
An important characteristic of a test suite that is computed by a dynamic ana...
An important characteristic of a test suite that is computed by a dynamic ana...An important characteristic of a test suite that is computed by a dynamic ana...
An important characteristic of a test suite that is computed by a dynamic ana...jeyasrig
 
Software Design
Software DesignSoftware Design
Software DesignSpy Seat
 
Debugging with visual studio beyond 'F5'
Debugging with visual studio beyond 'F5'Debugging with visual studio beyond 'F5'
Debugging with visual studio beyond 'F5'Dror Helper
 
Behaviour Driven Development and Thinking About Testing
Behaviour Driven Development and Thinking About TestingBehaviour Driven Development and Thinking About Testing
Behaviour Driven Development and Thinking About Testingdn
 
Bdd and-testing
Bdd and-testingBdd and-testing
Bdd and-testingmalcolmt
 
Case Study of the Unexplained
Case Study of the UnexplainedCase Study of the Unexplained
Case Study of the Unexplainedshannomc
 
Week1 programming challenges
Week1 programming challengesWeek1 programming challenges
Week1 programming challengesDhanu Srikar
 
Code igniter unittest-part1
Code igniter unittest-part1Code igniter unittest-part1
Code igniter unittest-part1Albert Rosa
 
Mastering Python lesson 3a
Mastering Python lesson 3aMastering Python lesson 3a
Mastering Python lesson 3aRuth Marvin
 
SynapseIndia dotnet development methodologies iterative
SynapseIndia dotnet development methodologies   iterativeSynapseIndia dotnet development methodologies   iterative
SynapseIndia dotnet development methodologies iterativeSynapseindiappsdevelopment
 
Synapseindia dot net development about programming
Synapseindia dot net development about programmingSynapseindia dot net development about programming
Synapseindia dot net development about programmingSynapseindiappsdevelopment
 
Mastering python lesson2
Mastering python lesson2Mastering python lesson2
Mastering python lesson2Ruth Marvin
 
3.6 debugging games
3.6 debugging games3.6 debugging games
3.6 debugging gamesSayed Ahmed
 
Tdd is not about testing (OOP)
Tdd is not about testing (OOP)Tdd is not about testing (OOP)
Tdd is not about testing (OOP)Gianluca Padovani
 
Dev buchan 30 proven tips
Dev buchan 30 proven tipsDev buchan 30 proven tips
Dev buchan 30 proven tipsBill Buchan
 

Similar to debugging.ppt (20)

Testing & should i do it
Testing & should i do itTesting & should i do it
Testing & should i do it
 
debugging (1).ppt
debugging (1).pptdebugging (1).ppt
debugging (1).ppt
 
An important characteristic of a test suite that is computed by a dynamic ana...
An important characteristic of a test suite that is computed by a dynamic ana...An important characteristic of a test suite that is computed by a dynamic ana...
An important characteristic of a test suite that is computed by a dynamic ana...
 
Software Design
Software DesignSoftware Design
Software Design
 
TDD Best Practices
TDD Best PracticesTDD Best Practices
TDD Best Practices
 
Debugging with visual studio beyond 'F5'
Debugging with visual studio beyond 'F5'Debugging with visual studio beyond 'F5'
Debugging with visual studio beyond 'F5'
 
Behaviour Driven Development and Thinking About Testing
Behaviour Driven Development and Thinking About TestingBehaviour Driven Development and Thinking About Testing
Behaviour Driven Development and Thinking About Testing
 
Bdd and-testing
Bdd and-testingBdd and-testing
Bdd and-testing
 
Case Study of the Unexplained
Case Study of the UnexplainedCase Study of the Unexplained
Case Study of the Unexplained
 
Week1 programming challenges
Week1 programming challengesWeek1 programming challenges
Week1 programming challenges
 
Code igniter unittest-part1
Code igniter unittest-part1Code igniter unittest-part1
Code igniter unittest-part1
 
CPP10 - Debugging
CPP10 - DebuggingCPP10 - Debugging
CPP10 - Debugging
 
Mastering Python lesson 3a
Mastering Python lesson 3aMastering Python lesson 3a
Mastering Python lesson 3a
 
SynapseIndia dotnet development methodologies iterative
SynapseIndia dotnet development methodologies   iterativeSynapseIndia dotnet development methodologies   iterative
SynapseIndia dotnet development methodologies iterative
 
Synapseindia dot net development about programming
Synapseindia dot net development about programmingSynapseindia dot net development about programming
Synapseindia dot net development about programming
 
Mastering python lesson2
Mastering python lesson2Mastering python lesson2
Mastering python lesson2
 
3.6 debugging games
3.6 debugging games3.6 debugging games
3.6 debugging games
 
Tdd is not about testing (OOP)
Tdd is not about testing (OOP)Tdd is not about testing (OOP)
Tdd is not about testing (OOP)
 
Dev buchan 30 proven tips
Dev buchan 30 proven tipsDev buchan 30 proven tips
Dev buchan 30 proven tips
 
CC-112-Lec.1.ppsx
CC-112-Lec.1.ppsxCC-112-Lec.1.ppsx
CC-112-Lec.1.ppsx
 

Recently uploaded

Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsanshu789521
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfSumit Tiwari
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
MENTAL STATUS EXAMINATION format.docx
MENTAL     STATUS EXAMINATION format.docxMENTAL     STATUS EXAMINATION format.docx
MENTAL STATUS EXAMINATION format.docxPoojaSen20
 
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...M56BOOKSTORE PRODUCT/SERVICE
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsKarinaGenton
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17Celine George
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 

Recently uploaded (20)

Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha elections
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
MENTAL STATUS EXAMINATION format.docx
MENTAL     STATUS EXAMINATION format.docxMENTAL     STATUS EXAMINATION format.docx
MENTAL STATUS EXAMINATION format.docx
 
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its Characteristics
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 

debugging.ppt

  • 2. Introduction  Debugging is methodical process for removing mistakes in program  So important, whole set of tools to help. Called “debuggers”  Trace code, print values, profile  New Integrated Development Environments (IDEs) (such as Game Maker) have it built in  But debugging still frustrating  Beginners not know how to proceed  Even advanced can get “stuck”  Don’t know how long takes to find  Variance can be high  What are some tips? What method can be applied?
  • 4. Step 1: Reproduce the Problem Consistently Find case where always occurs  “Sometimes game crashes after kill boss” doesn’t help much Identify steps to get to bug  Ex: start single player, room 2, jump to top platform, attack left, …  Produce systematic way to reproduce
  • 5. Step 2: Collect Clues  Collect clues as to bug  Clues suggest where problem might be  Ex: if crash using projectile, what about that code that handles projectile creation and shooting?  And beware that some clues are false  Ex: if bug follows explosion may think they are related, but may be from something else  Don’t spend too long - get in and observe  Ex: see reference pointer from arrow to unit that shot arrow should get experience points, but it is NULL  That’s the bug, but why is it NULL?
  • 6. Step 3: Pinpoint Error 1) Propose a hypothesis and prove or disprove  Ex: suppose arrow pointer corrupted during flight. Add code to print out values of arrow in air. But equals same value that crashes. Hypothesis is wrong. But now have new clue.  Ex: suppose unit deleted before experience points added. Print out values of all in camp before fire and all deleted. Yep, that’s it. Or, 2) divide-and-conquer method (note, can use with hypothesis test above, too)  Sherlock Holmes: “when you have eliminated the impossible, whatever remains, however improbably, must be the truth”  Setting breakpoints, look at all values, until discover bug  The “divide” part means break it into smaller sections  Ex: if crash, put breakpoint ½ way. Is it before or after?  Repeat.  Look for anomalies, NULL or NAN values
  • 7. Step 4: Repair the Problem  Propose solution. Exact solution depends upon stage of problem.  Ex: late in code cannot change data structures. Too many other parts use.  Worry about “ripple” effects.  Ideally, want original coder to fix  If not possible, at least try to talk with original coder for insights.  Consider other similar cases, even if not yet reported  Ex: other projectiles may cause same problem as arrows did
  • 8. Step 5: Test Solution Obvious, but can be overlooked if programmer is sure they have fix (but programmer can be wrong!) So, test that solution repairs bug  Best by independent tester Test if other bugs introduced (beware “ripple” effect)
  • 9. Outline 5-step debugging process (done) Prevention (next) Game Maker specifics Debugging tips
  • 10. Debugging Prevention  Add infrastructure, tools to assist  Alter game variables on fly (speed up debugging)  Visual diagnostics (maybe on avatars)  Log data (events, units, code, time stamps)  Indent code, use comments (in Game Maker)  Use consistent style, variable names  Ex: spr_boss, obj_boss  Avoid duplicating code – hard to fix if bug  Use a script  Avoid hard-coded values – makes brittle  Always initialize variables when declared  Verify coverage (test all code) when testing
  • 11. Outline 5-step debugging process (done) Prevention (done) Game Maker specifics (next) Debugging tips
  • 12. Game Maker – Print Messages Display a Message  object  main2  info Or, in code (control  code)  show_message(“Executed this code“)  show_message(“num:“ + string(num_here)) Beware if done every step!  Save code ahead of time  Use task manager to kill  Ctrl-Alt-Delete  Task Manager  Process is name of game file, not GameMaker.exe
  • 13. Game Maker – Debug Mode  Ex: easy  obj_hero.y  obj_hero.can_shoot • Save/load • Look at instances, global variables, local variables • Execute code • Set speed
  • 14. Game Maker – Print Debug Messages  Like show_message() but in debug mode only  Note, doesn’t pause  In code  show_debug_message (“Executed this code“)  Need to run in debug mode  Debug information  Tools  Show messages
  • 15. Game Maker – Log Messages  Write messages to file  Example:  At beginning (maybe create log object)  global.log_name = “logfile“; global.fid = file_text_open_write(global.log_name);  Then, where needed:  file_text_write_string(global.fid,”Debug message here”) ;  Close when done (object  event other  game end):  file_text_close(global.fid)  More file operations (look online) possible  Note: files also useful for save/load game, etc.
  • 16. Game Maker – Script/Code Syntax
  • 17. Game Maker – Error Messages (1 of 2)  Help pinpoint problem  Refer to object and method and offending code Pay attention! Refers to: -Object -Event -Line number -Variable name
  • 18. Game Maker – Error Messages (2 of 2)  Can write messages to log file  Can ignore messages  Use “error_last” and “error_occurred” for custom handling  Typically, use only in release
  • 19. Debugging Tips (1 of 3)  One thing at a time  Fix one thing at a time – don’t try to fix multiple problems  Change one thing at a time – test hypothesis. Change back if doesn’t fix problem.  Start with simpler case that works - then add more complex code, one thing at a time  Question your assumptions – don’t even assume simple stuff works, or “mature” products  Ex: libraries and tutorials can have bugs
  • 20. Debugging Tips (2 of 3)  Check code recently changed – if bug appears, may be in latest code (not even yours!)  Use debugger – breakpoints, memory watches, stack …  Break complex calculations into steps – may be equation that is at fault or “cast” badly  Check boundary conditions – classic “off by one” for loops, etc.  Minimize randomness –  Ex: can be caused by random seed or player input. Fix input (script player) so reproducible
  • 21. Debugging Tips (3 of 3)  Take a break – too close, can’t see it. Remove to provide fresh prospective  Explain bug to someone else – helps retrace steps, and others provide alternate hypotheses  Debug with partner – provides new techniques  Same advantage with code reviews, peer programming  Get outside help – tech support for consoles, Web examples, libraries, …