{"id":1916,"date":"2011-04-17T22:28:24","date_gmt":"2011-04-18T04:28:24","guid":{"rendered":"http:\/\/handyvandal.com\/?p=1916"},"modified":"2011-04-17T22:38:17","modified_gmt":"2011-04-18T04:38:17","slug":"debugging-techniques","status":"publish","type":"post","link":"https:\/\/handyvandal.com\/wphv\/2011\/04\/debugging-techniques\/","title":{"rendered":"Debugging Techniques"},"content":{"rendered":"<p>Some <a href=\"http:\/\/www.devmaster.net\/forums\/showthread.php?t=17308\">useful tips on debugging your code<\/a> from roel at devmaster.net. This is in response to a question about collision detection in C#, but the same techniques apply to a wide range of situations in game programming.<\/p>\n<p>roel writes: &#8220;Use your debugger to find out what happens &#8230;. If the problem occurs arbitrarily, this is usually my approach:<\/p>\n<ul>\n<li>make your code work deterministically: fixed timesteps, random number generators with fixed seeds;<\/li>\n<li>add a frame \/ iteration counter;<\/li>\n<li>add code that detects your problem &#8220;player is one pixel above the ground&#8221; and then outputs that counter;<\/li>\n<li>run your program and remember the value of the counter;<\/li>\n<li>add a breakpoint when that counter is reached so that your debugger kicks in in advance of the frame\/iteration where the problem occurs;<\/li>\n<li>restart your program and wait until the breakpoint is reached;<\/li>\n<li>step through it and see what went wrong and fix it.&#8221;<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Some useful tips on debugging your code from roel at devmaster.net. This is in response to a question about collision detection in C#, but the same techniques apply to a wide range of situations in game programming. roel writes: &#8220;Use your debugger to find out what happens &#8230;. If the problem occurs arbitrarily, this is [&hellip;]<\/p>\n","protected":false},"author":7,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[94],"tags":[],"class_list":["post-1916","post","type-post","status-publish","format-standard","hentry","category-programming"],"_links":{"self":[{"href":"https:\/\/handyvandal.com\/wphv\/wp-json\/wp\/v2\/posts\/1916","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/handyvandal.com\/wphv\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/handyvandal.com\/wphv\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/handyvandal.com\/wphv\/wp-json\/wp\/v2\/users\/7"}],"replies":[{"embeddable":true,"href":"https:\/\/handyvandal.com\/wphv\/wp-json\/wp\/v2\/comments?post=1916"}],"version-history":[{"count":9,"href":"https:\/\/handyvandal.com\/wphv\/wp-json\/wp\/v2\/posts\/1916\/revisions"}],"predecessor-version":[{"id":1925,"href":"https:\/\/handyvandal.com\/wphv\/wp-json\/wp\/v2\/posts\/1916\/revisions\/1925"}],"wp:attachment":[{"href":"https:\/\/handyvandal.com\/wphv\/wp-json\/wp\/v2\/media?parent=1916"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/handyvandal.com\/wphv\/wp-json\/wp\/v2\/categories?post=1916"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/handyvandal.com\/wphv\/wp-json\/wp\/v2\/tags?post=1916"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}