<?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>Electronic Space Nintendo &#187; Game dev &amp; design</title>
	<atom:link href="http://www.doomsday.no/esn/category/game-dev-design/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.doomsday.no/esn</link>
	<description>Video games, Weirdness, Adobe Flash, Android, Music, and TLDR</description>
	<lastBuildDate>Tue, 06 Dec 2011 00:47:20 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Thoughts on Microsoft&#8217;s 2011 E3 keynote</title>
		<link>http://www.doomsday.no/esn/2011/06/thoughts-on-microsofts-2011-e3-keynote/</link>
		<comments>http://www.doomsday.no/esn/2011/06/thoughts-on-microsofts-2011-e3-keynote/#comments</comments>
		<pubDate>Mon, 06 Jun 2011 21:26:02 +0000</pubDate>
		<dc:creator>Andreas</dc:creator>
				<category><![CDATA[Game dev & design]]></category>
		<category><![CDATA[Rants]]></category>
		<category><![CDATA[E3 2011]]></category>
		<category><![CDATA[Kinect]]></category>
		<category><![CDATA[Mass Effect 3]]></category>
		<category><![CDATA[Microsoft]]></category>

		<guid isPermaLink="false">http://www.doomsday.no/esn/?p=1292</guid>
		<description><![CDATA[I&#8217;m trying my best to reconcile my blistering rage regarding Microsoft&#8217;s application of the Kinect versus my amazement at the hardware itself. It&#8217;s hard to argue with impressive technology, but from watching today&#8217;s white-knuckled attempt at convincing gamers that the Kinect experience is a match made in heaven with traditional gaming, I had to take [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m trying my best to reconcile my blistering rage regarding Microsoft&#8217;s application of the Kinect versus my amazement at the hardware itself. It&#8217;s hard to argue with impressive technology, but from watching today&#8217;s white-knuckled attempt at convincing gamers that the Kinect experience is a match made in heaven with traditional gaming, I had to take a long walk around the block and listen to several creepily relaxing self-help tapes to bring my blood out of a boiling state.<span id="more-1292"></span></p>
<p><strong>Microsoft and its partners are making babbling cavemen out of people</strong>, and trying to sell it as though it is the future. It goes right against everything I feel is central to being a modern human being, so much so I actually feel it&#8217;s an anti-human movement to try and spread this philosophy among consumers.</p>
<p>Language is about symbols. Words are a mechanism for describing a symbol, and the spoken word is a physical abstraction. Throughout human history the ability to convey concepts and ideas effectively have been at the vanguard of the evolution of human society; The ability for a people to carry and learn from their history is why we are where we are today. The abstraction of symbols and the ability to argue their meaning is literally what separates man from other animals, and as we&#8217;ve become more and more modern, the natural evolution is one of further abstraction; The evolution of language has been about efficiency and precision, and in generalizing language to the point where the symbols themselves need little translation to be understood across borders. In spite of all snobbery, the smiley face is a genius invention of written language, and it happened organically. A symbol for sarcasm, for disdain, for sadness. You can convey so much information with so little effort.</p>
<p>Programming is a wonderful metaphor as well, giving you not only the power to engineer complicated mechanisms from symbols, must allows you to define the symbols for yourself. It&#8217;s an art of pure language, and every seasoned developer knows the typed words are a means to an end; The more you do it, the less you want to type. You just want to get right at those symbols and <em>craft</em>.</p>
<p>Controllers are a generalized, <strong>efficient method of interacting with the symbols of the virtual game space</strong>. The symbols of alphabetized buttons, the control stick and the digital pad have, with the history of video game culture, matured to the point where a player versed in the symbology can make assumption as to their meaning within a given context. When Halo revolutionized the twin-stick control scheme now common to first person games on consoles, it was the dawn of a new dialect. A new configuration of known symbols that would enter our common language.</p>
<p><strong>There is a purity, a beauty to the evolution of the game controller</strong>, because it has evolved alongside the demands of game developers and game players, with occasional mutations bringing about change. If you want signs of true divergence between the major players in the console scene, look no further than how they have handled their controllers. Whenever a new system comes out, the question is always; How will we talk to it? For me, personally, the hope is always that the controller will become less noticeable, for the sake of immersion. I want a beautiful, seamless experience.</p>
<p>But the Kinect is an absolute aberration in this regard. <strong>Never in the history of video games have players yearned for less responsiveness, less feedback, and more exertion</strong>, yet Microsoft seem to think removing nearly every sense that makes us human is the future of immersion. The idea that taking  the player&#8217;s physical space into the virtual brings an experience closer to reality is an absolute insanity, because as much as the brain wants to make the body believe, the body simply will not. Ask a piano player to play a beautiful piece of music on a piano that plays the keys 100 milliseconds after they are hit. No matter how much mental conditioning you go through, the shift in perception will never, EVER make for a natural experience.</p>
<p><strong>But the latency</strong> is the innocent tip of the treacle-slow iceberg of hopeless bullshit Microsoft are attempting to foist on us. Voice control, another fallacy and fantasy of hopeless technicians and scientists without a vibrant soulful bone in their bodies, not only drags us kicking and screaming back to the spoken word, but it actually makes the spoken word worse. You are now expected to speak in a stilted made-up inhuman <em>dialect </em>that would only be made acceptable if it came from a particularly excellent Christopher Walken impersonator.</p>
<p>Today&#8217;s Star Wars Kinect demo, where a player shouts in an unnaturally enunciated voice, &#8220;light saber, on!&#8221;, sums up <strong>the futility of the spoken word in a context where tactile response and immediacy is the key</strong> to every possible shred of immersion the experience has to offer. Bioware&#8217;s demo of voice recognition in Mass Effect 3 was a staggering display of stupidity; Who are these blithering idiots who believe I want to introduce even an lighting flash of a second&#8217;s worth of my own physical body into a video game role playing experience? Stephen Totilo asks; What if I&#8217;m playing a female character? Consider too that you are holding the controller in your hands as you are expected to say these words, in the slow enunciated fashion the technology requires. You are a BUTTON PRESS away from making a statement and getting on with your life, immersion intact.</p>
<p>(It&#8217;s all I can do not to break down and lose faith altogether. I thought game developers and designers were smart people! When I was a kid I thought those guys and gals were wicked space wizards who wanted nothing more than to blow my fucking mind, and here you are, making yourself, and your audience, look like bumbling morons. Game developers need to take a stand here.)</p>
<p>But Kinect goes below and beyond perverting an art form. As designers make moves to craft custom experiences that &#8220;make the most of the hardware&#8221;, the true weakness, and true evil of the technology, becomes apparent: <strong>There is not a single Kinect-centric experience now, or upcoming, that does not reduce its users to cave men.</strong> Without fingers, a sense of touch, a sense of feedback, and without the ability to even communicate like normal human beings in the language of our choice, Kinect reduces us to invalids, unable to attain mastery beyond the confines of a technology that operates primarily on guesswork and heuristics.</p>
<p>Kinect is a devolving necromancy,  old discarded tissue brought back like a cancer to slowly poison a beautiful, pure language that has evolved organically since the very beginning of the industry. While I love working and playing with the hardware on my PC, as a gamer for most of my life, and especially as someone who loves language, I fucking hate the Kinect so, so much, and everything it stands for. It&#8217;s fucking vile. If there is any Darwinistic justice, this experiment will be aborted and discarded like the weakening mutation it is.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.doomsday.no/esn/2011/06/thoughts-on-microsofts-2011-e3-keynote/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>My $.2 on Android dev vs iPhone dev</title>
		<link>http://www.doomsday.no/esn/2011/02/my-2-on-android-dev-vs-iphone-dev/</link>
		<comments>http://www.doomsday.no/esn/2011/02/my-2-on-android-dev-vs-iphone-dev/#comments</comments>
		<pubDate>Fri, 18 Feb 2011 16:42:48 +0000</pubDate>
		<dc:creator>Andreas</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Game dev & design]]></category>
		<category><![CDATA[Thoughts]]></category>

		<guid isPermaLink="false">http://www.doomsday.no/esn/?p=1269</guid>
		<description><![CDATA[I&#8217;ve recently had the good fortune of reaching the point where my Java proficiency is such that I&#8217;m finally able to create something, rather than just poke at the language and see what it does. It&#8217;s been a while since I felt like I could actually speak a new language, and the process has been [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve recently had the good fortune of reaching the point where my Java proficiency is such that I&#8217;m finally able to create something, rather than just poke at the language and see what it does. It&#8217;s been a while since I felt like I could actually speak a new language, and the process has been incredibly inspiring! From meekly putting some buttons on screen and going through the (excellent) Android developer guide to familiarize myself, I&#8217;m finally building a framework for making actual games, and I&#8217;ve begun coding creatively. It&#8217;s almost intoxicating. I had a moment last night with a glass of Stolichnaya, a warm blanket and a ~55fps blitted multitouch particle system where I realized to my horror that I have fallen in love with Java. My nerd circle is complete!</p>
<p>I have a certain disdain for Apple&#8217;s policy of developer lock-in, as well as their entire [<em>blahblahblah catch up with this with me over a beer sometime</em>], so for me the idea of investing so heavily in iOS development was never of any interest. I&#8217;m not enchanted with the philosophies that drive objective C, being firmly in the C++ camp, so iOS &#8220;development&#8221; for me has been limited to design discussions and project planning with my friends who do enjoy working on that platform. I want to stress out that while i think Apple can [<em>Escher-like construction of interwoven expletives</em>], their hardware is good, and their design philosophy is excellent. I&#8217;ve been an iPhone owner since the 3GS, and I&#8217;ve played a surprising amount of really good games on the platform. It&#8217;s solid.</p>
<p>I haven&#8217;t played a lot of good games for Android. It doesn&#8217;t feel solid.</p>
<h3>Which is better?</h3>
<p>The discussion invariably becomes a &#8220;which is better&#8221; question: Should I get an iPhone? Should I get an Android device? From the perspective of one &#8220;indoctrinated&#8221; to expect Apple-level polish at the expense of features, Android&#8217;s good sides will be invisible because you don&#8217;t think to look, and its bad sides will be staring you in the face from the get go; Android as an operating system simply <em>feels</em> less responsive. So obviously (literally), iOS is the stronger platform, right? Given the presumption that every Android device is an iPhone competitor, then you may have a strong argument.</p>
<p>However, at this junction, being a Flash developer with a new found fascination for Java and a better understanding of the Android platform, I don&#8217;t find myself able to make such a direct comparison. In fact, I think it&#8217;s practically invalid; The definition of an &#8220;Android device&#8221; at this point is incredibly open. Your application, in a single deployment, can theoretically target everything from a tiny-screened uncomplicated Sony Ericsson Xperia X10 Mini to the Samsung Galaxy Tab. You may expect to have access to a joystick, hell, with the Xperia Play, you can expect dual analog sticks. You can assume a single touch screen, or any sort of multitouch input. You MAY be working on a phone.. You may be working on the dashboard of a car. </p>
<p>Android is a very wide canvas, and I feel the idea that Android and iOS are implicit competitors is a misunderstanding. </p>
<p>I believe that an Android developer, to be successful, has to reach a very wide audience, not only in terms of software appeal, but also in terms of hardware optimization; The design must pre-empt a wide array of edge cases. It&#8217;s a complicated, arduous task, but the reward, I feel, is that same fuzzy warm feeling I get when a Flash application&#8217;s UI flows with the window size. The feeling that your bases are covered. The feeling that you&#8217;ve engineered a flexible machine. </p>
<p>And my real argument here is that designing for iPhone with the assumption that you can port painlessly to Android is a grave mistake.</p>
<h3>Scale down, not up</h3>
<p>At this point, having written an Android app that scales to a subset of devices you are happy with, what&#8217;s stopping you from porting to the iPhone with a minimum of change to your design? iPhones have a couple of configurations and little to no change in input capabilities; The biggest in recent times is the addition of the gyroscope with the iPhone 4, easily omitted for the 3G/S at the cost of fidelity, but no actual capability lost. In contrast Android devices have many dozens and more coming, and few input capabilities you can count on. </p>
<p>Being a Flash developer, I&#8217;m arrogantly going to assume you are one as well: You are already versed in designing applications with a variable canvas size. You are already used to optimizing to overcome crappy end-user hardware. Designing for a range of Android devices that are comparable to the iPhone will let you write in a language very similar to the one you know, typically with much better performance than you&#8217;d expect unless you are forgetting your optimizing lessons. Summary: You already know how to do this shit! </p>
<p>When your application is done and deployed, take it to someone else to get it ported, or use the porting as an excuse to learn iOS dev; Java is a very generic language, the API is uncomplicated enough that parallels can be found on most platforms, and if you are a game developer in particular, you&#8217;ll barely be using any of the OS-specific integration anyway. Port DOWN to iPhone, which is the more complicated platform but with a better known configuration. Don&#8217;t write your iOS application and expect your design to work within the flowing canvas of the Android platform, because they simply are not the same. But the iPhone is in actuality <em>the lowest common denominator</em>.</p>
<p>I see too many people wanting a cross platform framework for smartphone application dev to, I guess, &#8220;make the most money&#8221;, and some have found success with stuff like Corona. But this is a compromise layered on a compromise. I personally could never feel comfortable with such an attitude, because it not only undersells the platforms you are targeting, but it compromises your design in a way I feel is unnecessary. It also locks you into yet <em>another </em>platform, with <em>another</em> language. How low are you willing to go for a quick buck, guy?</p>
<h3>Fun times!</h3>
<p>My first Android game targets the Galaxy S in particular. It&#8217;ll be free, and will work wonderfully on all comparable devices. It&#8217;s a great learning process. 50fps multitouch accelerometer gravity party-time! It will also be ported to the iPhone when it&#8217;s done and tested. That&#8217;ll be programming and optimizing work. At this point, I&#8217;m having fun just playing. </p>
<p>If you&#8217;re a Flash developer in doubt, for what this is worth, I really must recommend getting a decent spec Android phone and getting into developing for it before letting Apple shackle you to their platform in a way that denies you flexibility of deployment. Working natively on a device like the Galaxy S is a total joy; This thing is so full of fun sensors and fancy junk, it&#8217;s kind of mind-blowing how little you must do before you&#8217;re integrating it all into an experience. And you can take that experience to iOS later, when it&#8217;s ready for it.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.doomsday.no/esn/2011/02/my-2-on-android-dev-vs-iphone-dev/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Finite state machine, J&#8217;adore</title>
		<link>http://www.doomsday.no/esn/2011/01/finite-state-machine-jadore/</link>
		<comments>http://www.doomsday.no/esn/2011/01/finite-state-machine-jadore/#comments</comments>
		<pubDate>Wed, 12 Jan 2011 15:37:36 +0000</pubDate>
		<dc:creator>Andreas</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[Game dev & design]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[patterns]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[semicolons]]></category>

		<guid isPermaLink="false">http://www.doomsday.no/esn/?p=1191</guid>
		<description><![CDATA[I tend to program in a results-first orientation, which means I often simply don&#8217;t find the time or benefit in implementing design patterns or frameworks such as PureMVC or Robotlegs, or even less complex ones. This is not because these patterns are without merit (quite the contrary), but because in my experience the scale and [...]]]></description>
			<content:encoded><![CDATA[<p>I tend to program in a results-first orientation, which means I often simply don&#8217;t find the time or benefit in implementing design patterns or frameworks such as PureMVC or Robotlegs, or even less complex ones. This is not because these patterns are without merit (quite the contrary), but because in my experience the scale and complexity an application will have to be at is quite high for it to necessitate such patterns, which introduce complexity in and of themselves. This includes introducing what you could call &#8220;foreign grammar&#8221; into a more natural dialect. Robotlegs in particular introduces so many new words, to a beginner it may feel like learning a new language altogether. This would, I feel, often get in the way of simply getting the job done, not to mention having to explain the framework to whoever comes next to maintain the project.</p>
<p>But this post is not about complex patterns. It&#8217;s about a very simple one; The first one I learned that used several classes as well as interfaces. Somewhat infamously at this point, I&#8217;m notoriously fond of interfaces and the freedom they offer the developer -which is ironic, because they are about limitations and requirements- and if you want to trace that love to its inception, the &#8220;finite state machine&#8221; is it. <span id="more-1191"></span></p>
<h2>What is a state machine?</h2>
<p>A state machine is a complex (but cool sounding) term for an object that can be in <em>one</em> of a <em>limited selection</em> of states. The typical example is the light switch: It can be in two states; on or off. The light-bulb can be lit or dark. The power can be up or down. Maybe you have poor wiring; the power can be fluctuating as well, a third state. In fact, as a Flash developer, you have probably been working with states and finite state machines ever since you first started playing around with the Flash IDE.  MovieClips are nothing but state machines where every frame is a state. A MovieClip of a walk cycle animation contains a state in which the character&#8217;s left foot is touching the ground. It can also be in a state where the left foot is lifted.</p>
<p>If this sounds like I&#8217;m overstating the obvious, I really am. A basic state machine is an exceedingly simple concept. Where state machines begin to shine however is in the concept of &#8220;transitions&#8221;.</p>
<h2>What is a transition?</h2>
<p>A transition is, as you&#8217;ve guessed, the proceedings that take place when a state machine changes its state. We don&#8217;t <em>need</em> transitions for a state machine to fulfill its purpose, but they are very powerful. A rule that is important to reiterate is that a state machine can <em>only ever be in one state, </em>and it&#8217;s this rule that offers one of the core benefits of the pattern; A sense of clarity.</p>
<p>(In this way programming is like maths to me. You know that 1+1=2, and that is a <em>fact of the universe</em>. Doesn&#8217;t it feel great to have such a solid grasp of reality?)</p>
<p>So given that a state machine can only ever be in one state, how would we change that state? Let&#8217;s go with the MovieClip example for now. Let&#8217;s say that MovieClips don&#8217;t exist, and we have to design their logic.</p>
<p>Our animation consists of a set of states, each describing a frame, and for a frame of animation the concept of a transition is simple; you simply tell the MovieClip to set its current state to another indexed frame, and the state changes, bam. Right? But even this simple state change has a <em>transition. </em>The previous frame is <em>removed</em>, and the new frame is <em>shown</em>. This transition could be handled by the state machine itself (in this case, the MovieClip), or by the individual frame. In the case of a dumb MovieClip with no logic attached to frames, our hypothetical reinvented MovieClip could handle this state transition just fine:</p>
<div class="codecolorer-container actionscript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="actionscript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">function</span> <span style="color: #0066CC;">set</span> currentFrame<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">index</span>:<span style="color: #0066CC;">int</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span><span style="color: #66cc66;">&#123;</span><br />
removeChild<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">_currentFrame</span><span style="color: #66cc66;">&#41;</span>;<br />
<span style="color: #0066CC;">_currentFrame</span> = frames<span style="color: #66cc66;">&#91;</span><span style="color: #0066CC;">index</span><span style="color: #66cc66;">&#93;</span>;<br />
addChild<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">_currentFrame</span><span style="color: #66cc66;">&#41;</span>;<br />
<span style="color: #66cc66;">&#125;</span></div></div>
<p>Let&#8217;s assume our frames have content however. Let&#8217;s say the first frame has a video player, and that the next frame has a sound to play. The video should stop, and the sound should begin playing. The state machine, in this case the MovieClip, doesn&#8217;t need to know exactly what is contained in the frames, but it does need to tell them to shut down and initialize. Again, not hard to imagine.</p>
<div class="codecolorer-container actionscript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="actionscript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">function</span> <span style="color: #0066CC;">set</span> currentFrame<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">index</span>:<span style="color: #0066CC;">int</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span><span style="color: #66cc66;">&#123;</span><br />
<span style="color: #0066CC;">_currentFrame</span>.<span style="color: #006600;">shutdown</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
removeChild<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">_currentFrame</span><span style="color: #66cc66;">&#41;</span>;<br />
<span style="color: #0066CC;">_currentFrame</span> = frames<span style="color: #66cc66;">&#91;</span><span style="color: #0066CC;">index</span><span style="color: #66cc66;">&#93;</span>;<br />
addChild<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">_currentFrame</span><span style="color: #66cc66;">&#41;</span>;<br />
<span style="color: #0066CC;">_currentFrame</span>.<span style="color: #006600;">initialize</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
<span style="color: #66cc66;">&#125;</span></div></div>
<p>And voila, we have described the state machine pattern that I have become so fond of, in its entirety!</p>
<h2>Applying the state machine pattern</h2>
<p>When I first started reading about artificial intelligence for games, state machines were introduced very rapidly. AI behavior could be described as a graph where each node was linked to possible states it could transition to. For instance an AI in a sneaking game could be defined by a graph such as this:<br />
<img class="aligncenter size-full wp-image-1246" title="Diagram1" src="http://www.doomsday.no/esn/wp-content/uploads/2011/01/Diagram1.png" alt="" width="265" height="332" /></p>
<p>Each box is a state the AI can be in, and the arrows represent possible transitions, each defined by the states themselves. The framework driving the AI only really needs to keep updating the current state, and let the logic of each state define the behavior.</p>
<p>I&#8217;ve written a primitive version of this AI using the state machine pattern, defining a simple autonomous agent that can move around the world, and a set of states that define its possible behaviors. Let&#8217;s take a look!</p>

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_StateMachineAgentDemo_580711758"
			class="flashmovie"
			width="600"
			height="300">
	<param name="movie" value="http://www.doomsday.no/misc/StateMachineAgentDemo.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="http://www.doomsday.no/misc/StateMachineAgentDemo.swf"
			name="fm_StateMachineAgentDemo_580711758"
			width="600"
			height="300">
	<!--<![endif]-->
		
<p><a href="http://adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a></p>

	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>
<p>Our Agent is a small, overconfident, myopic black arrow. He will hang out for a bit, then wander around at random, pausing once in a while. When the mouse cursor is in front of him within a certain radius, he will chase after it. When he comes close however, he&#8217;ll freak out and run away until he reaches a safe distance. Then he will resume his normal behavior again.</p>
<p>This behavior is defined by the following states</p>
<p><img class="aligncenter size-full wp-image-1237" title="Diagram2" src="http://www.doomsday.no/esn/wp-content/uploads/2011/01/Diagram2.png" alt="" width="248" height="211" /></p>
<p>Each state implements the IAgentState interface, which looks like this:</p>
<p><strong>The IAgentState interface</strong></p>
<div class="codecolorer-container actionscript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="actionscript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">package agent.<span style="color: #006600;">states</span><br />
<span style="color: #66cc66;">&#123;</span><br />
<span style="color: #0066CC;">import</span> agent.<span style="color: #006600;">Agent</span>;<br />
<span style="color: #0066CC;">public</span> <span style="color: #0066CC;">interface</span> IAgentState<br />
<span style="color: #66cc66;">&#123;</span><br />
<span style="color: #000000; font-weight: bold;">function</span> update<span style="color: #66cc66;">&#40;</span>a:Agent<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>; <span style="color: #808080; font-style: italic;">//called every frame</span><br />
<span style="color: #000000; font-weight: bold;">function</span> <span style="color: #0066CC;">enter</span><span style="color: #66cc66;">&#40;</span>a:Agent<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>; <span style="color: #808080; font-style: italic;">//called when the state becomes the current state</span><br />
<span style="color: #000000; font-weight: bold;">function</span> exit<span style="color: #66cc66;">&#40;</span>a:Agent<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>; <span style="color: #808080; font-style: italic;">//called when the state ceases to be the current state</span><br />
<span style="color: #66cc66;">&#125;</span><br />
<span style="color: #66cc66;">&#125;</span></div></div>
<p>This interface specifies 3 methods to be called by the state machine, each taking a reference to the state machine itself. I like to work on this reference because AI states can be treated as largely abstract; It&#8217;s not hard to conceive of several different types of agent needing the wandering behavior, and it is nice to be able to reuse the same behavior instance. Let&#8217;s look at the Idle state to see what this means.</p>
<p><strong>The Idle state</strong></p>
<div class="codecolorer-container actionscript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><div class="actionscript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">package agent.<span style="color: #006600;">states</span><br />
<span style="color: #66cc66;">&#123;</span><br />
<span style="color: #0066CC;">import</span> agent.<span style="color: #006600;">Agent</span>;<br />
<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> IdleState <span style="color: #0066CC;">implements</span> IAgentState<br />
<span style="color: #66cc66;">&#123;</span><br />
<span style="color: #808080; font-style: italic;">/* INTERFACE agent.states.IAgentState */</span><br />
<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> update<span style="color: #66cc66;">&#40;</span>a:Agent<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span><br />
<span style="color: #66cc66;">&#123;</span><br />
<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>a.<span style="color: #006600;">numCycles</span> <span style="color: #66cc66;">&gt;</span> <span style="color: #cc66cc;">30</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span> <span style="color: #808080; font-style: italic;">//Have we executed/idled for 30 frames?</span><br />
a.<span style="color: #006600;">setState</span><span style="color: #66cc66;">&#40;</span>Agent.<span style="color: #006600;">WANDER</span><span style="color: #66cc66;">&#41;</span>; <span style="color: #808080; font-style: italic;">//Then let's take a walk</span><br />
<span style="color: #66cc66;">&#125;</span><br />
<span style="color: #66cc66;">&#125;</span><br />
<br />
<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #0066CC;">enter</span><span style="color: #66cc66;">&#40;</span>a:Agent<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span><br />
<span style="color: #66cc66;">&#123;</span><br />
a.<span style="color: #006600;">say</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;Idling...&quot;</span><span style="color: #66cc66;">&#41;</span>;<br />
a.<span style="color: #006600;">speed</span> = <span style="color: #cc66cc;">0</span>; <span style="color: #808080; font-style: italic;">//Stop the agent</span><br />
<span style="color: #66cc66;">&#125;</span><br />
<br />
<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> exit<span style="color: #66cc66;">&#40;</span>a:Agent<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span><br />
<span style="color: #66cc66;">&#123;</span><br />
a.<span style="color: #006600;">randomDirection</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>; <span style="color: #808080; font-style: italic;">//When we leave this state, face the agent in a random direction</span><br />
<span style="color: #66cc66;">&#125;</span><br />
<span style="color: #66cc66;">&#125;</span><br />
<span style="color: #66cc66;">&#125;</span></div></div>
<p><strong>The wander state</strong></p>
<div class="codecolorer-container actionscript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><div class="actionscript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">package agent.<span style="color: #006600;">states</span><br />
<span style="color: #66cc66;">&#123;</span><br />
<span style="color: #0066CC;">import</span> agent.<span style="color: #006600;">Agent</span>;<br />
<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> WanderState <span style="color: #0066CC;">implements</span> IAgentState<br />
<span style="color: #66cc66;">&#123;</span><br />
<br />
<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> update<span style="color: #66cc66;">&#40;</span>a:Agent<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span><br />
<span style="color: #66cc66;">&#123;</span><br />
a.<span style="color: #006600;">say</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;Wandering...&quot;</span><span style="color: #66cc66;">&#41;</span>;<br />
a.<span style="color: #006600;">velocity</span>.<span style="color: #006600;">x</span> += <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">random</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">*</span> <span style="color: #cc66cc;">0.2</span> - <span style="color: #cc66cc;">0.1</span>; <span style="color: #808080; font-style: italic;">//very simple wander behavior,</span><br />
a.<span style="color: #006600;">velocity</span>.<span style="color: #006600;">y</span> += <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">random</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">*</span> <span style="color: #cc66cc;">0.2</span> - <span style="color: #cc66cc;">0.1</span>;<br />
<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>a.<span style="color: #006600;">numCycles</span> <span style="color: #66cc66;">&gt;</span> <span style="color: #cc66cc;">120</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span><br />
a.<span style="color: #006600;">setState</span><span style="color: #66cc66;">&#40;</span>Agent.<span style="color: #006600;">IDLE</span><span style="color: #66cc66;">&#41;</span>; <span style="color: #808080; font-style: italic;">//Let's take a break every 120 updates</span><br />
<span style="color: #66cc66;">&#125;</span><br />
<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">!</span>a.<span style="color: #006600;">canSeeMouse</span><span style="color: #66cc66;">&#41;</span> <span style="color: #b1b100;">return</span>;<br />
<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>a.<span style="color: #006600;">distanceToMouse</span> <span style="color: #66cc66;">&lt;</span> a.<span style="color: #006600;">fleeRadius</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span><br />
a.<span style="color: #006600;">setState</span><span style="color: #66cc66;">&#40;</span>Agent.<span style="color: #006600;">FLEE</span><span style="color: #66cc66;">&#41;</span>;<br />
<span style="color: #66cc66;">&#125;</span><span style="color: #b1b100;">else</span> <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>a.<span style="color: #006600;">distanceToMouse</span> <span style="color: #66cc66;">&lt;</span> a.<span style="color: #006600;">chaseRadius</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span><br />
a.<span style="color: #006600;">setState</span><span style="color: #66cc66;">&#40;</span>Agent.<span style="color: #006600;">CHASE</span><span style="color: #66cc66;">&#41;</span>;<br />
<span style="color: #66cc66;">&#125;</span><br />
<span style="color: #66cc66;">&#125;</span><br />
<br />
<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #0066CC;">enter</span><span style="color: #66cc66;">&#40;</span>a:Agent<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span><br />
<span style="color: #66cc66;">&#123;</span><br />
a.<span style="color: #006600;">speed</span> = <span style="color: #cc66cc;">1</span>; <span style="color: #808080; font-style: italic;">//Begin moving the agent</span><br />
<span style="color: #66cc66;">&#125;</span><br />
<br />
<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> exit<span style="color: #66cc66;">&#40;</span>a:Agent<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span><br />
<span style="color: #66cc66;">&#123;</span><br />
<span style="color: #66cc66;">&#125;</span><br />
<span style="color: #66cc66;">&#125;</span><br />
<span style="color: #66cc66;">&#125;</span></div></div>
<p>At this point I am sure you are getting the idea; The states themselves contain no data, and are entirely dependent on a state machine instance to interact with. In this case, it&#8217;s almost like a set of template methods that are being swapped out. The nice thing here is that instead of creating a ton of state objects for every agent, we can reuse the same states. Click the stage in the above swf to create new agents, all using the same static states.</p>
<p>Finally, we&#8217;ll look at the state machine itself.</p>
<p><strong>The Agent class</strong></p>
<div class="codecolorer-container actionscript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><div class="actionscript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">package agent<br />
<span style="color: #66cc66;">&#123;</span><br />
<span style="color: #0066CC;">import</span> agent.<span style="color: #006600;">states</span>.<span style="color: #66cc66;">*</span>;<br />
<span style="color: #808080; font-style: italic;">//imports omitted</span><br />
<span style="color: #66cc66;">&#123;</span><br />
<span style="color: #0066CC;">public</span> <span style="color: #0066CC;">static</span> const IDLE:IAgentState = <span style="color: #000000; font-weight: bold;">new</span> IdleState<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>; <span style="color: #808080; font-style: italic;">//Define possible states as static constants</span><br />
<span style="color: #0066CC;">public</span> <span style="color: #0066CC;">static</span> const WANDER:IAgentState = <span style="color: #000000; font-weight: bold;">new</span> WanderState<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
<span style="color: #0066CC;">public</span> <span style="color: #0066CC;">static</span> const CHASE:IAgentState = <span style="color: #000000; font-weight: bold;">new</span> ChaseState<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
<span style="color: #0066CC;">public</span> <span style="color: #0066CC;">static</span> const FLEE:IAgentState = <span style="color: #000000; font-weight: bold;">new</span> FleeState<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
<span style="color: #0066CC;">public</span> <span style="color: #0066CC;">static</span> const CONFUSED:IAgentState = <span style="color: #000000; font-weight: bold;">new</span> ConfusionState<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
<br />
<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _previousState:IAgentState; <span style="color: #808080; font-style: italic;">//The previous executing state</span><br />
<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _currentState:IAgentState; <span style="color: #808080; font-style: italic;">//The currently executing state</span><br />
<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">var</span> velocity:Point = <span style="color: #000000; font-weight: bold;">new</span> Point<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">var</span> speed:<span style="color: #0066CC;">Number</span> = <span style="color: #cc66cc;">0</span>;<br />
<br />
<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">var</span> fleeRadius:<span style="color: #0066CC;">Number</span> = <span style="color: #cc66cc;">50</span>; <span style="color: #808080; font-style: italic;">//If the mouse is &quot;seen&quot; within this radius, we want to flee</span><br />
<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">var</span> chaseRadius:<span style="color: #0066CC;">Number</span> = <span style="color: #cc66cc;">150</span>; <span style="color: #808080; font-style: italic;">//If the mouse is &quot;seen&quot; within this radius, we want to chase</span><br />
<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">var</span> numCycles:<span style="color: #0066CC;">int</span> = <span style="color: #cc66cc;">0</span>; <span style="color: #808080; font-style: italic;">//Number of updates that have executed for the current state. Timing utility.</span><br />
<br />
<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> Agent<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><br />
<span style="color: #66cc66;">&#123;</span><br />
<span style="color: #808080; font-style: italic;">//Boring stuff omitted</span><br />
<br />
_currentState = IDLE; <span style="color: #808080; font-style: italic;">//Set the initial state</span><br />
<span style="color: #66cc66;">&#125;</span><br />
<br />
<span style="color: #808080; font-style: italic;">/**<br />
* Update the current state, then update the graphics<br />
*/</span><br />
<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> update<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span><br />
<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">!</span>_currentState<span style="color: #66cc66;">&#41;</span> <span style="color: #b1b100;">return</span>; <span style="color: #808080; font-style: italic;">//If there's no behavior, we do nothing</span><br />
numCycles++;<br />
_currentState.<span style="color: #006600;">update</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">this</span><span style="color: #66cc66;">&#41;</span>;<br />
x += velocity.<span style="color: #006600;">x</span><span style="color: #66cc66;">*</span>speed;<br />
y += velocity.<span style="color: #006600;">y</span><span style="color: #66cc66;">*</span>speed;<br />
<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>x + velocity.<span style="color: #006600;">x</span> <span style="color: #66cc66;">&gt;</span> <span style="color: #0066CC;">stage</span>.<span style="color: #006600;">stageWidth</span> <span style="color: #66cc66;">||</span> x + velocity.<span style="color: #006600;">x</span> <span style="color: #66cc66;">&lt;</span> <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span> &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; x = <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">max</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">0</span>, <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">min</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">stage</span>.<span style="color: #006600;">stageWidth</span>, x<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; velocity.<span style="color: #006600;">x</span> <span style="color: #66cc66;">*</span>= -<span style="color: #cc66cc;">1</span>; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>y + velocity.<span style="color: #006600;">y</span> <span style="color: #66cc66;">&gt;</span> <span style="color: #0066CC;">stage</span>.<span style="color: #006600;">stageHeight</span> <span style="color: #66cc66;">||</span> y + velocity.<span style="color: #006600;">y</span> <span style="color: #66cc66;">&lt;</span> <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span><br />
y = <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">max</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">0</span>, <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">min</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">stage</span>.<span style="color: #006600;">stageHeight</span>, y<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;<br />
velocity.<span style="color: #006600;">y</span> <span style="color: #66cc66;">*</span>= -<span style="color: #cc66cc;">1</span>;<br />
<span style="color: #66cc66;">&#125;</span><br />
_pointer.<span style="color: #006600;">rotation</span> = RAD_DEG <span style="color: #66cc66;">*</span> <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">atan2</span><span style="color: #66cc66;">&#40;</span>velocity.<span style="color: #006600;">y</span>, velocity.<span style="color: #006600;">x</span><span style="color: #66cc66;">&#41;</span>;<br />
<span style="color: #66cc66;">&#125;</span><br />
<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> setState<span style="color: #66cc66;">&#40;</span>newState:IAgentState<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span><br />
<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>_currentState == newState<span style="color: #66cc66;">&#41;</span> <span style="color: #b1b100;">return</span>;<br />
<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>_currentState<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span><br />
_currentState.<span style="color: #006600;">exit</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">this</span><span style="color: #66cc66;">&#41;</span>;<br />
<span style="color: #66cc66;">&#125;</span><br />
_previousState = _currentState;<br />
_currentState = newState;<br />
_currentState.<span style="color: #0066CC;">enter</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">this</span><span style="color: #66cc66;">&#41;</span>;<br />
numCycles = <span style="color: #cc66cc;">0</span>;<br />
<span style="color: #66cc66;">&#125;</span><br />
<br />
<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #0066CC;">get</span> previousState<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:IAgentState <span style="color: #66cc66;">&#123;</span> <span style="color: #b1b100;">return</span> _previousState; <span style="color: #66cc66;">&#125;</span><br />
<br />
<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #0066CC;">get</span> currentState<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:IAgentState <span style="color: #66cc66;">&#123;</span> <span style="color: #b1b100;">return</span> _currentState; <span style="color: #66cc66;">&#125;</span><br />
<br />
<span style="color: #66cc66;">&#125;</span><br />
<br />
<span style="color: #66cc66;">&#125;</span></div></div>
<p>As you can see, we are still applying the same theory as in our MovieClip example; Close what you had, open what you&#8217;re getting, and since we&#8217;re doing realtime stuff, update what you got. I&#8217;ve put up the source for this example, in case you&#8217;re curious to <a href="http://www.doomsday.no/misc/statemachine_example_src.rar">take a peek</a>.</p>
<h2>Summing it up</h2>
<p>State machines are mechanisms that have their behavior defined by a known set of states. Knowing this, you can easily jot down your application as a state graph and use the state pattern and a rudimentary state machine to throw together a click through for instance, while maintaining scalability. I&#8217;m just scraping the surface. State machines have a huge number of uses, from managing visual states, to choosing which game state to execute, such as the title screen, leaderboards, game loop etc, to state machines creating new dynamic state machines during parsing algorithms. States themselves can very well be state machines.</p>
<p>I hope I haven&#8217;t bored you to death with my rambling. I&#8217;ve used this pattern and variations of it for a wide range of projects. It&#8217;s a safe bet for prototyping, almost indispensable for game development, and super stupid easy to pick up. Thank for your reading <img src='http://www.doomsday.no/esn/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.doomsday.no/esn/2011/01/finite-state-machine-jadore/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>Thoughts on Sonic the Hedgehog</title>
		<link>http://www.doomsday.no/esn/2010/08/thoughts-on-sonic-the-hedgehog/</link>
		<comments>http://www.doomsday.no/esn/2010/08/thoughts-on-sonic-the-hedgehog/#comments</comments>
		<pubDate>Tue, 03 Aug 2010 23:28:18 +0000</pubDate>
		<dc:creator>Andreas</dc:creator>
				<category><![CDATA[Game dev & design]]></category>
		<category><![CDATA[Thoughts]]></category>
		<category><![CDATA[Video games]]></category>
		<category><![CDATA[Limbo]]></category>
		<category><![CDATA[R-Type]]></category>
		<category><![CDATA[Sonic the Hedgehog]]></category>
		<category><![CDATA[SSX Blur]]></category>
		<category><![CDATA[Synesthesia]]></category>

		<guid isPermaLink="false">http://www.doomsday.no/esn/?p=1064</guid>
		<description><![CDATA[I have a long lasting relationship of frustrated ambivalence when it comes to Sonic. As a kid I borrowed a friend&#8217;s Master System to play that system&#8217;s port of the first title, and I absolutely, truly enjoyed it. In retrospect I enjoyed it much more than the &#8220;real&#8221; 16-bit title, and I still feel the [...]]]></description>
			<content:encoded><![CDATA[<p>I have a long lasting relationship of frustrated ambivalence when it comes to Sonic. As a kid I borrowed a friend&#8217;s Master System to play that system&#8217;s port of the first title, and I absolutely, truly enjoyed it. In retrospect I enjoyed it much more than the &#8220;real&#8221; 16-bit title, and I still feel the Master System port, having less tempo-fueling processing horsepower to rely on, became a better platformer. There was certainly a bit of running about, but nothing as blisteringly bananas as what the Mega Drive was pulling off.</p>
<p>My chief complaint about Sonic 16 was simply that the pleasure derived from it was directly proportional to the speed and momentum you were able to build up, and the game adored taking that momentum away from you with enemies coming at you too fast for you to realistically react.</p>
<p>Sonic 16 was the <a href="http://en.wikipedia.org/wiki/R-type" target="_blank">R-Type</a> of platformers, rewarding memorization and trial and error with a sense of exhilarating flow that wasn&#8217;t really available elsewhere. That said, when he wasn&#8217;t running like a madman, Sonic was, by any standard, a very boring character to play; If you weren&#8217;t playing Sonic &#8220;right&#8221;, I felt, you weren&#8217;t playing a very fun game.<span id="more-1064"></span></p>
<p>Regardless of which port was superior, the 16-bit Sonic was the true starting point of the franchise, a franchise that started out obsessed with speed, flow and momentum, but gradually, literally lost its way with a menagerie of spotlight-stealing supporting characters that wound up diluting the game&#8217;s personality to the point where it was impossible to care about.</p>
<p>As the series has evolved, it has become one of the most wayward of franchises. Almost every single title to come out since Sonic CD has been weakly attempting to toss up the formula and find some sort of modern uniqueness to make it relevant, and they have for the most part been failures across the board.</p>
<p>I rather enjoyed the first Sonic Adventure on the Dreamcast, but even that game was often a complete bore to play because of its insistence on contrived storytelling and unpolished supporting characters. As the modern titles experimented with Sonic&#8217;s sole unique attribute, speed, the emphasis on memorization and trial &amp; error made the games even harder to love.</p>
<div id="attachment_1073" class="wp-caption aligncenter" style="width: 610px"><img class="size-full wp-image-1073" title="Sonic_The_Hedgehog_Wallpaper_by_Ede" src="http://www.doomsday.no/esn/wp-content/uploads/2010/08/Sonic_The_Hedgehog_Wallpaper_by_Ede.jpg" alt="" width="600" height="437" /><p class="wp-caption-text">Them&#39;s a lot of generic looking mascot dudes!</p></div>
<h3>Sonic the Hedgehog needs to grow up.</h3>
<p>There is light however. There has been one branch of the series that surprised and impressed me. Sonic Rush on the Nintendo DS brought the game straight back to level-for-level traversal with a huge emphasis on constant speed, alternate paths and a trick combo system that aided both your score and your momentum.</p>
<p>Topping it off, courtesy of Hideki Nakanuma (also known for his stellar work on Jet Set Radio), was one of the most fiercely hyperactive rave soundtracks ever committed to a platformer; I don&#8217;t use the word &#8220;rave&#8221; lightly. This was straight up rave, 303s, pitched up samples, cut up breakbeats, outright randomness. This was a game that not only played fast, but felt <em>inherently </em>fast<em>.</em></p>
<p><object width="425" height="355"><param name="movie" value="http://www.youtube.com/v/QeyK4M_vFlY" /><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><embed wmode="opaque" src="http://www.youtube.com/v/QeyK4M_vFlY" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="355"></embed></object></p>
<p>The soundtrack was absolutely central to the game. When playing through stages with Blaze, the only playable supporting cast member (thank god), a remix of the original tune would play with more up-beat percussion. The result tentatively approached synesthesia, urging you to go faster, flow better, do more combos, and just headnod like a jackass to the catchy infectious music.</p>
<p>Sega has since abandoned Sonic Rush, and proceeded to create this shit instead.</p>
<p><object width="425" height="355"><param name="movie" value="http://www.youtube.com/v/cFiQjtRkc3U" /><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><embed wmode="opaque" src="http://www.youtube.com/v/cFiQjtRkc3U" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="355"></embed></object></p>
<p>&#8220;Sonic the Hedgehog&#8221;, a next-gen &#8220;reinvention&#8221; of the series that among other things featured Sonic, a surreal blue hedgehog, romancing a generic human princess lady, all set to generic techno rock (the de-facto standard music genre for Sonic ever since its brief ridiculous stint with big-band calypso after realizing it wasn&#8217;t 8-bit anymore). Sonic Team seems utterly incapable of evolving the Sonic franchise.  When hordes of fans clamor for the pure gameplay of old (though IMHO this is also misguided), Sega again and again looks to <em>Sonic Adventure</em> for inspiration. It&#8217;s crazy.</p>
<p>As Sonic 4 is about to hit us, created by Sonic Rush studio Dimps, playing by the 16 bit template to a fault, I have to wonder if Sega haven&#8217;t completely and utterly lost their marbles. I have a vague hope that Sonic 4 will at the very least be a competent platformer, but without a real hook to its character beyond trial and error resulting from unplayable speeds, it blows my mind that they haven&#8217;t stolen more from Sonic Rush&#8217;s mechanical innovations, such as a trick-powered boost meter letting you maintain your ridiculous speed while simply powering *through* any obstacles in your path.</p>
<p>It started with a few too many <a href="http://en.wikipedia.org/wiki/Paulaner" target="_blank">Paulaners</a>, reading Eurogamer&#8217;s articles on Sonic 4 and <a href="http://www.eurogamer.net/articles/the-colour-of-sonic-interview" target="_blank">Sonic Colors</a>, and the resulting drunken musing;</p>
<h3>Why on earth doesn&#8217;t a game character named Sonic have any sound-related powers?</h3>
<p>One of my favorite moments in the absolutely stellar <a href="http://www.youtube.com/watch?v=kD5F54SZkMA" target="_blank">Limbo</a> is a set piece in which the rules of the game change in sync with a pulsing rhythm in the background music/ambience. Being largely abstract, finding the rhythm in the ambient chaos to traverse a range of insta-death hazards was an almost transcendental experience as a gamer.</p>
<p>Here was a game that understood that a large portion of our brains is continuously working on processing environmental audio, and leveraged it to craft a deeper connection with the player.</p>
<p>Most games are more than happy relegating music to the status of background noise. It&#8217;s as though we have music for the sake of having music. Sound is feedback, but we are rarely offered a chance to feed back into the sound in a meaningful way. Some games play around with this, but with the way the market seems happy to overlook the technicalities of sound, I can imagine the interactive soundtrack of SSX Blur, rewarding flow and skilled play with music that &#8220;leveled up&#8221;, could have been a tough sell to the funding party.</p>
<p>If any franchise has a natural connection with sound, I suggest, it would be Sonic the Hedgehog. From the banality of the name, to the fact that the character&#8217;s inherent abilities are tied inextricably to flow and rhythm. I would love to play a Sonic game in which the soundtrack shifts to telegraph challenges, increases in intensity with the gameplay, and rewards flow and skill with not only progress, but with a better experience. Anyone who has played REZ will know the sensation of advancement is as tied to evolving the music as it is to actually winning the game. A huge part of the appeal of rhythm action titles like Guitar Hero is the inherent reward mechanic; By playing better, you get to hear better music.</p>
<p>Fingers crossed Sega will look to Rush again for their future titles. They need some fundamental color like this angle to differentiate themselves; You can&#8217;t coast on nostalgia like this forever. Worst case scenario, Sonic 4 will remind veterans of the series of how clunky it actually is in today&#8217;s environment.</p>
<p>For a character called Sonic, it&#8217;s about time he actually breaks the sound barrier.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.doomsday.no/esn/2010/08/thoughts-on-sonic-the-hedgehog/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>New open source project: Sound control</title>
		<link>http://www.doomsday.no/esn/2010/03/new-open-source-project-sound-control/</link>
		<comments>http://www.doomsday.no/esn/2010/03/new-open-source-project-sound-control/#comments</comments>
		<pubDate>Fri, 19 Mar 2010 15:40:52 +0000</pubDate>
		<dc:creator>Andreas</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[Game dev & design]]></category>
		<category><![CDATA[Audio]]></category>

		<guid isPermaLink="false">http://www.doomsday.no/esn/?p=832</guid>
		<description><![CDATA[Another quick holler to let you know I&#8217;ve gone and published a working library to the DSoundSystem Googlecode repository. It&#8217;s a library wrapping the native Flash sound API allowing much tighter control of sound playback, giving you a proper cue/track/mixer setup and a real birds-eye view of sound in your application. A core feature is [...]]]></description>
			<content:encoded><![CDATA[<p>Another quick holler to let you know I&#8217;ve gone and published a working library to the <a href="http://code.google.com/p/doomsdaysoundsystem/">DSoundSystem Googlecode repository</a>.<br />
It&#8217;s a library wrapping the native Flash sound API allowing much tighter control of sound playback, giving you a proper cue/track/mixer setup and a real birds-eye view of sound in your application.<br />
A core feature is the management of stereo positioning and distance gain attenuation of playing sounds based on listeners and sources.<br />
It also has support for playback of ByteArray sound data, and comes with the sound effect generator <a href="http://www.drpetter.se/project_sfxr.html">SFXR</a> fully integrated for all your placeholder or 8-bit video game needs.</p>
<p>Please check out the <a href="http://code.google.com/p/doomsdaysoundsystem/w/list">Googlecode wiki</a>, download the source, give it a spin and throw me some feedback if you like or hate it <img src='http://www.doomsday.no/esn/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.doomsday.no/esn/2010/03/new-open-source-project-sound-control/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Antisocial media</title>
		<link>http://www.doomsday.no/esn/2009/12/antisocial-media/</link>
		<comments>http://www.doomsday.no/esn/2009/12/antisocial-media/#comments</comments>
		<pubDate>Fri, 11 Dec 2009 20:43:51 +0000</pubDate>
		<dc:creator>Andreas</dc:creator>
				<category><![CDATA[Game dev & design]]></category>
		<category><![CDATA[Thoughts]]></category>
		<category><![CDATA[Video games]]></category>
		<category><![CDATA[animal crossing]]></category>
		<category><![CDATA[Antisocial media]]></category>
		<category><![CDATA[Facebook]]></category>
		<category><![CDATA[instant messaging]]></category>
		<category><![CDATA[internet]]></category>
		<category><![CDATA[MMO]]></category>
		<category><![CDATA[Nintendo]]></category>
		<category><![CDATA[Twitter]]></category>

		<guid isPermaLink="false">http://www.doomsday.no/esn/?p=789</guid>
		<description><![CDATA[Me and Anders Psychofreud started putting together a messaging application today that i think is totally weird, but for certain reasons really compelling. First a little history. If you haven&#8217;t played Animal Crossing on the DS or Wii, i strongly suggest that you find an opportunity to do so. On its own the game is [...]]]></description>
			<content:encoded><![CDATA[<p>Me and Anders Psychofreud started putting together a messaging application today that i think is totally weird, but for certain reasons really compelling. First a little history.</p>
<p>If you haven&#8217;t played Animal Crossing on the DS or Wii, i strongly suggest that you find an opportunity to do so. On its own the game is addictive, but its weird implementation of massively multiplayer online play is really worth a long look. Nintendo are infamous for their friend code system, which puts users who want to play together through a good few burning rings before they can actually do so. Because of this system, you will never openly communicate with an identifiable unknown. The system allows for play with random strangers, but communication seems to be reinvented every time. If you are connected friends, you might get a full suite of options, but for random strangers you&#8217;re typically given what amounts to a few emotes and canned phrases. For a game with MMO pretentions, this is obviously hugely challenging.</p>
<p>Animal Crossing lets users that aren&#8217;t connected friends &#8220;interact&#8221; through side-effects of their actions. I had a real moment of wow when i spent a few irrational minutes making a pixel perfect nazi swastika pattern and put it up in my clothes shop for my (already utterly irreverent) animals to wear. Soon, the swastika pattern had migrated from my town to my few friends&#8217; towns. And then the ball just rolled from there. Friends of friends of friends of friends would see nazi animals show up in their towns.</p>
<p>Media in Animal Crossing spreads like a disease. It&#8217;s a <em>viral mmo</em>.</p>
<p>An animal will show up in your town and ask for a new catchphrase. The next day, it might have moved out to another town. Which town? You&#8217;re not the one who decides. This lets you communicate ideas, but only to <em>random </em>recipients. This system is epitomized in the bottled mail system, which lets you write a message, put it in a bottle and toss it into the sea. Whoever gets the message is apparently <em>completely random</em>, throughout the online service. I have gotten bottled messages ranging from ascii cats to sorrowful suicide notes.</p>
<p>This is what makes Animal Crossing so enticing for adults i think. A combination of pure OCD collectomania and a world that seems wildly chaotic. In my mind, after a few weeks play, an Animal Crossing town is like an out of control train in a tight turn teetering on one rail.</p>
<p>What we begun putting together today is a purification of the bottled mail system. An anonymous client that lets you post messages into a pile, and retrieve random ones you haven&#8217;t written yourself. When you retrieve one, it is removed from the database. This ensures that a message is anonymous and personal. Of course, the system is widely open to abuse, but i actually don&#8217;t mind that aspect. Sitting on the beach sifting through debris for gold, you&#8217;re likely to find a whole lot of junk.</p>
<p>I&#8217;m hoping the system will find a place as a way to let off steam, and let off guilt. Somewhere to confess, or to be heard by someone who will know that somewhere, out there, a single individual posted this thought for a single individual to read. The internet is so often about the individual entity spreading information as widely as possible; the cluster bomb collateral damage model of information.</p>
<p>This narrows the focus back on the individual recipient, and theoretically eliminates the egotist exhibitionist publisher.</p>
<p>It&#8217;s the Anti-Twitter, anti-Facebook. It&#8217;s not about the masses, but the individual, sporadic connection of strangers&#8217; eyes meeting sporadically through the window of a passing bus. The prototype is in development <a href="http://www.doomsday.no/projects/antisocial/">here</a>, and I hope you&#8217;ll find it interesting as it evolves. At the time of writing it has almost no effort whatsoever put into the UI. Making it pretty comes next.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.doomsday.no/esn/2009/12/antisocial-media/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Unity book review forthcoming</title>
		<link>http://www.doomsday.no/esn/2009/12/unity-book-review-forthcoming/</link>
		<comments>http://www.doomsday.no/esn/2009/12/unity-book-review-forthcoming/#comments</comments>
		<pubDate>Thu, 10 Dec 2009 10:31:54 +0000</pubDate>
		<dc:creator>Andreas</dc:creator>
				<category><![CDATA[Game dev & design]]></category>
		<category><![CDATA[Literature]]></category>
		<category><![CDATA[Unity3D]]></category>
		<category><![CDATA[packt]]></category>
		<category><![CDATA[unity]]></category>
		<category><![CDATA[will goldstone]]></category>

		<guid isPermaLink="false">http://www.doomsday.no/esn/?p=783</guid>
		<description><![CDATA[Well look what dropped into my mailbox today! A review copy of Packt&#8217;s new Unity book; Unity Game Development Essentials by Will Goldstone. Just in time to break my inspirational drought! I haven&#8217;t written anywhere near enough about Unity on this site yet, but i have a couple of large projects in the pipeline, and [...]]]></description>
			<content:encoded><![CDATA[<p>Well look what dropped into my mailbox today! A review copy of Packt&#8217;s new Unity book; <a href="http://www.packtpub.com/unity-game-development-essentials?utm_source=doomsda y.no&amp;utm_medium=bookrev&amp;utm_content=blog&amp;utm_campaign=mdb_001512" target="_blank">Unity Game Development Essentials</a> by Will Goldstone. Just in time to break my inspirational drought!<br />
I haven&#8217;t written anywhere near enough about Unity on this site yet, but i have a couple of large projects in the pipeline, and this is a nice kickstart to get writing.</p>
<p>Lovely looking book so far. It&#8217;s a thorough beginner&#8217;s introduction to the Unity editor and its unique concepts, and contains enough references to Flash to be a real asset to the Flash designer/developer wanting to test the Unity waters. When I&#8217;m done with it, being a wonderful man, I&#8217;ll do the right thing and tell you if it&#8217;s worth your time <img src='http://www.doomsday.no/esn/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.doomsday.no/esn/2009/12/unity-book-review-forthcoming/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Randomness in games</title>
		<link>http://www.doomsday.no/esn/2009/09/randomness-in-games/</link>
		<comments>http://www.doomsday.no/esn/2009/09/randomness-in-games/#comments</comments>
		<pubDate>Mon, 28 Sep 2009 12:44:54 +0000</pubDate>
		<dc:creator>Andreas</dc:creator>
				<category><![CDATA[Game dev & design]]></category>
		<category><![CDATA[Game design]]></category>

		<guid isPermaLink="false">http://www.doomsday.no/esn/?p=470</guid>
		<description><![CDATA[Greg Costikyan on the history and application of randomness in games http://playthisthing.com/randomness-blight-or-bane Fantastic read, heartily recommended if you&#8217;re a game designer]]></description>
			<content:encoded><![CDATA[<p>Greg Costikyan on the history and application of randomness in games</p>
<p><a href="http://playthisthing.com/randomness-blight-or-bane" target="_blank">http://playthisthing.com/randomness-blight-or-bane</a></p>
<p>Fantastic read, heartily recommended if you&#8217;re a game designer</p>
]]></content:encoded>
			<wfw:commentRss>http://www.doomsday.no/esn/2009/09/randomness-in-games/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Key polling, part deux</title>
		<link>http://www.doomsday.no/esn/2009/09/key-polling-part-deux/</link>
		<comments>http://www.doomsday.no/esn/2009/09/key-polling-part-deux/#comments</comments>
		<pubDate>Sun, 27 Sep 2009 16:21:17 +0000</pubDate>
		<dc:creator>Andreas</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[Game dev & design]]></category>
		<category><![CDATA[Game development]]></category>
		<category><![CDATA[Video games]]></category>

		<guid isPermaLink="false">http://www.doomsday.no/esn/?p=444</guid>
		<description><![CDATA[Keith Peters put up a comprehensive blog post on why he disagrees with generic keyboard managers. It&#8217;s well worth reading. I have to admit, i couldn&#8217;t even conceive of input events directly altering the model without first passing through an input testing step in the game loop. It&#8217;s practically game dev heresy! It apparently boils [...]]]></description>
			<content:encoded><![CDATA[<p>Keith Peters put up a comprehensive <a href="http://www.bit-101.com/blog/?p=2406" target="_blank">blog post on why he disagrees with generic keyboard managers</a>. It&#8217;s well worth reading. I have to admit, i couldn&#8217;t even conceive of input events directly altering the model without first passing through an input testing step in the game loop. It&#8217;s practically game dev heresy!</p>
<p>It apparently boils down to an optimization issue. I&#8217;ll say that if you need those extra tiny cycles, then sure, Keith&#8217;s approach is a fair optimization. But, call me conservative, i would personally never think to base my game development workflow on such an approach. Writing custom code for a very abstract step of the game framework on a game by game basis seems like an unnecessary speed bump. In other words, i&#8217;d go mad writing boring code before i got to do any of the fun stuff.</p>
<p><a href="http://www.iainlobb.com/">Iain Lobb </a>is considering publishing his gamepad class, and i do believe i&#8217;ll do the same soon.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.doomsday.no/esn/2009/09/key-polling-part-deux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Actionscript nerd-out: Bit-flagging</title>
		<link>http://www.doomsday.no/esn/2008/07/actionscript-nerd-out-bit-flagging/</link>
		<comments>http://www.doomsday.no/esn/2008/07/actionscript-nerd-out-bit-flagging/#comments</comments>
		<pubDate>Tue, 08 Jul 2008 00:36:45 +0000</pubDate>
		<dc:creator>Andreas</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[Game dev & design]]></category>

		<guid isPermaLink="false">http://www.doomsday.no/wp/?p=57</guid>
		<description><![CDATA[Working on games i often wind up in a situation where i need to validate a bunch of booleans quite often, and not always the same ones. Basically, a game entity state could be a mixture of many, such as ducking, jumping, attacking, burning etc, and i wanted a way to quantify that state with [...]]]></description>
			<content:encoded><![CDATA[<p>Working on games i often wind up in a situation where i need to validate a bunch of booleans quite often, and not always the same ones. Basically, a game entity state could be a mixture of many, such as ducking, jumping, attacking, burning etc, and i wanted a way to quantify that state with a single method, which meant the simplest way to have a system supporting an arbitrary number of flags would be using the &#8230;(rest) argument.</p>
<pre>
var jumping:Boolean = false;
var attacking:Boolean = false;
var crouching:Boolean = false;
var burning:Boolean = false;

function validateFlags(...stateFlags:Array):Boolean{
	for(var i:int = stateFlags.length;i--;){
		if(!this[stateFlags[i]]) return false;
	}
	return true;
}

trace(validateFlags("burning","crouching")); //ugh
</pre>
<p>However, considering how many validations would be required every game update thats a multitude of for loops for no reason. In addition, as readable as it is to have a ton of booleans describing every possible state flag, the idea of a single variable for all of them really appeals to me. So let&#8217;s put them all into an 8bit integer.</p>
<pre>const JUMPING:uint = 1;
const ATTACKING:uint = 2;
const CROUCHING:uint = 4;
const BURNING:uint = 8;

var state:uint= 0;

function setFlags(newFlags:uint):void{
	state|=newFlags;
}
function unSetFlags(flagsToUnset:uint):void{
	state&#038;=(~flagsToUnset);
}
function validateFlags(flagsToValidate:uint):Boolean{
	return (state&#038;flagsToValidate)==flagsToValidate;
}
setFlags(BURNING|CROUCHING|JUMPING);

trace(validateFlags(BURNING|CROUCHING)); //true. i like
</pre>
<p>Not only do we avoid a for loop, but we also avoid a bunch of unnecessary booleans, and all validation is boiled down to two quick bitwise ops and a single check for equality.</p>
<p>Something about stuffing a bunch of information into a single number makes me feel like an actual programmer. Gee willikers!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.doomsday.no/esn/2008/07/actionscript-nerd-out-bit-flagging/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Steampunk in gaming</title>
		<link>http://www.doomsday.no/esn/2008/06/steampunk-in-gaming/</link>
		<comments>http://www.doomsday.no/esn/2008/06/steampunk-in-gaming/#comments</comments>
		<pubDate>Sun, 01 Jun 2008 09:20:02 +0000</pubDate>
		<dc:creator>Andreas</dc:creator>
				<category><![CDATA[Game dev & design]]></category>
		<category><![CDATA[Video games]]></category>
		<category><![CDATA[Steampunk]]></category>

		<guid isPermaLink="false">http://www.doomsday.no/wp/?p=23</guid>
		<description><![CDATA[Great article up on Ars Technica about the use of steampunk imagery and concepts in video games. Those of you that know me know i&#8217;m a giant stupid fan of this stuff. Well worth the read.]]></description>
			<content:encoded><![CDATA[<p><a href="http://arstechnica.com/articles/culture/steampunk-video-games.ars" target="_blank">Great article</a> up on Ars Technica about the use of steampunk imagery and concepts in video games. Those of you that know me know i&#8217;m a giant stupid fan of this stuff. Well worth the read.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.doomsday.no/esn/2008/06/steampunk-in-gaming/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>INEXCUSABLE #2: Things i hate about Metal Gear Solid</title>
		<link>http://www.doomsday.no/esn/2006/12/inexcusable-2-things-i-hate-about-metal-gear-solid/</link>
		<comments>http://www.doomsday.no/esn/2006/12/inexcusable-2-things-i-hate-about-metal-gear-solid/#comments</comments>
		<pubDate>Mon, 25 Dec 2006 21:59:00 +0000</pubDate>
		<dc:creator>Andreas</dc:creator>
				<category><![CDATA[Game dev & design]]></category>
		<category><![CDATA[Rants]]></category>
		<category><![CDATA[Video games]]></category>
		<category><![CDATA[Game design]]></category>
		<category><![CDATA[Inexcusable]]></category>
		<category><![CDATA[Metal Gear Solid]]></category>

		<guid isPermaLink="false">http://www.doomsday.no/esn/2006/12/inexcusable-2-things-i-hate-about-metal-gear-solid/</guid>
		<description><![CDATA[I 10x hate the controls Kojima and the boys concocted for the MGS games. That&#8217;s hate hate hate hate hate hate hate hate hate hate them. I&#8217;ve played through the Metal Gears on the NES, the MSX, the Playstation, even the Metal Gear Acid ones on the PSP, and as i&#8217;m going through MGS3 now [...]]]></description>
			<content:encoded><![CDATA[<p>I 10x hate the controls Kojima and the boys concocted for the MGS games. That&#8217;s hate hate hate hate hate hate hate hate hate hate them.</p>
<p>I&#8217;ve played through the Metal Gears on the NES, the MSX, the Playstation, even the Metal Gear Acid ones on the PSP, and as i&#8217;m going through MGS3 now there are just some choices that i have no idea why they haven&#8217;t backed out on. I know they released MGS3 Subsistence now to mend certain things like the draconian camera, but as far as i know the control setup is, was, will always be the wildest bout of controller masturbation any developer ever put a joypad through. Kojima&#8217;s credo it seems is If It&#8217;s There Make A Jonesey Of It (i just made that expression up. It means to use it a lot).</p>
<p>The PS2 dual shock joypad has the following buttons:<br />2 Left buttons<br />2 Right buttons<br />8 directional joypad<br />4 analog face buttons<br />two analog sticks that depress for another 2 buttons<br />a select button<br />a start button</p>
<p>That gives the joypad 20 buttons (TWENTY) which may be utilized by developers.</p>
<p>In every single gameplay mode of MGS, every single button is being put to use. Sometimes the uses differ depending on the situation you&#8217;re in, how long they&#8217;re held down, how HARD they&#8217;re pressed, how they&#8217;re pressed in combination with others.</p>
<p>With all this in mind, recall that Solid Snake or any other snake progeny moves like a broken matchbox car compared to the more recent Sam Fisher of the Splinter Cell games. Splinter cell has context sensitive buttons. Metal Gear has a button for every context. It&#8217;s been a while since i played Falcon 4, but if i&#8217;m not completely mistaken, it took less than 20 buttons to fly an <span style="font-style: italic;">F-16 fighter/bomber</span>, and that&#8217;s in real life.</p>
<p>What the fuck is up with a world where a game i&#8217;ve played for almost a decade <span style="font-style: italic; font-weight: bold;">still baffles me</span> with its technicalities? This is a game where moving towards an enemy slowly and moving towards an enemy <span style="font-style: italic;">stealthily </span>are two separate actions, and as such is mapped to <span style="font-weight: bold;">two entirely separate input methods</span>. It was confusing enough in MGS2, but at least that planted you in a somewhat rigid environment. MGS3 places you in an open, &#8220;free&#8221; area with myriads of tactical possibilities, and as awesome as that is, the moments where the game just flat out stumbles over its torturous button layout are so plentiful it makes me seriously question mr Kojima&#8217;s prowess as a game designer. As a storyteller and <span style="font-style: italic;">systems engineer</span> i have no doubt in my mind he&#8217;s a class act through and through, but what makes Miyamoto such a god damn champ is that he can convey this level of perceived complexity through an action that flows through your fingers like a word off your tongue.</p>
<p>Some games revel in complexity. System Shock 2 had an interface that almost felt designed as a moodpiece rather than an actual interface (when else would you want details on what exactly a cup was). Deus Ex thrived on its same level of <span style="font-style: italic;">perceived </span>complexity, where a point and click inventory system would allow users to handle multiple kinds of ammo and other categories of objects. Deus Ex 2 took more flak from die hard players than any other fora, and  one of the major reason was a &#8220;dumbing down&#8221;.</p>
<p>Making Solid Snake control like a <span style="font-style: italic;">game character</span> and not some arcane device uncovered in an alien mineshaft wouldn&#8217;t, in this gamer&#8217;s eye, be dumbing the game down. If MGS4 controls anything like MGS3, salty tears will fall, because this idiocy is messing up a perfectly good game of storydriven stealth action.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.doomsday.no/esn/2006/12/inexcusable-2-things-i-hate-about-metal-gear-solid/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Pretty amazing virtual life game</title>
		<link>http://www.doomsday.no/esn/2006/11/pretty-amazing-virtual-life-game/</link>
		<comments>http://www.doomsday.no/esn/2006/11/pretty-amazing-virtual-life-game/#comments</comments>
		<pubDate>Thu, 23 Nov 2006 01:38:00 +0000</pubDate>
		<dc:creator>Andreas</dc:creator>
				<category><![CDATA[Game dev & design]]></category>
		<category><![CDATA[General coolness]]></category>
		<category><![CDATA[Video games]]></category>
		<category><![CDATA[Game design]]></category>

		<guid isPermaLink="false">http://www.doomsday.no/esn/2006/11/pretty-amazing-virtual-life-game/</guid>
		<description><![CDATA[http://alterego.polemik.ch/ I&#8217;m pretty impressed something this simple can have such an impact. Really makes you think about some choices you&#8217;ve made in your life.]]></description>
			<content:encoded><![CDATA[<p><a href="http://alterego.polemik.ch/">http://alterego.polemik.ch/ </a></p>
<p>I&#8217;m pretty impressed something this simple can have such an impact. Really makes you think about some choices you&#8217;ve made in your life.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.doomsday.no/esn/2006/11/pretty-amazing-virtual-life-game/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>INEXCUSABLE</title>
		<link>http://www.doomsday.no/esn/2006/08/inexcusable/</link>
		<comments>http://www.doomsday.no/esn/2006/08/inexcusable/#comments</comments>
		<pubDate>Sat, 12 Aug 2006 16:47:00 +0000</pubDate>
		<dc:creator>Andreas</dc:creator>
				<category><![CDATA[Game dev & design]]></category>
		<category><![CDATA[Rants]]></category>
		<category><![CDATA[Video games]]></category>
		<category><![CDATA[Game design]]></category>
		<category><![CDATA[Inexcusable]]></category>
		<category><![CDATA[Namco]]></category>
		<category><![CDATA[Tekken]]></category>

		<guid isPermaLink="false">http://www.doomsday.no/esn/2006/08/inexcusable/</guid>
		<description><![CDATA[Today&#8217;s culprit: Cheap bosses in fighting games Nothing screams &#8220;we couldn&#8217;t even bother&#8221; like a final boss fight that determinedly breaks the rules of the game up until then. It is well known that Namco have never even bothered balancing their Tekken franchise, with character matchups that aren&#8217;t just broken, but WILFULLY so. Want to [...]]]></description>
			<content:encoded><![CDATA[<p><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://namco-ch.net/tekken5/vs_jinpachi/img/vsj1.jpg"><img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 200px;" src="http://namco-ch.net/tekken5/vs_jinpachi/img/vsj1.jpg" alt="" border="0" /></a><br />Today&#8217;s culprit: Cheap bosses in fighting games</p>
<p>Nothing screams &#8220;we couldn&#8217;t even bother&#8221; like a final boss fight that determinedly breaks the rules of the game up until then. It is well known that Namco have never even bothered balancing their Tekken franchise, with character matchups that aren&#8217;t just broken, but WILFULLY so. Want to put Anna Williams up against Bryan Fury? Good luck with that, you&#8217;ve got a far-far harder fight ahead of you than if you played Yoshimitsu.</p>
<p>So in terms of balance, Namco have basically handed the gauntlet to the multiplayer gamers, who have to create some kind of unwritten code of honor as to how to play the game, with characters being delegated into &#8220;tiers&#8221;. No wonder Itagaki rips on Tekken.</p>
<p>Namco, you ASSHOLES.</p>
<p>Jinpachi? What in gods name were you thinking? You take an otherwise entirely enjoyable story mode (by fighting game standards), and end it with a big fat cheat? If your boss isn&#8217;t hard enough, there is a VERY fine line between cheap and challenging, and you take that line and basically LEAP joyfully across it with Jinpachi.
<ol>
<li>Attack that comes out in less than 5 frames, stuns you for 2 seconds and has no buildup? Check.</li>
<li>*UNBLOCKABLE RANGED ATTACK* in a game that&#8217;s previously been known to disregard Street Fighter&#8217;s fireball massive? Check. Does it take 65% health off your bar? Yeap. Is it dodgeable? With great effort, but then another one is coming right after it so why bother.</li>
<li>Character mesh so MESSY that identifying the buildup to a move among it&#8217;s myriads of useless wavy junk becomes nigh on impossible? Check.</li>
<li>HUGE character mesh, making catching the difference between a high and a medium or a medium or a low attack a complete lottery? Check.</li>
</ol>
<p>Fighting game developers: If you can&#8217;t include the last boss of the game as a playable character because you KNOW it&#8217;s cheap, your design flat out sucks. Last time i saw something this retarded was in Marvel Vs Capcom 2, with a screenfilling multiphase thing that would be better off in Gunstar heroes. Complete bullshit.</p>
<p>Rubbing salt into my wounds, Tekken 5 has a model for unlockables that requires you to play the game for a very, very long time indeed, with the fastest way to moneys being the story mode. Playing through the story mode and having to vomit my way through Jinpachi THIRTY TIMES is about as unpleasant a thought as i can come up with right now.</p>
<p>And <a href="http://www.gamespot.com/ps2/action/tekken5/review.html">Jeff Gerstman</a>, you list &#8220;tough final boss fight&#8221; as a PRO? Jinpachi isn&#8217;t challenging, he&#8217;s a pain in the ass! It&#8217;s like saying putting needles under your feet makes running a marathon more challenging!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.doomsday.no/esn/2006/08/inexcusable/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>World of warcraft has issues</title>
		<link>http://www.doomsday.no/esn/2006/04/world-of-warcraft-has-issues/</link>
		<comments>http://www.doomsday.no/esn/2006/04/world-of-warcraft-has-issues/#comments</comments>
		<pubDate>Sun, 09 Apr 2006 23:24:00 +0000</pubDate>
		<dc:creator>Andreas</dc:creator>
				<category><![CDATA[Game dev & design]]></category>
		<category><![CDATA[Video games]]></category>
		<category><![CDATA[MMO]]></category>
		<category><![CDATA[Second life]]></category>
		<category><![CDATA[World of warcraft]]></category>

		<guid isPermaLink="false">http://www.doomsday.no/esn/2006/04/world-of-warcraft-has-issues/</guid>
		<description><![CDATA[I know. Obvious to pretty much anyone who play the game regularly. However i&#8217;d like to discuss some issues with WoW&#8217;s infrastructure, and touch on why i can&#8217;t seem to get hooked on it at all. Everyone&#8217;s familiar with the queuing issue, when realms started choking and Blizzard were forced to implement the population full [...]]]></description>
			<content:encoded><![CDATA[<p>I know. Obvious to pretty much anyone who play the game regularly. However i&#8217;d like to discuss some issues with WoW&#8217;s infrastructure, and touch on why i can&#8217;t seem to get hooked on it at all.</p>
<p>Everyone&#8217;s familiar with the queuing issue, when realms started choking and Blizzard were forced to implement the population full status, effectively denying any new players.<br />At the same time, Blizzard has realized that to keep the players that are filling up these servers, they need to supply more high-level content.</p>
<p>In the first bout, this resulted in the battlegrounds and improved honor point system, supposedly incentive to keep PvP where it belonged.</p>
<p>Secondly, the intensified raid focus, leading to huge sprawling and admittedly epic quests that have given some players their best experiences with the game.</p>
<p>Third, the expansion pack, providing a whole new high level world of sorts, as well as new character races.</p>
<p>All of these enhancements have, paired with the barring of new players to full realms, in my mind at least, effectively doomed the game to an endless cycle of creating new realms, and endlessly enhancing high level content. As a gamer who has always been quite happy being around the half-way mark with x number of level 30 characters, this ensures my experience with WoW is a solo affair. I&#8217;ll elaborate.</p>
<p>The last time i played WoW, i played on Neptulon, lazily pushing a character up to level 20, before i realized i was bored to shit with the experience of endlessly &#8220;killing stuff while being on an irc with more advanced smileys&#8221;.  Recently, having seen a number of patches and updates to the game, i figured i&#8217;d give it another go. I found that Neptulon was now a full realm, but my character was still intact. The problem is, everyone else on the server is levels 50 through 60, meaning every single area i could safely go to was populated by exactly nobody, leading to an incredibly lonely experience. In the same way, why would a level 60 reroll on a server to go through the same lonely junk i was? In this way, the low/mid level content is completely wasted, and the server is dependant on high level content to keep its appeal. It doesn&#8217;t help that so much low/mid content almost requires a group, meaning if anyone wishes to go through said lonely grind, they&#8217;ll have to do so against terrifying odds. Not cool.</p>
<p>So this gets me thinking.. Where is WoW heading? What is even the point of the low level questing anymore? New players are barred the full experience, veterans stay for their buddies and the prestige of the PvP. What made WoW so amazing to me was its genuine *content*, it&#8217;s hand made feel and its willingness to really make you care about its world. All this is essentially forfeit now, to keep a hard core group of dedicated players.</p>
<p>In the same way, the increased focus on gigantic raids has excluded a great number of players on inferior hardware, who could handle the game normally but feel the utter pain of 1fps when they join a large raid; WoW&#8217;s technology can&#8217;t *handle* the raid sizes required in some cases. Some players who were drawn to WoW for it&#8217;s scalability, that they could actually get it to run and look good on their old rigs, these players are effectively excluded from a great deal of the content.</p>
<p>Going around alone on Neptulon, grinding my way through yada-quest after blabla-quest, trying to reach a point where i can actually SEE all these players that are filling up this realm, it&#8217;s hard not to quit the damn thing and play a game that actually offers an experience on its own without the assistance of lol-ing powergamers. What good is an MMORPG that bars the general public from enjoying it?</p>
<p>Actually, without the people, what good are MMORPGs at all? What can developers do to ensure that their game doesn&#8217;t reach critical mass like WoW is rapidly approaching and instead have an organic, open appeal that isn&#8217;t limited to those who are the most dedicated?</p>
<p>As much as i loathe Second Life&#8217;s presentation and weird reliance on real money, i believe they are touching on something WoW is missing sorely: the player&#8217;s ability to manifest. This lack of reality and consequence to the player&#8217;s actions pulls the rug from underneath the game&#8217;s suspension of disbelief. An example of Blizzard&#8217;s disdain of this is the addition of the instant quest text of a recent patch, which lets players breeze through quests paying no heed to the carefully written briefings. This caters *only* to the veterans who want to get through quests again to quickly level. All this builds on the feeling that everything you do is meaningless other than the quest reward and XP, and that&#8217;s a fallacy that made me leave AO back when, and get into WoW in the first place. I wanted a single player calibre experience with my friends, and for a long time i got just that.</p>
<p>I want WoW to give me an experience other than levelling and chatting with strangers. Is this too much to ask?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.doomsday.no/esn/2006/04/world-of-warcraft-has-issues/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The human interface</title>
		<link>http://www.doomsday.no/esn/2005/11/the-human-interface/</link>
		<comments>http://www.doomsday.no/esn/2005/11/the-human-interface/#comments</comments>
		<pubDate>Wed, 23 Nov 2005 21:30:00 +0000</pubDate>
		<dc:creator>Andreas</dc:creator>
				<category><![CDATA[Game dev & design]]></category>
		<category><![CDATA[Interface design]]></category>

		<guid isPermaLink="false">http://www.doomsday.no/esn/2005/11/the-human-interface/</guid>
		<description><![CDATA[Another post on flashlounge that just kind of got out of hand Slightly edited to make it an ok read out of context. The subject of the interface came up when discussing wether the next gen of consoles was in fact pushing the envelope further, and Adary Wakefield brought up VR and how that evolution [...]]]></description>
			<content:encoded><![CDATA[<p>Another post on flashlounge that just kind of got out of hand <img src='http://www.doomsday.no/esn/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  Slightly edited to make it an ok read out of context. The subject of the interface came up when discussing wether the next gen of consoles was in fact pushing the envelope further, and Adary Wakefield brought up VR and how that evolution kind of just stopped. Never one to back off from a chance to speculate in an overblown way, well i just had to..</p>
<p>As a guy who has spent the better part of the last 2 years developing and focus testing &#8220;tactile&#8221; interfaces for software solutions (tablets and touch screens mostly, also some primitive mocap), i just have to throw in the problem that for a complex mechanism, in most cases intuitivity is actually counterintuitive. You&#8217;d think reaching out to touch a screen, &#8220;grabbing&#8221; an object and twisting it sideways was intuitive, but there&#8217;s an element of uncanny valley to it that actually throws people off. A lot. It also tends to alienate in-depth gamers who want functionality, not tactility. Latest example being Black &#038; white 2, a game that has an interface designed around grabbing, touching, poking and throwing, and the more you play with it, the more you realise you&#8217;d rather just click on stuff than pretend to be this floating hand. Pushing the mouse cursor to the left on your screen to scroll left is, in software terms, THE way to go.</p>
<p>The whole grabbing and dragging thing is 3 operations instead of the simple 1, and what users want, in my experience, is to perform, not figure out how to perform. In simple game design terms, you have the zork school of text adventures, which would try to immerse the player by giving her a completely open range of movements, in theory. In practise it was a counterintuitive interface, kinda-fondly known as guess-the-verb.</p>
<p>Computer interfaces and human interfaces are awkwardly positioned. The lead criticism of Nintendo&#8217;s new motion-based revolution controller is that it places a lot of stress on the joints of the entire arm, not just the fingers, but on the wrist, elbow, shoulder, maybe even neck. Any intense game needs to focus as much interaction into as few movements as possible to be appealing in the long run, simply because, well, if you wanted a workout, you&#8217;d go to the gym. The wacko here of course is rythm based arcade games, ala DDR and Guitar freaks, but ironically, even in that area of body interfaces, the games that require the user to use say 6 pads instead of 4 and to use his hands to press buttons at the same time are the least popular. Simplicity is a virtue.</p>
<p>The tactility of an interface is useful inversely to how complicated the application is. The more you want a user to accomplish, the more you&#8217;ll have to deviate from truly intuitive movements like pointing, dragging, twisting and tapping, and get into esoteric things like drawing shapes/gestures and things of that order. Extending that functionality to body movement is actually a step backward. The ultimate interface is one that is easy to learn and that is applicable to any application after learning it. The keyboard/mouse is uncanny in its efficiency as well as its broad area of successful application.</p>
<p>An element of game design people, especially sim heads, tend to forget, is that games are entertainment to most people, and one of the few forms of truly interactive escapism out there;<br />If i want to be some crazy agile superspy, i&#8217;ll pop in Splinter cell 3, and step in the shoes of a character more able and more skilled than i am. The interface is a means to let me, the regular joe, pretend to be a veteran infiltrator and pull off the tough stuff with a measure of success. If the interface demanded a 1 to 1 mapping of my real skills into that of the game character, you&#8217;d lop off a good 99% of the market right then and there.</p>
<p>The abstraction in the user interface is what make games approachable; making the more direct or more &#8220;human&#8221; is, in my opinion, a strong, firm step backwards.</p>
<p><a class="moz-txt-link-freetext" href="http://www.naturalpoint.com/trackir/">http://www.naturalpoint.com/trackir/</a></p>
<p>It looks completely idiotic. Looking one way to turn your virtual head, and thus limiting your field if view on the screen is the very essence of the human interface gone too far. When it&#8217;s directly detrimental to your gameplay, what&#8217;s the point.</p>
<p>To summarise, VR lacks success and support because it&#8217;s deeply counterintuitive and deeply weird to people with no interest in it, and because it demands custom interfaces for each and every application with no true time-tested design to it.</p>
<p>What i&#8217;d like to see is evolving the gamepad, to the point where controls are on 3 axes and we have actual depth control. I&#8217;d like to grab a force feedback bluetooth gamepad that gives motion feedback. If you press the button that represents a door opening action, and the door<br />cannot be opened, the controller physically prohibits you from pushing the button. Standing against a wall, trying to move against it can&#8217;t be done. The control stick won&#8217;t let you push that direction. Stuff like that, connect the player&#8217;s physical world to the virtual world of the<br />game. A good step was rumble, now couple that with temperature shifts (put a silent fan in there to cool it, already controllers that do this), buttons and controls that let you feel the texture and<br />composition of the objects you interact with. In an FPS, make the heavy weapons heavy. Make your fingers work to use them instead of imposing some virtual limit on you. The limit is real.</p>
<p>That, would be rad.</p>
<p>Suspension of disbelief is a tough matter, but closing the gap between the game world and how you interact with it is more about the human mind than some 1 to 1 proxy mapping, which felt weird in 98, and feels weird today. Abstraction and careful measurement of it is the bridge.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.doomsday.no/esn/2005/11/the-human-interface/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

