<?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/"
	xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>WatchHogStories</title>
	<atom:link href="http://watchhogstories.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://watchhogstories.wordpress.com</link>
	<description>Just another WordPress.com weblog</description>
	<lastBuildDate>Mon, 22 Jun 2009 06:22:44 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language></language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='watchhogstories.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/8f97437891c9d24b09c6f00fb8312f69?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>WatchHogStories</title>
		<link>http://watchhogstories.wordpress.com</link>
	</image>
			<item>
		<title>The Prodigal Son Returns..</title>
		<link>http://watchhogstories.wordpress.com/2009/06/22/the-prodigal-son-returns/</link>
		<comments>http://watchhogstories.wordpress.com/2009/06/22/the-prodigal-son-returns/#comments</comments>
		<pubDate>Mon, 22 Jun 2009 06:18:31 +0000</pubDate>
		<dc:creator>oladotunr</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://watchhogstories.wordpress.com/?p=25</guid>
		<description><![CDATA[After a  looooong break I feel it&#8217;s time to drop back into blogging. Expecially since I&#8217;ve been getting a fair amount of unexpected traffic of late (I didn&#8217;t think anyone actually read this blog! thanks guys!!).
The days have been pretty busy of late having been moved into the core engine team at my current studio [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=watchhogstories.wordpress.com&blog=1107197&post=25&subd=watchhogstories&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>After a  looooong break I feel it&#8217;s time to drop back into blogging. Expecially since I&#8217;ve been getting a fair amount of unexpected traffic of late (I didn&#8217;t think anyone actually read this blog! thanks guys!!).</p>
<p>The days have been pretty busy of late having been moved into the core engine team at my current studio and spending a vast amount of time learning what it takes to make a next-gen multi-platform engine tick and writing everything from particle editors to flash native rendering systems and more.</p>
<p>It is however time to get back into imparting some of the things i&#8217;ve learned &amp; so stay tuned for some more (hopefully) useful tutorials soon..</p>
<p>- The Hog</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/watchhogstories.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/watchhogstories.wordpress.com/25/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/watchhogstories.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/watchhogstories.wordpress.com/25/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/watchhogstories.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/watchhogstories.wordpress.com/25/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/watchhogstories.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/watchhogstories.wordpress.com/25/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/watchhogstories.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/watchhogstories.wordpress.com/25/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=watchhogstories.wordpress.com&blog=1107197&post=25&subd=watchhogstories&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://watchhogstories.wordpress.com/2009/06/22/the-prodigal-son-returns/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/686657622caaa72fefb56a76bf938ac5?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">oladotunr</media:title>
		</media:content>
	</item>
		<item>
		<title>Coding Practices &#8211; The Modulus Operator..</title>
		<link>http://watchhogstories.wordpress.com/2008/08/11/coding-practices-the-modulus-operator/</link>
		<comments>http://watchhogstories.wordpress.com/2008/08/11/coding-practices-the-modulus-operator/#comments</comments>
		<pubDate>Mon, 11 Aug 2008 12:02:08 +0000</pubDate>
		<dc:creator>oladotunr</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://watchhogstories.wordpress.com/?p=19</guid>
		<description><![CDATA[During my travels of programming video games for a living, I take great pleasure in the fulfillment of learning, exploring &#38; experimenting with algorithms &#38; the intricacies of programming languages everyday. Being a gamplay programmer I tend to find that I make regular use of the modulus operator &#38; it seems to be one of [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=watchhogstories.wordpress.com&blog=1107197&post=19&subd=watchhogstories&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>During my travels of programming video games for a living, I take great pleasure in the fulfillment of learning, exploring &amp; experimenting with algorithms &amp; the intricacies of programming languages everyday. Being a gamplay programmer I tend to find that I make regular use of the modulus operator &amp; it seems to be one of those little tools that most people seem to overlook but can be really useful for a variety of problems. So I thought it might be a good idea to write a little article about my experiences with lil&#8217; old &#8216;%&#8217; &amp; hopefully it maybe able to encourage others share good practical uses for it too &amp; hopefully teach me a thing or two.</p>
<p>Before we begin I&#8217;d just like to make a note that I&#8217;m going to be using C# for all my examples considering this blog are generally c#/XNA-centric (however i&#8217;m pretty sure the same functions for the modulus operator can be applied in C/C++ &amp; most other languages)..</p>
<p><span id="more-19"></span></p>
<p><strong>So What Is The Ol&#8217; Mod..?</strong></p>
<p>The Modulus operator (sometimes termed &#8216;<a href="http://en.wikipedia.org/wiki/Modulo_operation">Modulo</a>&#8216; in computing fields) defines an operation which returns the remainder of a division of one number by another. So for example if we take the any dividend &#8216;a&#8217;, &amp; a divisor &#8216;n&#8217; then we can define a % n (a <em>modulo </em>n) as the remainder.</p>
<p>So if we have 7 % 3 then we look at it as an integer division of only the proportion of the numbers which can evaluate to a whole number. In this case we see that 7 / 3 doesn&#8217;t equal a whole number (equals 2.333) however 6/3 does (leaving no remainder) so to find the modulus of this expression we can treat 7 / 3 as 6/3 + remainder which tells us that the remainder is 1. Here&#8217;s a few more examples just to help you get your head around the idea:-</p>
<p>8 % 4 = 0<br />
12 % 16 = 12</p>
<p>So a few rules to bear in mind which will help you use the operator in practice:-</p>
<ol>
<li>if a / n equals a whole number then a % n  always equals 0</li>
<li>if a is less than n then a % n always equals a</li>
<li>if a is greater than n then a % n always equals a value between 1 and n-1</li>
</ol>
<p>As we can see these three simple rules help put things into perspective &amp; should now hopefully give us a really sound idea of some of the ways we can use the operator in practice.</p>
<p><strong>Let&#8217;s Get To The Main Course Already..!</strong></p>
<p>OK so now we&#8217;re ready to begin looking at some of the ways we can use the modulus operator &amp; it&#8217;s unique properties for something useful. Here&#8217;s what I have so far:-</p>
<p><strong>Wrap-Around &amp; Looping Number Iteration</strong></p>
<p>Sometimes in our travels we may need to iterate through an array in such a way that we can use an incremental index value that can be reset once it goes beyond the bounds of the array. Modulus is really useful for doing these tasks as, looking at rules 1, 2 &amp; 3, we can see that it&#8217;s zero-based in nature &amp; perfectly suited to this kind of &#8216;wrap-around&#8217; processing. So where we would have once had something like this</p>
<blockquote><p>// increment index &amp; return the item in the array<br />
i++;<br />
if (i &gt;= maxNumValues) i = 0;<br />
return foo[i];</p></blockquote>
<p>We can now substitute it for something like this</p>
<blockquote><p>// increment index &amp; return the item in the array<br />
return foo[ (i++)  %  maxNumValues ];</p></blockquote>
<p>Not a massive change but at least we&#8217;ve saved ourselves a few extra lines of code &amp; removed the branch statement.</p>
<p><strong>2D Coordinate Indexing</strong></p>
<p>On several occasions i&#8217;ve found that I needed to index data in a 2D grid format. Whether it be indexing tiles on a spritesheet or onscreen items in a grid there&#8217;s generally a tendencies to define the data in a &#8216;flattened&#8217; array format &amp; make the grid-like behaviour implicit in it&#8217;s use. So say we have a sprite sheet containing a grid of tiled sprites of size d x d pixels and arranged in a grid of 4 x 4 tiles. if we treat the tiles as a 1D array of data then we can index each value from left-to-right, going from top-to-bottom starting at 0 and ending at 15 (4 x 4 -1 since it&#8217;s zero-based). in this case if we wanted to get the coordinates of a tile as say index = 9 we could do the following</p>
<ul>
<li>count up the indices from 0 to 9 &amp; in each step:-</li>
<li> add 1 to x &amp; if x is greater than the number of tiles in a row then remove the number of tiles in a row from x &amp; add one to y</li>
<li>multiply x by the tileWidth &amp; y by the tileHeight &amp; return the two values</li>
</ul>
<p>This will work if you use a while loop and branch statements but it will end up taking up several lines of code &amp; could end up being overly complex. However if we use the modulus operator we can do it much quicker/cleaner</p>
<blockquote><p>x = index % numTilesRow;<br />
y = ( index &#8211; x ) / numTilesRow;<br />
return new TileDims( x * tileW, y * tileH );</p></blockquote>
<p>I added the struct TileDims just for illustration purposes but beyond that it&#8217;s a pretty neat &amp; cheap solution. Also we can reverse this &amp; retrieve the index from the coordinate values in a simple fashion</p>
<blockquote><p>// return the index for x &amp; y<br />
return x + ( numTilesRow * y );</p></blockquote>
<p><strong>Detemining Odd or Even Numbers</strong></p>
<p>We can use % to determine whether a number is odd or even by examining exactly what it is we mean by &#8216;odd&#8217; &amp; by &#8216;even&#8217; first. by definition an odd number is any number that cannot divide into 2 (i.e. odd / 2 != wholeNum). With this in mind we can do a simple check for this</p>
<blockquote><p>// odd number check<br />
if ( num % 2 != 0)<br />
// odd number..<br />
else<br />
// even number..</p></blockquote>
<p>Simple to use but it can save alot of time trying to determine whether this is true using a brute force, iterative approach.<br />
<strong>How Many 10s, 100s etc In A Decimal Value</strong></p>
<p>Sometimes we may need to figure out how many 10s are in a number for example, which can be especially useful of you need to separate the digits of a number for rendering on multiple quads. Again the implementation is pretty simple</p>
<blockquote><p>// find the number of 10s &amp; 100s in num<br />
tens = ( num &#8211; (num % 10) ) / 10;<br />
hundrds = ( num &#8211; (num % 100) ) / 100;</p></blockquote>
<p>So that&#8217;s it from me!</p>
<p>Please feel free to drop any comments you have &amp; also I&#8217;d love to hear about any other neat little % tricks you&#8217;ve discovered during your own coding travels..!<br />
- The Hog</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/watchhogstories.wordpress.com/19/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/watchhogstories.wordpress.com/19/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/watchhogstories.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/watchhogstories.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/watchhogstories.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/watchhogstories.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/watchhogstories.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/watchhogstories.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/watchhogstories.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/watchhogstories.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/watchhogstories.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/watchhogstories.wordpress.com/19/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=watchhogstories.wordpress.com&blog=1107197&post=19&subd=watchhogstories&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://watchhogstories.wordpress.com/2008/08/11/coding-practices-the-modulus-operator/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/686657622caaa72fefb56a76bf938ac5?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">oladotunr</media:title>
		</media:content>
	</item>
		<item>
		<title>Moving On..</title>
		<link>http://watchhogstories.wordpress.com/2008/07/28/moving-on/</link>
		<comments>http://watchhogstories.wordpress.com/2008/07/28/moving-on/#comments</comments>
		<pubDate>Mon, 28 Jul 2008 15:51:32 +0000</pubDate>
		<dc:creator>oladotunr</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[menu system]]></category>
		<category><![CDATA[smc]]></category>
		<category><![CDATA[solace]]></category>

		<guid isPermaLink="false">http://watchhogstories.wordpress.com/?p=12</guid>
		<description><![CDATA[Life is good..
Well ok I guess it isn&#8217;t all the time but no matter how bad things might get, you always get those instances (however brief) that things start looking up to the point where you start to wonder &#8220;Hmmm.. Many things might turn out OK after all..&#8221;
Take these past few months for instance,
I&#8217;ve been [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=watchhogstories.wordpress.com&blog=1107197&post=12&subd=watchhogstories&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Life is good..</p>
<p>Well ok I guess it isn&#8217;t all the time but no matter how bad things might get, you always get those instances (however brief) that things start looking up to the point where you start to wonder &#8220;Hmmm.. Many things might turn out OK after all..&#8221;</p>
<p>Take these past few months for instance,<br />
I&#8217;ve been busy as a beaver organizing my wedding, knocking out PSP code for the current project at work &amp; more importantly doing quite a bit of XNA development.<br />
So it came as icing on the cake when MS recently announced their plans to monetize their Community Games platform launching this holiday. I&#8217;d always dreamed of shipping a nice little polished game for people the world over to enjoy &amp; now it seems that not only can a little dedication &amp; hard work secure my dreams coming true, but they may also net me a bit of pocket money in the process..</p>
<p>In such an exciting time it only helped both motivate and accelerate my drive to get the two XNA projects i&#8217;m working on out the door. Also I figure now would be as good a time as any to post a little progress on one of them:-</p>
<div id="attachment_13" class="wp-caption aligncenter" style="width: 428px"><a href="http://watchhogstories.files.wordpress.com/2008/07/menu_screen.jpg"><img class="size-full wp-image-13" src="http://watchhogstories.files.wordpress.com/2008/07/menu_screen.jpg?w=418&#038;h=244" alt="solace engine menu test" width="418" height="244" /></a><p class="wp-caption-text">solace engine menu test</p></div>
<p>It&#8217;s a test render of the early menu system for the game. The design is essentially a dial mechanism (apologies for the not-so-l337-programmer-art..) that rotates persistently &amp; all the menu options are procedurally distributed as label links around the screen. So far it&#8217;s fully functional (complete with transitions &amp; floaty, turny dynamics..) &amp; adding new menu screens are as easy as creating a new menu overlay object &amp; adding strings for each menu element.</p>
<p>On the other side of the development field..</p>
<p>After a bit of a long break, me &amp; rich have been working rigorously to get SMC into a state where it&#8217;s playable &amp; it&#8217;s really coming along now. We&#8217;ll be posted some new updates on <a href="http://houseofsmash.blogspot.com">houseofsmash</a> soon so don&#8217;t forget to look out for updates in the coming days/weeks..</p>
<p>P.S.</p>
<p>After developing the current engine (which I&#8217;m using on both my current projects) for over a year now it&#8217;s really been an interested ride for me that&#8217;s helped me to learn alot. I&#8217;m looking forward to taking the platform from strength to strength as development progresses &amp; I have alot of plans for what I would like to do with it even after I complete (or bust) the two current projects..</p>
<p>Stay tuned for more soon!</p>
<p>- The Hog</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/watchhogstories.wordpress.com/12/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/watchhogstories.wordpress.com/12/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/watchhogstories.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/watchhogstories.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/watchhogstories.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/watchhogstories.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/watchhogstories.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/watchhogstories.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/watchhogstories.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/watchhogstories.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/watchhogstories.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/watchhogstories.wordpress.com/12/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=watchhogstories.wordpress.com&blog=1107197&post=12&subd=watchhogstories&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://watchhogstories.wordpress.com/2008/07/28/moving-on/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/686657622caaa72fefb56a76bf938ac5?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">oladotunr</media:title>
		</media:content>

		<media:content url="http://watchhogstories.files.wordpress.com/2008/07/menu_screen.jpg" medium="image">
			<media:title type="html">solace engine menu test</media:title>
		</media:content>
	</item>
		<item>
		<title>Im Back&#8230;</title>
		<link>http://watchhogstories.wordpress.com/2008/06/13/im-back/</link>
		<comments>http://watchhogstories.wordpress.com/2008/06/13/im-back/#comments</comments>
		<pubDate>Fri, 13 Jun 2008 14:40:33 +0000</pubDate>
		<dc:creator>oladotunr</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://watchhogstories.wordpress.com/?p=11</guid>
		<description><![CDATA[Well it&#8217;s been a while since my last post&#8230; I&#8217;ve been pretty busy since getting on with life, preparing to get married &#38; also laying the foundations for my major XNA project. SMC is still around &#38; I keep jumping back to it where I can but beyond that I&#8217;ve been fleshing out the editor [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=watchhogstories.wordpress.com&blog=1107197&post=11&subd=watchhogstories&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Well it&#8217;s been a while since my last post&#8230; I&#8217;ve been pretty busy since getting on with life, preparing to get married &amp; also laying the foundations for my major XNA project. SMC is still around &amp; I keep jumping back to it where I can but beyond that I&#8217;ve been fleshing out the editor for my other project; Encrypt..</p>
<p>So far I&#8217;ve got the character edit suite fully fleshed out &amp; operational with only some minor tweaks needed going forward.. I&#8217;m currently working on the animation systems which I hope to share between the editor &amp; the game &amp; so hopefully once thats in &amp; setup i&#8217;ll be able to slap up a couple of test animations &amp; a character for when I start working on the game itself.. I&#8217;ll be looking to post some media soon so watch this space for more info.</p>
<p>Cheers!</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/watchhogstories.wordpress.com/11/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/watchhogstories.wordpress.com/11/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/watchhogstories.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/watchhogstories.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/watchhogstories.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/watchhogstories.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/watchhogstories.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/watchhogstories.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/watchhogstories.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/watchhogstories.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/watchhogstories.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/watchhogstories.wordpress.com/11/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=watchhogstories.wordpress.com&blog=1107197&post=11&subd=watchhogstories&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://watchhogstories.wordpress.com/2008/06/13/im-back/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/686657622caaa72fefb56a76bf938ac5?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">oladotunr</media:title>
		</media:content>
	</item>
		<item>
		<title>New Developments&#8230;</title>
		<link>http://watchhogstories.wordpress.com/2007/10/29/new-developments/</link>
		<comments>http://watchhogstories.wordpress.com/2007/10/29/new-developments/#comments</comments>
		<pubDate>Mon, 29 Oct 2007 20:16:04 +0000</pubDate>
		<dc:creator>oladotunr</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://watchhogstories.wordpress.com/2007/10/29/new-developments/</guid>
		<description><![CDATA[Well life&#8217;s been kinda crazy since I moved down to london to start my new job down here.. I&#8217;ve kinda fallen a little behind on myXNA work in favour of catching up with real life. Apart from getting engaged, moving in with my twin bro, completing a multitude of Xbox360 titles (including Halo3) &#38; developing [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=watchhogstories.wordpress.com&blog=1107197&post=10&subd=watchhogstories&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Well life&#8217;s been kinda crazy since I moved down to london to start my new job down here.. I&#8217;ve kinda fallen a little behind on myXNA work in favour of catching up with real life. Apart from getting engaged, moving in with my twin bro, completing a multitude of Xbox360 titles (including Halo3) &amp; developing a complete viseme generation pipeline &amp; lip sync animation framework for our PSP title at work, I&#8217;ve been keeping myself busy trying to catch up on lost time with SMC as well as working on a little something else&#8230;:</p>
<p><img src="http://img.photobucket.com/albums/v687/ArchangelMorph/Orbit.jpg" alt="Orbit" align="middle" border="1" height="236" hspace="0" vspace="0" width="422" /></p>
<p>Orbit is a 2D puzzle game I started working on one day when I was bored at work.. It really speaks something regarding the productivity of XNA as a development platform considering I got as far as this with only a few days of development time.. Then again I did have the benefit of using the engine i&#8217;ve been working on for SMC for the past several months and so I guess it did kind of make life alot easier. I guess it also says something about the flexibility of my little engine there too! The game is fairly simple so far &amp; most of the basic functionality is there. The graphics are currently placeholder (since some of them were ripped from the inet&#8230;) &amp; i&#8217;m sure as soon as I can find an artist I can redo them <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<p>Anyways now I finally gotaround to having the internet setup at home i&#8217;ll be getting back into SMC in full swing and then maybe if I get some free time I can finish off orbit too..</p>
<p>Until then!</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/watchhogstories.wordpress.com/10/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/watchhogstories.wordpress.com/10/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/watchhogstories.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/watchhogstories.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/watchhogstories.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/watchhogstories.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/watchhogstories.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/watchhogstories.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/watchhogstories.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/watchhogstories.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/watchhogstories.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/watchhogstories.wordpress.com/10/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=watchhogstories.wordpress.com&blog=1107197&post=10&subd=watchhogstories&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://watchhogstories.wordpress.com/2007/10/29/new-developments/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/686657622caaa72fefb56a76bf938ac5?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">oladotunr</media:title>
		</media:content>

		<media:content url="http://img.photobucket.com/albums/v687/ArchangelMorph/Orbit.jpg" medium="image">
			<media:title type="html">Orbit</media:title>
		</media:content>
	</item>
		<item>
		<title>Been a while..</title>
		<link>http://watchhogstories.wordpress.com/2007/10/01/been-a-while/</link>
		<comments>http://watchhogstories.wordpress.com/2007/10/01/been-a-while/#comments</comments>
		<pubDate>Mon, 01 Oct 2007 13:13:10 +0000</pubDate>
		<dc:creator>oladotunr</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://watchhogstories.wordpress.com/2007/10/01/been-a-while/</guid>
		<description><![CDATA[Well it&#8217;s been a while since I last updated my blog. For the past few months i&#8217;ve been settling into my new role in my new london based company. So far things have been really great both in terms of socially integrating into the community of the company (really important in terms of encouraging a [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=watchhogstories.wordpress.com&blog=1107197&post=9&subd=watchhogstories&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Well it&#8217;s been a while since I last updated my blog. For the past few months i&#8217;ve been settling into my new role in my new london based company. So far things have been really great both in terms of socially integrating into the community of the company (really important in terms of encouraging a strong work ethic) and as well as developing my knowledge base and skills as a games programmer. It&#8217;s strange because i&#8217;m the only junior coder in the entire company which is a little daunting sometimes when your surrounded with a whole wealth of knowledge and experience but I&#8217;ve been keeping myself open to learning new things and have tried to be as careful as I can be when writing critical code in terms of making sure it&#8217;s stylistically consistent with the rest of the guy&#8217;s work whilst adding my own little flavour to keep my stuff readable, well structured and maintainable.</p>
<p><span id="more-9"></span></p>
<p>So far i&#8217;ve been working on a PSP project which is great being my first forray into the handheld hardware space which does throw up alot of considerations you can just ignore on the PC. It&#8217;s suprising how close the hardware is to the ps2 (with some interesting differences) and I&#8217;ve had a whale of a time getting my head around vFPU programming; vectorizing and laying out my accelerated math libs with major considerations towards data access/storage across the vector registers. It was a little disheartening though to find out that after spending several weeks writing and testing my vFPU math libs (which ran like lightning in my remote tests when compared to running the FPU equivalents..), they not only didn&#8217;t provide much savings with respect to overall, real-world performance (when used with our animation system in particular) but in some cases actually ran slower due to excessive stalls during load/store ops to and from the vFPU registers. I suspect that using an intrinsic-based library would have worked much better but in the end the quickest fix came from graphics-side optimisations our lead did in the engine and thus, we ended up shelving my vFPU code and moving onto other things.</p>
<p>Ah well such is the nature of the job I suppose!</p>
<p>That&#8217;s about it for now anyways. I&#8217;ll try and get back soon to drop some more goings on in between writing lip syncing (viseme generation) tools, working on SMC (my xna game) and Orbit (a small xna puzzle game I started on at work..) &amp; playing Halo 3 (at home)..</p>
<p>Until then..</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/watchhogstories.wordpress.com/9/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/watchhogstories.wordpress.com/9/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/watchhogstories.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/watchhogstories.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/watchhogstories.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/watchhogstories.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/watchhogstories.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/watchhogstories.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/watchhogstories.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/watchhogstories.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/watchhogstories.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/watchhogstories.wordpress.com/9/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=watchhogstories.wordpress.com&blog=1107197&post=9&subd=watchhogstories&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://watchhogstories.wordpress.com/2007/10/01/been-a-while/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/686657622caaa72fefb56a76bf938ac5?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">oladotunr</media:title>
		</media:content>
	</item>
		<item>
		<title>A new chapter&#8230;</title>
		<link>http://watchhogstories.wordpress.com/2007/07/25/a-new-chapter/</link>
		<comments>http://watchhogstories.wordpress.com/2007/07/25/a-new-chapter/#comments</comments>
		<pubDate>Wed, 25 Jul 2007 12:59:51 +0000</pubDate>
		<dc:creator>oladotunr</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://watchhogstories.wordpress.com/2007/07/25/a-new-chapter/</guid>
		<description><![CDATA[Well i&#8217;m fast coming up to my last week at my current employer Zoe Mode (Kuju). Things have gone really well over the past 7 months and I&#8217;ve really gained alot of invaluable knowledge and experience relating to the process of video games development and what it means to code at a professional level. It&#8217;s [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=watchhogstories.wordpress.com&blog=1107197&post=8&subd=watchhogstories&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Well i&#8217;m fast coming up to my last week at my current employer Zoe Mode (Kuju). Things have gone really well over the past 7 months and I&#8217;ve really gained alot of invaluable knowledge and experience relating to the process of video games development and what it means to code at a professional level. It&#8217;s been alot of hard work but i&#8217;ve enjoyed every minute of it..</p>
<p>Hopefully with a move to london on the way and a new position at a new studio (on a new platform) things can only get better and i&#8217;m looking forward to seeing how things pan out from here!</p>
<p> <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/watchhogstories.wordpress.com/8/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/watchhogstories.wordpress.com/8/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/watchhogstories.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/watchhogstories.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/watchhogstories.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/watchhogstories.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/watchhogstories.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/watchhogstories.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/watchhogstories.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/watchhogstories.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/watchhogstories.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/watchhogstories.wordpress.com/8/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=watchhogstories.wordpress.com&blog=1107197&post=8&subd=watchhogstories&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://watchhogstories.wordpress.com/2007/07/25/a-new-chapter/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/686657622caaa72fefb56a76bf938ac5?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">oladotunr</media:title>
		</media:content>
	</item>
		<item>
		<title>New Blog!!</title>
		<link>http://watchhogstories.wordpress.com/2007/06/27/new-blog/</link>
		<comments>http://watchhogstories.wordpress.com/2007/06/27/new-blog/#comments</comments>
		<pubDate>Wed, 27 Jun 2007 18:39:37 +0000</pubDate>
		<dc:creator>oladotunr</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://watchhogstories.wordpress.com/2007/06/27/new-blog/</guid>
		<description><![CDATA[Finally setup a new blog for the XNA game i&#8217;m working on! The game is called smash crew and has been in development for a few months now. We still have a long way to go though and for those who are interested you can find out more about it here
Anyways i&#8217;ll be posting any [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=watchhogstories.wordpress.com&blog=1107197&post=6&subd=watchhogstories&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Finally setup a new blog for the XNA game i&#8217;m working on! The game is called smash crew and has been in development for a few months now. We still have a long way to go though and for those who are interested you can find out more about it <a href="http://houseofsmash.blogspot.com">here</a></p>
<p>Anyways i&#8217;ll be posting any info regarding the game on the blog so stay tuned for more info..!</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/watchhogstories.wordpress.com/6/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/watchhogstories.wordpress.com/6/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/watchhogstories.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/watchhogstories.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/watchhogstories.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/watchhogstories.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/watchhogstories.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/watchhogstories.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/watchhogstories.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/watchhogstories.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/watchhogstories.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/watchhogstories.wordpress.com/6/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=watchhogstories.wordpress.com&blog=1107197&post=6&subd=watchhogstories&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://watchhogstories.wordpress.com/2007/06/27/new-blog/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/686657622caaa72fefb56a76bf938ac5?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">oladotunr</media:title>
		</media:content>
	</item>
		<item>
		<title>Game Design Thoughts: Building emotional engagement</title>
		<link>http://watchhogstories.wordpress.com/2007/05/31/game-design-thoughts-building-emotional-engagement/</link>
		<comments>http://watchhogstories.wordpress.com/2007/05/31/game-design-thoughts-building-emotional-engagement/#comments</comments>
		<pubDate>Thu, 31 May 2007 17:04:39 +0000</pubDate>
		<dc:creator>oladotunr</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://watchhogstories.wordpress.com/2007/05/31/game-design-thoughts-building-emotional-engagement/</guid>
		<description><![CDATA[Decided to drop by again, since i&#8217;ve been a little out of touch with watchhogging as of late, and voice a few pontifications surrounding an area of game design that i&#8217;ve been thinking about for a while now..
Since the I watched my first movie I realised something. As a human being it&#8217;s pretty easy to [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=watchhogstories.wordpress.com&blog=1107197&post=5&subd=watchhogstories&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Decided to drop by again, since i&#8217;ve been a little out of touch with watchhogging as of late, and voice a few pontifications surrounding an area of game design that i&#8217;ve been thinking about for a while now..</p>
<p>Since the I watched my first movie I realised something. As a human being it&#8217;s pretty easy to enjoy and be immersed in some form of media when it engages you emotionally. From reading a love story novel, to watching a hollywood flick it&#8217;s clear that the &#8220;human element&#8221; of being able to connect with the individuals who make up the centre of the plot really help to draw the reader/user in and (for the most enthusiastic) provoke thought and sometimes even emotional responses surrounding the experience, decisions and actions the fictional characters face.<br />
So it seemed pretty strange to me that the vast majority of video games over the years seem to fail, all to well in fact, to captivate its audience in the same way with very human, believable experiences that enable that user connection..</p>
<p><span id="more-5"></span> The reasons for why this is the case are probably vast and varied and for themost part seem to stem from the developer&#8217;s motivations towards the theme and plot of the game or to a rather grave misconception that hardware limitations prevent in-game characters from representing enough &#8220;realism&#8221; to present sufficient &#8220;expression for emotion&#8221; (i&#8217;ll talk a little bit more about this later..)<br />
Now for the sake of arguement lets look at the first reason&#8230;</p>
<p>It seems pretty obvious that many games developers see their games as a form of escapism over anything else. A place where users can jump in and free themselves from the worries and stresses of everyday life and enjoy the experience of exploring a world defined by abstract rules which defy many of the constraints of the real world and take part in various compelling and involving activities (gameplay). As a result many games are developed with a kind of &#8220;desolation factor&#8221; when it comes to the human element. Most of the games people play have no more than a handful of significant characters present throughout the experience (with other NPCs being either cannon fodder, a la FPSs, or mute, stupid bots with little to no means of providing anything that could be considered human expression). I can think over probably over a hundred titles where the protagonist is just about the only &#8220;human&#8221; character present in the game at all and its that kind of experience which really ruins any chance of truely giving the player the opportunity to become emotionally engaged with the experience.</p>
<p>Now relating the the subject of the technical aspect, it&#8217;s pretty clear that it&#8217;s hard to create NPCs in a game world who dynamically behave in a human-like fashion. Its the computational load factors which prevent games from giving the characters in the world &#8220;true AI&#8221; I agree. I do worry however that human expression in game characters fails more because of the design than the lack of processing capability. I say this because anyone who has ever played Super Robot Taisen on the GBA (the first or the second one) will realise that true human reflection requires a greater emphasis on personality over anything else. The game itself sets the player as a Super Robot Pilot aboard a battleship in a war against an army of aliens out to takeover/destroy the world. The thing that really struck me about this game however was the dialogue elements which, in practise only acts as a form of intermission between the turn based battles/missions but is also used to drive the plot of the game forward. Throughout most of the dialogues you spend listening to conversations about characters talking about their favourite TV programs, their hobbies and interests and various other abstract bits and bobs that don&#8217;t do anything for the plot, but work really well to flesh out the characters and personalities of each one. Admittedly reading a load of text broken up only by consistently pressing the &#8220;ok&#8221; button didn&#8217;t make particularly great gameplay but it did do one thing really well. That was to really enable the player to connect to the characters in a very deep and engaging way, so much that you actually begin to care about them during play. When one of your team defects you feel a sense of loss for example and it really draws you into the experience which, on the surface doesn&#8217;t even seem possible through a story told by characters represented by static drawings with scrolling text dialogues. So if SRT can do this then why do we have so many games which attempt to emphasize narrative and end up providing only hollow, uninspring and cliche characters who, when given a gun within the game, you wouldn&#8217;t think twice about blowing them away?</p>
<p>Overall this subject made me wonder&#8230; What if a game could put you in a position where you could adaquately develop a true sense of involvement with the world. By providing a protagonist that is as human as you or I? By creating gameplay situations out of the very life experiences this character would face in the world and never removing the player from his seat at the control of this character. What if the world would react not only to the character and his actions but even moreso to itself, with NPCs able to interact with each other, carrying out important tasks and influencing the plot in deeper ways (hopefully contributing the the removal of the notorious &#8220;I am the centre of the universe&#8221; mechanic that ruins the believability of so many &#8220;open world&#8221; games)..?</p>
<p>Well these are some few of my many musings on this subject.. For now however I must end here but i&#8217;ll be back soon to ponder over the subject some more..</p>
<p>Feel free to drop comments, criticisms and general questions as you so desire..</p>
<p>Happy watchhogging!</p>
<p>- Hog</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/watchhogstories.wordpress.com/5/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/watchhogstories.wordpress.com/5/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/watchhogstories.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/watchhogstories.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/watchhogstories.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/watchhogstories.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/watchhogstories.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/watchhogstories.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/watchhogstories.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/watchhogstories.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/watchhogstories.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/watchhogstories.wordpress.com/5/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=watchhogstories.wordpress.com&blog=1107197&post=5&subd=watchhogstories&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://watchhogstories.wordpress.com/2007/05/31/game-design-thoughts-building-emotional-engagement/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/686657622caaa72fefb56a76bf938ac5?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">oladotunr</media:title>
		</media:content>
	</item>
		<item>
		<title>XNA Tutorial 1 &#8211; Reading Sequential Data From An Xml File</title>
		<link>http://watchhogstories.wordpress.com/2007/05/15/xna-tutorial-1-reading-sequential-data-from-an-xml-file/</link>
		<comments>http://watchhogstories.wordpress.com/2007/05/15/xna-tutorial-1-reading-sequential-data-from-an-xml-file/#comments</comments>
		<pubDate>Tue, 15 May 2007 23:17:14 +0000</pubDate>
		<dc:creator>oladotunr</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://watchhogstories.wordpress.com/2007/05/15/xna-tutorial-1-reading-sequential-data-from-an-xml-file/</guid>
		<description><![CDATA[Ok so here&#8217;s my first tutorial! I thought I&#8217;d go with something light to ease you into it, hope you find it useful&#8230;
So this tutorial focuses on retrieving data for your C#/XNA application from an XML data file. The idea is so that data elements can be parsed and read into your application sequentially (as [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=watchhogstories.wordpress.com&blog=1107197&post=4&subd=watchhogstories&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Ok so here&#8217;s my first tutorial! I thought I&#8217;d go with something light to ease you into it, hope you find it useful&#8230;</p>
<p>So this tutorial focuses on retrieving data for your C#/XNA application from an XML data file. The idea is so that data elements can be parsed and read into your application sequentially (as opposed to serialising the entire xml document into an equivalent binary construct) . This can be especially useful for a number of reasons; if you have a large amount of data of the same type that you wish to store in a single file (a list of bitmap font data descriptions for instance) then you can simply read each element of the data one-by-one and do something with it (sotre in an internal/external structure, process it and move onto the next etc..) This is much simpler than having to create a seperate xml file for each description and serialising each one which could become painstakingly tedious..</p>
<p><span id="more-4"></span>The key to this tutorial is a little class called the <font color="#3366ff"><em>XmlReader </em></font>( can be found in <font color="#3366ff"><em>System.Xml</em></font>). Using this class is pretty simple and straight forward and you only have to make sure you know the specific tags your interested in within the file to make it work for you.</p>
<p>Now let&#8217;s get down to business&#8230;</p>
<p>Let&#8217;s say we have a folder containing a load if bitmap fonts each labelled &#8220;BmpFontOne.tga&#8221;, &#8220;BmpFontTwo.tga&#8221; etc&#8230; Now let&#8217;s say we want to load some of these fonts into our XNA game but we need a means to specify exactly which ones the game should load and in what order..</p>
<p>Lets say we have an .xml file which looks like this:</p>
<p><!--more--></p>
<p>&lt;?xml version=&#8221;1.0&#8243; encoding=&#8221;utf-8&#8243; ?&gt;<br />
&lt;<font color="#ff0000">FontManager</font>&gt;<br />
&lt;<font color="#ff0000">numFonts</font>&gt;8&lt;/<font color="#ff0000">numFonts</font>&gt;</p>
<p>&lt;<font color="#ff0000">FontObj</font>&gt; &lt;<font color="#800000">fontType</font>&gt;0&lt;/<font color="#800000">fontType</font>&gt; &lt;<font color="#800000">fontName</font>&gt;BmpFontDefault&lt;/<font color="#800000">fontName</font>&gt; &lt;/<font color="#ff0000">FontObj</font>&gt;<br />
&lt;<font color="#ff0000">FontObj</font>&gt; &lt;<font color="#800000">fontType</font>&gt;0&lt;/<font color="#800000">fontType</font>&gt; &lt;<font color="#800000">fontName</font>&gt;BmpFontBankGothicB18&lt;/<font color="#800000">fontName</font>&gt; &lt;/<font color="#ff0000">FontObj</font>&gt;<br />
&lt;<font color="#ff0000">FontObj</font>&gt; &lt;<font color="#800000">fontType</font>&gt;0&lt;/<font color="#800000">fontType</font>&gt; &lt;<font color="#800000">fontName</font>&gt;BmpFontEarthR16&lt;/<font color="#800000">fontName</font>&gt; &lt;/<font color="#ff0000">FontObj</font>&gt;<br />
&lt;<font color="#ff0000">FontObj</font>&gt; &lt;<font color="#800000">fontType</font>&gt;0&lt;/<font color="#800000">fontType</font>&gt; &lt;<font color="#800000">fontName</font>&gt;BmpFontEddieR20&lt;/<font color="#800000">fontName</font>&gt; &lt;/<font color="#ff0000">FontObj</font>&gt;<br />
&lt;<font color="#ff0000">FontObj</font>&gt; &lt;<font color="#800000">fontType</font>&gt;0&lt;/<font color="#800000">fontType</font>&gt; &lt;<font color="#800000">fontName</font>&gt;BmpFontEurostarR20&lt;/<font color="#800000">fontName</font>&gt; &lt;/<font color="#ff0000">FontObj</font>&gt;<br />
&lt;<font color="#ff0000">FontObj</font>&gt; &lt;<font color="#800000">fontType</font>&gt;0&lt;/<font color="#800000">fontType</font>&gt; &lt;<font color="#800000">fontName</font>&gt;BmpFontGriffonShadowR20&lt;/<font color="#800000">fontName</font>&gt; &lt;/<font color="#ff0000">FontObj</font>&gt;<br />
&lt;<font color="#ff0000">FontObj</font>&gt; &lt;<font color="#800000">fontType</font>&gt;0&lt;/<font color="#800000">fontType</font>&gt; &lt;<font color="#800000">fontName</font>&gt;BmpFontGunmetalR20&lt;/<font color="#800000">fontName</font>&gt; &lt;/<font color="#ff0000">FontObj</font>&gt;<br />
&lt;<font color="#ff0000">FontObj</font>&gt; &lt;<font color="#800000">fontType</font>&gt;0&lt;/<font color="#800000">fontType</font>&gt; &lt;<font color="#800000">fontName</font>&gt;BmpFontTech001&lt;/<font color="#800000">fontName</font>&gt; &lt;/<font color="#ff0000">FontObj</font>&gt;</p>
<p>&lt;/<font color="#ff0000">FontManager</font>&gt;</p>
<p><!--more--><br />
Now as we can see the file contains a description of each bitmap font we want to load which is made up of a fontType (to tell the game whether it&#8217;s a truetype font or a bitmapFont, not used for this particular example) and a fontName (used to load the desired file). Notice we don&#8217;t specify an extension for each fontName (e.g. .tga) because we assume the bitmapFonts have been imported into game project and setup to be pre-processed using the framework content pipeline (in this case using the custom bitmapFont processor defined in MS&#8217;s FontSample example <a href="http://creators.xna.com/Education/Samples.aspx">(See Samples)</a>..</p>
<p>Now in code I setup a class called FontManager which has a couple of interesting tidbits in it. FontManager contains a smal class called FontObj which defines a font and contains a few attributes; a fontType, a fontName and the Font object (defined elsewhere) to be created once the fontName and fontType have been defined. Also FontManager contains a List object which we will use to store theFontObjs once we know how many to add.</p>
<p>In the FontManager&#8217;s LoadFonts() method we do the following:</p>
<p><!--more--><br />
<font color="#0000ff">public void </font>LoadFonts(<font color="#3366ff">ContentManager </font>content)<br />
{<br />
<font color="#008000">// Read setup information from the xml file..</font><br />
<font color="#3366ff">Stream </font>stream = File.OpenRead(kFontPath + kFontFileName);</p>
<p>ReadXMLFile(kFontPath + kFontFileName);</p>
<p><font color="#008000">// Load each font using it&#8217;s own xml-read data..</font><br />
<font color="#0000ff">for</font>(<font color="#0000ff">int </font>idx = 0; idx &lt; numFonts; idx++)<br />
{<br />
m_fontObjectList[idx].m_font = content.Load&lt;<font color="#3366ff">Font</font>&gt;(kFontPath + m_fontObjectList[idx].fontName);<br />
}<br />
}</p>
<p><font color="#0000ff">private void</font> ReadXMLFile(<font color="#0000ff">string </font>filename)<br />
{<br />
<font color="#008000">//load the xml file into the XmlTextReader object. </font><br />
<font color="#3366ff">XmlTextReader </font>XmlRdr = <font color="#0000ff">new </font>System.Xml.<font color="#3366ff">XmlTextReader</font>(filename);</p>
<p><font color="#008000">//while moving through the xml document.</font><br />
<font color="#0000ff">int </font>typeIterator = 0;<br />
<font color="#0000ff">int </font>nameIterator = 0;<br />
<font color="#0000ff">bool </font>ListIsReady = <font color="#0000ff">false</font>;<br />
<font color="#0000ff">while </font>(XmlRdr.Read())<br />
{<br />
<font color="#008000">//check the node type and look for the elements desired.</font><br />
<font color="#0000ff">if </font>(XmlRdr.NodeType == <font color="#3366ff">XmlNodeType</font>.Element &amp;&amp; XmlRdr.Name == <font color="#800000">&#8220;numFonts&#8221;</font>)<br />
{<br />
numFonts = XmlRdr.ReadElementContentAsInt();<br />
<font color="#008000">// Now we have the number of fonts to read we need to fill the fontlist</font><br />
<font color="#008000">// so we can read in the font data.</font><br />
<font color="#0000ff">for </font>(<font color="#0000ff">int </font>idx = 0; idx &lt; numFonts; idx++)<br />
{<br />
m_fontObjectList.Add(<font color="#0000ff">new </font><font color="#3366ff">FontObj</font>());<br />
}<br />
ListIsReady = <font color="#0000ff">true</font>; <font color="#008000">// guard to make sure we have font objects to fill with data..</font><br />
}</p>
<p><font color="#0000ff">if </font>(ListIsReady)<br />
{<br />
<font color="#008000">//check the node type and look for the elements desired.</font><br />
<font color="#0000ff">if </font>(XmlRdr.NodeType == XmlNodeType.Element &amp;&amp; XmlRdr.Name == <font color="#800000">&#8220;fontType&#8221;</font>)<br />
{<br />
m_fontObjectList[typeIterator].fontType = (<font color="#3366ff">fType</font>)XmlRdr.ReadElementContentAsInt();<br />
typeIterator++;<br />
}<br />
<font color="#008000">//check the node type and look for the elements desired.</font><br />
<font color="#0000ff">if </font>(XmlRdr.NodeType == <font color="#3366ff">XmlNodeType</font>.Element &amp;&amp; XmlRdr.Name == <font color="#800000">&#8220;fontName&#8221;</font>)<br />
{<br />
m_fontObjectList[nameIterator].fontName = XmlRdr.ReadElementContentAsString();<br />
nameIterator++;<br />
}<br />
}<br />
} <font color="#008000">//endwhile</font><br />
}</p>
<p><!--more-->Notice that in LoadFonts() we call the method ReadXMLFile() which handles all the .xml parsing, before we proceed to load in all of the specified fonts. Also we can see that in ReadXMLFile() we start by opening up the file stream to read from the file before parsing the first data element. The initial element, which defines the number of fonts to be loaded, is taken and processed by using it to create FontObjs and adding them to the List structure. Once all the FontObjs have been created we then proceed to continue parsing the file to retrieve the data descriptions of the specified number of fonts.</p>
<p>Lastly we use the content manager to load all of our brand spanking new fonts into the game for use..</p>
<p>This system is considerably flexible as it allows you to change and alter the number of fonts you wish to use in your game without recompilation. You wanna add a new font? just up the font number in the .xml doc and add a description for it! Also if you really wanted to get fancy you could have seperate .xml files each named differently (MenuFonts.xml, WorldOneFonts.xml, MiniGameFonts.xml etc..) and load in each one for a specific subsystem in your game. That way each subsystem can have its own description of the fonts its going to use, which the descriptions pointing the content manager to the files to load (which could be kept in a global font pool/folder)..<br />
Also it isn&#8217;t just useful for fonts as you can use a variatino of this system to load in variable quantities of description/data sets for just about anything you can think of..</p>
<p>Lastly I just want to note that I also included into FontManager two methods named GetFont(), one which takes in an index parameter and returns the FontObj in the List at that particular index, and the other method which taking in a string defining the font name and returns the FontObj which owns it (a little slower due to the string comparision)..</p>
<p>Well that&#8217;s it for my first tutorial but check back soon for some more in depth, XNA/game centric offerings as and when time permits..</p>
<p>Also if you have any requests for tutorials then you can drop me comment and i&#8217;ll try and fit them into my schedule wherever possible..</p>
<p>- Hog</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/watchhogstories.wordpress.com/4/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/watchhogstories.wordpress.com/4/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/watchhogstories.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/watchhogstories.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/watchhogstories.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/watchhogstories.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/watchhogstories.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/watchhogstories.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/watchhogstories.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/watchhogstories.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/watchhogstories.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/watchhogstories.wordpress.com/4/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=watchhogstories.wordpress.com&blog=1107197&post=4&subd=watchhogstories&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://watchhogstories.wordpress.com/2007/05/15/xna-tutorial-1-reading-sequential-data-from-an-xml-file/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/686657622caaa72fefb56a76bf938ac5?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">oladotunr</media:title>
		</media:content>
	</item>
	</channel>
</rss>