<?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>Daniel P. Wright &#187; Programming</title>
	<atom:link href="http://www.dpwright.com/category/programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.dpwright.com</link>
	<description>Portfolio and Development Commentary</description>
	<lastBuildDate>Thu, 13 Aug 2009 17:13:25 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Teesside Alumni Day</title>
		<link>http://www.dpwright.com/2009/02/28/teesside-alumni-day/</link>
		<comments>http://www.dpwright.com/2009/02/28/teesside-alumni-day/#comments</comments>
		<pubDate>Sat, 28 Feb 2009 00:16:46 +0000</pubDate>
		<dc:creator>dpwright</dc:creator>
				<category><![CDATA[Games]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.dpwright.com/2009/02/28/teesside-alumni-day/</guid>
		<description><![CDATA[The talks mentioned in my recent post have now come to pass!  All in all, the first Teesside alumni day was a success.  It was great to see everyone again and I must say I thought everyone&#8217;s talk was very interesting and thought-provoking.
We&#8217;re hoping to put a similar event on next year, hopefully [...]]]></description>
			<content:encoded><![CDATA[<p>The talks mentioned in my <a href="http://www.dpwright.com/2009/02/04/upcoming-talks-at-teesside/">recent post</a> have now come to pass!  All in all, the first Teesside alumni day was a success.  It was great to see everyone again and I must say I thought everyone&#8217;s talk was very interesting and thought-provoking.</p>
<p>We&#8217;re hoping to put a similar event on next year, hopefully bigger and more packed-out, so Teesside students watch this space.  In the meanwhile, I&#8217;ve put my slides up on my portfolio page <a href="http://www.dpwright.com/portfolio/writing/the-power-to-create/">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dpwright.com/2009/02/28/teesside-alumni-day/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Upcoming talks at Teesside</title>
		<link>http://www.dpwright.com/2009/02/04/upcoming-talks-at-teesside/</link>
		<comments>http://www.dpwright.com/2009/02/04/upcoming-talks-at-teesside/#comments</comments>
		<pubDate>Wed, 04 Feb 2009 00:34:40 +0000</pubDate>
		<dc:creator>dpwright</dc:creator>
				<category><![CDATA[Games]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.dpwright.com/2009/02/04/upcoming-talks-at-teesside/</guid>
		<description><![CDATA[I&#8217;m very excited to announce a set of talks that have been in the works for a while, namely the upcoming alumni day at the University of Teesside on February 25th.  I&#8217;ve kept pretty quiet (read: silent) about this while it&#8217;s been in planning because I haven&#8217;t known whether we&#8217;ll get the numbers / [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m very excited to announce a set of talks that have been in the works for a while, namely the upcoming alumni day at the University of Teesside on February 25th.  I&#8217;ve kept pretty quiet (read: silent) about this while it&#8217;s been in planning because I haven&#8217;t known whether we&#8217;ll get the numbers / be able to book the room / and so forth, but finally it&#8217;s all been confirmed!</p>
<p>The idea behind the event is that alumni from the University of Teesside return to give talks on topics they&#8217;ve learned about since leaving the University and entering the world of professional games development.  Unlike the typical, &#8220;This is my experience of the games industry after my first few months there&#8221; talk (one of which I gave <a href="http://www.dpwright.com/portfolio/writing/little-big-adventure-a-year-and-a-half-in-the-games-industry/">back in in May</a>), this offers the chance for alumni to talk about a topic that matters to them – whether it&#8217;s the particular aspect of games development they&#8217;ve been involved with, or a technology they&#8217;ve explored or developed, or a particular approach to design.  And, of course, it gives students an insight into aspects of games development they wouldn&#8217;t usually encounter as part of their course.  The planned talks this time round are:</p>
<ul>
<li><b><a href="http://www.dpwright.com/" target="_blank">Me</a></b>, talking about multi-platform asset and build management using <font face="monospace">make</font> and other UNIX tools.</li>
<li><a href="http://www.pjblewis.com/" target="_blank"><b>Peter J. B. Lewis</b></a>, talking about working as a programmer in middleware, based on his experience at Geomerics in Cambridge.</li>
<li><a href="http://theseus314.gibbering.net/" target="_blank"><b>Luke Nockles</b></a>, covering a variety of aspects of design, including game design, level design, and HUD and UI design.</li>
<li><a href="http://essell.org/journal/index.php" target="_blank"><b>Steve Lee</b></a>, talking about the role of design, getting a job in the industry, the meaning and value of elegance, and games as education / art.</li>
</ul>
<p>There&#8217;ll also be a panel at the end which will likely focus on our early experiences in the industry but will be pretty open, so we&#8217;ll just go in whichever direction questions take us.</p>
<p>I&#8217;m really excited about this event and I hope that, if it&#8217;s a success, it can become an annual affair.  Naturally I&#8217;ll be putting my slides up on this website once I&#8217;ve given the talk, so anyone who makes it should be able to find them on the <a href="http://www.dpwright.com/portfolio/">portfolio page</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dpwright.com/2009/02/04/upcoming-talks-at-teesside/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>I can make you a star</title>
		<link>http://www.dpwright.com/2008/03/11/i-can-make-you-a-star/</link>
		<comments>http://www.dpwright.com/2008/03/11/i-can-make-you-a-star/#comments</comments>
		<pubDate>Tue, 11 Mar 2008 10:38:48 +0000</pubDate>
		<dc:creator>dpwright</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.dpwright.com/2008/03/11/i-can-make-you-a-star/</guid>
		<description><![CDATA[I&#8217;ve recently been moved across to a new project, one which I&#8217;m enjoying immensely.  It has two properties which make its development particularly interesting: it is massively data-driven, and it is being developed across a multitude of platforms (five at last count).  In order to accomplish this feat we are using make.
make, and [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve recently been moved across to a new project, one which I&#8217;m enjoying immensely.  It has two properties which make its development particularly interesting: it is massively data-driven, and it is being developed across a multitude of platforms (five at last count).  In order to accomplish this feat we are using <a href="http://www.gnu.org/software/make/" target="_blank"><font face="monospace">make</font></a>.</p>
<p><font face="monospace">make</font>, and the UNIX-style command line environment it typically utilises, is often forgotten or even scorned by programmers studying games-specific courses, or even some of those I&#8217;ve met in the industry itself.  We&#8217;ve become used to IDEs which enable us to drag and drop files, edit them, compile, run and debug all in the same window.  These have their advantages: the initial learning curve is much shallower, and they can deliver a tightly integrated experience (which is rather the point).  They have their disadvantages too, however, and console-driven build management tools like <font face="monospace">make</font> shouldn&#8217;t be discarded out of hand.</p>
<p><span id="more-62"></span>Each of the platforms we&#8217;re working with at the moment has an IDE associated with it: Microsoft platforms use Visual Studio .NET, while Sony and Nintendo both have CodeWarrior compilers set up, as well as their own alternatives.  It&#8217;s quite easy to build and maintain a project / environment / solution for each individual platform, but running five concurrently is a different matter entirely.  You know the story: somebody creates a new file and forgets to add it to all the different project files, or they write some code and check it in after compiling for one platform, not realising that it breaks the build on some of the other platforms&#8230; and so on.  We&#8217;ve all experienced it in one way or another; most of us have been guilty of it at least once or twice. And with five different IDEs to load up and hit &#8220;compile&#8221;, who can blame us? Every check-in becomes a chore, which leads to fewer check-ins overall, which leads to difficult merges and difficult-to-track revisions.</p>
<p>One problem with using IDEs for cross-platform development is that they force you into a certain way of setting up your build.  Sure, they try to add some flexibility with pre- and post- build steps, but if you want to do anything other than a simple compile it all gets a bit voodoo.  <font face="monospace">make</font> simply lets you run shell commands, meaning that it is not restricted to doing things in a particular order, to using a particular compiler, or even to compiling a particular language!  The same makefile could compile C/C++ source files, link them into an executable, and run LaTeX over any .tex files it comes across, generating beautifully formatted documentation.</p>
<p>Indeed, this flexibility means <font face="monospace">make</font> need not be limited to building the application executable.  It can also process asset data ready for transferral to disc.  Each platform will typically have its own texture format which is optimised for that platform specifically, and may have native formats for other media such as mesh data, videos, and audio streams. It pays to use these formats if possible, and <font face="monospace">make</font> makes this pretty easy.  It can be set up to handle all conversion, and move the new native-format files to the correct location in the directory structure.</p>
<p>Often this sort of asset processing is done using a custom tool written to do the job; typically a GUI tool written in C# or Python.  Consider coding such a tool in C#, for example.  It&#8217;s not difficult, but it would involve an unnecessary amount of work to accomplish something really quite simple. Python may be better &#8212; indeed, another build system, <a href="http://www.scons.org/" target="_blank"><font face="monospace">scons</font></a>, is built upon it &#8212; but writing a full GUI tool from scratch seems like a waste of effort when what we&#8217;re trying to achieve is an automatic tool; one which requires as little user interaction as possible.</p>
<p><font face="monospace">make</font> allows us to set up dependencies to automate the conversion of asset files and move them into the correct place with ease.  In addition to that, it will only perform these conversions if the source file has changed, which is a massive boon when you consider the length of time it takes to convert, say, video assets.</p>
<p><a href="http://www.gnu.org/software/make/manual/" target="_blank">There are plenty of places</a> to learn <font face="monospace">make</font>, so I won&#8217;t go into the details of how to use it here, but for those reading who&#8217;ve never coded outside of Visual Studio, I urge you to take a look at <font face="monospace">make</font> and see what it can do for you.  Indeed, get ahold of <a href="http://cygwin.org/" target="_blank">Cygwin</a> and familiarise yourself with it.  The command line is far from dead, and as you learn how to take advantage of its many powerful features, you&#8217;ll likely find it changes the way you work.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dpwright.com/2008/03/11/i-can-make-you-a-star/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Method Programming</title>
		<link>http://www.dpwright.com/2008/02/09/method-programming/</link>
		<comments>http://www.dpwright.com/2008/02/09/method-programming/#comments</comments>
		<pubDate>Sat, 09 Feb 2008 17:43:17 +0000</pubDate>
		<dc:creator>dpwright</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.dpwright.com/2008/02/09/method-programming/</guid>
		<description><![CDATA[Obviously: I&#8217;m a programmer; My primary programming language is C++; I like Object-Oriented stuff, like neat design patterns and small discrete modules and aggregate components and things. Obviously a post entitled &#8220;Method Programming&#8221; is going to be about programming class methods to maximum effect, right? Perhaps about reducing the size and increasing the number of [...]]]></description>
			<content:encoded><![CDATA[<p>Obviously: I&#8217;m a programmer; My primary programming language is C++; I like Object-Oriented stuff, like neat design patterns and small discrete modules and aggregate components and things. Obviously a post entitled &#8220;Method Programming&#8221; is going to be about programming class methods to maximum effect, right? Perhaps about reducing the size and increasing the number of methods, for clarity. Maybe I&#8217;ll go totally zany and start talking about how non-member, non-friend functions are the bees&#8217; knees, or how protected member variables shouldn&#8217;t be allowed (both ideas I&#8217;ve picked up from articles by <a href="http://www.gotw.ca/" target="_blank">Herb Sutter</a> and <a href="http://www.aristeia.com/" target="_blank">Scott Meyers</a>, by the way, not my own crazy filth).</p>
<p>But no, that&#8217;s not it. Actually what I&#8217;m talking about is this&#8230;</p>
<p align="center"><a href='http://www.dpwright.com/wp-content/uploads/2008/02/wrk-env-masked.jpg' target='_blank' title='Work Environment'><img src='http://www.dpwright.com/wp-content/uploads/2008/02/wrk-env-masked.th.jpg' alt='Work Environment' /></a></p>
<p><span id="more-58"></span>
<p>That&#8217;s a screenshot of my working environment at Zoë Mode (the code itself is masked out using a simple regex). I do most of my work in <a href="http://www.vim.org/" target="_blank">Vim</a> running under <a href="http://cygwin.com/" target="_blank">Cygwin</a> across both my monitors. I&#8217;ve installed <a href="http://www.nongnu.org/ratpoison/" target="_blank">ratpoison</a> so that I can utilise all the screen space available to me, as well as cut down on mouse usage.</p>
<p>All that is fascinating, I&#8217;m sure. But the interesting thing about this screenshot probably isn&#8217;t the software or the environment. It&#8217;s probably the fact that everything&#8217;s <font color="pink"><b>pink</b></font>. Yes, my xterm is set to a pink background, vim uses that default background &#8211; I&#8217;ve even set Windows to use the &#8220;Rose&#8221; theme packaged with it, with some minor tweaks to make it a bit pinker. Why would I do this? Why would I subject myself to near-fatal levels of pinkery? The answer, my dear Watsina, is elementary. I&#8217;m simply <em>getting into character</em>.</p>
<p>Method acting is a well-known technique practiced by many actors including Robert de Niro, Al Pacino, Marlon Brando, and some others who weren&#8217;t in Mafia films. <a href="http://en.wikipedia.org/wiki/Method_acting" target="_blank">Wikipedia</a> describes it as &#8220;an acting technique in which actors try to replicate real life emotional conditions under which the character operates, in an effort to create a life-like, realistic performance.&#8221;</p>
<p>The game I&#8217;m working on at the moment is aimed toward the young female market. You see where I&#8217;m going with this? That&#8217;s right, through making my computer almost entirely pink, I hope to arrive at a deeper understanding of what it means to be a young girl. It means pink, apparently.</p>
<p>Here&#8217;s hoping I don&#8217;t find myself working on <i>GTA</i> any time soon&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dpwright.com/2008/02/09/method-programming/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>New everything</title>
		<link>http://www.dpwright.com/2008/01/07/57/</link>
		<comments>http://www.dpwright.com/2008/01/07/57/#comments</comments>
		<pubDate>Sun, 06 Jan 2008 23:32:00 +0000</pubDate>
		<dc:creator>dpwright</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.dpwright.com/2008/01/07/57/</guid>
		<description><![CDATA[It&#8217;s been an interesting and exciting first month, settling into life in Brighton and working at Zoë Mode. I&#8217;m working on a cross-platform title for Wii and PS2 which has a small team and a short development cycle. In some ways this is nice, and close to what I&#8217;ve been used to during my time [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s been an interesting and exciting first month, settling into life in Brighton and working at Zoë Mode. I&#8217;m working on a cross-platform title for Wii and PS2 which has a small team and a short development cycle. In some ways this is nice, and close to what I&#8217;ve been used to during my time at Virtual Playground, but there are some very definite differences! The most dramatic of these is probably the experience of working for console rather than PC. I&#8217;d never appreciated just how limited these machines are, especially with regard to memory. That and the lack of an operating system make for quite a different coding experience.</p>
<p>It&#8217;s nice though; fun. You get the feeling you&#8217;re much more &#8220;close to the metal&#8221;, and you have to be much more aware of the machine&#8217;s resources.</p>
<p>Of course, the other major thing that&#8217;s happened is Christmas and New Year. This year &#8211; or I should say last year, on December 31st &#8211; I went to <a href="http://www.youtube.com/watch?v=NlncBd0EzlU" target="_blank">Oxford Services</a> for the annual Oxford Services New  Years Eve celebrations! <span id="more-57"></span>Started a few years ago by <a href="http://walkinginairports.blogspot.com/" target="_blank">Dave Shearn</a>, this small gathering of friends grew this year to include <b>59</b> attendees (and a puppet). Shearn&#8217;s dream is that at least once every year we will have the opportunity to see all of our friends. It&#8217;s a lovely idea, and our Welcome Break certainly made for a great way to round off the year. I saw some old friends, and I met some new ones &#8211; whom I look forward to seeing again next year at Oxford Services.</p>
<p><center><img src='http://www.dpwright.com/wp-content/uploads/2008/01/oxford_services.jpg' alt='Oxford Services' /></center></p>
<p>I did make one New Year&#8217;s Resolution this year, though I only thought to make it on the 4th, and that involved keeping closer track of my money. That doesn&#8217;t necessarily mean spending less, I should note, just being more aware of where my spending tends to fall, and perhaps using that awareness to redirect it toward more productive endeavours. With this in mind I&#8217;ve installed <a href="http://www.gnucash.org/" target="_blank">GnuCash</a>, and I&#8217;ve been playing with it the past few days. It&#8217;s a reasonably nice piece of software &#8211; while not as powerful as the tool my mother uses, Quickbooks, or other tools such as Quicken or Microsoft Money, it seems to suit my purposes quite well. Since <a href="http://www.dpwright.com/2007/10/21/machine-death/">my desktop broke</a> I&#8217;ve been using my laptop most of the time, on which my primary OS is Ubuntu Linux, so those packages weren&#8217;t really an option anyway.</p>
<p>As a result of all this, I&#8217;ve found that managing ones personal finances is not unlike playing a <a href="http://en.wikipedia.org/wiki/Economic_simulation_game" target="_blank">Resource Management Game</a> such as <a href="http://simcity3000unlimited.ea.com/us/guide/" target="_blank">SimCity</a>. This makes perfect sense, of course, since these games are designed to simulate real-world economics &#8211; nevertheless, I hadn&#8217;t quite looked at it that way before. It&#8217;s really quite rewarding manipulating my budget to accommodate different things, and trying to improve my high score offers the real-world benefit of also increasing my wealth!</p>
<p>The only rather annoying thing about GnuCash is its reports system. If you want to define a new report other than those templates that come with the application, you have to write a script to generate it in <a href="http://en.wikipedia.org/wiki/Scheme_%28programming_language%29" target="_blank">Scheme</a>. This is not a trivial task; one of the sample reports weighs in at 521 lines &#8211; and Lisp-variants are supposed to be eloquent! On the bright side, the reports that come with GnuCash are really very good, but I do occasionally come across functionality that would be easy to implement were I using a spreadsheet, but which are a pain to try and wedge into GnuCash. Maybe I&#8217;ll come up with some solutions as I get more use out of the program in the coming months, but either way it&#8217;s a nice piece of software.</p>
<p>The other thing I spent my Christmas break doing was helping my Dad with <a href="http://www.paulwrightjewellery.com/" target="_blank">his website</a>. This got me back into web design, or rather, programming for websites. I was using <a href="http://www.zencart.com/" target="_blank">Zen-Cart</a>, which is written in PHP, but what I really want to learn now is <a href="http://www.ruby-lang.org/en/" target="_blank">Ruby</a>. It&#8217;s cool, glamorous, and everyone&#8217;s using it, which are rubbish reasons &#8211; but hey, it&#8217;s a hobby. It does look really nice though! I particularly like its stance on typing &#8211; <a href="http://en.wikipedia.org/wiki/Duck_typing" target="_blank">duck typing</a> is an idea I&#8217;ve been growing to like more and more recently without having heard the expression, since it&#8217;s essentially what C++ offers through templates, though C++ does it with <a href="http://www.boost.org/boost/regex/v4/sub_match.hpp" target="_blank">a lot less style</a>. I&#8217;m really intrigued to see how Ruby feels to use, since it was designed with this style of programming in mind. At the same time, I would feel a lot less safe doing this sort of thing within an interpreted environment. One thing I love about templates is that they are a <b>compile-time</b> flexible typing mechanism.</p>
<p>We&#8217;ll see how it goes&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dpwright.com/2008/01/07/57/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>&lt;/teesside&gt;&lt;virtual-playground&gt;</title>
		<link>http://www.dpwright.com/2007/09/16/38/</link>
		<comments>http://www.dpwright.com/2007/09/16/38/#comments</comments>
		<pubDate>Sun, 16 Sep 2007 14:00:58 +0000</pubDate>
		<dc:creator>dpwright</dc:creator>
				<category><![CDATA[Games]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.dpwright.com/2007/09/16/38/</guid>
		<description><![CDATA[Well, my University life is over, I&#8217;m no longer a student, and I&#8217;m staggering, blinking, into the light, arms open and ready to embrace the Real World. In fact, the transition hasn&#8217;t been so difficult. I started work back at Virtual Playground &#8211; the company where I completed my industrial placement &#8211; almost immediately upon [...]]]></description>
			<content:encoded><![CDATA[<p>Well, my University life is over, I&#8217;m no longer a student, and I&#8217;m staggering, blinking, into the light, arms open and ready to embrace the Real World. In fact, the transition hasn&#8217;t been so difficult. I started work back at <a href="http://www.dpwright.com/portfolio/virtual-playground/">Virtual Playground</a> &#8211; the company where I completed my industrial placement &#8211; almost immediately upon completing my course. Nothing had really changed in the year I&#8217;d been gone, so I was able to hit the ground running, already familiar with the codebase and the toolchain used there. We completed <a href="http://www.dpwright.com/portfolio/virtual-playground/prison-tycoon-3/">Prison Tycoon 3</a>, and then moved on to do some refactoring concurrently with our next project.</p>
<p>Probably the biggest part of this refactoring effort has been the move to an aggregation-driven object system. That is, up until now we&#8217;ve had a classic deep hierarchy, adding functionality by deriving new classes, pushing functionality further up the hierarchy when we need to share it, and so forth. This <a href="http://www.gamearchitect.net/Articles/GameObjects1.html" target="_blank">is</a> <a href="http://c2.com/cgi/wiki?CompositionInsteadOfInheritance" target="_blank">not</a> <a href="http://www.drizzle.com/~scottb/gdc/game-objects.htm" target="_blank">ideal</a>. We&#8217;ve been told time and again how composition is more effective, more flexible, and generally safer than inheritance. Many of us are already comfortable with the inheritance-driven model, though, and are used to working with it and finding ways round its flaws.</p>
<p><span id="more-38"></span>Since reading Mick West&#8217;s March 2006 article in gamedeveloper magazine, &#8220;Evolve Your Hierarchy&#8221;, I&#8217;ve wanted to try out composite object systems, and see how much extra flexibility they give you, and whether usability suffers as a result. I was finally given the opportunity a month ago, when I was asked to take our existing inheritance-driven hierarchy (from basic objects that can load and save down to AI-driven characters that can make decisions, have FSMs, pathfinding, and spline-following capabilities), and start writing aggregate equivalents. Since the current title is quite simple I&#8217;ve only had to replicate a limited subset of the functionality that existed in our original system, giving me more time to focus on the design issues involved.</p>
<p>We&#8217;ve gone for what West calls a &#8220;Component Container&#8221; in his article, whereby we still have the idea of a game <b>Entity</b> as a concrete object, to which we can attach <b>Behaviours</b>. These Behaviours consist of small, very specific classes adding a particular function to the Entity. We&#8217;ve tried to be quite strict about limiting the scope of their abilities &#8211; if a Behaviour gets too hefty we split it up into two separate Behaviours. So far it&#8217;s been very successful. We&#8217;ve been able to replicate all the functionality we&#8217;ve needed so far from the old system, and we quickly got used to the idea of creating a new Behaviour and attaching it, rather than creating a new class and deriving it. We&#8217;ve taken the old object factory, which allowed artists to specify how the objects they were adding to the game should act, and added the notion of Behaviours &#8211; so objects of each type have a set of default Behaviours, after which more can be attached to extend functionality for that item in particular.</p>
<p>The main difficulty we&#8217;ve come across is communication between these Behaviours. In an ideal world, the Behaviours would be entirely self-standing, and we could simply depend upon their standard <kbd>clone()</kbd>/<kbd>init()</kbd>/<kbd>update()</kbd> interface to run themselves. Tragically, the world is not ideal: the Animation Behaviour will need access to the mesh in order to animate it, but the mesh is stored within the SceneNode Behaviour. The FSM Behaviour (when we write it) will need to tell the PathFind Behaviour where to go, will need to pass the path found by PathFind to the SplineFollow Behaviour, will need to tell the Animation Behaviour to start the walk animation, and will need to update the position of the SceneNode. There is a lot of intercommunication. So far, we&#8217;ve been fairly flexible about giving access to Behaviours &#8211; they can be retrieved from the Entity storing them, and since each Behaviour has a handle to its parent Entity they can be accessed from within or without.</p>
<p>All in all, I&#8217;d highly recommend this style of object composition. It&#8217;s easy to use, and quite intuitive for those of us coming from an inheritance-oriented background. After a while, you realise that the Entities are not really necessary; a component manager could be used to store a variety of Behaviours which have an entity ID to describe how they fit together, in what West calls &#8220;Pure Aggregation&#8221; in his article. The Entities in our system essentially act as localised component managers. West recommends this as an intermediate solution, and to a degree I agree &#8211; the purely aggregate system has an abstract and simple beauty to it, and is incredibly flexible and powerful. However, the idea of concrete Entities can be a useful one, and I think so long as we are limiting this system to in-game objects (as opposed to all game functionality, including scripts and triggers, etc.) we will probably keep them.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dpwright.com/2007/09/16/38/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
