Interactive Media and Game Development Debugging.

Slides:



Advertisements
Similar presentations
VCE SD Theory Slideshows By Mark Kelly Vceit.com Debugging Techniques.
Advertisements

COMPUTER PROGRAMMING I Essential Standard 5.02 Understand Breakpoint, Watch Window, and Try And Catch to Find Errors.
Why care about debugging? How many of you have written a program that worked perfectly the first time? No one (including me!) writes a program that works.
Annoucements  Next labs 9 and 10 are paired for everyone. So don’t miss the lab.  There is a review session for the quiz on Monday, November 4, at 8:00.
Debugging Mohammad Zikky, M.T. 2 Debugging Introduction (1 of 2)  Debugging is methodical process for removing mistakes in a program  So important,
IMGD 1001: Debugging. 2 Debugging Introduction (1 of 2)  Debugging is methodical process for removing mistakes in a program  So important, whole set.
Announcements Wednesday's test will be postponed until Thursday – July 7 th, See me if this won’t work for you. Project 1 will be due Monday – July.
Interactive Media and Game Development Debugging.
Chapter 3.5 Debugging Games
Debugging Introduction to Computing Science and Programming I.
IMGD 1001: Debugging by Mark Claypool Robert W. Lindeman
Nov 10, Fall 2006IAT 8001 Debugging. Nov 10, Fall 2006IAT 8002 How do I know my program is broken?  Compiler Errors –easy to fix!  Runtime Exceptions.
Interactive Media and Game Development Debugging.
Debugging CPSC 315 – Programming Studio Fall 2008.
The IDE (Integrated Development Environment) provides a DEBUGGER for locating and correcting errors in program logic (logic errors not syntax errors) The.
XP 1 Working with JavaScript Creating a Programmable Web Page for North Pole Novelties Tutorial 10.
How to Debug VB .NET Code.
16/27/2015 3:38 AM6/27/2015 3:38 AM6/27/2015 3:38 AMTesting and Debugging Testing The process of verifying the software performs to the specifications.
Interactive Media and Game Development Debugging.
2/9/2007EECS150 Lab Lecture #41 Debugging EECS150 Spring2007 – Lab Lecture #4 Laura Pelton Greg Gibeling.
Programming Fundamentals (750113) Ch1. Problem Solving
CHAPTER 10 Recursion. 2 Recursive Thinking Recursion is a programming technique in which a method can call itself to solve a problem A recursive definition.
02/10/06EECS150 Lab Lecture #41 Debugging EECS150 Spring 2006 – Lab Lecture #4 Philip Godoy Greg Gibeling.
JS Arrays, Functions, Events Week 5 INFM 603. Agenda Arrays Functions Event-Driven Programming.
Jun 16, 2014IAT 2651 Debugging. Dialectical Materialism  Dialectical materialism is a strand of Marxism, synthesizing Hegel's dialectics, which proposes.
Chapter 5: Control Structures II (Repetition)
CHAPTER 5: CONTROL STRUCTURES II INSTRUCTOR: MOHAMMAD MOJADDAM.
EGR 2261 Unit 5 Control Structures II: Repetition  Read Malik, Chapter 5.  Homework #5 and Lab #5 due next week.  Quiz next week.
Structured programming 4 Day 34 LING Computational Linguistics Harry Howard Tulane University.
Debugging & Troubleshooting “To err is human, but it takes a computer to really foul things up” © 2004 Lawrence Snyder.
1 Today Random testing again Some background (Hamlet) Why not always use random testing? More Dominion & project? CUTE: “concolic” testing.
Debugging. Compile problems Read the whole complaint! Runtime problems –Exceptions –Incorrect behavior.
The First in GPON Verification Classic Mistakes Verification Leadership Seminar Racheli Ganot FlexLight Networks.
Testing and Debugging Version 1.0. All kinds of things can go wrong when you are developing a program. The compiler discovers syntax errors in your code.
Testing. 2 Overview Testing and debugging are important activities in software development. Techniques and tools are introduced. Material borrowed here.
DEBUGGING. BUG A software bug is an error, flaw, failure, or fault in a computer program or system that causes it to produce an incorrect or unexpected.
Chapter 22 Developer testing Peter J. Lane. Testing can be difficult for developers to follow  Testing’s goal runs counter to the goals of the other.
Testing and Debugging Session 9 LBSC 790 / INFM 718B Building the Human-Computer Interface.
1 Κατανεμημένες Διαδικτυακές Εφαρμογές Πολυμέσων Γιάννης Πετράκης.
Debugging Strategies from Software Carpentry. Agan's Rules Many people make debugging harder than it needs to be by: Using inadequate tools Not going.
Chapter 5 Control Structure (Repetition). Objectives In this chapter, you will: Learn about repetition (looping) control structures Explore how to construct.
Chapter 5: Control Structures II (Repetition). Objectives In this chapter, you will: – Learn about repetition (looping) control structures – Learn how.
Debugging, bug finding and bug avoidance Part 3 Alan Dix
BMTRY 789 Lecture 11: Debugging Readings – Chapter 10 (3 rd Ed) from “The Little SAS Book” Lab Problems – None Homework Due – None Final Project Presentations.
1 Debugging and Syntax Errors in C++. 2 Debugging – a process of finding and fixing bugs (errors or mistakes) in a computer program.
Design - programming Cmpe 450 Fall Dynamic Analysis Software quality Design carefully from the start Simple and clean Fewer errors Finding errors.
M1G Introduction to Programming 2 3. Creating Classes: Room and Item.
Testing CSE 160 University of Washington 1. Testing Programming to analyze data is powerful It’s useless (or worse!) if the results are not correct Correctness.
Source Level Debugging of Parallel Programs Roland Wismüller LRR-TUM, TU München Germany.
JavaScript Introduction and Background. 2 Web languages Three formal languages HTML JavaScript CSS Three different tasks Document description Client-side.
AVCE ICT – Unit 7 - Programming Session 12 - Debugging.
CSE 332: C++ expressions Expressions: Operators and Operands Operators obey arity, associativity, and precedence int result = 2 * 3 + 5; // assigns 11.
CS 115 Lecture 5 Math library; building a project Taken from notes by Dr. Neil Moore.
Debugging using By: Samuel Ashby. What is debugging?  A bug is an error in either a program or the hardware itself.  Debugging is first locating and.
Game Maker Tutorials Introduction Clickball IntroductionClickball Where is it? Shooting Where is it?Shooting.
Error Analysis Logic Errors.
Testing and Debugging.
Libraries and Debugging
CSS 161: Fundamentals of Computing
Sentinel logic, flags, break Taken from notes by Dr. Neil Moore
Chapter 15 Debugging.
CSCE 315 – Programming Studio, Fall 2017 Tanzir Ahmed
Programming Fundamentals (750113) Ch1. Problem Solving
Debugging at Scale.
Chapter 15 Debugging.
An Introduction to Debugging
Chapter 3 Debugging Section 3.4
Chapter 15 Debugging.
Chapter 15 Debugging.
Presentation transcript:

Interactive Media and Game Development Debugging

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 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, … –Produces 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. And/Or, 2) divide-and-conquer method –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)

Debugging Prevention Add infrastructure, tools to assist –Alter game variables on fly (speed up) –Visual diagnostics (maybe on avatars) –Log data (events, units, code, time stamps) Always initialize variables when declared Indent code, use comments Use consistent style, variable names Avoid identical code – harder to fix if bug found –Use a script Avoid hard-coded (magic numbers) – makes brittle Verify coverage (test all code) when testing

Outline 5-step debugging process(done) Kodu specifics(next) Debugging tips

Debugging in Kodu (1 of 4) Built-in debugging aids Path Collision Sight and sound

Debugging in Kodu (2 of 4) PathSight and Hearing Collisions

Debugging in Kodu (3 of 4)

Debugging in Kodu (4 of 4) To help see when/if events triggered, add own debug “messages” –Color, express …

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, …