<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>TURBU &#187; Dev Humor</title>
	<atom:link href="http://turbu-rpg.com/category/dev-humor/feed" rel="self" type="application/rss+xml" />
	<link>http://turbu-rpg.com</link>
	<description>The Ultimate Rpg BUilder</description>
	<lastBuildDate>Thu, 19 Aug 2010 02:44:23 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Code-fu</title>
		<link>http://turbu-rpg.com/39/code-fu</link>
		<comments>http://turbu-rpg.com/39/code-fu#comments</comments>
		<pubDate>Thu, 27 Mar 2008 05:12:13 +0000</pubDate>
		<dc:creator>Mason Wheeler</dc:creator>
				<category><![CDATA[Dev Humor]]></category>

		<guid isPermaLink="false">http://turbu-rpg.com/?p=39</guid>
		<description><![CDATA[I ran into some trouble testing a map today.  It would crash when I ran one of the events, and the routine that it crashed in was a system routine written in assembly language that did some odd things to memory, such as changing the program&#8217;s Call Stack, which my debugger needs to track the [...]]]></description>
			<content:encoded><![CDATA[<p>I ran into some trouble testing a map today.   It would crash when I ran one of the events, and the routine that it crashed in was a system routine written in assembly language that did some odd things to memory, such as changing the program&#8217;s Call Stack, which my debugger needs to track the problem backwards from the crash to its source.</p>
<p>Very well.   My code-fu is strong.   Wise man say, &#8220;If cannot start from problem and work backwards,  grasshopper, set breakpoint right before problem and work forwards.&#8221;<span id="more-39"></span>  Well, thanks a bunch, wise man, but that&#8217;s kind of a circular definition.   To know where &#8220;right before&#8221; is, I have to know where the problem itself is, which is what I&#8217;m trying to find out.   And the fact that it&#8217;s in a script only makes things worse&#8211;the script engine does all sorts of strange things.   So I look at the original event script in RM2K and watch what&#8217;s going on on screen, to see what steps I know have actually executed.   Then I notice something very strange in the event:</p>
<p>Move Event: Hero</p>
<p>That&#8217;s odd.   It usually displays the movement data.   I look closer and&#8230; there <em>is</em> no movement data.   Just &#8220;Move Hero&#8221;.   No movement commands.   Oh, and the little &#8220;repeat action&#8221; box is checked.   So not only does the hero do <em>nothing</em>, (as opposed to simply not doing anything, which was what he was doing before,) he continues doing <em>nothing</em> forever&#8230; until about 4 lines later, when &#8220;Move Event: Hero Down&#8221; shows up.</p>
<p>This must be the work of a very cunning ninja, laying a trap for me.   I must proceed carefully.   I set my breakpoint with caution in the routine that handles event movement.   I trace the whole thing very carefully in the debugger, and&#8230;</p>
<p><strong>Access Violation Exception</strong></p>
<p>&#8230;a swift karate chop from a different thread of the program blindsides me.   The error&#8217;s not coming from here, where the data&#8217;s being processed; it&#8217;s coming from the place where the movement command to do <em>nothing</em> is being carried out!</p>
<p>When my head clears and my program resets, I wearily drag myself to my feet and reset my breakpoints.   This glitch&#8217;s skill is great.   But my code-fu is stronger.   I search carefully for the problem, narrow it down to one subroutine&#8230;</p>
<p><strong>Access Violation Exception</strong></p>
<p>&#8230;I stumble to the ground, blinking back tears of pain and shock.   There it was, right behind me!   But when I turn around&#8230; nothing.   The ninja had struck and fled, and I still had no idea what the problem was.</p>
<p>In the end, I never did manage to figure out what was causing the access violation.   There doesn&#8217;t seem to be anything wrong with the data that gets generated; the system&#8217;s just handling it in a very strange way.   But wise man say, &#8220;If cannot track down exact location of glitch, cut off earlier.&#8221;   So I went back into the routine that generates movement commands and had it watch for that particular &#8220;do <em>nothing</em> forever&#8221; ninja.   If it runs into it in the future, it&#8217;ll simply turn off the &#8220;loop forever&#8221; flag, so the character will do <em>nothing</em> once, and then go back to&#8230; well&#8230; not doing anything, like he was doing before.</p>
]]></content:encoded>
			<wfw:commentRss>http://turbu-rpg.com/39/code-fu/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Potion of Death!</title>
		<link>http://turbu-rpg.com/8/potion-of-death</link>
		<comments>http://turbu-rpg.com/8/potion-of-death#comments</comments>
		<pubDate>Mon, 12 Nov 2007 23:45:27 +0000</pubDate>
		<dc:creator>Mason Wheeler</dc:creator>
				<category><![CDATA[Dev Humor]]></category>

		<guid isPermaLink="false">http://turbu-rpg.com/devblog/?p=8</guid>
		<description><![CDATA[It&#8217;s funny how bugs can interact with each other in unexpected ways. Case in point: The Potion of Death I accidentally created last night as I was coding item usage in the menu system. The RPG Maker item data structure has a list of flags representing which conditions the item cures. But since most items [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s funny how bugs can interact with each other in unexpected ways.  Case in point:  The Potion of Death I accidentally created last night as I was coding item usage in the menu system.</p>
<p>The RPG Maker item data structure has a list of flags representing which conditions the item cures.  But since most items don&#8217;t cure any condition, the program saves space in the file by simply skipping the entire list if the whole thing&#8217;s set to <strong>false</strong>.  In my code to read the data structure, I accidentally had it set the entire set to <strong>true</strong> if the list was missing from the file.  So an ordinary item, such as a potion, suddenly becomes a cure-all item.</p>
<p>But it gets worse.  Characters can be afflicted with various conditions, as defined by the game writer, and one condition that&#8217;s hard-coded into the system: &#8220;dead&#8221;.  If a character&#8217;s dead, it changes a bunch of the code for his behavior.  (For example, he can&#8217;t be healed while dead.)  In the code to set a character&#8217;s condition, I had a check for whether the condition being set was condition #1 (dead), and if it was, to set a couple other things in the hero&#8217;s data structure relating to being dead.  Unfortunately, this check didn&#8217;t look to see whether the &#8220;dead&#8221; condition was being turned on or off.</p>
<p>You can probably see where this is going.  I tested out a potion on a hero, and&#8230; he died?!? That confused the heck out of me, of course.  Turns out the potion (with the &#8220;cure condition&#8221; attributes set to all <strong>true</strong>) had tried to cure the hero of being &#8220;dead&#8221;&#8211;for technical reasons, it&#8217;s more efficient to simply set the condition to <strong>false</strong> than to check whether it&#8217;s set and then only set it if it&#8217;s already <strong>true</strong>&#8211;and this set off the special code.  So instead of getting healed by 50 HP, the hero died.  Huzzah for Potions of Death!</p>
]]></content:encoded>
			<wfw:commentRss>http://turbu-rpg.com/8/potion-of-death/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
