<?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>Robin Debreuil&#039;s Blog</title>
	<atom:link href="http://blog.debreuil.com/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://blog.debreuil.com</link>
	<description>I&#039;m wasting time, and time&#039;s wasting me</description>
	<lastBuildDate>Sat, 07 Aug 2010 22:32:06 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Sleepwalker game now Open Source</title>
		<link>http://blog.debreuil.com/?p=198</link>
		<comments>http://blog.debreuil.com/?p=198#comments</comments>
		<pubDate>Wed, 28 Jul 2010 17:32:34 +0000</pubDate>
		<dc:creator>robin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.debreuil.com/?p=198</guid>
		<description><![CDATA[Our Sleepwalker game in now open source. It was built with Swf2XNA and it a good example of how you can build an XNA game using Flash and C#. 
You can find the source and more info here: http://wiki.github.com/debreuil/Swf2XNA/sleepwalker
]]></description>
			<content:encoded><![CDATA[<p><img src="http://blog.debreuil.com/images/sleepwalkerBoxArt.jpg" alt="Sleepwalker XBox Indie game" align="left" hspace="15" />Our <a href="http://marketplace.xbox.com/en-US/games/media/66acd000-77fe-1000-9115-d802585505a3/">Sleepwalker game</a> in now open source. It was built with <a href="http://github.com/debreuil/Swf2XNA">Swf2XNA</a> and it a good example of how you can build an XNA game using Flash and C#. </p>
<p>You can find the source and more info here: <a href="http://wiki.github.com/debreuil/Swf2XNA/sleepwalker">http://wiki.github.com/debreuil/Swf2XNA/sleepwalker</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.debreuil.com/?feed=rss2&amp;p=198</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>SVG vs SWF, Seven Years Later</title>
		<link>http://blog.debreuil.com/?p=175</link>
		<comments>http://blog.debreuil.com/?p=175#comments</comments>
		<pubDate>Sun, 25 Jul 2010 21:15:15 +0000</pubDate>
		<dc:creator>robin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.debreuil.com/?p=175</guid>
		<description><![CDATA[About seven years ago I made a swf to svg converter. It converted all graphics and animations and played fine (if a bit herky jerky) in the Adobe SVG player. As far as I know all markup was legal and approved (I avoided any player specific hacks and scripting). Now with an increasing interest in [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://blog.debreuil.com/images/horseSwf.png" alt="horse animation" align="left"  Hspace="30" Vspace="10" />About seven years ago I made a swf to svg converter. It converted all graphics and animations and played fine (if a bit herky jerky) in the Adobe SVG player. As far as I know all markup was legal and approved (I avoided any player specific hacks and scripting). Now with an increasing interest in svg due to Html5 and Apple, I thought I&#8217;d revisit the project. Chrome and Mozilla can play SVG content now, IE might one day, who knows, maybe it can finally be useful!</p>
<p>Or not. For a final demo, I shrank and spliced an old Flash3 animation that showed off what the converter could do without choking the player. While it didn&#8217;t look set to take over, it was a start &#8211; like many people I really wanted vector control at the page level so all was cool. &#8220;Imagine what the future will bring!&#8221;</p>
<p>Have a look for yourself:<br />
<a href="http://debreuil.com/svg/horse.html">SWF Animation</a><br />
<a href="http://debreuil.com/svg/horse.svg">SVG Animation</a> (warning, may take down Chrome)<br />
<a href="http://debreuil.com/svg/animTest.zip">Download</a>  </p>
<p>In Mozilla the svg just gives a blank screen. Chrome has a little more luck &#8211; it plays for a bit and then gives an &#8216;oh snap&#8217; error. The swf to xaml converter we made suffered a similar fate, and broke later versions of xaml tools as well. Fwiw, all flash animation we have (going back to Flash2) runs flawlessly in the latest player, as does 99.99% of our actionscript code. This is seriously something to consider when moving your assets to html5 (or any direct play xml based format imo). But hey, you can bet on whatever horse you like &#8211; just you really should watch them warming up first &#8211; in these links above that is ; ).</p>
<p><img src="http://blog.debreuil.com/images/horseChrome.png" alt="chrome svg animation" /><br />
SVG animation plays in Chrome, sort of (used to look great!)</p>
<p><img src="http://blog.debreuil.com/images/chromEnd.png" alt="Chrome End " /><br />
&#8230;and then it dies.</p>
<p>I&#8217;m sure it will have uses. Any new graphic support in browsers is a good thing &#8212; just don&#8217;t bet on it replacing Flash anytime soon.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.debreuil.com/?feed=rss2&amp;p=175</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Remapping shortcut keys in FlashDevelop</title>
		<link>http://blog.debreuil.com/?p=168</link>
		<comments>http://blog.debreuil.com/?p=168#comments</comments>
		<pubDate>Sun, 25 Jul 2010 01:29:24 +0000</pubDate>
		<dc:creator>robin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.debreuil.com/?p=168</guid>
		<description><![CDATA[*** Note: You can do it my way below, or you can do what Philippe Elsass (who probably made the feature) says below. Err, thanks Philippe!
&#8220;Shortcuts which are not in MainMenu.xml can be changed in plugin settings. Press F10, and look into ASCompletion settings.&#8221;
Now back to our regular scheduled irrelevant blog post : )
**************************************
This is [...]]]></description>
			<content:encoded><![CDATA[<p>*** Note: You can do it my way below, or you can do what Philippe Elsass (who probably made the feature) says below. Err, thanks Philippe!<br />
&#8220;<strong>Shortcuts which are not in MainMenu.xml can be changed in plugin settings. Press F10, and look into ASCompletion settings.</strong>&#8221;</p>
<p>Now back to our regular scheduled irrelevant blog post : )</p>
<p>**************************************</p>
<p>This is a mental note to self. I think I put a note like this on my last blog, and its gone now. Damn internet wreckers!</p>
<p>So I always map F3 to copy and F4 to paste, otherwise my arm gets shooting pain, and not the big H type. F3 is easy, just open ProgramFiles>FlashDevelop>Settings>ScintillaMenu.xml. Duplicate the Copy command, and change Control C to F3. You might as well do paste as well, but it won&#8217;t work yet. This duplicates those things in the menu &#8211; there is a MainMenu.xml file that has copy and paste, but that didn&#8217;t seem to work for me.</p>
<p>The problem with F4 is it is used by OpenDeclaration, and because of this it is added to an ignore list, and is ignored when I map it to paste. I&#8217;m not sure the following step is needed anymore, but I  recompiled the source and changed the hardcoded value at ASCompletion>Settings>GeneralSettings.cs line 36:</p>
<p>       <strong> const Keys DEFAULT_GOTODECLARATION = Keys.Control | Keys.F11;<br />
        const Keys DEFAULT_DECLARATIONBACK = Keys.Control | Keys.F12;</strong></p>
<p>That still didn&#8217;t take. The last thing needed it to go to FlashDevelop&#8217;s Tools menu, and select Application Files. This brings up the config folder, and from here you want to load Data>ASCompletions>Settings.fdb<br />
These are binary flashDevelop config files, so you need to load them in FlashDevelop. Add the the part two tags at the top, and change to whatever keys you want:</p>
<p><strong>&lt;GeneralSettings xmlns:xsi=&#8221;http://www.w3.org/2001/XMLSchema-instance&#8221; xmlns:xsd=&#8221;http://www.w3.org/2001/XMLSchema&#8221;&gt;<br />
  &lt;GotoDeclaration&gt;F11&lt;/GotoDeclaration&gt;<br />
  &lt;BackFromDeclaration&gt;F12&lt;/BackFromDeclaration&gt;<br />
  &lt;JavadocTags&gt;</strong></p>
<p>Last caveat: When you save this file is saved, however the settings require a restart. When you close, it will be overwritten with the old settings! Ok, so save, go to explorer and rename a copy, close, switch the copy back, et voila! Now those are remapped, and F4 will paste. </p>
<p>Whew.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.debreuil.com/?feed=rss2&amp;p=168</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Sleepwalker (Swf2XNA) released!</title>
		<link>http://blog.debreuil.com/?p=165</link>
		<comments>http://blog.debreuil.com/?p=165#comments</comments>
		<pubDate>Mon, 12 Jul 2010 16:48:45 +0000</pubDate>
		<dc:creator>robin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Swf2XNA C# Swf games XNA XBLIG]]></category>

		<guid isPermaLink="false">http://blog.debreuil.com/?p=165</guid>
		<description><![CDATA[Sleepwalker has finally been passed and released, just in time for me to be starting more contracting  
http://catalog.xna.com/en-US/GameDetails.aspx?catalogEntryId=635e46d7-3dc3-4caf-aad1-6ab7b78ba3f3&#038;type=2
Have a look, if you know flash it is really easy to make something like this (or better of course). This took my brother and I two weeks, though the sequel will take a lot less time. [...]]]></description>
			<content:encoded><![CDATA[<p>Sleepwalker has finally been passed and released, just in time for me to be starting more contracting <img src='http://blog.debreuil.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><a href="http://catalog.xna.com/en-US/GameDetails.aspx?catalogEntryId=635e46d7-3dc3-4caf-aad1-6ab7b78ba3f3&#038;type=2">http://catalog.xna.com/en-US/GameDetails.aspx?catalogEntryId=635e46d7-3dc3-4caf-aad1-6ab7b78ba3f3&#038;type=2</a></p>
<p>Have a look, if you know flash it is really easy to make something like this (or better of course). This took my brother and I two weeks, though the sequel will take a lot less time. I think I&#8217;m starting to understand why Hollywood likes sequels when no one else does.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.debreuil.com/?feed=rss2&amp;p=165</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Getting started with Swf2XNA</title>
		<link>http://blog.debreuil.com/?p=152</link>
		<comments>http://blog.debreuil.com/?p=152#comments</comments>
		<pubDate>Thu, 01 Jul 2010 10:04:06 +0000</pubDate>
		<dc:creator>robin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.debreuil.com/?p=152</guid>
		<description><![CDATA[Swf2XNA is now live! This is an open source (BSD) program that allows you to make Windows/XBox/Win7 games by leveraging Flash for assets and layout, as well as using Box2D visually. It makes 2D games in XNA quite simple to make!
There is a reasonable amount of documentation, some videos, and a lot of sample code [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://github.com/debreuil/Swf2XNA">Swf2XNA</a> is now live! This is an open source (BSD) program that allows you to make Windows/XBox/Win7 games by leveraging Flash for assets and layout, as well as using <a href="http://www.box2d.org/">Box2D</a> visually. It makes 2D games in <a href="http://creators.xna.com/">XNA</a> quite simple to make!</p>
<p>There is a reasonable amount of <a href="http://wiki.github.com/debreuil/Swf2XNA/">documentation</a>, some videos, and a lot of <a href="http://github.com/debreuil/Swf2XNA/downloads">sample code and components</a>. If you have any questions, feel free to <a href="mailto:robin@debreuil.com">email</a> or ask on twitter (I&#8217;m there more often than anywhere &#8211; <a href="http://twitter.com/debreuil">@debreuil</a>).</p>
<p><object width="480" height="385"><param name="movie" value="http://www.youtube.com/v/3a82_jv_BEc&amp;hl=en_US&amp;fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/3a82_jv_BEc&amp;hl=en_US&amp;fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="385"></embed></object><br />
Getting Started with Swf2XNA</p>
<p><object width="480" height="385"><param name="movie" value="http://www.youtube.com/v/c7a5xxXmdMk&amp;hl=en_US&amp;fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/c7a5xxXmdMk&amp;hl=en_US&amp;fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="385"></embed></object><br />
Swf2XNA Components</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.debreuil.com/?feed=rss2&amp;p=152</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>48 hour game at PegJam (Sleepwalker, made with Swf2XNA)</title>
		<link>http://blog.debreuil.com/?p=141</link>
		<comments>http://blog.debreuil.com/?p=141#comments</comments>
		<pubDate>Mon, 31 May 2010 19:09:29 +0000</pubDate>
		<dc:creator>robin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.debreuil.com/?p=141</guid>
		<description><![CDATA[Great weekend. PegJam was the 2nd Winnipeg version of TigJam, which is where game devs from all over get together for weekend of coding madness. I believe the idea is to make a 48 hour game, but the whole thing is more about ideas than rules. There were some really really talented people around, and [...]]]></description>
			<content:encoded><![CDATA[<p>Great weekend. <a href="http://infiniteammo.ca/blog/tigjam-winnipeg-sign-up/">PegJam</a> was the 2nd Winnipeg version of <a href="http://www.tigsource.com/2008/08/23/tigjam/">TigJam</a>, which is where game devs from all over get together for weekend of coding madness. I believe the idea is to make a 48 hour game, but the whole thing is more about ideas than rules. There were some really really talented people around, and by demo time Sunday night it was pretty phenomenal what everyone had done. Really, it was like, wow! Huge thanks to <a href="http://infiniteammo.ca/">Alec Holowka</a> and everyone involved : ).</p>
<p>Sandy and I really wanted to test out the swf2xna framework in a real world deadline situation, and the 48 hour game seemed perfect. Sky and Free (my sons) helped a ton out too &#8211; in spite of missing almost a full day for their <a href="http://www.bandaidlive.ca/index.php?p=bands">concert</a>, they added (to the framework) shadows and highlight shaders, zoom/follow camera, and lots of physics goodness. Sandy made all the art from scratch in Flash. Most of the coding time was spent on components, but we managed to finish the main screens and three levels (the levels are very quick to make now though, as it is just placing assets in flash and testing). I was sort of keeping track of time, I figured Sandy and I spent roughly 16 hours on it, and Sky and Free 8 each. Lots of visiting was happening, which of course was the best part! </p>
<p>Note: swf2xna does box2d layout (in a similar way to the <a href="http://debreuil.com/v2d/">V2D layout engine</a> for flash). It uses the super duper <a href="http://box2dxna.codeplex.com/">box2dXNA</a> port, which is optimized for xbox &#8211; highly recommended!</p>
<p>Here is the game:</p>
<p><object width="660" height="405"><param name="movie" value="http://www.youtube.com/v/Yq6OQKJP9VQ&#038;hl=en_US&#038;fs=1&#038;border=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/Yq6OQKJP9VQ&#038;hl=en_US&#038;fs=1&#038;border=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="660" height="405"></embed></object></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.debreuil.com/?feed=rss2&amp;p=141</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>JSFL for Circles, Grids, and Auto-Naming</title>
		<link>http://blog.debreuil.com/?p=121</link>
		<comments>http://blog.debreuil.com/?p=121#comments</comments>
		<pubDate>Wed, 28 Apr 2010 08:18:19 +0000</pubDate>
		<dc:creator>robin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.debreuil.com/?p=121</guid>
		<description><![CDATA[I&#8217;m doing a lot of layout for some games using the swf>xna converter. One thing that is tedious in flash is renaming all your instances sq_0, sq_1, sq_2&#8230; Also grid layout is more tedious than it should be, and circular layout almost not doable (Flash really needs a &#8216;repeat&#8217; like ctrl&#8217;R in CorelDraw!). Jsfl to [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m doing a lot of layout for some games using the swf>xna converter. One thing that is tedious in flash is renaming all your instances sq_0, sq_1, sq_2&#8230; Also grid layout is more tedious than it should be, and circular layout almost not doable (Flash really needs a &#8216;repeat&#8217; like ctrl&#8217;R in CorelDraw!). Jsfl to the partial rescue.</p>
<p>These are the scripts I&#8217;ve been using a fair bit, they are somewhat handy to me, so posting them here just in case they are for you too. Like all script it is basically vomit on the page, tweaked until it barely works, so buyer beware. Basically you select objects on the stage, and run the commands.</p>
<p>// makes groups of grids in place (and reindexes) based on the w/h and instance root names.<br />
// Selection of multiple groups allowed.<br />
// eg. 20 objects with the root &#8220;square&#8221; and 15 with the root &#8220;circle&#8221;<br />
// will make two grids, one of circles and one of squares.<br />
// To change the center point between fixed, averaged, or weighted, look at the last lines</p>
<p><a href="http://blog.debreuil.com/images/CirclesAndGrids.zip">http://blog.debreuil.com/images/CirclesAndGrids.zip</a></p>
<p><a href="http://blog.debreuil.com/images/CirclesAndGrids.zip"><img src="http://blog.debreuil.com/images/makeCircle.png" alt="makes circles with jsfl" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.debreuil.com/?feed=rss2&amp;p=121</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>I&#8217;m an iPad</title>
		<link>http://blog.debreuil.com/?p=119</link>
		<comments>http://blog.debreuil.com/?p=119#comments</comments>
		<pubDate>Mon, 26 Apr 2010 17:29:47 +0000</pubDate>
		<dc:creator>robin</dc:creator>
				<category><![CDATA[general]]></category>
		<category><![CDATA[swf]]></category>

		<guid isPermaLink="false">http://blog.debreuil.com/?p=119</guid>
		<description><![CDATA[
]]></description>
			<content:encoded><![CDATA[<p><img alt="" src="http://debreuil.com/temp/ImAnIPad2.png" title="Im not a Mac" class="alignnone" width="500" height="488" /></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.debreuil.com/?feed=rss2&amp;p=119</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Removing Components from a Circuit Board with Sand and Oil</title>
		<link>http://blog.debreuil.com/?p=108</link>
		<comments>http://blog.debreuil.com/?p=108#comments</comments>
		<pubDate>Tue, 09 Mar 2010 23:18:05 +0000</pubDate>
		<dc:creator>robin</dc:creator>
				<category><![CDATA[electronics and microcontrollers]]></category>

		<guid isPermaLink="false">http://blog.debreuil.com/?p=108</guid>
		<description><![CDATA[We finally had a nice warm day here in Manitoba, so outdoor experimenting was finally a go : ). I had tried removing components from old boards with hot cooking oil before and it worked somewhat well. The temperature is right (220C+), but it was a bit messy, and while the solder melted, it didn&#8217;t [...]]]></description>
			<content:encoded><![CDATA[<p>We finally had a nice warm day here in Manitoba, so outdoor experimenting was finally a go : ). I had tried removing components from old boards <a href="http://blog.debreuil.com/?p=60">with hot cooking oil</a> before and it worked somewhat well. The temperature is right (220C+), but it was a bit messy, and while the solder melted, it didn&#8217;t flow out of the board without a whack. </p>
<p>The new theory was that if the cooking oil was added to sand, it could still regulate the temperature, and the sand could act like a large soldering wick, and suck out the solder as well. Lo and behold, it worked great!</p>
<p>I did this outdoor as there is a certain smell involved. I&#8217;d recommend old clothes and not standing down wind as well. I had teflon and steel skillets from the thrift shop, the steel one worked better as it got hotter (not sure if that is a teflon thing, or just that particular brand). I used canola oil because that is what I had, peanut oil does get hotter though, and motor oil might work too.</p>
<p><img src="http://blog.debreuil.com/images/solder/theSetup.jpg" alt="setup for board stripping" /><br />
The smell of cooking boards in the morning.</p>
<p><img src="http://blog.debreuil.com/images/solder/212degrees.jpg" alt="measuring the temperature with multimeter" /><br />
Check to make sure things are getting hot enough</p>
<p><img src="http://blog.debreuil.com/images/solder/firstBoard.jpg" alt="the first victim" /><br />
a nice power supply board. Never did like TRS-80&#8217;s.</p>
<p><img src="http://blog.debreuil.com/images/solder/pullingParts.jpg" alt="just pull em out" /><br />
Parts can be pulled out with a glove, I held the board down with a scraper in the other hand sometimes.</p>
<p><img src="http://blog.debreuil.com/images/solder/tandyCooking.jpg" alt="This Epson no longer complains about the cold garage." /><br />
A bunch of memory chips and holders. Even the holders come out unscathed!</p>
<p><img src="http://blog.debreuil.com/images/solder/delicateBoard.jpg" alt="even worked for fancy plastic" /><br />
From a video recorder &#8211; there was a little damage to the outer plastic holder, but only because I pulled it too early.</p>
<p><img src="http://blog.debreuil.com/images/solder/solderRemains.jpg" alt="solder sucked into the sand" /><br />
See how the solder was sucked right off the board. Hey, maybe I could reuse that too ; ).</p>
<p><img src="http://blog.debreuil.com/images/solder/componentBounty.jpg" alt="like a digikey order arriving, almost" /><br />
I feel like a big order just arrived from Digikey. Well almost : ).</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.debreuil.com/?feed=rss2&amp;p=108</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Particle Effects Without Particles</title>
		<link>http://blog.debreuil.com/?p=62</link>
		<comments>http://blog.debreuil.com/?p=62#comments</comments>
		<pubDate>Wed, 03 Feb 2010 06:14:05 +0000</pubDate>
		<dc:creator>robin</dc:creator>
				<category><![CDATA[general]]></category>
		<category><![CDATA[swf]]></category>
		<category><![CDATA[xna]]></category>

		<guid isPermaLink="false">http://blog.debreuil.com/?p=62</guid>
		<description><![CDATA[Particle effects are made by taking a lot of small bitmaps and varying their location and attributes over time. The resulting &#8216;animation&#8217; can look like fire, smoke, or nearly anything else you like.
Normally when coding these you create a small particle class or struct, and it holds things like position, color, direction, acceleration, alpha, scale, [...]]]></description>
			<content:encoded><![CDATA[<p>Particle effects are made by taking a lot of small bitmaps and varying their location and attributes over time. The resulting &#8216;animation&#8217; can look like fire, smoke, or nearly anything else you like.</p>
<p><img src="http://blog.debreuil.com/images/shader01.jpg" alt="Shader Example" align="left" hspace="10" vspace="10"/>Normally when coding these you create a small particle class or struct, and it holds things like position, color, direction, acceleration, alpha, scale, etc. These properties change each update which makes them &#8216;come alive&#8217;. You then assemble a bunch of these particles into &#8216;effects&#8217; or some such thing. To leave a trail, or create blowing smoke, you can drop a series of these effects.</p>
<p>Our approach is similar, but we don&#8217;t use a particle class. Instead we use a random number between 0 and 1, and an equation. The random number is used to vary an effect, otherwise they can look very symetrical. So for example the alpha can be (255 * nextRandom()) to have it vary between invisible and visible. To make it also fade in, it can be (255 * nextRandom * t). To make it ease out on fading it can be (255 * nextRandom * Easing.FadeOutQuad(t, 255, 0)). I think you get the idea. </p>
<p>So instead of particles, there is just a calculation waiting to happen. Not having to deal with individual particle instances or state allows you to do things like change the particle count on the fly (by simply changing the loop size), or reverse time by changing &#8216;t&#8217;.</p>
<p>For anyone who does Flash, I&#8217;m sure the Easing idea is familiar. <a href="http://robertpenner.com/">Robert Penner</a>&#8217;s easing equations are universally popular, as they allow people to easily add tweening, fading and bouncing from code. I&#8217;m basing the equations on these, and adding a few non easing ones that are useful for particles (trig functions, weird functions, etc).</p>
<p>Rather than store the random numbers for each particle (which would require a particle class), we store the random seed and regenerate the same sequence of random numbers each update. This may sound slow, but reasonable random number generation can be surprisingly simple and blazingly fast (one billion numbers in 1.8 seconds <a href="http://software.intel.com/en-us/articles/fast-random-number-generator-on-the-intel-pentiumr-4-processor/">on a p4</a>!). We are using the <a href="http://www.codeproject.com/KB/cs/fastrandom.aspx">FastRandom</a> class by Colin Green which is really fast, and a drop in replacement for System.Random. This allows resetting the random seed without penalty. This is important as we reset the seed every update in order to get the same random number sequence time. It is also easy to extend &#8211; we have added saving state, so for example we can start at the 500th random number of a given seed without going through the first 499. Awesome code, I&#8217;d recommend using it for anything random in your game.</p>
<p>Note this code is available at <a href="http://www.codeplex.com/swf">http://www.codeplex.com/swf</a> though the particle part hasn&#8217;t yet been added (using git locally, so it is a pain).</p>
<p>Here are some quick demo videos, I&#8217;d like to say they will clear up this crappy explanation, but I&#8217;ve seen them.<br />
<object width="445" height="364"><param name="movie" value="http://www.youtube.com/v/u0wkKIlevbg&#038;hl=en_US&#038;fs=1&#038;border=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/u0wkKIlevbg&#038;hl=en_US&#038;fs=1&#038;border=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="445" height="364"></embed></object><br />
Part 1</p>
<p><object width="445" height="364"><param name="movie" value="http://www.youtube.com/v/pV5P5BIieU8&#038;hl=en_US&#038;fs=1&#038;border=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/pV5P5BIieU8&#038;hl=en_US&#038;fs=1&#038;border=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="445" height="364"></embed></object><br />
Part 2</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.debreuil.com/?feed=rss2&amp;p=62</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
