Chapter 3.5 Debugging Games. 2 The Five Step Debugging Process 1. Reproduce the problem consistently...
-
Upload
emery-ross -
Category
Documents
-
view
218 -
download
1
Transcript of Chapter 3.5 Debugging Games. 2 The Five Step Debugging Process 1. Reproduce the problem consistently...
![Page 1: Chapter 3.5 Debugging Games. 2 The Five Step Debugging Process 1. Reproduce the problem consistently 2. Collect clues 3. Pinpoint the error 4. Repair.](https://reader036.fdocuments.in/reader036/viewer/2022082516/56649cf05503460f949becef/html5/thumbnails/1.jpg)
Chapter 3.5Debugging Games
![Page 2: Chapter 3.5 Debugging Games. 2 The Five Step Debugging Process 1. Reproduce the problem consistently 2. Collect clues 3. Pinpoint the error 4. Repair.](https://reader036.fdocuments.in/reader036/viewer/2022082516/56649cf05503460f949becef/html5/thumbnails/2.jpg)
2
The Five StepDebugging Process
1. Reproduce the problem consistently
2. Collect clues3. Pinpoint the error4. Repair the problem5. Test the solution
![Page 3: Chapter 3.5 Debugging Games. 2 The Five Step Debugging Process 1. Reproduce the problem consistently 2. Collect clues 3. Pinpoint the error 4. Repair.](https://reader036.fdocuments.in/reader036/viewer/2022082516/56649cf05503460f949becef/html5/thumbnails/3.jpg)
3
Step 1: Reproduce the Problem Consistently
Sample repro steps:1. Start a single player game2. Choose Skirmish on map 443. Find the enemy camp4. From a distance, use projectile
weapons to attack the enemies at the camp
5. Result: 90 percent of the time the game crashes
![Page 4: Chapter 3.5 Debugging Games. 2 The Five Step Debugging Process 1. Reproduce the problem consistently 2. Collect clues 3. Pinpoint the error 4. Repair.](https://reader036.fdocuments.in/reader036/viewer/2022082516/56649cf05503460f949becef/html5/thumbnails/4.jpg)
4
Step 2:Collect Clues
Each clue a chance to rule out a cause
Each clue a chance to narrow down the list of suspects
Realize that some clues can be misleading and should be ignored
![Page 5: Chapter 3.5 Debugging Games. 2 The Five Step Debugging Process 1. Reproduce the problem consistently 2. Collect clues 3. Pinpoint the error 4. Repair.](https://reader036.fdocuments.in/reader036/viewer/2022082516/56649cf05503460f949becef/html5/thumbnails/5.jpg)
5
Step 3:Pinpoint the Error
Two main methods:1. Propose a Hypothesis
You have an idea what is causing the bug Design tests to prove or disprove your
hypothesis
2. Divide and Conquer Narrow down what could be causing the
bug Eliminate possibilities from the top down or Backtrack from the point of failure upward
![Page 6: Chapter 3.5 Debugging Games. 2 The Five Step Debugging Process 1. Reproduce the problem consistently 2. Collect clues 3. Pinpoint the error 4. Repair.](https://reader036.fdocuments.in/reader036/viewer/2022082516/56649cf05503460f949becef/html5/thumbnails/6.jpg)
6
Step 4:Repair the Problem Propose solution Consider implications at point in project Programmer who wrote the code
should ideally fix the problem (or at least be consulted)
Explore other ways the bug could occur Ensure underlying problem fixed and not
just a symptom of the problem
![Page 7: Chapter 3.5 Debugging Games. 2 The Five Step Debugging Process 1. Reproduce the problem consistently 2. Collect clues 3. Pinpoint the error 4. Repair.](https://reader036.fdocuments.in/reader036/viewer/2022082516/56649cf05503460f949becef/html5/thumbnails/7.jpg)
7
Step 5:Test the Solution Verify the bug was fixed Check original repro steps Ideally have someone else
independently verify the fix Make sure no new bugs were
introduced At the very end of the project, have
other programmers review the fix
![Page 8: Chapter 3.5 Debugging Games. 2 The Five Step Debugging Process 1. Reproduce the problem consistently 2. Collect clues 3. Pinpoint the error 4. Repair.](https://reader036.fdocuments.in/reader036/viewer/2022082516/56649cf05503460f949becef/html5/thumbnails/8.jpg)
8
Expert Debugging Tips Question assumptions Minimize interactions and interference Minimize randomness Break complex calculations into steps Check boundary conditions Disrupt parallel computations Exploit tools in the debugger Check code that has recently changed Explain the bug to someone else Debug with a partner Take a break from the problem Get outside help
![Page 9: Chapter 3.5 Debugging Games. 2 The Five Step Debugging Process 1. Reproduce the problem consistently 2. Collect clues 3. Pinpoint the error 4. Repair.](https://reader036.fdocuments.in/reader036/viewer/2022082516/56649cf05503460f949becef/html5/thumbnails/9.jpg)
9
Tough Debugging Scenarios Bug exists in Release but not Debug
Uninitialized data or optimization issue Bug exists on final hardware, not dev-kit
Find out how they differ – usually memory size or disc emulation Bug disappears when changing something innocuous
Timing or memory overwrite problem Intermittent problems
Record as much info when it does happen Unexplainable behavior
Retry, Rebuild, Reboot, Reinstall Internal compiler errors
Full rebuild, divide and conquer, try other machines Suspect it’s not your code
Check for patches, updates, or reported bugs Contact console maker, library maker, or compiler maker
![Page 10: Chapter 3.5 Debugging Games. 2 The Five Step Debugging Process 1. Reproduce the problem consistently 2. Collect clues 3. Pinpoint the error 4. Repair.](https://reader036.fdocuments.in/reader036/viewer/2022082516/56649cf05503460f949becef/html5/thumbnails/10.jpg)
10
Understanding theUnderlying System
Knowing prog. language not enough Know how the compiler implements code Know the details of your hardware
Especially important for console development Know how assembly works and be able to
read it Helps with optimization bugs or compiler
issues Might mean bytecode instruction set or
interpreter internals
![Page 11: Chapter 3.5 Debugging Games. 2 The Five Step Debugging Process 1. Reproduce the problem consistently 2. Collect clues 3. Pinpoint the error 4. Repair.](https://reader036.fdocuments.in/reader036/viewer/2022082516/56649cf05503460f949becef/html5/thumbnails/11.jpg)
11
Adding Infrastructureto Assist in Debugging Alter game variables during gameplay Visual AI diagnostics Logging capability Recording and playback capability Track memory allocation Print as much information as possible
on a crash Educate your entire team
testers, artists, designers, producers
![Page 12: Chapter 3.5 Debugging Games. 2 The Five Step Debugging Process 1. Reproduce the problem consistently 2. Collect clues 3. Pinpoint the error 4. Repair.](https://reader036.fdocuments.in/reader036/viewer/2022082516/56649cf05503460f949becef/html5/thumbnails/12.jpg)
12
Prevention of Bugs Set compiler to highest warning level Set compiler warnings to be errors Compiler on multiple compilers Write your own memory manager Use asserts to verify assumptions Initialize variables when they are declared Bracket loops and if statements Use cognitively different variable names Avoid identical code in multiple places Avoid magic (hardcoded) numbers Verify code coverage when testing