<?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>dave&#039;s blog of art and programming &#187; flash</title>
	<atom:link href="http://www.pawfal.org/dave/blog/category/flash/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.pawfal.org/dave/blog</link>
	<description>missing acceptable use policy</description>
	<lastBuildDate>Wed, 08 Feb 2012 12:11:49 +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>Making game characters with a webcam</title>
		<link>http://www.pawfal.org/dave/blog/2011/01/making-game-characters-with-a-webcam/</link>
		<comments>http://www.pawfal.org/dave/blog/2011/01/making-game-characters-with-a-webcam/#comments</comments>
		<pubDate>Wed, 05 Jan 2011 15:28:42 +0000</pubDate>
		<dc:creator>dave</dc:creator>
				<category><![CDATA[flash]]></category>
		<category><![CDATA[groworld]]></category>
		<category><![CDATA[lirec]]></category>

		<guid isPermaLink="false">http://www.pawfal.org/dave/blog/?p=1645</guid>
		<description><![CDATA[Start with a drawing of a character seperated into pieces, and show it to a webcam. An application locates all the "image islands" in the picture using OpenCV and cvBlobLib:

The image is thresholded to make an alpha channel and the images are saved. A web server (written in clojure) picks them up automatically and sends [...]]]></description>
			<content:encoded><![CDATA[<p>Start with a drawing of a character seperated into pieces, and show it to a webcam. An application locates all the "image islands" in the picture using OpenCV and <a href="http://opencv.willowgarage.com/wiki/cvBlobsLib">cvBlobLib</a>:</p>
<p><a href="http://www.pawfal.org/dave/blog/wp-content/uploads/2011/01/paper.png"><img src="http://www.pawfal.org/dave/blog/wp-content/uploads/2011/01/paper-300x234.png" alt="" title="paper" width="300" height="234" class="alignnone size-medium wp-image-1646" /></a></p>
<p>The image is thresholded to make an alpha channel and the images are saved. A web server (written in clojure) picks them up automatically and sends them to a flash application (written in haxe) which builds a skeleton using <a href="http://en.wikipedia.org/wiki/Prim%27s_algorithm">prims algorithm</a> for minimum spanning tree, a port from <a href="http://fo.am/hapstar">hapstar</a> (you make a graph of all pieces connected to all others and use the MST of that). </p>
<p>This automagically created skeleton can then be animated to make puppet like characters directly from drawings on paper:</p>
<p><a href="http://www.pawfal.org/dave/blog/wp-content/uploads/2011/01/ingame2.png"><img src="http://www.pawfal.org/dave/blog/wp-content/uploads/2011/01/ingame2.png" alt="" title="ingame2" width="483" height="387" class="alignnone size-full wp-image-1647" /></a></p>
<p>Here is a more complex abstract test:</p>
<p><a href="http://www.pawfal.org/dave/blog/wp-content/uploads/2011/01/paper2.png"><img src="http://www.pawfal.org/dave/blog/wp-content/uploads/2011/01/paper2-300x234.png" alt="" title="paper2" width="300" height="234" class="alignnone size-medium wp-image-1650" /></a> <a href="http://www.pawfal.org/dave/blog/wp-content/uploads/2011/01/ingame3.png"><img src="http://www.pawfal.org/dave/blog/wp-content/uploads/2011/01/ingame3.png" alt="" title="ingame3" width="347" height="358" class="alignnone size-full wp-image-1651" /></a></p>
<p>Code <a href="http://svn.lirec.eu/scenarios/GerminationX/">here</a> and <a href="http://svn.lirec.eu/libs/magicsquares/applications/harvest/">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pawfal.org/dave/blog/2011/01/making-game-characters-with-a-webcam/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Plant spirits, AI and gitorious</title>
		<link>http://www.pawfal.org/dave/blog/2010/07/plant-spirits-ai-and-gitorious/</link>
		<comments>http://www.pawfal.org/dave/blog/2010/07/plant-spirits-ai-and-gitorious/#comments</comments>
		<pubDate>Fri, 30 Jul 2010 10:43:49 +0000</pubDate>
		<dc:creator>dave</dc:creator>
				<category><![CDATA[flash]]></category>
		<category><![CDATA[games]]></category>
		<category><![CDATA[groworld]]></category>
		<category><![CDATA[lirec]]></category>

		<guid isPermaLink="false">http://www.pawfal.org/dave/blog/?p=1391</guid>
		<description><![CDATA[This week has been about researching the next steps for the germination x design. Principally looking at how we can use the game to demonstrate and exploit some of the work on the Lirec project. I've had a speculative look at how we could use companions to fit the theme of a permaculture game, and [...]]]></description>
			<content:encoded><![CDATA[<p>This week has been about researching the next steps for the <a href="http://libarynth.org/germinationx_game_design">germination x design</a>. Principally looking at how we can use the game to demonstrate and exploit some of the work on the <a href="http://www.lirec.eu">Lirec project</a>. I've had a <a href="http://libarynth.org/germinationx_companion">speculative look</a> at how we could use companions to fit the theme of a permaculture game, and ended up with some strange combination of bickering greek gods and plant spirits. </p>
<p>I've also been playing with the AgentMind code from our partners at <a href="http://www.hw.ac.uk/">Heriot Watt</a> and got some of my own AI agents running and interacting with objects in a test world. At the other end, the client game code is now free from flash dependencies, so it should be possible to target HTML5 canvas and flash in the same code.</p>
<p>I've also switched from svn to git for everything and moved to <a href="http://gitorious.org">gitorious</a>. Germination X is <a href="http://gitorious.org/germinationx">here</a> and all the rest of my mess is now located <a href="http://gitorious.org/flotsam">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pawfal.org/dave/blog/2010/07/plant-spirits-ai-and-gitorious/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>On Flash, software art and freedom</title>
		<link>http://www.pawfal.org/dave/blog/2010/06/on-flash-software-art-and-freedom/</link>
		<comments>http://www.pawfal.org/dave/blog/2010/06/on-flash-software-art-and-freedom/#comments</comments>
		<pubDate>Sun, 27 Jun 2010 10:38:01 +0000</pubDate>
		<dc:creator>dave</dc:creator>
				<category><![CDATA[flash]]></category>
		<category><![CDATA[random thoughts]]></category>

		<guid isPermaLink="false">http://www.pawfal.org/dave/blog/?p=1349</guid>
		<description><![CDATA[With the current state of html5 not really being where I want it to be, I feel I need to air my dirty laundry on the use of Flash. 
I want to make browser based applications in order to increase accessibility - with the understanding that I may need to make concessions to freedom to [...]]]></description>
			<content:encoded><![CDATA[<p>With the current state of html5 not really being where I want it to be, I feel I need to air my dirty laundry on the use of Flash. </p>
<p>I want to make browser based applications in order to increase accessibility - with the understanding that I may need to make concessions to freedom to achieve this. With experience, I have found (for example by porting fluxus to windows) that such concessions over accessibility lead to more people using free software (and in that case, moving over to the linux version completely over time) than sticking in accepted, and eventually all too comfortable, spaces.</p>
<p>Obviously licensing the source as GPL helps, as does using a GPL toolchain (Haxe). Above all though, in artistic terms I find excessive purity to be counter productive.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pawfal.org/dave/blog/2010/06/on-flash-software-art-and-freedom/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Wilderness in html5 canvas</title>
		<link>http://www.pawfal.org/dave/blog/2010/05/wilderness-in-html5-canvas/</link>
		<comments>http://www.pawfal.org/dave/blog/2010/05/wilderness-in-html5-canvas/#comments</comments>
		<pubDate>Sun, 16 May 2010 18:09:49 +0000</pubDate>
		<dc:creator>dave</dc:creator>
				<category><![CDATA[flash]]></category>
		<category><![CDATA[games]]></category>
		<category><![CDATA[groworld]]></category>
		<category><![CDATA[rendering]]></category>

		<guid isPermaLink="false">http://www.pawfal.org/dave/blog/?p=1266</guid>
		<description><![CDATA[My exploration of web programming continues, this is a rewrite of the wilderness game world from haxe/flash into javascript and html5 canvas. There are some plans to make this into something more resembling an actual game, but at the moment it's serving as a good test as I get to grips with these new fangled [...]]]></description>
			<content:encoded><![CDATA[<p>My exploration of web programming continues, this is a rewrite of the <a href="http://www.pawfal.org/dave/blog/2009/12/wilderness/">wilderness</a> game world from haxe/flash into javascript and html5 canvas. There are some plans to make this into something more resembling an actual game, but at the moment it's serving as a good test as I get to grips with these new fangled bits and pieces.</p>
<p><iframe src ="http://www.pawfal.org/dave/live/wilderness-canvas/wilderness.html" width="660" height="500"></p>
<p>Your browser does not support iframes.</p>
<p></iframe></p>
<p>Leaving out all the hot air about small companies beginning with "A", here are my thoughts on canvas for making games compared with haxe/flash:</p>
<p>Pros:</p>
<li>Javascript is much nicer for me than Haxe due to dynamic typing and it's comparative closeness to Scheme.</li>
<li>Immediate mode for graphics allows you to draw a scene how you want with your own containers. The retained mode MovieClip object in Flash is an annoyance for me. Hopefully similar things happen in web graphics as it did in 3D with the early DirectX retained mode, which was eventually abandoned.
<li>I've started using Chrome for development - the javascript debugger is one of the best I've come across, and the Firefox one is pretty good too. When using haxe/flash I ended up completely relying on print statements.</li>
<li>It's nicer to develop in a normal webpage rather than a plugin.</li>
<p>Cons:</p>
<li>Canvas is currently much much slower than Flash. It's quite possible I'm doing something stupid, but the canvas version uses about 40% of my processor where as the flash version is 5-10%.</li>
<li>Less built in support for text and user interface items like entry dialogs. There is probably much more missing along these lines, and much that will need to be implemented from scratch. Personally speaking I am not too fond of library frameworks implemented by <a href="http://www.joelonsoftware.com/articles/fog0000000018.html">architecture astronauts</a>, so I can live with this at the moment.</li>
<p>Update: While I hope HTML5 is the future, it seems on some counts my optimism was premature, it seems it's still to reach a point where it's available for the majority of people - and where it is available, the stability and performance is variable.  With this in mind : <a href="http://www.pawfal.org/dave/blog/2010/06/on-flash-software-art-and-freedom/">On flash, software art and freedom</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.pawfal.org/dave/blog/2010/05/wilderness-in-html5-canvas/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Wilderness</title>
		<link>http://www.pawfal.org/dave/blog/2009/12/wilderness/</link>
		<comments>http://www.pawfal.org/dave/blog/2009/12/wilderness/#comments</comments>
		<pubDate>Mon, 07 Dec 2009 17:30:21 +0000</pubDate>
		<dc:creator>dave</dc:creator>
				<category><![CDATA[flash]]></category>
		<category><![CDATA[groworld]]></category>

		<guid isPermaLink="false">http://www.pawfal.org/dave/blog/?p=934</guid>
		<description><![CDATA[I'm not sure if this is another groworld game prototype or something else at the moment. Use the cursor keys to move around, when you get to the edge of the visible bit of world you can step into the next (as long there is not water on the other side). It's a pseudo infinite [...]]]></description>
			<content:encoded><![CDATA[<p>I'm not sure if this is another groworld game prototype or something else at the moment. Use the cursor keys to move around, when you get to the edge of the visible bit of world you can step into the next (as long there is not water on the other side). It's a pseudo infinite wilderness, very much inspired by <a href="http://en.wikipedia.org/wiki/Spindizzy_(video_game)">SpinDizzy</a>, and feeling boxed in while playing FarmVille.</p>
<p><iframe src ="http://www.pawfal.org/dave/live/wilderness/1" width="660" height="500"></p>
<p>Your browser does not support iframes.</p>
<p></iframe></p>
<p>These are the tiles it's using:</p>
<p><a href="http://www.pawfal.org/dave/blog/wp-content/uploads/2009/12/cubes.png"><img class="alignnone size-medium wp-image-935" title="cubes" src="http://www.pawfal.org/dave/blog/wp-content/uploads/2009/12/cubes-300x230.png" alt="" width="300" height="230" /></a></pre>
<p>The <a href="http://www.pawfal.org/flotsam/haxe/wilderness/textures/wilderness.svg">original svg</a> is with the <a href="http://www.pawfal.org/flotsam/haxe/wilderness/">code in svn</a>.</p>
<p>I'd also add that selected ambient works is good listening while drawing sprites :)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pawfal.org/dave/blog/2009/12/wilderness/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>More on haxe development</title>
		<link>http://www.pawfal.org/dave/blog/2009/11/more-on-haxe-development/</link>
		<comments>http://www.pawfal.org/dave/blog/2009/11/more-on-haxe-development/#comments</comments>
		<pubDate>Mon, 30 Nov 2009 16:59:45 +0000</pubDate>
		<dc:creator>dave</dc:creator>
				<category><![CDATA[flash]]></category>
		<category><![CDATA[howto]]></category>

		<guid isPermaLink="false">http://www.pawfal.org/dave/blog/?p=909</guid>
		<description><![CDATA[I thought I'd expand a little on the al jazari flash game, and how to develop flash games using free software.
Haxe is really rather nice, and although I'd prefer something with more parentheses (and ironically, less static typing) it does make programming for flash a nicer experience than I'd been led to believe is normally [...]]]></description>
			<content:encoded><![CDATA[<p>I thought I'd expand a little on the al jazari flash game, and how to develop flash games using free software.</p>
<p><a href="http://haxe.org/">Haxe</a> is really rather nice, and although I'd prefer something with more parentheses (and ironically, less static typing) it does make programming for flash a nicer experience than I'd been led to believe is normally the case. I only used haxe, gimp and a bit of fluxus to get sprite renders of the 3D models, along with the firefox and of course its flash plugin (I'd like to use <a href="http://www.gnu.org/software/gnash/">gnash</a> if I do a lot more of this). I'm going to describe the basics and some of the things it took me longer to figure out. I relied a lot on howtos in blog posts, so I thought it would be a good idea to join in the fun.</p>
<p>Firstly you need a file called compile.hxml with something like this in it:</p>
<pre><span style="color: #0000ff;">-swf al-jazari.swf
-swf-version 9
-swf-lib resources.swf
-main AlJazari
-swf-header 640:480:40:ffffff</span></pre>
<p>This is something like a makefile for haxe and contains the main output file, the main class and the size of the area the plugin will take up. You compile your haxe script with the command <span style="color: #0000ff;">haxe compile.hxml</span>.</p>
<p>The style of haxe (or paradigm, if you will) is very Java like (which is probably good for me after all this exposure to Scheme and C++). You need to name your file the same as the class containing the main function eg:</p>
<pre><span style="color: #0000ff;">class MyMainClass
{
    static function main()
    {
        trace("this gets run");
    }
}</span></pre>
<p>Will work if it's called MyMainClass.hx and the compile.hxml contains:</p>
<p><span><span style="color: #0000ff;">-main MyMainClass</span></span></p>
<p>You can then test it out by writing a little html like this:</p>
<pre><span style="color: #0000ff;">&lt;object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
    width="50"
    height="50"
    align="middle"&gt;
&lt;param name="movie" value="al-jazari.swf"/&gt;
&lt;param name="allowScriptAccess" value="always" /&gt;
&lt;param name="quality" value="high" /&gt;
&lt;param name="scale" value="noscale" /&gt;
&lt;param name="salign" value="lt" /&gt;
&lt;param name="bgcolor" value="#ffffff"/&gt;
&lt;embed src="al-jazari.swf"
    bgcolor="#000000"
    width="640"
    height="480"
    name="haxe"
    quality="high"
    align="middle"
    allowScriptAccess="always"
    type="application/x-shockwave-flash"
    pluginspage="http://www.macromedia.com/go/getflashplayer"
    /&gt;
&lt;/object&gt;</span></pre>
<p>And then point your browser at this to test the code.</p>
<p><span style="text-decoration: underline;">Using textures</span></p>
<p>The compile.hxml file for al jazari also includes a reference to a lib - which is where you can embed resources like textures for making sprites. You build one of these with a bit of xml like this:</p>
<pre><span style="color: #0000ff;">&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;movie version="9"&gt;
    &lt;background color="#ffffff"/&gt;
    &lt;frame&gt;
        &lt;library&gt;
            &lt;bitmap id="BlueCubeTex" import="textures/blue-cube.png"/&gt;
        &lt;/library&gt;
    &lt;/frame&gt;
&lt;/movie&gt;</span></pre>
<p>The id refers to a class you have to add to your haxe script - I think this is like a forward declaration or extern of some form, which allows you to refer to your texture:</p>
<p><span style="color: #0000ff;">class BlueCubeTex extends BitmapData { public function new() { super(0,0); } }</span></p>
<p>This bit of code (say in a class inherited from Sprite) will then draw the texture like this:</p>
<p><span style="color: #0000ff;">graphics.clear();<br />
graphics.beginBitmapFill(</span><span style="color: #0000ff;">BlueCubeTex</span><span style="color: #0000ff;">);<br />
graphics.drawRect(0,0,64,64);<br />
graphics.endFill();</span></p>
<p>The xml script is needed to build the swf library file which contains the textures, which you do by running:</p>
<p><span style="color: #0000ff;">swfmill simple resources.xml resources.swf</span></p>
<p><a href="http://swfmill.org/">swfmill</a> is free software, and installable with <span style="color: #0000ff;">apt-get install swfmill</span> on ubuntu.</p>
<p><span style="text-decoration: underline;">Using sound</span></p>
<p>I couldn't figure out a way to embed sounds using swfmill, it seems that it's a recent feature, and I couldn't find any examples that included the haxe code to load them. I did get this to work though:</p>
<p><span style="color: #0000ff;">import flash.media.Sound;<br />
import flash.net.URLRequest;<br />
import flash.media.SoundLoaderContext;</span></p>
<p>...</p>
<p><span style="color: #0000ff;">var sound: Sound = new Sound();<br />
var req:URLRequest = new URLRequest("path/from/main/swf/to/samples/sample.mp3");<br />
var context:SoundLoaderContext = new SoundLoaderContext(8000,true);<br />
sound.load(req,context);<br />
</span></p>
<p>Which loads mp3s from a url, and then after some time (you can set up a callback to tell you then it's loaded but I didn't bother):</p>
<p><span style="color: #0000ff;">sound.play(0);</span></p>
<p>Where the parameter is the offset (in samples I think) from the start of the sound.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pawfal.org/dave/blog/2009/11/more-on-haxe-development/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Al Jazari in flash! (or haxe)</title>
		<link>http://www.pawfal.org/dave/blog/2009/11/al-jazari-in-flash-or-haxe/</link>
		<comments>http://www.pawfal.org/dave/blog/2009/11/al-jazari-in-flash-or-haxe/#comments</comments>
		<pubDate>Wed, 18 Nov 2009 17:15:51 +0000</pubDate>
		<dc:creator>dave</dc:creator>
				<category><![CDATA[flash]]></category>
		<category><![CDATA[livecoding]]></category>

		<guid isPermaLink="false">http://www.pawfal.org/dave/blog/?p=887</guid>
		<description><![CDATA[My first flash/haxe app, which I found really fun to make. Click on the code to change the instructions, and on the cubes to activate or deactivate triggers - there is only one robot and one sample (808 handclap) working for the moment. Here's more about the al jazari project.
[update - added some more samples]
[update [...]]]></description>
			<content:encoded><![CDATA[<p>My first flash/<a href="http://haxe.org/">haxe</a> app, which I found really fun to make. Click on the code to change the instructions, and on the cubes to activate or deactivate triggers - there is only one robot and one sample (808 handclap) working for the moment. Here's <a href="http://www.pawfal.org/dave/index.cgi?Projects/Al%20Jazari">more about the al jazari project</a>.</p>
<p>[update - added some more samples]<br />
[update #2 - more robots and more sounds, click on the robots to edit their code]</p>
<p><iframe src ="http://www.pawfal.org/dave/live/al-jazari/v2" width="660" height="500"></p>
<p>Your browser does not support iframes.</p>
<p></iframe></p>
<p>The source code and textures <a href="http://www.pawfal.org/flotsam/haxe/al-jazari/">are here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pawfal.org/dave/blog/2009/11/al-jazari-in-flash-or-haxe/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

