<?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>Soulwire &#187; Autonomous</title>
	<atom:link href="http://blog.soulwire.co.uk/tag/autonomous/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.soulwire.co.uk</link>
	<description>Art + Technology</description>
	<lastBuildDate>Thu, 27 May 2010 16:18:19 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Flipping you the Boid</title>
		<link>http://blog.soulwire.co.uk/laboratory/flash/as3-flocking-steering-behaviors</link>
		<comments>http://blog.soulwire.co.uk/laboratory/flash/as3-flocking-steering-behaviors#comments</comments>
		<pubDate>Tue, 05 May 2009 15:12:45 +0000</pubDate>
		<dc:creator>Soulwire</dc:creator>
				<category><![CDATA[Actionscript 3.0]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Lab]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[AI]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[Autonomous]]></category>
		<category><![CDATA[Emergence]]></category>
		<category><![CDATA[Experiments]]></category>

		<guid isPermaLink="false">http://blog.soulwire.co.uk/?p=320</guid>
		<description><![CDATA[
I’ve uploaded the Boid source code. Sorry for the delay. I’ve also included some basic examples of how you can create nice behaviors using the Boid class. If you set Main.as as your document class then you’ll see that within that you can specify the demo to run when you compile.
The basic demos included are:

Chase [...]


Related posts:<ol><li><a href='http://blog.soulwire.co.uk/laboratory/flash/perlin-noise-flow-field' rel='bookmark' title='Permanent Link: Perlin Noise Flow Field'>Perlin Noise Flow Field</a></li>
<li><a href='http://blog.soulwire.co.uk/code/open-source/as3-drag-drop-shuffle-grid-menu' rel='bookmark' title='Permanent Link: AS3 Shuffle Grid Class'>AS3 Shuffle Grid Class</a></li>
<li><a href='http://blog.soulwire.co.uk/code/open-source/two-sided-planes-in-flash-player-10' rel='bookmark' title='Permanent Link: Double Sided 3D Plane in FP10'>Double Sided 3D Plane in FP10</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p><a href="http://blog.soulwire.co.uk/wp-content/uploads/2009/05/boids.swf" title="AS3 Steering Behaviors" rel="lightbox;width=800;height=760" ><img class="alignnone size-full wp-image-519" title="Boids AS3 Demo" src="http://blog.soulwire.co.uk/wp-content/uploads/2009/05/boids.jpg" alt="Boids AS3 Demo" width="710" height="326" /></a></p>
<p>I’ve uploaded the Boid source code. Sorry for the delay. I’ve also included some basic examples of how you can create nice behaviors using the Boid class. If you set <em>Main.as</em> as your document class then you’ll see that within that you can specify the demo to run when you compile.</p>
<p>The basic demos included are:</p>
<ul>
<li><strong>Chase</strong> &#8211; Boids chase each other</li>
<li><strong>Flock</strong> &#8211; Boids flock together with some wander</li>
<li><strong>Graphics</strong> &#8211; How to use custom graphics with a Boid instance</li>
<li><strong>Seek</strong> &#8211; Boids seek the mouse position</li>
<li><strong>Wander</strong> &#8211; You guessed it, they wander</li>
</ul>
<p>I’ve commented all of the methods and properties and there is also documentation (open <strong><em>index.html</em></strong> in the docs folder) to get you started. Before you mention it, yes, there is some redundant code ;) (such as the <em>constrainToRect</em> method which doesn&#8217;t really work) but I need to do some optimisations anyway so I just left it as is for now, rough and ready.</p>
<p><a href="http://blog.soulwire.co.uk/wp-content/plugins/download-monitor/download.php?id=boids.zip" class="download" title="AS3 Boid Class & Demos: AS3 Boid class for creating flocking behavior, with a variety of steering behaviors and examples of how to use the Boid class."  rel="nofollow"><strong>Download:</strong> AS3 Boid Class & Demos</a><span id="more-320"></span></p>
<p>It’s been a little while since I posted! I’m in the process of moving house and office, plus I’ve been repeatedly slammed at work. Apologies to those of you who’ve left comments and haven’t got much by way of reply. I’ll hopefully be visible again over the next few weeks.</p>
<p>I actually coded this experiment back in November, but only recently decided that enough was enough and hijacked an evening so I could tidy up the code and build a UI for the demo.</p>
<p>Since coming across Craig Reynold’s paper; “<a rel="nofollow" href="http://blog.soulwire.co.uk/goto/http://www.red3d.com/cwr/steer/gdc99/"  target="_blank">Steering Behaviors for Autonomous Characters</a>” whilst I was researching complexity theory for a university project (it wasn’t as academic as it sounds!), I’ve found myself becoming fascinated by flocking and swarm beahviors and the notion that you can create complex systems from relatively simple components. Much like the <a href="http://blog.soulwire.co.uk/laboratory/flash/2d-cellular-automata" title="2D Cellular Automata"  target="_blank">Cellular Automata</a>, you can program an agent to have only a limited set of abilities and awareness, define a set rules for it to follow, and then create a multitude of instances of the agent to see what patterns begin to emerge through their interactions.</p>
<p><a rel="nofollow" href="http://blog.soulwire.co.uk/goto/http://www.red3d.com/cwr/boids/" title="Flocking"  target="_blank">Flocking</a> is a great example of this, as Reynolds demonstrated. His agents, or “<a rel="nofollow" href="http://blog.soulwire.co.uk/goto/http://en.wikipedia.org/wiki/Boids" title="Boids"  target="_blank">Boids</a>”, could perform certain maneuvers, such as <em>seeking</em> a target, <em>fleeing</em> from a predator, <em>avoiding obstacles</em> or <em>wandering</em> randomly. Combine these behaviors though, and allow each Boid to consider it’s neighbors when deciding on its locomotion, and complex behaviors begin to emerge.</p>
<p>The most infamous of these combinations is that of <em>separation</em>, <em>cohesion</em> and <em>alignment</em>, as it can produce a swarm behavior reminiscent of flocking birds or shoals of fish.</p>
<p><strong>Separation</strong> means that each Boid attempts to maintain a certain distance from its immediate neighbors, <strong>Cohesion</strong> ensures that each Boid attempts to stay close to the centre of the immediate flock and <strong>Alignment</strong> will calculate the average heading of the flock and steer towards this vector.</p>
<p>Each of these behaviors is fairly simple in isolation, but the results can give the impression that some significant AI is at work, when all that’s really going on is some simple vector math.</p>
<p><a rel="nofollow" href="http://blog.soulwire.co.uk/goto/http://www.flight404.com/blog/" title="Flight 404"  target="_blank">Robert Hodgin</a> has done some <a rel="nofollow" href="http://blog.soulwire.co.uk/goto/http://www.flight404.com/blog/?p=99"  target="_blank">amazing work with flocking behaviors</a>, so too has <a rel="nofollow" href="http://blog.soulwire.co.uk/goto/http://www.psyop.tv/o.php?id=51|0"  target="_blank">Psyop</a>, and of course <a rel="nofollow" href="http://blog.soulwire.co.uk/goto/http://www.red3d.com/cwr/"  target="_blank">Reynolds</a> is the daddy of all this stuff. There are some good libraries out there too, such as <a rel="nofollow" href="http://blog.soulwire.co.uk/goto/http://opensteer.sourceforge.net/"  target="_blank">OpenSteer</a>, and <a rel="nofollow" href="http://blog.soulwire.co.uk/goto/http://www.bit-101.com/blog/"  target="_blank">Keith Peters</a> talks about this too in <em>Advanced Actionscript Animation</em>.</p>
<p>I’ve been trying to sharpen up my mathematical skills lately though, and was eager to play around with the new (new when I created this experiment anyway!) Flash Player 10 API &#8211; the 3D aspects in particular. So at the core of the Boid class are the native <em>Vector3D</em>, <em>Matrix3D</em> and <em>PerspectiveProjection</em> classes. Ok, so we’ve all got our own Vector3D and Matrix3D class in our library, but I thought it’d be good to use Adobe’s, especially seeing you can then apply the Matrix3D <em>directly to a DisplayObject’s transform property</em>.</p>
<p>Another cool feature I came across was the <a rel="nofollow" href="http://blog.soulwire.co.uk/goto/http://livedocs.adobe.com/flex/3/langref/flash/geom/Matrix3D.html#pointAt()"  target="_blank">Matrix3D.pointAt()</a> method, which will rotate a Matrix around a given axis and in this case can be used to orientate the Boid to it’s heading vector… Nice!</p>
<p>I’ve had a lot of fun putting together the Boid demo anyway &#8211; tweaking various settings on the individual Boids as well as the group behaviors (my personal favorite is ‘<em>Chase</em>’ mode with ‘<em>Number of Boids</em>’ cranked right up!).</p>
<p>If you have a play with the settings though, you’ll quickly see what I mean about the plethora of different effects that can be accomplished, even by simply adjusting the locomotive abilities of the Boids.</p>
<p>Due to said lack of free time as of late, I haven’t documented the code fully, though I have started and so if anyone is interested in the source code <em>then please say so</em> in the comments and I’ll try and finish the job (after a mere 6 months!) and put it up for download.</p>


<p>Related posts:<ol><li><a href='http://blog.soulwire.co.uk/laboratory/flash/perlin-noise-flow-field' rel='bookmark' title='Permanent Link: Perlin Noise Flow Field'>Perlin Noise Flow Field</a></li>
<li><a href='http://blog.soulwire.co.uk/code/open-source/as3-drag-drop-shuffle-grid-menu' rel='bookmark' title='Permanent Link: AS3 Shuffle Grid Class'>AS3 Shuffle Grid Class</a></li>
<li><a href='http://blog.soulwire.co.uk/code/open-source/two-sided-planes-in-flash-player-10' rel='bookmark' title='Permanent Link: Double Sided 3D Plane in FP10'>Double Sided 3D Plane in FP10</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://blog.soulwire.co.uk/laboratory/flash/as3-flocking-steering-behaviors/feed</wfw:commentRss>
		<slash:comments>54</slash:comments>
		</item>
		<item>
		<title>Perlin Noise Flow Field</title>
		<link>http://blog.soulwire.co.uk/laboratory/flash/perlin-noise-flow-field</link>
		<comments>http://blog.soulwire.co.uk/laboratory/flash/perlin-noise-flow-field#comments</comments>
		<pubDate>Sun, 14 Dec 2008 23:11:59 +0000</pubDate>
		<dc:creator>Soulwire</dc:creator>
				<category><![CDATA[Actionscript 3.0]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Lab]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[Autonomous]]></category>
		<category><![CDATA[Emergence]]></category>
		<category><![CDATA[Experiments]]></category>

		<guid isPermaLink="false">http://blog.soulwire.co.uk/?p=263</guid>
		<description><![CDATA[
It was a rainy Sunday and I found myself playing around with perlin noise for a couple of hours.
The idea was to create a simple flow field using the BitmapData perlinNoise method, and use this to influence the movement of autonomous agents. There is no complex vector math or steering behaviours, just some simple logic [...]


Related posts:<ol><li><a href='http://blog.soulwire.co.uk/laboratory/flash/as3-flocking-steering-behaviors' rel='bookmark' title='Permanent Link: Flipping you the Boid'>Flipping you the Boid</a></li>
<li><a href='http://blog.soulwire.co.uk/code/actionscript-3/webcam-motion-detection-tracking' rel='bookmark' title='Permanent Link: AS3 Webcam Motion Tracking'>AS3 Webcam Motion Tracking</a></li>
<li><a href='http://blog.soulwire.co.uk/code/open-source/two-sided-planes-in-flash-player-10' rel='bookmark' title='Permanent Link: Double Sided 3D Plane in FP10'>Double Sided 3D Plane in FP10</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p><a href="http://blog.soulwire.co.uk/wp-content/uploads/2008/12/flow-field.swf" rel="lightbox:width=780;height=450;" title="Perlin Noise Flow Field" ><img src="http://blog.soulwire.co.uk/wp-content/uploads/2008/12/flow-field-710x352.jpg" alt="Flow Field with Perlin Noise" title="Flow Field with Perlin Noise" width="710" height="352" class="alignnone size-medium wp-image-563" /></a></p>
<p>It was a rainy Sunday and I found myself playing around with <a rel="nofollow" href="http://blog.soulwire.co.uk/goto/http://en.wikipedia.org/wiki/Perlin_noise"  target="_blank">perlin noise</a> for a couple of hours.</p>
<p>The idea was to create a simple flow field using the BitmapData perlinNoise method, and use this to influence the movement of autonomous agents. There is no complex vector math or steering behaviours, just some simple logic for how a particle or agent reacts to the current pixel it is positioned over.<span id="more-263"></span></p>
<p>Despite its simplicity, by changing parameters such as the level of offset per frame or the x and y frequency, it is possible to create some interesting effects which resemble the movement of flocking birds, shoals of fish or indeed more fittingly for this time of year; panicking Christmas shoppers desperately hunting for gifts.</p>
<p>At each update step, an agent will grab the value of the pixel it is on top of and alter its trajectory based on the brightness of the pixel. Throw in some variance relating to how strongly an individual agent will react to this value and some interesting patterns begin to emerge.</p>
<p>The basic logic I’m using in this demo is as follows:</p>
<pre lang="actionscript">// Get the pixel the agent is over
var pixel:uint = noiseBitmap.getPixel( agent.x, agent.y );

// Find the brightness of the pixel
var brightness:Number = pixel / 0xFFFFFF;

// Set the angle and the speed according to brightness
var speed:Number = brightness * agent.speed;
var angle:Number = brightness * 360 * Math.PI / 180;

// Update the agent's position / rotation
agent.x += Math.cos( angle ) * speed;
agent.y += Math.sin( angle ) * speed;
agent.rotation = brightness * 360;</pre>
<p>Feel free to download the source code and start tweaking the many variables. Adding further life to the agents by introducing collision or allowing additional individual traits beyond simply speed and wander might be one option worth exploring.</p>
<a href="http://blog.soulwire.co.uk/wp-content/plugins/download-monitor/download.php?id=perlin-flow-field.zip" class="download" title="Perlin Noise Flow Field: An example of how to use the Perlin noise algorithm to simulate flocking behaviors."  rel="nofollow"><strong>Download:</strong> Perlin Noise Flow Field</a>
<p>Have fun!&#8230;</p>


<p>Related posts:<ol><li><a href='http://blog.soulwire.co.uk/laboratory/flash/as3-flocking-steering-behaviors' rel='bookmark' title='Permanent Link: Flipping you the Boid'>Flipping you the Boid</a></li>
<li><a href='http://blog.soulwire.co.uk/code/actionscript-3/webcam-motion-detection-tracking' rel='bookmark' title='Permanent Link: AS3 Webcam Motion Tracking'>AS3 Webcam Motion Tracking</a></li>
<li><a href='http://blog.soulwire.co.uk/code/open-source/two-sided-planes-in-flash-player-10' rel='bookmark' title='Permanent Link: Double Sided 3D Plane in FP10'>Double Sided 3D Plane in FP10</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://blog.soulwire.co.uk/laboratory/flash/perlin-noise-flow-field/feed</wfw:commentRss>
		<slash:comments>29</slash:comments>
		</item>
		<item>
		<title>2D Cellular Automata</title>
		<link>http://blog.soulwire.co.uk/laboratory/flash/2d-cellular-automata</link>
		<comments>http://blog.soulwire.co.uk/laboratory/flash/2d-cellular-automata#comments</comments>
		<pubDate>Tue, 06 May 2008 13:16:41 +0000</pubDate>
		<dc:creator>Soulwire</dc:creator>
				<category><![CDATA[Actionscript 3.0]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Generative]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[Autonomous]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[Complexity]]></category>
		<category><![CDATA[Emergence]]></category>
		<category><![CDATA[Experiments]]></category>

		<guid isPermaLink="false">http://blog.soulwire.co.uk/?p=69</guid>
		<description><![CDATA[
Inspired by Conway’s game of life, I decided to program a 2 dimensional Cellular Automaton in Actionscript 3.
I had been reading up on complexity theory for a recent project and the Cellular Automata just kept on rearing its head. Of course it displays the fundamental qualities of complexity; starting with an object following a set [...]


Related posts:<ol><li><a href='http://blog.soulwire.co.uk/laboratory/flash/as3-flocking-steering-behaviors' rel='bookmark' title='Permanent Link: Flipping you the Boid'>Flipping you the Boid</a></li>
<li><a href='http://blog.soulwire.co.uk/laboratory/flash/recursive-polygon-subdivision' rel='bookmark' title='Permanent Link: Recursive Polygon Subdivision'>Recursive Polygon Subdivision</a></li>
<li><a href='http://blog.soulwire.co.uk/laboratory/flash/perlin-noise-flow-field' rel='bookmark' title='Permanent Link: Perlin Noise Flow Field'>Perlin Noise Flow Field</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p><a rel="lightbox;width=800;height=525;" title="2D Cellular Automata" href="http://blog.soulwire.co.uk/wp-content/uploads/2008/05/cellular-automata.swf"><img src="http://blog.soulwire.co.uk/wp-content/uploads/2008/05/cellular-automata-710x326.jpg" alt="2D Cellular Automata" title="2D Cellular Automata" width="710" height="326" class="alignnone size-medium wp-image-689" /></p>
<p></a>Inspired by <strong>Conway’s game of life</strong>, I decided to program a <strong>2 dimensional Cellular Automaton</strong> in Actionscript 3.</p>
<p>I had been reading up on complexity theory for a recent project and the Cellular Automata just kept on rearing its head. Of course it displays the fundamental qualities of complexity; starting with an object following a set of simple rules and then creating multiple instances to form complex and unpredictable patterns.<span id="more-69"></span></p>
<p>In terms of visualisation, the Cellular Automata is interesting because it has potential to be used for many applications. Complexity Theory and Systems Theory are used to simulate various growth patterns such as that of a city or population. My personal ideas are of course much simpler, one being a 3 dimensional version which uses <strong>Papervision 3D</strong>; and, rather than switching cells on or off, would incrementally grow or shrink shapes in 3D space to create landscapes or cityscapes whose growth is determined by the development of the Automata.</p>
<p>This particular Actionscript 3 version is a fairly direct port of the 2 dimensional ‘Game of Life’ permutation, but is fun to play with none-the-less.</p>
<p><strong>The rules are as follows:</strong></p>
<p>Each cell can be either <strong>empty</strong>, <strong>new</strong>, <strong>alive </strong>or <strong>dead</strong>. As the grid updates, each cell observes its 8 neighbouring cells (or less if it is at a corner or edge) and changes it&#8217;s state depending on the state of said neighbouring cells.</p>
<ul>
<li>If <strong>less than 2 neighbours</strong> are alive, the cell dies <em>(loneliness)</em></li>
<li>If <strong>more than 3 neighbours</strong> are alive, the cell dies <em>(overcrowding)</em></li>
<li>If a living cell has <strong>2 or 3 living neighbours</strong> it continues to live</li>
<li>If a dead cell has <strong>3 living neighbours</strong> it comes to life</li>
</ul>
<p>There are many initial shapes which either form patterns of perpetual growth or at least interesting shapes as the system updates; some simply die out. Have a play and see if you can find shapes, or combinations of shapes which do interesting things. It’s quite addictive!</p>
<p>I have added a few presets to illustrate how certain groupings of cells that are alive when the system starts can behave in the grid as the automaton runs, and also a randomise button which will create a random grid of empty and alive cells and can form some interesting patterns as the system iterates and emergence begins to kick in.</p>
<p>The <a href="http://blog.soulwire.co.uk/wp-content/plugins/download-monitor/download.php?id=cellular-automata.zip" title="Actionscript 3 Cellular Automata source code" >source code</a> is of course available, so have a play with that and see what happens when you change the rules or create bigger grids.</p>
<p><strong>A quick note about the Actionscript.</strong></p>
<p>I have created a <strong>CAGrid </strong>class for building Cellular Automata, which can be instantiated at any size and with any amount of rows and colums.</p>
<pre lang="actionscript">/**
* A grid of cells used to produce a 2 dimensional cellular automata
*
* @param	gridSize	The dimensions in pixels of the grid
* @param	segments	The number of cells in each row or column
* @param	cellPad		The padding (or spacing) inside each cell
*/

public function CAGrid( gridSize:int, segments:int, cellPad:int )</pre>
<p>The CAGrid class contains methods for drawing the grid, resetting the grid, updating the system, randomising cells, saving configurations and loading presets, and is automatically redrawn when the size or rows / columns are changed during runtime using the <strong>size </strong>and <strong>segments </strong>setters respectively.</p>
<p>The <strong>Cell </strong>class contains a simple setter for <strong>status</strong>, and some constants for easy reference to the cell&#8217;s state. In this example the cell is drawn by choosing a colour which corresponds to the state of the cell, but a movieclip with labelled frames (for example) could just as easily be used to create more visually interesting results.</p>
<p>Oh, and included are some <strong>custom skinned CS3 components</strong> (button and comboBox) which look a bit like the Vista skin, so maybe those are goodies in themselves!</p>
<a href="http://blog.soulwire.co.uk/wp-content/plugins/download-monitor/download.php?id=cellular-automata.zip" class="download" title="2D Cellular Automata: An AS3 implementation of Conways' Game of Life. A 2D Cellular Automata with source code and demo."  rel="nofollow"><strong>Download:</strong> 2D Cellular Automata</a>


<p>Related posts:<ol><li><a href='http://blog.soulwire.co.uk/laboratory/flash/as3-flocking-steering-behaviors' rel='bookmark' title='Permanent Link: Flipping you the Boid'>Flipping you the Boid</a></li>
<li><a href='http://blog.soulwire.co.uk/laboratory/flash/recursive-polygon-subdivision' rel='bookmark' title='Permanent Link: Recursive Polygon Subdivision'>Recursive Polygon Subdivision</a></li>
<li><a href='http://blog.soulwire.co.uk/laboratory/flash/perlin-noise-flow-field' rel='bookmark' title='Permanent Link: Perlin Noise Flow Field'>Perlin Noise Flow Field</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://blog.soulwire.co.uk/laboratory/flash/2d-cellular-automata/feed</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
	</channel>
</rss>
