{"id":1506,"date":"2011-10-26T16:40:10","date_gmt":"2011-10-26T15:40:10","guid":{"rendered":"http:\/\/positech.co.uk\/cliffsblog\/?p=1506"},"modified":"2011-10-26T13:44:47","modified_gmt":"2011-10-26T12:44:47","slug":"knowing-what-your-code-does","status":"publish","type":"post","link":"https:\/\/www.positech.co.uk\/cliffsblog\/2011\/10\/26\/knowing-what-your-code-does\/","title":{"rendered":"Knowing what your code does"},"content":{"rendered":"<p>Do you know how your game works? I bet you *think* you do. And if you do, there are never surprises when you suddenly take a look at a frame of it being rendered. Invariably, mistakes mean stuff works differently to how you intended it to.<\/p>\n<p>I use AQTime, which is pricey as hell, but fantastic, as a profiler. You can control it from code too, so I can pause my game mid-battle, hit &#8216;F&#8217; to go one frame-advance, and that frame is profiled by aqtime. It then will dump tons of stats, telling we call times and counts for every function (or even line)\u00a0 and let me see this:<\/p>\n<p><a href=\"http:\/\/positech.co.uk\/cliffsblog\/wp-content\/uploads\/2011\/10\/aqtime.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1507\" title=\"aqtime\" src=\"http:\/\/positech.co.uk\/cliffsblog\/wp-content\/uploads\/2011\/10\/aqtime.jpg\" alt=\"\" width=\"600\" height=\"264\" srcset=\"https:\/\/www.positech.co.uk\/cliffsblog\/wp-content\/uploads\/2011\/10\/aqtime.jpg 600w, https:\/\/www.positech.co.uk\/cliffsblog\/wp-content\/uploads\/2011\/10\/aqtime-300x132.jpg 300w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/a><\/p>\n<p>This chart immediately tells me that some lightmapbuffer sprite code was being run. It should be skipped in daylight levels, so clearly I have a bug. And that&#8217;s before I even begin to look at performance optimisations in this frame.<\/p>\n<p>If you write big complex stuff and don&#8217;t have a professional quality profiler, you need one. They are absolutely fantastic.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Do you know how your game works? I bet you *think* you do. And if you do, there are never surprises when you suddenly take a look at a frame of it being rendered. Invariably, mistakes mean stuff works differently to how you intended it to. I use AQTime, which is pricey as hell, but<\/p>\n<p class=\"text-right\"><span class=\"screen-reader-text\">Continue Reading&#8230; Knowing what your code does<\/span><a class=\"btn btn-secondary continue-reading\" href=\"https:\/\/www.positech.co.uk\/cliffsblog\/2011\/10\/26\/knowing-what-your-code-does\/\">Continue Reading&#8230;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-1506","post","type-post","status-publish","format-standard","hentry","category-programming"],"_links":{"self":[{"href":"https:\/\/www.positech.co.uk\/cliffsblog\/wp-json\/wp\/v2\/posts\/1506","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.positech.co.uk\/cliffsblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.positech.co.uk\/cliffsblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.positech.co.uk\/cliffsblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.positech.co.uk\/cliffsblog\/wp-json\/wp\/v2\/comments?post=1506"}],"version-history":[{"count":1,"href":"https:\/\/www.positech.co.uk\/cliffsblog\/wp-json\/wp\/v2\/posts\/1506\/revisions"}],"predecessor-version":[{"id":1508,"href":"https:\/\/www.positech.co.uk\/cliffsblog\/wp-json\/wp\/v2\/posts\/1506\/revisions\/1508"}],"wp:attachment":[{"href":"https:\/\/www.positech.co.uk\/cliffsblog\/wp-json\/wp\/v2\/media?parent=1506"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.positech.co.uk\/cliffsblog\/wp-json\/wp\/v2\/categories?post=1506"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.positech.co.uk\/cliffsblog\/wp-json\/wp\/v2\/tags?post=1506"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}