<?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>Paradice Software</title>
	<atom:link href="http://www.paradicesoftware.com/blog/index.php/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.paradicesoftware.com/blog</link>
	<description>Developing a role-playing game since 1981</description>
	<lastBuildDate>Tue, 22 Jun 2010 08:23:04 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Xbox 360 &#8211; KINECT</title>
		<link>http://www.paradicesoftware.com/blog/index.php/2010/06/xbox-360-kinect/</link>
		<comments>http://www.paradicesoftware.com/blog/index.php/2010/06/xbox-360-kinect/#comments</comments>
		<pubDate>Tue, 22 Jun 2010 08:23:04 +0000</pubDate>
		<dc:creator>Lawrence</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.paradicesoftware.com/blog/?p=218</guid>
		<description><![CDATA[A quick look at the Xbox 360 Kinect&#8230; looks good. Note that it&#8217;s much faster response time on the guy in the red sweater compared to the chick in the black and white. At previous demos, the demonstrators have been wearing red too. Apparently, they worked firstly on fine-tuning the system to minimise latency on [...]]]></description>
			<content:encoded><![CDATA[<p>A quick look at the Xbox 360 Kinect&#8230; looks good. Note that it&#8217;s much faster response time on the guy in the red sweater compared to the chick in the black and white. At previous demos, the demonstrators have been wearing red too. Apparently, they worked firstly on fine-tuning the system to minimise latency on red, and they&#8217;re working to bring other colours/patterns up to the same speed between now and launch (November). I think this shows the latency could be VERY acceptable!</p>
<p><object width="384" height="283" align="middle"><param name="allowScriptAccess" value="always" /><param name="allowFullScreen" value="true" /><param name="movie" value="http://widget.nbc.com/videos/nbcshort_at.swf?CXNID=1000004.10045NXC&#038;widID=4727a250e66f9723&#038;clipID=1235148&#038;showID=243&#038;siteurl=http://www.nbc.com?vty=fromWidget_Video&#038;dst=nbc|widget|NBC Video&#038;__source=nbc|widget|NBC Video"/><param name="quality" value="high" /><param name="bgcolor" value="#000000" /><embed src="http://widget.nbc.com/videos/nbcshort_at.swf?CXNID=1000004.10045NXC&#038;widID=4727a250e66f9723&#038;clipID=1235148&#038;showID=243&#038;siteurl=http://www.nbc.com?vty=fromWidget_Video&#038;dst=nbc|widget|NBC Video&#038;__source=nbc|widget|NBC Video" quality="high" bgcolor="#000000" width="384" height="283" align="middle" allowFullScreen="true" allowScriptAccess="always" type="application/x-shockwave-flash"></embed></object></p>
]]></content:encoded>
			<wfw:commentRss>http://www.paradicesoftware.com/blog/index.php/2010/06/xbox-360-kinect/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Citadel Beta released!</title>
		<link>http://www.paradicesoftware.com/blog/index.php/2010/03/citadel-beta-released/</link>
		<comments>http://www.paradicesoftware.com/blog/index.php/2010/03/citadel-beta-released/#comments</comments>
		<pubDate>Tue, 09 Mar 2010 11:01:40 +0000</pubDate>
		<dc:creator>Lawrence</dc:creator>
				<category><![CDATA[Citadel]]></category>
		<category><![CDATA[Icefall]]></category>
		<category><![CDATA[Beta]]></category>
		<category><![CDATA[Networking]]></category>

		<guid isPermaLink="false">http://www.paradicesoftware.com/blog/?p=206</guid>
		<description><![CDATA[People who know me on Facebook may be aware that I recently took a break from Icefall to focus on networking code.
I plan for networking to form an important part of Icefall&#8217;s gameplay: the game itself is not realtime multiplayer, however I plan for an &#8216;Auction House&#8217;, scoreboards/leaderboards/server-firsts, player-to-player mail, and other online community-type features.
BUT [...]]]></description>
			<content:encoded><![CDATA[<p>People who know me on Facebook may be aware that I recently took a break from Icefall to focus on networking code.</p>
<p>I plan for networking to form an important part of Icefall&#8217;s gameplay: the game itself is not realtime multiplayer, however I plan for an &#8216;Auction House&#8217;, scoreboards/leaderboards/server-firsts, player-to-player mail, and other online community-type features.</p>
<p>BUT I have never worked with any networking code of any complexity before, and I determined that trying to &#8216;learn while I go&#8217; during the Icefall development process would not be the best idea. Hence, Citadel!</p>
<p>Citadel is a &#8216;tower-defense&#8217; game. For those unfamiliar with the concept, essentially an endless wave of bad guys (in this case, tanks, jets, armoured cars, and trikes) try to get to and destroy your tower. Your job is to build a system of defensive towers to prevent them from doing that. The towers themselves automatically aim and fire, the strategy lies in placing the right towers and walls in the right places to do as much damage to the invaders as possible.</p>
<p>Each wave of invaders is tougher than the last, and eventually they will overwhelm your defenses. However, each invader you kill will give you some credits to spend on additional defense, and you receive more credits for tougher invaders. So the object is to last as long as possible, try to save money for the strongest towers (the Tesla Coil), and ultimately get a big score.</p>
<p>As far as tower-defense games go, Citadel currently isn&#8217;t that sophisticated (it&#8217;s a beta version, after all!) and doesn&#8217;t have upgradable towers or multiple game types or anything like that, but it does have a unique feature that I couldn&#8217;t find in any other Tower Defense games anywhere: it can do multiplayer. Get a friend on a LAN, or over the internet (hook up a voice-chat program like MSN or Ventrilo!) and you can join forces to get the highest scores. It&#8217;s competitive co-operative: you share the same base and it&#8217;s game over when an invader reaches it, but who does the most damage to the creates gets the most credits for the kill, and the most score at the end.</p>
<p>NOTE: The invaders MUST ALWAYS HAVE *some way* to get through. Even if they have to go ridiculously long ways around crazily long mazes and queue up single file, it is against the rules of tower defense games to block them off completely. If you do that, it&#8217;s immediately game over!</p>
<p>Try the demo! If you don&#8217;t like it, that&#8217;s fine &#8211; but if it works (especially the networking part), or if it doesn&#8217;t work and you tell me about it and I work with you to make it work, then you&#8217;re helping me to make sure Icefall&#8217;s online components are awesome when they come out!</p>
<div id="attachment_208" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.paradicesoftware.com/blog/wp-content/uploads/2010/03/Citadeltitle.png"><img class="size-medium wp-image-208" title="Citadel - Menu" src="http://www.paradicesoftware.com/blog/wp-content/uploads/2010/03/Citadeltitle-300x225.png" alt="The Citadel Main Menu" width="300" height="225" /></a><p class="wp-caption-text">The Citadel Main Menu</p></div>
<div id="attachment_209" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.paradicesoftware.com/blog/wp-content/uploads/2010/03/Citadelaction.png"><img class="size-medium wp-image-209" title="Citadel - Gameplay" src="http://www.paradicesoftware.com/blog/wp-content/uploads/2010/03/Citadelaction-300x225.png" alt="Early into a Citadel game" width="300" height="225" /></a><p class="wp-caption-text">Early into a Citadel game</p></div>
<p><a href="http://www.paradicesoftware.com/storage/CitadelSetup.exe">Download the beta demo here</a> and let me know in the comments what you think, if it works, or (more importantly!) if it doesn&#8217;t work, or (MOST importantly!) what your high score is <img src='http://www.paradicesoftware.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.paradicesoftware.com/blog/index.php/2010/03/citadel-beta-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>3rd Party Code</title>
		<link>http://www.paradicesoftware.com/blog/index.php/2010/03/3rd-party-code/</link>
		<comments>http://www.paradicesoftware.com/blog/index.php/2010/03/3rd-party-code/#comments</comments>
		<pubDate>Sat, 06 Mar 2010 22:46:42 +0000</pubDate>
		<dc:creator>Lawrence</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Good coding guidelines]]></category>
		<category><![CDATA[3rd party]]></category>
		<category><![CDATA[libraries]]></category>

		<guid isPermaLink="false">http://www.paradicesoftware.com/blog/?p=203</guid>
		<description><![CDATA[As a general rule, I like to write all of the code used by my games/programs myself. Not because I think I am the best programmer in the world, but because &#8211; for me &#8211; one of the main reasons I program is to learn more about how software functions on the very lowest levels, [...]]]></description>
			<content:encoded><![CDATA[<p>As a general rule, I like to write all of the code used by my games/programs myself. Not because I think I am the best programmer in the world, but because &#8211; for me &#8211; one of the main reasons I program is to learn more about how software functions on the very lowest levels, and if I used extensive 3rd party code (like Unreal Engine for my game, for example) a lot of that stuff that I *want* to learn about would be abstracted away, or worse: still present but obscured and intermingled with the 3rd party code itself.</p>
<p>Coincidentally, this is the same reason I don&#8217;t use managed languages like C#. I quite like knowing about things that managed code wants to hide! The increase in development time is not that important to me, I have no external deadlines to meet.</p>
<p>However, there are points beyond which it&#8217;s not practical for me to write the code myself, because it&#8217;s either A) incredibly complex, B) boring, C) proprietary, or D) so ubiquitous that it really doesn&#8217;t need reinventing. e.g.: writing code to decode an MP3 file into raw audio. I could *potentially* do this, but as it belongs to all four categories, I&#8217;m really comfortable with not doing it myself!</p>
<p>Currently in my Freepascal development I am using three 3rd Party Code libraries every day. And they are all excellent, both in terms of features and being easy enough that I can &#8216;plug them in&#8217; to my own lx7 game engine with very little work. Here they are:</p>
<h3>DirectX &#8211; by Clootie</h3>
<p>No, not DirectX itself (that deserves a whole separate subject!), but a port of all the headers/structures/glue code necessary to use DirectX in Freepascal. This gives me low level access to every function and interface used by DirectX itself, and the port is so perfect I was able to build my own graphics engine on top of Direct3D just by studying the (C++) DirectX SDK. Nothing is missing! Everything works! You probably won&#8217;t appreciate how rare this is if you normally use C++.<br />
<a href="http://www.clootie.ru/">http://www.clootie.ru/</a></p>
<h3>BASSfpc</h3>
<p>BASS is an Audio Library that makes it *dead easy* to play sound and music files of many different types. BASSfpc is the FPC port of this. BASS handles MP3s, WAVs, OGGs, and about a million other sound types, and it does it efficiently and with the bare minimum of code needed (literally about 4 lines of code to init the library and start playing an MP3!).<br />
<a href="http://www.un4seen.com/">http://www.un4seen.com/</a></p>
<h3>LNet</h3>
<p>The newest addition to my Libs folder. LNet provides a set of classes to implement networking, at the very lowest level, without adding any additional features or complexity. That&#8217;s exactly what I needed, because I want to add my own features and complexity! There are many many network libraries out there, but (for Freepascal at least) LNet definately gets my vote, for being simple, class-based, and extremely elegant.<br />
<a href="http://lnet.wordpress.com/">http://lnet.wordpress.com/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.paradicesoftware.com/blog/index.php/2010/03/3rd-party-code/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Icefall Progress</title>
		<link>http://www.paradicesoftware.com/blog/index.php/2010/01/icefall-progress/</link>
		<comments>http://www.paradicesoftware.com/blog/index.php/2010/01/icefall-progress/#comments</comments>
		<pubDate>Sat, 09 Jan 2010 11:05:31 +0000</pubDate>
		<dc:creator>Lawrence</dc:creator>
				<category><![CDATA[Icefall]]></category>
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.paradicesoftware.com/blog/?p=197</guid>
		<description><![CDATA[Long time, no update. My holiday from my real job is almost at an end, but the good news is that I have spent a lot of time with Icefall and it&#8217;s actually starting to come together!
I had developed a lot of separate pieces of game infrastructure (random map generation, character creation, character death&#8230; etc), [...]]]></description>
			<content:encoded><![CDATA[<p>Long time, no update. My holiday from my real job is almost at an end, but the good news is that I have spent a lot of time with Icefall and it&#8217;s actually starting to come together!</p>
<p>I had developed a lot of separate pieces of game infrastructure (random map generation, character creation, character death&#8230; etc), and over the last couple of days I have successfully integrated them all into the main Icefall build. This means that what I have now, for the first time, is a *fully* playable game! You start out creating a character, you can explore, find items, kill monsters, and be killed in turn. </p>
<p>There&#8217;s still thousands of features missing (I had thought I was pretty well progressed on the UI side of things, but now the framework is in place, I can see there are quite a few gaps I need to fill in) but now I have something that feels like a game, I can start iterating on it and trying it out. </p>
<p>The game has killed me several times already &#8211; I have added a few &#8216;tough&#8217; monsters for the deep dungeon, but I haven&#8217;t really added any high-level equipment yet. So it&#8217;s possible for my character to be wearing all the best items in the game and still get owned by the monsters. This will be fixed as I add in more content <img src='http://www.paradicesoftware.com/blog/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<p>I didn&#8217;t meet my goal of having it completed over Christmas, but at least I have made significant progress. Overall, I&#8217;m pretty happy with how far along it is.</p>
<p>Finally, anyone who has played a roguelike will be very familiar with the death screen. Here&#8217;s Icefall&#8217;s current version (more information about how/when/why you died will be added in future):</p>
 <div id="attachment_200" class="wp-caption aligncenter" style="width: 600px"><img src="http://www.paradicesoftware.com/blog/wp-content/uploads/2010/01/Death.png" alt="The Icefall death screen quickly becomes familiar." title="Death Screen" width="590" height="392" class="size-full wp-image-200" /><p class="wp-caption-text">The Icefall death screen quickly becomes familiar.</p></div>
]]></content:encoded>
			<wfw:commentRss>http://www.paradicesoftware.com/blog/index.php/2010/01/icefall-progress/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Happy Holidays</title>
		<link>http://www.paradicesoftware.com/blog/index.php/2009/12/happy-holidays/</link>
		<comments>http://www.paradicesoftware.com/blog/index.php/2009/12/happy-holidays/#comments</comments>
		<pubDate>Sat, 26 Dec 2009 09:53:13 +0000</pubDate>
		<dc:creator>Lawrence</dc:creator>
				<category><![CDATA[Icefall]]></category>

		<guid isPermaLink="false">http://www.paradicesoftware.com/blog/?p=195</guid>
		<description><![CDATA[Sorry, no posts for a while! I&#8217;m on holiday for Christmas, although I will be spending some time working on finishing up Icefall, I probably won&#8217;t be posting that much.
See you in the new year!
]]></description>
			<content:encoded><![CDATA[<p>Sorry, no posts for a while! I&#8217;m on holiday for Christmas, although I will be spending some time working on finishing up Icefall, I probably won&#8217;t be posting that much.<br />
See you in the new year!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.paradicesoftware.com/blog/index.php/2009/12/happy-holidays/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Game Golden Rule #2: Settings &amp; Controls</title>
		<link>http://www.paradicesoftware.com/blog/index.php/2009/12/game-golden-rule-2-settings-controls/</link>
		<comments>http://www.paradicesoftware.com/blog/index.php/2009/12/game-golden-rule-2-settings-controls/#comments</comments>
		<pubDate>Tue, 15 Dec 2009 07:18:21 +0000</pubDate>
		<dc:creator>Lawrence</dc:creator>
				<category><![CDATA[Game Golden Rules]]></category>
		<category><![CDATA[Good coding guidelines]]></category>

		<guid isPermaLink="false">http://www.paradicesoftware.com/blog/?p=193</guid>
		<description><![CDATA[This is the second entry in my set of &#8220;10 Game Development Golden Rules&#8221;. Hopefully, this one is less contentious than the first!
The rule is:
Provide gamma and volume controls, and separate music from sound.
Pretty simple. But essential! The good news is, the AAA titles pretty much universally support this now. And it&#8217;s a good thing, [...]]]></description>
			<content:encoded><![CDATA[<p>This is the second entry in my set of &#8220;10 Game Development Golden Rules&#8221;. Hopefully, this one is less contentious than the first!</p>
<p>The rule is:</p>
<h3>Provide gamma and volume controls, and separate music from sound.</h3>
<p>Pretty simple. But essential! The good news is, the AAA titles pretty much universally support this now. And it&#8217;s a good thing, as I use these settings all the time. </p>
<p>I have an Xbox 360 but, unlike most Xbox 360s, mine isn&#8217;t connected to a TV &#8211; it plugs into a second DVI port on one of my 22&#8221; widescreen PC monitors. This is awesome because I can run it at 1680&#215;1050 and games look beautiful! (handy bonus: I can web-surf on my other screen while waiting for Matchmaking in Halo 3)</p>
<p>BUT my monitor has a very different colour profile than your average TV, and games with a lot of contrasting light/dark elements can look really bad by default. Gamma controls in your game are pretty essential for me to see the graphics the way the designer intended. I&#8217;m sure there are other people in similar situations or even wildly different situations who also need gamma settings. Your game needs to support them too!! And since there&#8217;s nothing on the &#8220;con&#8221; side of the ledger that could make it a bad idea, you have no excuse!</p>
<p>Providing separate controls for sound/music: Music is awesome but people like to be able to hear the game sounds sometimes! Particularly in a &#8216;competitive&#8217; environment, or simply when your game is providing an audio narrative (GTA4 is an excellent example &#8211; the &#8220;in-car radio&#8221; music is huge and contributes to the GTA atmosphere, but you <strong>need</strong> to turn the music volume down to be able to hear what mission you&#8217;re being given via the cellphone). If I&#8217;m playing an FPS single-player, I might turn the music up, but in multiplayer I want to use every audio cue the game gives me for competitive advantage, so I need to kill the music or at least turn it down. </p>
<p>Just like with the gamma controls, the good news is this is pretty universal now. But there are still Flash games that don&#8217;t separate them (and, even worse: there are plenty that have no Volume settings at all &#8211; sound is either On or Off). Sound might *add* to the game experience, but I&#8217;d like to set it so that it doesn&#8217;t completely drown out my background music, thanks! Vista and Windows 7 allow you to set the volume controls at the &#8220;application&#8221; level, which solves the problem for me specifically, but it doesn&#8217;t help anyone using XP (or anyone who doesn&#8217;t know about that feature). Support them too!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.paradicesoftware.com/blog/index.php/2009/12/game-golden-rule-2-settings-controls/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Assets as Text Files!</title>
		<link>http://www.paradicesoftware.com/blog/index.php/2009/12/assets-as-text-files/</link>
		<comments>http://www.paradicesoftware.com/blog/index.php/2009/12/assets-as-text-files/#comments</comments>
		<pubDate>Sun, 06 Dec 2009 09:42:48 +0000</pubDate>
		<dc:creator>Lawrence</dc:creator>
				<category><![CDATA[Good coding guidelines]]></category>
		<category><![CDATA[Icefall]]></category>

		<guid isPermaLink="false">http://www.paradicesoftware.com/blog/?p=191</guid>
		<description><![CDATA[OK, this trick is probably universally known, but I&#8217;ve only just discovered it (by the classic programmer method of reinventing it), so on the chance there are others who are unfamiliar with this technique, it&#8217;s worth describing.
Any sufficiently complex game is going to have &#8220;assets&#8221;: data external to the main program that the game depends [...]]]></description>
			<content:encoded><![CDATA[<p>OK, this trick is probably universally known, but I&#8217;ve only just discovered it (by the classic programmer method of reinventing it), so on the chance there are others who are unfamiliar with this technique, it&#8217;s worth describing.</p>
<p>Any sufficiently complex game is going to have &#8220;assets&#8221;: data external to the main program that the game depends on to function. This includes &#8220;art assets&#8221; (textures, images, music, etc) as well as more application-specific &#8220;data assets&#8221; which contain data in a format unique to your application (e.g. Icefall has &#8220;item types&#8221; of all the different equipment players can find/buy/receive).</p>
<p>Handling art assets is relatively easy: you create/modify them in Photoshop (or equivalent), you save them as PNGs or JPGs, and you&#8217;re done! You might wrap them all up in a custom file format to compress/encrypt/streamline them, but that&#8217;s pretty simple and you can do that at the very end of development.</p>
<p>Data assets are different. There aren&#8217;t any programs around that can edit &#8220;Icefall item types&#8221; files. I need to write my own &#8220;Item Types Editor&#8221;, which understands this format and can load, modify and save it. This leads to two problems:</p>
<p>1. I have to spend time writing an Editor. (the actual format load/save code could be shared with Icefall itself, but there&#8217;s all the UI!).</p>
<p>2. If I ever change the &#8220;item types&#8221; format, all the data I&#8217;ve previously created is now in jeopardy. (What I typically do is modify the &#8217;save&#8217; code only, run the editor and  load each asset (old-code), and re-save it (new-code), then when that&#8217;s done I can modify the &#8216;load&#8217; code.</p>
<p>Depending on the type of data asset, using Asset Text Files may be superior. I DON&#8217;T mean your game should store all of it&#8217;s data assets in plain text (yuck!). Here&#8217;s what I mean:</p>
<p>Whip up a simple plaintext &#8217;syntax&#8217; that stores all of the information you want to include in your data asset. Then,  instead of creating an &#8220;Editor&#8221; with bulky UI code, create a command line utility that can parse your plaintext files and spit out your compiled data asset files. If you borrow your main game code for load/save, all you have to write is the text parser, and that can be as easy as you like: you&#8217;re dictating the syntax it has to interpret.</p>
<p>The BEST part of this system is that it makes changing the format of the assets later on very very easy. Oops, I forgot a field for my item types? No worries. Add the extra field to your text file sources (bringing to bear the full power of your fantastic Programmer Text Editor / IDE you&#8217;re using &#8211; the programmers&#8217; Photoshop), a quick change to the asset compiler to recognise the new format, and hit execute.</p>
<p>You get other benefits too: you can put &#8216;logic&#8217; into your compiler without having to put it in you main game. (e.g. scale the values, dictate whatever &#8220;optional&#8221; or &#8220;Default&#8221; fields, anything!</p>
<p>It doesn&#8217;t work for everything (e.g. Icefall&#8217;s &#8220;Level Map&#8221; is huge and an Editor really is the right option for that) &#8211; but when it&#8217;s appropriate, I have found it works brilliantly.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.paradicesoftware.com/blog/index.php/2009/12/assets-as-text-files/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>The quest for an intuitive interface</title>
		<link>http://www.paradicesoftware.com/blog/index.php/2009/12/the-quest-for-an-intuitive-interface/</link>
		<comments>http://www.paradicesoftware.com/blog/index.php/2009/12/the-quest-for-an-intuitive-interface/#comments</comments>
		<pubDate>Fri, 04 Dec 2009 21:09:54 +0000</pubDate>
		<dc:creator>Lawrence</dc:creator>
				<category><![CDATA[Icefall]]></category>
		<category><![CDATA[UI]]></category>

		<guid isPermaLink="false">http://www.paradicesoftware.com/blog/?p=188</guid>
		<description><![CDATA[One of the hardest bits about creating Icefall was getting the User Interface (UI) just right.
Icefall&#8217;s chief inspirations are &#8220;old-school&#8221; role-playing games like Angband (aka Roguelikes: Nethack, Moria, Omega, ADOM all fall into this category). But these old-school games all rely on essentially a text-mode interface with a myriad of hotkeys. I want to make [...]]]></description>
			<content:encoded><![CDATA[<p>One of the hardest bits about creating Icefall was getting the User Interface (UI) just right.<br />
Icefall&#8217;s chief inspirations are &#8220;old-school&#8221; role-playing games like Angband (aka Roguelikes: Nethack, Moria, Omega, ADOM all fall into this category). But these old-school games all rely on essentially a text-mode interface with a myriad of hotkeys. I want to make Icefall more accessible than that. So I took the UI elements from &#8216;modern&#8217; RPGs like World of Warcraft, Titan Quest, and Dragon Age: Orgins: hotbars, cooldowns, drag &amp; drop.</p>
<p>Of course these &#8216;modern&#8217; interfaces are much more work to get right than a classic keyboard-driven one. Even though I&#8217;ve spent more time on this aspect than any other, it&#8217;s still not perfect. Here&#8217;s an example I found yesterday:</p>
<div id="attachment_189" class="wp-caption aligncenter" style="width: 411px"><img class="size-full wp-image-189" title="Icefall Backpack user interface" src="http://www.paradicesoftware.com/blog/wp-content/uploads/2009/12/Backpack_armor.png" alt="Icefall Backpack user interface" width="401" height="352" /><p class="wp-caption-text">Icefall Backpack user interface</p></div>
<p>Looks easy enough. To equip the Apprentice Jerkin, players can either click and drag it to their Character Sheet, or else right-click it to equip. The problem: there are two, identical jerkins in the player&#8217;s inventory. Click and drag works fine, but if you right-click the second one, a strange thing happens: the *other* jerkin is equipped instead, and disappears from inventory.</p>
<p>Why? Well, right clicking an item in Icefall triggers a codepath to essentially &#8220;Activate Item: Apprentice Jerkin&#8221;. It&#8217;s set up this way so that players can also drag equipment to their hotbar, and equip it directly from there. All good so far. BUT: internally, the inventory is stored as an array, and is stored from left-to-right, top-to-bottom. So when the &#8220;Activate Item&#8221; codepath is triggered, it goes looking for an Apprentice Jerkin to activate, and it finds the other jerkin (the one in the row above) first &#8211; so it activates it!</p>
<p>A rare situation, a completely logical consequence of the way I implemented right-click behaviour. Technically correct (There are no downfalls to the player if the &#8216;wrong&#8217; jerkin is equipped: they&#8217;re identical by definition) and yet it feels completely wrong and would likely alienate a casual user. So I&#8217;m going to have to find a workaround <img src='http://www.paradicesoftware.com/blog/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.paradicesoftware.com/blog/index.php/2009/12/the-quest-for-an-intuitive-interface/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Icefall Character Creation</title>
		<link>http://www.paradicesoftware.com/blog/index.php/2009/11/icefall-character-creation/</link>
		<comments>http://www.paradicesoftware.com/blog/index.php/2009/11/icefall-character-creation/#comments</comments>
		<pubDate>Mon, 30 Nov 2009 10:36:38 +0000</pubDate>
		<dc:creator>Lawrence</dc:creator>
				<category><![CDATA[Icefall]]></category>
		<category><![CDATA[Decision]]></category>

		<guid isPermaLink="false">http://www.paradicesoftware.com/blog/?p=179</guid>
		<description><![CDATA[Because screenshots are always interesting, here is a screenshot of the &#8220;Character Creation&#8221; part of Icefall. This is one of the very first screens new players will see, as they opt to begin a new adventure the first thing to do is decide who they&#8217;re going to be. (I deliberately replaced the description text with [...]]]></description>
			<content:encoded><![CDATA[<p>Because screenshots are always interesting, here is a screenshot of the &#8220;Character Creation&#8221; part of Icefall. This is one of the very first screens new players will see, as they opt to begin a new adventure the first thing to do is decide who they&#8217;re going to be. (I deliberately replaced the description text with Latin, don&#8217;t want to give away too many plot points at this stage!)</p>
<div class="mceTemp mceIEcenter">
<div id="attachment_178" class="wp-caption aligncenter" style="width: 641px"><img class="size-full wp-image-178 " title="Character Creation" src="http://www.paradicesoftware.com/blog/wp-content/uploads/2009/11/CreateChar.png" alt="Icefall Character Creation, Nov 30 2009" width="631" height="314" /><p class="wp-caption-text">Icefall Character Creation, Nov 30 2009</p></div>
</div>
<p>Note: the &#8220;portrait&#8221; is currently a giant, upscaled version of the tiles used for the characters ingame. I would love to have larger character portraits, but my artistic skill just isn&#8217;t there&#8230;. hopefully I will find or convince someone at some point to help out <img src='http://www.paradicesoftware.com/blog/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<h3>Class Selection</h3>
<p>In Icefall, Class is a much more important choice than Race: Race has a few minor effects on stats, starting location, etc, but Class affects how you will approach the game: how you will defeat monsters and complete quests.</p>
<p>I strongly considered a &#8220;class-free&#8221; model, where the player starts with a generic character and shapes it over time just by their choices of equipment and &#8217;specialisations&#8217; (Titan Quest is a good example of this approach), but it made things too complicated, and you don&#8217;t gain too much in the approach anyway: in Titan Quest, if you don&#8217;t specialise correctly, you&#8217;ll end up a sort of &#8220;jack-of-all trades&#8221; type character who is not good enough at any one thing to get very far. So you may as well make the choice up-front, so that you and the game can work together to give you the type of experience you want. Choose a Ranger? Great, I&#8217;m going to give you some ranger-related quests.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.paradicesoftware.com/blog/index.php/2009/11/icefall-character-creation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Development Speed = Effort / (Complexity * Quality)</title>
		<link>http://www.paradicesoftware.com/blog/index.php/2009/11/development-speed-effort-complexity-quality/</link>
		<comments>http://www.paradicesoftware.com/blog/index.php/2009/11/development-speed-effort-complexity-quality/#comments</comments>
		<pubDate>Fri, 27 Nov 2009 06:57:07 +0000</pubDate>
		<dc:creator>Lawrence</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.paradicesoftware.com/blog/?p=176</guid>
		<description><![CDATA[I took a few days&#8217; break from Icefall to develop a quickfire helper application for myself (a simple media-centre type program to organise, search and filter the various videos and music I have lurking around, with a few handy unique features like automatic IMDB-Lookup for descriptions, saves me typing them off the DVD cover).
After working [...]]]></description>
			<content:encoded><![CDATA[<p>I took a few days&#8217; break from Icefall to develop a quickfire helper application for myself (a simple media-centre type program to organise, search and filter the various videos and music I have lurking around, with a few handy unique features like automatic IMDB-Lookup for descriptions, saves me typing them off the DVD cover).</p>
<p>After working on Icefall for so long, I was amazed at how quickly I was developing the code for the new program! When writing Icefall, I might create a single new source file in a night&#8217;s work, or maybe make 4 or 5 moderate improvements to existing code. On the media app, I was churning out half a dozen new source files at a time, and I had the entire application virtually finished in about three days.</p>
<p>Thinking about my observations of the difference, I eventually came up with the following formula:</p>
<h3>Development Speed = Effort / (Complexity * Quality)</h3>
<p>For a given amount of effort, I can get a lot more done on the media app, because A: it&#8217;s far less complex, and B: I care much less about the quality of the code. Multiply those factors together and you can see why Icefall development is approximately an order of magnitude slower: it&#8217;s a complex system, all the code has to be correct, robust, speedy, and extensible.</p>
<p>I&#8217;m convinced this is part of the reason why so many &#8220;we&#8217;re going to create the perfect application, that does everything and is open source&#8221; projects never reach version 1.0. With all the effort in the world, they&#8217;re just throwing huge numbers on the wrong side of the divisor. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.paradicesoftware.com/blog/index.php/2009/11/development-speed-effort-complexity-quality/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Icefall UI Evolution</title>
		<link>http://www.paradicesoftware.com/blog/index.php/2009/11/icefall-ui-evolution/</link>
		<comments>http://www.paradicesoftware.com/blog/index.php/2009/11/icefall-ui-evolution/#comments</comments>
		<pubDate>Fri, 20 Nov 2009 23:25:57 +0000</pubDate>
		<dc:creator>Lawrence</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Icefall]]></category>
		<category><![CDATA[Decision]]></category>

		<guid isPermaLink="false">http://www.paradicesoftware.com/blog/?p=170</guid>
		<description><![CDATA[Taking a break from coding topics, today&#8217;s post explores how Icefall&#8217;s dialog User Interface (UI) has evolved over the course of it&#8217;s development. My automatic-backup tool keeps every version of Icefall available, so I fired up a few old versions and took some screenshots to illustrate the process.
Original Design

This screenshot is actually from the realtime Icefall [...]]]></description>
			<content:encoded><![CDATA[<p>Taking a break from coding topics, today&#8217;s post explores how Icefall&#8217;s dialog User Interface (UI) has evolved over the course of it&#8217;s development. My automatic-backup tool keeps every version of Icefall available, so I fired up a few old versions and took some screenshots to illustrate the process.</p>
<h3>Original Design</h3>
<p><img class="aligncenter size-medium wp-image-166" title="UI Dialog: Original" src="http://www.paradicesoftware.com/blog/wp-content/uploads/2009/11/Stage1-300x239.jpg" alt="UI Dialog: Original" width="300" height="239" /></p>
<p>This screenshot is actually from the realtime Icefall prototype. I needed a quick way to change screen resolutions for testing, so this is it. Some interesting features: The green background would slowly sway while the dialog was open, and there was a shimmering gold border around whichever element had keyboard focus.</p>
<h3>Revision</h3>
<p><img class="aligncenter size-medium wp-image-167" title="Icefall: Revision" src="http://www.paradicesoftware.com/blog/wp-content/uploads/2009/11/Stage2-300x266.jpg" alt="Icefall: Revision" width="300" height="266" /></p>
<p>Fast forward to the turn-based rewrite of Icefall, and this is the original Video Options dialog. Some big changes: the background texture is more subdued, there is a panel on the left to select what <strong>type </strong>of options to view, and the gold-edge focus indicator has gone (now, the focused element is just highlighted a little more). Buttons and checkboxes have also had a minor makeover, e.g. the buttons are now rounded.</p>
<h3>Revision 2</h3>
<p><img class="aligncenter size-medium wp-image-168" title="UI Dialog: Revision 2" src="http://www.paradicesoftware.com/blog/wp-content/uploads/2009/11/Stage3-300x248.jpg" alt="UI Dialog: Revision 2" width="300" height="248" /></p>
<p>What changed here? The window frame! Gone is the &#8216;rusted steel&#8217; frame from the top and bottom of the window, replaced with an ice-blue frame that encloses all four sides. I wanted to get more &#8220;ice theme&#8221; into the UI for the game, and at the same time I needed a UI frame that covered the left and right too, because not all UI elements use the slate background (the spellbook, for example, uses a &#8216;book&#8217; background, and it looked a little strange with no enclosing frame). I also think this looks better than the previous one.</p>
<h3>Current Design</h3>
<p><img class="aligncenter size-medium wp-image-169" title="UI Design: Final" src="http://www.paradicesoftware.com/blog/wp-content/uploads/2009/11/Stage4-300x248.jpg" alt="UI Design: Final" width="300" height="248" /></p>
<p>Good, the rate-of-change of the dialog is slowing down, which means we&#8217;re getting closer to completion! The only change here is to the background of the listbox. The &#8216;green waves&#8217; looked ok in the original version, but as the look and feel of the rest of the dialog evolved, it began to look more and more out of place. When the dialog frames turned ice-blue, it was a good opportunity to build on that existing colourspace and again lend more of an &#8216;icey&#8217; theme to things by using a dark, ice-blue texture. This is what this dialog looks like in current builds. Hopefully, you agree with me that it&#8217;s the best looking of them all?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.paradicesoftware.com/blog/index.php/2009/11/icefall-ui-evolution/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>More Textures than Memory</title>
		<link>http://www.paradicesoftware.com/blog/index.php/2009/11/more-textures-than-memory/</link>
		<comments>http://www.paradicesoftware.com/blog/index.php/2009/11/more-textures-than-memory/#comments</comments>
		<pubDate>Wed, 18 Nov 2009 05:10:19 +0000</pubDate>
		<dc:creator>Lawrence</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Good coding guidelines]]></category>
		<category><![CDATA[Icefall]]></category>
		<category><![CDATA[DirectX]]></category>
		<category><![CDATA[Freepascal]]></category>

		<guid isPermaLink="false">http://www.paradicesoftware.com/blog/?p=155</guid>
		<description><![CDATA[Icefall uses literally dozens of textures&#8230; (and it will probably be &#8216;hundreds&#8217; by the time the game is completed).
Textures are used for everything, from the mouse cursor, menus, fonts, buttons, to the game world itself, spells/action icons, monsters, equipment&#8230; everything.
Although my own main PC has 512MB of video (texture) RAM, not everyone does! And
following on [...]]]></description>
			<content:encoded><![CDATA[<p>Icefall uses literally dozens of textures&#8230; (and it will probably be &#8216;hundreds&#8217; by the time the game is completed).</p>
<p>Textures are used for everything, from the mouse cursor, menus, fonts, buttons, to the game world itself, spells/action icons, monsters, equipment&#8230; everything.</p>
<p>Although my own main PC has 512MB of video (texture) RAM, not everyone does! And<br />
following on from my <a href="http://www.paradicesoftware.com/blog/index.php/2009/11/minimum-requirements/">minimum requirements</a> post, I don&#8217;t really want someone&#8217;s video card memory size to be a limiting factor if everything else meets the requirements, so Icefall needs a way to manage things when there are more textures than there is video memory.</p>
<p>I don&#8217;t want each bit of code that uses textures to worry about whether they&#8217;re loaded or not, so the logical choice is to encapsulate all of the texture handling into one place: I call the class that handles this the <em>TContentManager</em> (&#8221;content&#8221; because it also handles sounds, fonts, music, etc.).</p>
<p>When the game code asks the <em>TContentManager</em> for a texture: the first thing it does is look to see if that texture is already available in video memory: if so, it just hands out a reference. Easy! If not, it retrieves the filename for that texture from Icefall&#8217;s <em>ResourceDatabase</em>, and attempts to load the texture from disk. If that fails, it looks at <strong>why</strong> it failed: if it&#8217;s <em>D3DERR_OUTOFVIDEOMEMORY</em>, the next step is to unload some other texture and try again, repeating until the load succeeds or we have no loaded textures left. (If it still doesn&#8217;t load, or if the texture load fails for some other reason, it&#8217;s goodbye Icefall).</p>
<p>Programmatically:</p>
<blockquote><pre>
function TContentManager.GetTexture(ID: TTextureID): TLXTexture;
var
   HRes: HRESULT;
   NewTexture: TLXTexture;
   FileName: String;
begin
   if TextureLoaded(ID) then
      exit(Texture[ID]);

   FileName := ResourceManager.Textures[ID].FileName;
   repeat
      HRes := LXLoadTexture(FileName,NewTexture);
      case HRes of
         D3D_OK:
            Texture[ID] := NewTexture;
         D3DERR_OUTOFVIDEOMEMORY:
            UnloadTexture(0);
      else
         // Fatal error!
      end;
   until TextureLoaded(ID);
   result := Texture[ID];
end function;
</pre>
</blockquote>
<p><em>UnloadTexture</em> is a method that unloads a texture. It takes a <em>TTextureID</em> as a parameter, but passing 0 in this case tells the method we want it to choose a texture to unload itself. This is where it gets interesting.</p>
<p>Before I got to this, I originally had set up a few states so that they explicitly called <em>TContentManager.UnloadTexture</em> to release textures when the game left that state (e.g. the game would unload the &#8216;Option-selection&#8217; texture when the player closed the Options dialog). However, this turned out to be sub-optimal for several reasons:</p>
<ul>
<li>Players might well leave and re-enter states (like Options) several times to accomplish whatever it is they&#8217;re trying to do.</li>
<li>It doesn&#8217;t make use of extra video memory: it keeps loading from disk (or the disk-cache anyway) while the extra video memory stays idle.</li>
<li>I had to explicitly declare what textures I was done with. Not a problem really but &#8216;just another thing&#8217; that I had to do when changing states.</li>
</ul>
<p>So now I no longer explicitly release anything. <em>UnloadTexture</em> always chooses the texture to unload that was least-recently used (a linked list makes this a very fast and efficient check &#8211; no timers or array scanning involved). In practise &#8220;least recently used&#8221; turns out to be about 97% optimal (when simulated against a 100% optimal algorithm which is permitted to see the future when deciding what to unload) so it&#8217;s virtually perfect &#8211; substantially better than my explicit declarations were. </p>
<p>If for some crazy reason the user doesn&#8217;t want Icefall consuming all of their video RAM*, I can chuck in a call to <em>IDirect3DDevice9.GetAvailableTextureMem</em> and trigger <em>UnloadTexture</em> if it&#8217;s below some specific amount. Alternatively, I could keep a sum of the amount of texture memory I&#8217;m using, and trigger <em>UnloadTexture</em> if that amount threatens to exceed 32MB or whatever (I haven&#8217;t decided yet).</p>
<p>The point is, if you find yourself manually balancing resources, it&#8217;s probably an excellent idea to profile your resource usage and see if you can find a pattern that will let you just automate the whole thing**. You&#8217;ll save yourself much time and your code will be cleaner and more flexible.</p>
<p>*Note: this only actually matters on Vista or Windows 7. Under the Windows XP model, multiple applications can&#8217;t share texture memory anyway. As soon as an application takes focus, DirectX invalidates all texture resources belonging to everything else (forcing them to reload from system-memory or disk when they get restored). The WDDM (Windows Display Driver Model) in Vista &#8220;understands&#8221; video memory, and can share it amongst applications. This is one of the reasons DirectX 10+ can&#8217;t be backported to XP: XP has no concept of video card resources.</p>
<p>**If you&#8217;re creating a game frame-rate locked or just frame-rate dependent, you might still need to explicitly acquire and release resources (e.g. between levels), because a 10ms pause at an unexpected point in your game could be noticeable or detrimental. Either that, or move the resource acquistion to another thread and have low-quality &#8216;emergency&#8217; textures to display while the real ones load&#8230; this is a very common technique for FPS games. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.paradicesoftware.com/blog/index.php/2009/11/more-textures-than-memory/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Scary Windows development stories</title>
		<link>http://www.paradicesoftware.com/blog/index.php/2009/11/scary-windows-development-stories/</link>
		<comments>http://www.paradicesoftware.com/blog/index.php/2009/11/scary-windows-development-stories/#comments</comments>
		<pubDate>Mon, 16 Nov 2009 08:44:20 +0000</pubDate>
		<dc:creator>Lawrence</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Good coding guidelines]]></category>
		<category><![CDATA[Taxes]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://www.paradicesoftware.com/blog/?p=148</guid>
		<description><![CDATA[I&#8217;m currently reading a book about the evolution of Windows. One of the most interesting things I keep finding is how stupid some 3rd party application developers must have been&#8230;. for example, it seems to have been common practice that if you wanted your app to grab a particular Windows setting (let&#8217;s say the Fonts [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m currently reading a book about the evolution of Windows. One of the most interesting things I keep finding is how stupid some 3rd party application developers must have been&#8230;. for example, it seems to have been common practice that if you wanted your app to grab a particular Windows setting (let&#8217;s say the Fonts directory), instead of a quick MSDN search, which turns up both the <em>SHGetFolderPath</em> and <em>SHGetKnownFolderPath</em> functions (either of which is exactly what you want), these programmers fired up RegEdit and searched for the path of their own Fonts folder&#8230; the first key they found, they used as the parameter for a call to  <em>RegOpenKeyEx</em> and they read the value that way.</p>
<p>To me, that is not only a frighteningly ignorant and dangerous way to develop software (you&#8217;re not going to discover caveats &#038; usage notes by browsing RegEdit!) but <strong>of course</strong> this is not the supported way to do it (how could any sane developer think otherwise?), and <strong>of course</strong> that app would have broken immediately on any new of Windows had MS not added a compatibility shim to watch for that program checking that buggy key, and substituting in a quick call to obtain the real value&#8230;</p>
<p>This isn&#8217;t backyard programmers writing in VBA in Excel to accomplish some one-off business task, either.. it&#8217;s commercial software that did this, written by professional developers and sold to unsuspecting customers for big cash. Scary stuff.</p>
<p>The only question worth pondering here is: was this &#8216;grab something promising out of the Registry&#8217; technique better or worse than just hard-coding &#8220;C:\Windows\Fonts\&#8221; into the application? (I&#8217;m not 100% sure but it seems very likely there&#8217;s a shim out there for programs that did that, too.) </p>
]]></content:encoded>
			<wfw:commentRss>http://www.paradicesoftware.com/blog/index.php/2009/11/scary-windows-development-stories/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Game Golden Rule #1: Support Windowed-mode</title>
		<link>http://www.paradicesoftware.com/blog/index.php/2009/11/game-golden-rule-1-support-windowed-mode/</link>
		<comments>http://www.paradicesoftware.com/blog/index.php/2009/11/game-golden-rule-1-support-windowed-mode/#comments</comments>
		<pubDate>Thu, 12 Nov 2009 06:50:43 +0000</pubDate>
		<dc:creator>Lawrence</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Game Golden Rules]]></category>
		<category><![CDATA[DirectX]]></category>
		<category><![CDATA[Taxes]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://www.paradicesoftware.com/blog/?p=141</guid>
		<description><![CDATA[I thought I&#8217;d cover this rule first, because I listed it as number one and also because it&#8217;s probably one of the most controversial. Let&#8217;s begin: a simple Why/Why Not argument should suffice for this one:
Why Allow Windowed-mode:
It&#8217;s more convenient for your users. Some users multitask (gasp!), even while playing games. This is much harder [...]]]></description>
			<content:encoded><![CDATA[<p>I thought I&#8217;d cover this rule first, because I listed it as number one and also because it&#8217;s probably one of the most controversial. Let&#8217;s begin: a simple Why/Why Not argument should suffice for this one:</p>
<h3>Why Allow Windowed-mode:</h3>
<p><strong>It&#8217;s more convenient for your users.</strong> Some users multitask (gasp!), even while playing games. This is much harder to do when your game is Fullscreen. I suspect this is a part of why games like Minesweeper and Solitaire get so much play-time. They&#8217;re built into the OS, sure, but you can also fire them up and play while you&#8217;re waiting for something to download/compile/whatever. Very handy!</p>
<p><strong>It&#8217;s more convenient for you.</strong> Debugging is hard, and debugging fullscreen is harder! My own game engine (in debug builds) has a feature to throw a debugging/log window up so I can watch internal game messages etc: you can&#8217;t do this if your game is always fullscreen. Not only that, but if your game crashes at some Direct3D stuff (which can happen in early builds, before you lock down your video interface code), it&#8217;s very tricky to find a cause when you&#8217;re staring at a blank screen. A blank window on the desktop gives you more context and options.</p>
<p><strong>It makes paying certain Windows taxes more obvious.</strong> If you&#8217;re running in Windowed mode while developing, you&#8217;re going to be hitting the titlebar close button, you&#8217;ll be minimising/maximising your game Window, or maybe just clicking other apps, stealing your game&#8217;s focus. Because you&#8217;re doing these things, you&#8217;re much more likely to take the time to ensure your game handles them correctly. Fullscreen games are required to handle these situations too, you know: but some of them never get around to it! (Civilization 3, which is always &#8220;fullscreen&#8221;, can experience a rather ugly crash if I dare to click something on my second monitor while I&#8217;m playing).</p>
<p><strong>It&#8217;s future proof.</strong> You might think your fullscreen game is pretty cool, what with it supporting resolutions right up to 1920&#215;1080, but who knows what the future holds? How well will your fullscreen game look on some giant desktop running 12,000&#215;12,000 pixels? Or do you just expect no one will be playing it then? (if you don&#8217;t, then code this way: you&#8217;re sure to be correct). Windowed mode doesn&#8217;t solve this completely, but it gives your users more options.</p>
<p>Ok, hopefully you can that there are always scenarios where that option would be valuable, but you might not be convinced to allow it in <strong>your</strong> game. Let&#8217;s take a look at some reasons why not:</p>
<h3>Why NOT allow Windowed-mode:</h3>
<p><strong>It&#8217;s hard to code.</strong> Oh no, now all of your video code has two scenarios to account for! Well, actually, no it doesn&#8217;t. Once you&#8217;ve initialised Direct3D correctly, none of your other code even needs to *know* it&#8217;s drawing to a windowed area of the desktop. And initialising Direct3D to support either Windowed or Fullscreen mode is <strong>easy</strong>! I&#8217;ll bet you $5 that the sum total of video code required to support this option is LESS than the amount of code required to present the option to the user and store the result.</p>
<p><strong>Fullscreen is more atmospheric. Atmosphere is important in my game!</strong> By all means then, make fullscreen the default. Plenty of games do. I&#8217;m just asking for the <strong>option!</strong></p>
<p><strong>But I want to retain control.</strong> Fuck off! The user is in control: it&#8217;s their computer. Besides, if the user really wants to window you, they can do it: they can fire up a virtual machine and lock you inside it: good luck getting into fullscreen mode then. Of course, if it&#8217;s that important to them, they&#8217;re more likely to just uninstall you and go play something with a windowed option.</p>
<p>And there you have it. Why I believe every game should support Windowed-mode!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.paradicesoftware.com/blog/index.php/2009/11/game-golden-rule-1-support-windowed-mode/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Paying your Windows Taxes</title>
		<link>http://www.paradicesoftware.com/blog/index.php/2009/11/paying-your-windows-taxes/</link>
		<comments>http://www.paradicesoftware.com/blog/index.php/2009/11/paying-your-windows-taxes/#comments</comments>
		<pubDate>Wed, 11 Nov 2009 05:09:57 +0000</pubDate>
		<dc:creator>Lawrence</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Game Golden Rules]]></category>
		<category><![CDATA[Taxes]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://www.paradicesoftware.com/blog/?p=123</guid>
		<description><![CDATA[In Windows (like every operating system), when you&#8217;re writing an application or game there are certain things that your application is responsible for handling: some of them are easy, some of them take a little bit more effort. On his excellent blog, Microsoft&#8217;s Raymond Chen calls these responsibilities &#8220;Taxes&#8221;, and there are good reasons why [...]]]></description>
			<content:encoded><![CDATA[<p>In Windows (like every operating system), when you&#8217;re writing an application or game there are certain things that your application is responsible for handling: some of them are easy, some of them take a little bit more effort. On his excellent blog, Microsoft&#8217;s <a href="http://blogs.msdn.com/oldnewthing/archive/2005/08/22/454487.aspx">Raymond Chen</a> calls these responsibilities &#8220;Taxes&#8221;, and there are good reasons why you should pay them. Windows taxes include things like:</p>
<ul>
<li>Respond to Windows messages correctly</li>
<li>Respect user action (don&#8217;t silently cancel a Sleep request)</li>
<li>Non-standard installs (don&#8217;t assume C:\Windows!)</li>
<li>Run fine as a Standard User</li>
<li>Respect the user&#8217;s settings</li>
</ul>
<p>Raymond talks about more complex taxes too (internationalisation, heirarchical file systems), but I&#8217;m sticking to what I&#8217;m comfortable with!</p>
<p>Unfortunately, amongst all applications, games appear to be the worst at being good Windows citizens, there are far too many games out there (not just freeware ones either) that don&#8217;t pay <strong>any</strong> of the above taxes, and (to sustain the metaphor) some start trying &#8216;tax-fraud&#8217; schemes like:</p>
<ul>
<li>Trying to disable Alt-Tab</li>
<li>Refusing to be minimised (automatically restoring themselves after 1 sec)</li>
<li>Preventing the system from shutting down</li>
</ul>
<p>I might make this another series because there&#8217;s plenty to talk about, and most of it&#8217;s not even that difficult these days: you just have to be aware of the situation, and what the correct behaviour is. (I must admit I never gave thought to multi-monitor situations before I got my second monitor).</p>
<p>For now though, I will limit myself to a list of ten &#8216;golden rules&#8217; which I believe all games should obey, at a minimum (not all of them are Windows taxes &#8211; some of them are just treating your users properly). In fact I will expand on some of these in later posts too, because they&#8217;re worth talking about.</p>
<h3>Top ten Golden rules for Games: being a good Windows application</h3>
<ol>
<li>1. Fullscreen games: <strong>always</strong> allow an option to run in a Window.</li>
<li>2. Provide gamma and volume controls, and separate music from sound.</li>
<li>3. Always allow your game to be paused, saved and quit. At any time.</li>
<li>4. Provide a way to skip <strong>anything</strong> non-interactive: from cutscenes to credits.</li>
<li>5. Respect multi-monitor: If you were dragged to monitor 2, next time open on monitor 2.</li>
<li>6. Respect the filesystem: don&#8217;t open files in Read/Write mode if you only want to read from them.</li>
<li>7. Respect security: A game <strong>does not</strong> need an Administrator account to play!</li>
<li>8. Respect UI settings: if the user has selected &#8216;Use Large Fonts&#8217; in Windows, use larger fonts in your game!</li>
<li>9. Respect sessions: if the user logs off/hibernates/shuts down, handle it gracefully. Don&#8217;t try to block the action, and don&#8217;t lose their progress.</li>
<li>10. Adapt to a changing system: if you last opened on 1680&#215;1050, but the system now says the monitor can&#8217;t support that, open in a res it <strong>can</strong> support.</li>
</ol>
<p>I&#8217;ll talk about how to implement some of these (and why they&#8217;re so important) in future posts.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.paradicesoftware.com/blog/index.php/2009/11/paying-your-windows-taxes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Class Balance</title>
		<link>http://www.paradicesoftware.com/blog/index.php/2009/11/class-balance/</link>
		<comments>http://www.paradicesoftware.com/blog/index.php/2009/11/class-balance/#comments</comments>
		<pubDate>Mon, 09 Nov 2009 04:43:54 +0000</pubDate>
		<dc:creator>Lawrence</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.paradicesoftware.com/blog/?p=119</guid>
		<description><![CDATA[Class balance. In the RPG sense, class balance means that the various different character types (wizard, warrior, druid etc) are &#8220;balanced&#8221; in the sense that the difficulty of the game, and your character&#8217;s ability, remain approximately the same regardless of your choice of class. (and Race: Humans, Elf, Dwarf etc)
Obviously, in an online-, or otherwise [...]]]></description>
			<content:encoded><![CDATA[<p>Class balance. In the RPG sense, class balance means that the various different character types (wizard, warrior, druid etc) are &#8220;balanced&#8221; in the sense that the difficulty of the game, and your character&#8217;s ability, remain approximately the same regardless of your choice of class. (and Race: Humans, Elf, Dwarf etc)</p>
<p>Obviously, in an online-, or otherwise multiplayer game, class balance is critically important. If your wizards can always beat your warriors, the game will NOT be fun for people who choose to play warriors. And they won&#8217;t switch and play wizards, either: they&#8217;ll just stop playing and find another game.</p>
<p>But is class balance critical in a single-player game, like Icefall? In many roguelikes, the classes aren&#8217;t balanced: some classes and races are substantially more powerful than others (e.g. High Elves might come complete with bonuses to all their stats, Resist Poison, etc etc &#8211; with no downsides), and players are actively encouraged to start with the easier classes.</p>
<p>A third alternative is to balance classes not for &#8216;difficulty&#8217;, but for &#8216;effort&#8217;: you might be free to roll a powerful Immortal instead of a lowly Human, but the Immortal will require twice as much experience to gain every level.</p>
<p>I&#8217;m not at the stage of class balancing yet &#8211; but I&#8217;m thinking about it. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.paradicesoftware.com/blog/index.php/2009/11/class-balance/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Minimum requirements</title>
		<link>http://www.paradicesoftware.com/blog/index.php/2009/11/minimum-requirements/</link>
		<comments>http://www.paradicesoftware.com/blog/index.php/2009/11/minimum-requirements/#comments</comments>
		<pubDate>Thu, 05 Nov 2009 08:11:56 +0000</pubDate>
		<dc:creator>Lawrence</dc:creator>
				<category><![CDATA[Icefall]]></category>
		<category><![CDATA[Decision]]></category>
		<category><![CDATA[DirectX]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://www.paradicesoftware.com/blog/?p=114</guid>
		<description><![CDATA[What&#8217;s a reasonable minimum spec to aim for these days?
With Icefall, I&#8217;ve already taken the decision to target Direct3D9 &#8211; I get a lot of extra capabilities compared to DirectX8, and it still works with Windows XP unlike 10 or 11&#8230; a pretty simple decision.
But what about in terms of video memory? And system RAM? [...]]]></description>
			<content:encoded><![CDATA[<p>What&#8217;s a reasonable minimum spec to aim for these days?</p>
<p>With Icefall, I&#8217;ve already taken the decision to target Direct3D9 &#8211; I get a lot of extra capabilities compared to DirectX8, and it still works with Windows XP unlike 10 or 11&#8230; a pretty simple decision.</p>
<p>But what about in terms of video memory? And system RAM? What&#8217;s a realistic minimum these days? Icefall is a freeware, turn-based RPG, so by rights it shouldn&#8217;t require a leading edge PC, but I need a specific target to prevent limiting myself unnescessarily. </p>
<p>Howzabout 32mb video, and 512mb RAM? I think that fits most every PC you could buy in the last few years&#8230; and should be enough for some reasonable effects. Anyone got any thoughts on this?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.paradicesoftware.com/blog/index.php/2009/11/minimum-requirements/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>To install or not to install?</title>
		<link>http://www.paradicesoftware.com/blog/index.php/2009/11/to-install-or-not-to-install/</link>
		<comments>http://www.paradicesoftware.com/blog/index.php/2009/11/to-install-or-not-to-install/#comments</comments>
		<pubDate>Mon, 02 Nov 2009 04:55:32 +0000</pubDate>
		<dc:creator>Lawrence</dc:creator>
				<category><![CDATA[Icefall]]></category>
		<category><![CDATA[DirectX]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://www.paradicesoftware.com/blog/?p=102</guid>
		<description><![CDATA[Should Icefall come with an Installer/Setup program?
My previous games (like the Five Hundred card game) didn&#8217;t require any installation at all: it assumed you had DirectX7 (the game just failed if you didn&#8217;t), and all of the files it needed were in the same directory as the EXE itself. You just unzipped it to wherever [...]]]></description>
			<content:encoded><![CDATA[<p>Should Icefall come with an Installer/Setup program?</p>
<p>My previous games (like the Five Hundred card game) didn&#8217;t require any installation at all: it assumed you had DirectX7 (the game just failed if you didn&#8217;t), and all of the files it needed were in the same directory as the EXE itself. You just unzipped it to wherever you liked, and double clicked the EXE to play. To uninstall, you just delete the folder.</p>
<p>Icefall is a little bit more complicated. All of the game&#8217;s data is still a relative path from the EXE itself, but this time it needs a specific Direct3D9 library installed (one that doesn&#8217;t ship by default with the rest of DirectX, but that other games may have already installed). So I need to include the DX Installer. </p>
<p>The Microsoft DX installer is smart enough to not overwrite a newer version of the same library (and you can only include the needed library &#8211; I don&#8217;t have to include the full DX9 100mb installer!), so I don&#8217;t need to worry about that stuff, but the question is, should I include this as an &#8216;optional&#8217; installer that the user can run if Icefall doesn&#8217;t run immediately, or would it be less confusing to just make a full install program that all users run, and call this as a part of it (I could throw out options for the Start Menu etc. at the same time).</p>
<p>I&#8217;m leaning towards making a full installer, mainly because the DirectX library is designed to never be uninstalled (it&#8217;s a shared library, and other D3D9 apps might use it), and it would be very confusing for users to have an installer with no corresponding uninstaller&#8230; also, I may as well get with the program and use the Start Menu, registry etc. the way Windows programs are supposed to. Does anyone have any opinions on this?</p>
<p>Bonus trivia: I get quite regular emails about my Five Hundred game, since it made it onto lots of the large &#8216;freeware games&#8217; websites and was quite well received at the time. One of the common questions people ask these days is &#8220;how do I uninstall it? It&#8217;s not in Add/Remove programs&#8221;. They must have forgotten that they never installed it in the first place, just unzipped. A few of them are still confused when I tell them to just delete it, so it&#8217;s clearly not what today&#8217;s users are expecting.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.paradicesoftware.com/blog/index.php/2009/11/to-install-or-not-to-install/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Controlling Gamestate</title>
		<link>http://www.paradicesoftware.com/blog/index.php/2009/10/controlling-gamestate/</link>
		<comments>http://www.paradicesoftware.com/blog/index.php/2009/10/controlling-gamestate/#comments</comments>
		<pubDate>Fri, 30 Oct 2009 18:57:41 +0000</pubDate>
		<dc:creator>Lawrence</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Icefall]]></category>
		<category><![CDATA[Gamestate]]></category>

		<guid isPermaLink="false">http://www.paradicesoftware.com/blog/?p=90</guid>
		<description><![CDATA[Virtually all programs have this, a central &#8216;game&#8217; loop that grabs user input, updates game logic, redraws the screen. At it&#8217;s simplest possible level, it usually looks something like this:

repeat
   Input;
   Update;
   Redraw;
until Quit;

The problem mainly comes in that middle section, Update. For any game, there are a variety [...]]]></description>
			<content:encoded><![CDATA[<p>Virtually all programs have this, a central &#8216;game&#8217; loop that grabs user input, updates game logic, redraws the screen. At it&#8217;s simplest possible level, it usually looks something like this:</p>
<blockquote>
<pre>repeat
   Input;
   Update;
   Redraw;
until Quit;</pre>
</blockquote>
<p>The problem mainly comes in that middle section, <em>Update</em>. For any game, there are a variety of different states you can be in (main menu, options screen, credits, playing game) and for most games, &#8220;playing game&#8221; breaks down into a whole lot more states by itself. For my simple 500 Card Game, I had states &#8220;bidding&#8221;, &#8220;dealing&#8221;, &#8220;choosing kitty&#8221;, as well as playing. If you&#8217;re not careful, your <em>Update</em> procedure can end up looking like this:</p>
<blockquote>
<pre>Procedure Update;
begin
   case State of
      STATE_MENU:
         // wait for a menu click
      STATE_OPTIONS:
         // handle user input
      STATE_CREDITS:
         // roll some credits
      STATE_GAME:
         case GameState of
            GS_PLAYING:
               // handle user input
               // update some monsters
            // etc
         end;
      // STATE_ even more stuff:
   end;
end;</pre>
</blockquote>
<p>So far, so big and clunky. It gets worse when you have to handle nested state transitions: in my card game, someone could be playing, then go to the Menu and come back. So I had to have a variable &#8216;LastState&#8217; that remembered where they were, so they could go back to it. But it&#8217;s worse than that, because they might go to the Menu, then go to the Options screen: and when they came back, they&#8217;d still want their current game to not be lost! My card game was simple, so I managed this as simply as I could: when entering the &#8216;menu&#8217; state, the menu grabbed it&#8217;s own copy of LastState, and it restored this value when the other screens (Options, Credits etc) returned to it, so there was always a way back to the game. This was the simplest case, because every state had exactly one other state that it could be transitioned from (you couldn&#8217;t get to Options from Game without going through Menu).</p>
<p>For Icefall though, the stakes were raised. I wanted the Options screen accessible from in-game, as well as in the initial menu. And there are many more states that the game can be in, and some of them should not be returned to (e.g the &#8220;create character&#8221; screen), so rather than a gigantic and ugly Update loop, I went back to good old OOP and implemented a class-based state stack.</p>
<p>Icefall has a central &#8220;State Engine&#8221; that looks after the current state stack, handles transitions between them, and calls whichever state is &#8216;on top&#8217; during the main loop. The State class looks something like this:</p>
<blockquote>
<pre>TIceState = class (TIceClass)
   constructor Create
      (StateEngine: TIceStateEngine;
       Transition: TStateTransition);
   procedure OnEnter; virtual;
   procedure OnLeave; virtual;
   procedure Update; virtual;
   procedure Redraw;
   // other useful state methods
   destructor Destroy; override;
end;</pre>
</blockquote>
<p>Essentially, for every state the game can be in, I have a corresponding class that defines it&#8217;s specific behaviour in <em>Update</em>. I can also do other &#8216;maintenence&#8217; (e.g. ensure the right music is playing) by overriding the OnEnter and OnLeave procedures. The game can change states by constructing a new <em>TIceState</em> instance, passing it a reference to the state engine and describing the type of transition to use (e.g. whether to nest the state [for a trip to a Menu] or just progress to the new state with no way back [like a character create screen]). You can also leave a state just by destructing the class instance: the state engine will pop back to the next highest state on the state stack, or quit the game if there are no states left (e.g., you just hit &#8216;Exit&#8217; from the Main Menu). </p>
<p>The state engine takes care of nested states and transitions, and someone&#8217;s <strong>exact</strong> state in the game can be saved (if needed) by storing the entire state stack: while I&#8217;m unlikely to want the game to be saved while on the Character Create screen, it&#8217;s good to know I can safely save the game while in shops, or at any other point, without even worrying about special handling code to cover all the situations.</p>
<p>Another interesting thing I have done is move the game&#8217;s &#8220;loader&#8221; (the part that loads textures, sounds, music, fonts, databases) into it&#8217;s own state, and just made it the very first state that&#8217;s pushed onto the stack, and it takes a parameter to the state to transition to when it&#8217;s done. It takes the whole &#8216;loading&#8217; step out of the main game code, which makes that much simpler, and I can make the loader just load the resources I&#8217;m going to need right now: some other state (like the credits) can always call it again later to load specific credit-y images.</p>
<p>I can also use the the same game engine to build other tools like the Map Editor: the only difference between the map editor and the game itself is that it compiles in a different set of states: when the map editor has loaded, it launches itself into a <em>TMapEditorState</em> instead of a <em>TMainMenuState</em>.</p>
<p>Overall, having a <strong>state stack</strong> is very flexible, quite simple to use and maintain, and overall a vast improvement from the &#8216;giant case statement&#8217; I was using previously.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.paradicesoftware.com/blog/index.php/2009/10/controlling-gamestate/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>OOP Part 3: Composition</title>
		<link>http://www.paradicesoftware.com/blog/index.php/2009/10/oop-part-3-composition/</link>
		<comments>http://www.paradicesoftware.com/blog/index.php/2009/10/oop-part-3-composition/#comments</comments>
		<pubDate>Fri, 30 Oct 2009 06:05:18 +0000</pubDate>
		<dc:creator>Lawrence</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Icefall]]></category>
		<category><![CDATA[OOP]]></category>

		<guid isPermaLink="false">http://www.paradicesoftware.com/blog/?p=80</guid>
		<description><![CDATA[Last time, we looked at the inheritance style of object-oriented programming in detail. Now let&#8217;s look at the alternative: composition.
We&#8217;ll use another example from Icefall to illustrate the differences. Icefall has a central &#8216;world view&#8217; that shows the player and their immediate surroundings (items, monsters, terrain, etc). The world view also shows animations (e.g. fireballs, [...]]]></description>
			<content:encoded><![CDATA[<p>Last time, we looked at the <strong>inheritance</strong> style of object-oriented programming in detail. Now let&#8217;s look at the alternative: <strong>composition</strong>.</p>
<p>We&#8217;ll use another example from Icefall to illustrate the differences. Icefall has a central &#8216;world view&#8217; that shows the player and their immediate surroundings (items, monsters, terrain, etc). The world view also shows animations (e.g. fireballs, weapons swinging, speech bubbles, etc) and it&#8217;s the animation code that we&#8217;ll be looking at in detail today.</p>
<p>I designed this feature around each animation being a class instance, with the class methods and properties making it easy for the game engine to control the details (lifetime, location, save/load etc etc). I knew I&#8217;d have several different types of animation, so my initial implementation chucked all that &#8216;management&#8217; functionality into a <em>TAnimation</em> class, and left virtual methods for  things like <em>Process</em> and <em>Draw</em> for descendents to implement. After creating a few basic animations, my class hierarchy looked like this:</p>
<blockquote>
<pre>TAnimation
   TAnimText
      TAnimSpeech
      TAnimTexturedText
   TAnimTexture
      TAnimMissile
      TAnimExplosion
      TAnimMelee</pre>
</blockquote>
<p>Animations with text (i.e. picking up an item) were a subclass, and speech bubbles (or text with a textured background) were subclasses of that. Missiles (like fireballs) were a subclass where the animation moved from one place to another (and was rotated to face the right direction), and Explosions were in one place but had a series of animation frames over time. Melee animations showed a weapon and some motion-blur, sweeping out to attack a monster/player.</p>
<p>The problem with this system, which I discovered after adding <em>TAnimTexturedText</em> (specificially to show damage-dealt as a number on a bloodsplat-graphic background) was that most of the subtypes only varied in very small ways, and the overhead of naming, constructing and using each subtype took more effort than defining the subtype itself. Also, the &#8216;event&#8217; system I was setting up for Icefall was supposed to allow for animations to be defined dynamically in response to any spell or event (and new events added in data files without recompiling the game) &#8211; but the code that supported this was going to be very complex and ugly if it had to choose between all of the different constructors each time and pass a specific set of parameters to make it happen.</p>
<p>So, I rewrote the animation subsystem to bring any functionality that I could possibly re-use into the parent class: now, all animations had a <em>Texture</em> property, a <em>Rotate</em> property, <em>Frames</em>, <em>Movement</em>, <em>Sound</em>&#8230; which could all be left at Nil or 0 if not needed. My new, composited animation hierarchy looked like this:</p>
<blockquote>
<pre>TAnimation
   TAnimText
      TAnimSpeech</pre>
</blockquote>
<p>As soon as I did this, I found that it was not only easier to manage the sources, but that features of the parent class ended up getting used more often than I anticipated: e.g. giving an explosion a random value for <em>Rotate</em> made each explosion look slightly different, and I could apply a small <em>Movement</em> value to Text to let it &#8216;float&#8217; upwards from where it first appeared: new and useful functionality essentially for &#8216;free&#8217;.</p>
<p>Note that I kept <em>AnimText</em> separate from the parent, because there is some substantially different functionality: it has text (which directly contributes to the size and position of the anim), which is also dynamic, and there is some special logic to ensure two text animations don&#8217;t overlap each other. It made sense to move this code out into a specific class where it could be closely tweaked. Speech is different again, because there is a &#8220;speaker&#8221; creature that it it linked to: the speech bubble needs to move around with it&#8217;s speaker, disappear if they die, etc.</p>
<p>In summary, now that the <em>TAnimation</em> class is composited, it&#8217;s significantly &#8216;better&#8217; code than before:</p>
<ul>
<li>Fewer types to worry about</li>
<li>Much easier to follow the logic of the code in a single class</li>
<li>Can trivially re-use functionality developed for one subtype in others</li>
<li>Much easier for other code to utilise this class effectively</li>
</ul>
<p>So, my conclusion in this small series is:</p>
<p>Use composition in your classes, unless there is substantially different behaviour, or external code needs to interact with a specific subtype in a special way (e.g. <em>TAnimation</em> itself is inherited from <em>TWorldObject</em>, because the world view needs to interact with animations in a specific way).</p>
<p>Next time, I&#8217;ll find something different to ramble on about.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.paradicesoftware.com/blog/index.php/2009/10/oop-part-3-composition/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
