<?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"
	>

<channel>
	<title>Mark Danks</title>
	<atom:link href="http://www.danks.org/mark/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.danks.org/mark</link>
	<description></description>
	<pubDate>Thu, 03 Jul 2008 20:39:06 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
	<language>en</language>
			<item>
		<title>PlayStation-edu</title>
		<link>http://www.danks.org/mark/2008/06/06/playstation-edu/</link>
		<comments>http://www.danks.org/mark/2008/06/06/playstation-edu/#comments</comments>
		<pubDate>Fri, 06 Jun 2008 18:46:31 +0000</pubDate>
		<dc:creator>mdanks</dc:creator>
		
		<category><![CDATA[Code]]></category>

		<category><![CDATA[Games]]></category>

		<guid isPermaLink="false">http://www.danks.org/mark/?p=89</guid>
		<description><![CDATA[I just put up a post on the PlayStation blog about the PlayStation-edu program:
 http://blog.us.playstation.com/2008/06/06/playstation-edu/
It is a program to get development hardware into the classrooms of universities and colleges.
I am giving a talk about it at the Game Education Summit next week in Dallas.
[update]
Made slashdot!
]]></description>
			<content:encoded><![CDATA[<p>I just put up a post on the PlayStation blog about the PlayStation-edu program:</p>
<p><a href="http://blog.us.playstation.com/2008/06/06/playstation-edu/"> http://blog.us.playstation.com/2008/06/06/playstation-edu/</a></p>
<p>It is a program to get development hardware into the classrooms of universities and colleges.</p>
<p>I am giving a talk about it at the <a href="http://www.gameeducationsummit.com/">Game Education Summit</a> next week in Dallas.</p>
<p>[update]</p>
<p>Made <a href="http://developers.slashdot.org/article.pl?sid=08/06/07/0316231">slashdot</a>!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.danks.org/mark/2008/06/06/playstation-edu/feed/</wfw:commentRss>
		</item>
		<item>
		<title>CG vs HLSL</title>
		<link>http://www.danks.org/mark/2008/06/05/cg-vs-hlsl/</link>
		<comments>http://www.danks.org/mark/2008/06/05/cg-vs-hlsl/#comments</comments>
		<pubDate>Fri, 06 Jun 2008 06:32:41 +0000</pubDate>
		<dc:creator>mdanks</dc:creator>
		
		<category><![CDATA[Code]]></category>

		<guid isPermaLink="false">http://www.danks.org/mark/?p=88</guid>
		<description><![CDATA[I just converted my app from Cg to HLSL.  No real reason, except that I didn&#8217;t want to be locked into nVidia graphics cards.
In general, I find Cg more straightforward than HLSL.  However, once I finished, it does not really make any difference to my app code because I have abstracted the shader [...]]]></description>
			<content:encoded><![CDATA[<p>I just converted my app from <a href="http://en.wikipedia.org/wiki/Cg_%28programming_language%29">Cg </a>to <a href="http://en.wikipedia.org/wiki/HLSL">HLSL</a>.  No real reason, except that I didn&#8217;t want to be locked into nVidia graphics cards.</p>
<p>In general, I find Cg more straightforward than HLSL.  However, once I finished, it does not really make any difference to my app code because I have abstracted the shader layer away.  Considering that I plan to stick with very straightforward shader files (and not even bother with .fx files), it probably does not matter in the end.</p>
<p>My next step is to create a job management system which runs on multiple threads&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.danks.org/mark/2008/06/05/cg-vs-hlsl/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Realtime Brushes</title>
		<link>http://www.danks.org/mark/2008/05/26/realtime-brushes/</link>
		<comments>http://www.danks.org/mark/2008/05/26/realtime-brushes/#comments</comments>
		<pubDate>Mon, 26 May 2008 16:38:21 +0000</pubDate>
		<dc:creator>mdanks</dc:creator>
		
		<category><![CDATA[Code]]></category>

		<guid isPermaLink="false">http://www.danks.org/mark/?p=84</guid>
		<description><![CDATA[The renderer which I have been working on is based around brushes.  At the moment, they are very basic, but they produce some pretty images.  As mentioned in previous posts, there is a cube with each side having a different image on it.

I finally hooked up a screenshot function to the app as [...]]]></description>
			<content:encoded><![CDATA[<p>The renderer which I have been working on is based around brushes.  At the moment, they are very basic, but they produce some pretty images.  As mentioned in previous posts, there is a cube with each side having a different image on it.</p>
<p style="text-align: center;"><img class="alignnone size-full wp-image-85 aligncenter" title="brush" src="http://www.danks.org/mark/wp-content/uploads/2008/05/brush.jpg" alt="" width="500" height="272" /></p>
<p>I finally hooked up a screenshot function to the app as well as a mode to capture at 30fps.  All of those images create a movie.  It is not perfect, because the D3D function GetBackBuffer() stalls like crazy.  I am still trying to figure out how to capture at a decent framerate without having to use a video capture card.</p>
<p>For the movie, it shows the brushes moving around the images, turning the cube, and a few other effects.  Right now, there are very few rules for the brushes, so I need to add some more to see what happens.</p>
<p><a href="http://www.danks.org/mark/Videos/brush.mpg">The movie</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.danks.org/mark/2008/05/26/realtime-brushes/feed/</wfw:commentRss>
<enclosure url="http://www.danks.org/mark/Videos/brush.mpg" length="2763236" type="video/mpeg" />
		</item>
		<item>
		<title>PixelJunk Monsters Soundtrack</title>
		<link>http://www.danks.org/mark/2008/05/25/pixeljunk-monsters-soundtrack/</link>
		<comments>http://www.danks.org/mark/2008/05/25/pixeljunk-monsters-soundtrack/#comments</comments>
		<pubDate>Mon, 26 May 2008 01:20:33 +0000</pubDate>
		<dc:creator>mdanks</dc:creator>
		
		<category><![CDATA[Games]]></category>

		<guid isPermaLink="false">http://www.danks.org/mark/?p=82</guid>
		<description><![CDATA[The soundtrack to the game PixelJunk Monsters has been released on the PSN Store!  There is a great interview of Otograph, the group behind the music over on the PlayStation blog.  I managed to find time to play a number of levels in the game&#8230;I probably got 5-7 rainbows before other things demanded [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignright alignnone size-full wp-image-83" style="float: right;" title="pixeljunkmonsters" src="http://www.danks.org/mark/wp-content/uploads/2008/05/pixeljunkmonsters.jpg" alt="" width="256" height="256" />The soundtrack to the game <a href="http://www.metacritic.com/games/platforms/ps3/pixeljunkmonsters">PixelJunk Monsters</a> has been released on the PSN Store!  There is a great <a href="http://blog.us.playstation.com/2008/05/22/pixeljunk-monsters-soundtrack-an-interview-with-otograph/">interview of Otograph</a>, the group behind the music over on the PlayStation blog.  I managed to find time to play a number of levels in the game&#8230;I probably got 5-7 rainbows before other things demanded my time.  I would love to go back and play it some more.  The amazing thing about the soundtrack is that it does not have any DRM.  I can move it off my PS3 to my main PC (where I can stream it to my <a href="http://www.roku.com/">Roku Soundbridge</a>) and to my <a href="http://www.apple.com/ipodnano/">iPod Nano</a> for when I go running and traveling.</p>
<p>It is really nice that you can play PixelJunk Monsters via RemotePlay. I can sit on my couch and play the game on my PSP with headphones on, instead of taking over my main TV.  The game works just fine and the music is even more addictive with headphones on.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.danks.org/mark/2008/05/25/pixeljunk-monsters-soundtrack/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Animating Brushes</title>
		<link>http://www.danks.org/mark/2008/05/18/animating-brushes/</link>
		<comments>http://www.danks.org/mark/2008/05/18/animating-brushes/#comments</comments>
		<pubDate>Mon, 19 May 2008 05:41:38 +0000</pubDate>
		<dc:creator>mdanks</dc:creator>
		
		<category><![CDATA[Code]]></category>

		<guid isPermaLink="false">http://www.danks.org/mark/?p=76</guid>
		<description><![CDATA[I have been spending time making a realtime brushing engine.  It uses CG shaders to do the rendering and can be driven by scripts or a joystick.
The interesting thing when running in real time is that the brushes fade out and move around.  It means that often, it is much harder to understand [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignright size-full wp-image-78" style="float: right;" title="Flower 1" src="http://www.danks.org/mark/wp-content/uploads/2008/05/brush11.jpg" alt="" width="354" height="311" />I have been spending time making a realtime brushing engine.  It uses <a href="http://developer.nvidia.com/page/home.html">CG shaders</a> to do the rendering and can be driven by scripts or a joystick.</p>
<p>The interesting thing when running in real time is that the brushes fade out and move around.  It means that often, it is much harder to understand what the underlying picture is (not that the fish or crabs in the previous videos were easy to understand).</p>
<p>The entire engine is a multithreaded render which builds a command buffer in the simulation thread, while drawing the previous frame&#8217;s command buffer in the render thread.  The synchronization is always tricky, but I have a number of debugging rendering modes which make it easier to figure out what is going on.  At compile time, I can select:</p>
<ul>
<li>Multithreaded double-buffer</li>
<li>Single threaded double-buffer</li>
<li>Single threaded single-buffer</li>
<li>Single threaded immediate</li>
</ul>
<p><span id="more-76"></span>When I am adding a new feature, I start at the &#8220;easiest&#8221; level (single threaded immediate) and work my way up from there.  Usually, if the single threaded double-buffer is working fine, then the multithreaded one is okay as well.</p>
<p>I am using Direct3D for all of the rendering.  Along with the command buffer, I have a vertex buffer.  Since it is created with a FVF (vertex description), I can use it with the offset command to just fill it with vertices.  Since I am used to the PS2 and PS3 ways of rendering, this feels very natural.  I don&#8217;t have many fixed vertex buffers with the brushes&#8230;everything is dynamic and generated per frame.</p>
<p style="text-align: center;"><img class="aligncenter size-full wp-image-79" title="Flower 2" src="http://www.danks.org/mark/wp-content/uploads/2008/05/brush2.jpg" alt="" width="334" height="311" /></p>
<p>Currently, I have flower pictures as the background.  I create a cube with a flower per panel.  The panel which is facing the user is the drawing panel, although I have a number of buttons which cause other things to happen to the image (spawn a 1,000 brushes, collapse all brushes to the center, etc).  I sort the panels based on the middle of the panel and get some rendering back to front.  It is not perfect, but it does the trick for most angles.</p>
<p>The next step is to add the scripting back into the engine.  With my previous <a href="http://www.danks.org/mark/peduncle/">Peduncle</a> work, it was all non-realtime and I just rendered out a movie.  I need to get some level of control over the input to the system&#8230;relying on my joystick movements in realtime won&#8217;t cut it.</p>
<p style="text-align: center;"><img class="size-full wp-image-80 aligncenter" style="vertical-align: middle;" title="Flower 3" src="http://www.danks.org/mark/wp-content/uploads/2008/05/brush3.jpg" alt="" width="275" height="269" /></p>
<p>The other thing is to add some more job/task management code.  While I have the simulation and rendering in different threads, there is a lot which can be spawned off to other threads.  For example, all of the panels are distinct at the moment&#8230;they don&#8217;t depend on other panels.  I am planning to spawn a number of threads at the start of the app.  Then they can be woken up by tasks which need to run and then go back to sleep when the task finishes.  The goal is to not spawn/kill threads every frame, which is very expensive to do, but rather reuse the threads.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.danks.org/mark/2008/05/18/animating-brushes/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Sushi for Breakfast</title>
		<link>http://www.danks.org/mark/2008/04/24/sushi-for-breakfast/</link>
		<comments>http://www.danks.org/mark/2008/04/24/sushi-for-breakfast/#comments</comments>
		<pubDate>Thu, 24 Apr 2008 14:03:27 +0000</pubDate>
		<dc:creator>mdanks</dc:creator>
		
		<category><![CDATA[Food]]></category>

		<category><![CDATA[Travel]]></category>

		<guid isPermaLink="false">http://www.danks.org/mark/?p=74</guid>
		<description><![CDATA[I am in Tokyo for a few days and I went to the Tsukiji Fish Market this morning.  The market is the main place for all seafood for Japan&#8230;a giant warehouse of fish, crab, eel, and other sea creatures.  Of course, the earlier that you arrive, the more interesting it is, so I was up [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignright size-full wp-image-75" style="float: right;" title="fishmarket" src="http://www.danks.org/mark/wp-content/uploads/2008/04/fishmarket.jpg" alt="Tokyo fish market" width="307" height="230" />I am in Tokyo for a few days and I went to the <a href="http://www.tsukiji-market.or.jp/tukiji_e.htm">Tsukiji Fish Market</a> this morning.  The market is the main place for all seafood for Japan&#8230;a giant warehouse of fish, crab, eel, and other sea creatures.  Of course, the earlier that you arrive, the more interesting it is, so I was up at 5am to head over there.</p>
<p>After wandering around for a while, I went to get breakfast. The best breakfast around the fish market?  Sushi!  At 7am, I was eating maguro, saba, uni, and other wonderful raw food.  Got to love Tokyo!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.danks.org/mark/2008/04/24/sushi-for-breakfast/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Multithreaded Rendering</title>
		<link>http://www.danks.org/mark/2008/04/13/multithreaded-rendering/</link>
		<comments>http://www.danks.org/mark/2008/04/13/multithreaded-rendering/#comments</comments>
		<pubDate>Mon, 14 Apr 2008 05:02:15 +0000</pubDate>
		<dc:creator>mdanks</dc:creator>
		
		<category><![CDATA[Code]]></category>

		<category><![CDATA[Games]]></category>

		<guid isPermaLink="false">http://www.danks.org/mark/?p=73</guid>
		<description><![CDATA[One of the big things for games programming these days is dealing with multiprocessing.  I have been working on a multithreaded renderer in my spare time to do interactive brush work.  The previous movies for peduncle are all non-interactive.  They actually render in faster than realtime, but they just run from a [...]]]></description>
			<content:encoded><![CDATA[<p>One of the big things for games programming these days is dealing with multiprocessing.  I have been working on a multithreaded renderer in my spare time to do interactive brush work.  The <a href="http://www.danks.org/mark/2008/01/11/peduncle-video/">previous movies for peduncle</a> are all non-interactive.  They actually render in faster than realtime, but they just run from a command line.  First, I had to create the basic infrastructure, which is not much different than a game.   This infrastructure means all of the usual subsystems like fileIO, memory, debug scaffolding, and rendering.  I already had fileIO running in another thread.  This evening, I got my multithreaded renderer working.</p>
<p><span id="more-73"></span></p>
<p>The basic architecture for the renderer is to build a render queue (a command list), then execute all of those commands.  In fact, this is almost identical to a PS2 rendering DMA list.  <a href="http://www.bringyou.to/games/PS2.htm">Xgkick the data</a> and let the GS render.</p>
<p>My renderer has four modes:</p>
<ul>
<li>Immediate</li>
<li>Single threaded, single buffer</li>
<li>Single threaded, double buffer</li>
<li>Multithreaded, double buffer</li>
</ul>
<p><strong>Immediate </strong>is useful for debugging, although it is extremely slow.  Whenever a command is inserted into the render queue, it is immediately executed.  Great for stepping through code, since the rendering happens when it is coded from the simulation thread.  Very bad performance.</p>
<p><strong>Single threaded, single buffer</strong> puts all of the commands into a buffer.  At the end of the frame, it goes through those commands and renders them.  There is only one buffer, which is cleared at the end of the frame.  This is good for making sure that your commands are executing properly, without having to worry about threading issues.</p>
<p><strong>Single threaded, double buffer</strong> is almost the same as the &#8220;single threaded, single buffer&#8221; except when the rendering happens at the end of the frame, it renders the data from the <em>previous</em> simulation frame.  This is because there are two buffers.  Again, easier to debug since it is a single thread, but more difficult to understand the rendering queue because it is the previous frames data.</p>
<p><strong>Multithreaded, double buffer</strong> is the normal rendering mode.  At the start of the frame, the simulation thread begins to fill a render buffer with commands.  At the same time, the render thread is processing the render buffer from the <em>previous</em> simulation frame.  At the end of the frame, both threads synchronize and the buffers switch.  This is the fastest mode, but very hard to debug.</p>
<p>People have asked why I don&#8217;t have explicit code running in the render thread, such as object-&gt;draw().  In reality, one of the commands is a callback, which could do something like that.  However, that tends to make thread synchronization and mutex hell.  By explicitly dealing with commands, there is very little synchronization between the simulation and render threads.  It also makes it much better for systems like the PS3, where the SPUs are doing a lot of the work and you have to <a href="http://www.danks.org/mark/2007/10/09/what-is-dma/">DMA data to them</a> anyways.</p>
<p>Hopefully, I will have some cool movies soon now that the basics are in place.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.danks.org/mark/2008/04/13/multithreaded-rendering/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Stormfront Studios Closes</title>
		<link>http://www.danks.org/mark/2008/04/02/stormfront-studios-closes/</link>
		<comments>http://www.danks.org/mark/2008/04/02/stormfront-studios-closes/#comments</comments>
		<pubDate>Wed, 02 Apr 2008 23:04:48 +0000</pubDate>
		<dc:creator>mdanks</dc:creator>
		
		<category><![CDATA[Code]]></category>

		<category><![CDATA[Games]]></category>

		<guid isPermaLink="false">http://www.danks.org/mark/2008/04/02/stormfront-studios-closes/</guid>
		<description><![CDATA[Stormfront Studios has closed its doors.  While I have not worked there for a number of years now, it was my first games job&#8230;they took a chance on a strange music guy who had been focusing on image processing.  I am incredibly proud of The Lord of the Rings: The Two Towers.  [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.danks.org/mark/wp-content/uploads/2008/04/stormfrontstudios.jpg" alt="stormfrontstudios.jpg" align="right" border="2" /><a href="http://www.gamasutra.com/php-bin/news_index.php?story=18087">Stormfront Studios</a> has closed its doors.  While I have not worked there for a number of years now, it was my first games job&#8230;they took a chance on a strange music guy who had been focusing on image processing.  I am incredibly proud of The Lord of the Rings: The Two Towers.  The tech that my engineering team and I created was truly some of best in the industry at the time.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.danks.org/mark/2008/04/02/stormfront-studios-closes/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Cross Core Code</title>
		<link>http://www.danks.org/mark/2008/03/16/cross-core-code/</link>
		<comments>http://www.danks.org/mark/2008/03/16/cross-core-code/#comments</comments>
		<pubDate>Mon, 17 Mar 2008 04:51:53 +0000</pubDate>
		<dc:creator>mdanks</dc:creator>
		
		<category><![CDATA[Code]]></category>

		<guid isPermaLink="false">http://www.danks.org/mark/2008/03/16/cross-core-code/</guid>
		<description><![CDATA[I have been dealing with multicore code lately.  This is both at work and in my spare programming time.  At work, the PS3 is an interesting problem because there are heterogenous CPUs (the PPU and SPUs).  It becomes more complicated when there is not unified memory.  Licensed PS3 programmers can download [...]]]></description>
			<content:encoded><![CDATA[<p>I have been dealing with multicore code lately.  This is both at work and in my spare programming time.  At work, the PS3 is an interesting problem because there are heterogenous CPUs (the PPU and SPUs).  It becomes more complicated when there is not unified memory.  Licensed PS3 programmers can download my C++ template class which tries to address this problem.  At home, I am programming on a dual-core Wintel box, and in some ways it is not any easier.</p>
<p><span id="more-32"></span>Previous to my game career, I used to do high end medical VR.  Many, many years ago, I had an <a href="http://www.sgi.com">SGI Onyx</a> as my &#8220;desktop&#8221; computer.  With all of the extra hardware like dual graphics pipes, <a href="http://www.polhemus.com/">Polhemus sensors</a>, gloves, and head displays, I probably had around a million dollars of hardware for my personal use.  However, even though I was on a quad-processor Onyx, there were exactly the same problems which I am dealing with today&#8230;and my computing and graphics power is probably much greater now.</p>
<p>I have seen people write code to mask the differences between the various threading systems, like pthreads, win32 threads, SPU tasks, etc., but it never <em>feels right</em>.  I guess that most of what I have looked at feels like a hack.  In the PS3 model, you want a ton of little tasks.  In the XBox360/quad-core model, you want monolithic threads which use each core fully.  Thankfully, the little task model works fine on the XBox360 (as developers are beginning to figure out).  It is still up to the developer to understand what of their data is read-only vs read/write, since that can make a huge difference in a non-unified memory environment.  At home, with <a href="http://www.danks.org/mark/peduncle/">my brush work</a>, I am looking at how to parallelize the brushes across multiple cores to try and get to interactive rates.</p>
<p>In the end, this post is more musings and rants about the current state of things.  In general, most game developers are beginning to realize that the raw performance of their code is much less important to the memory model and data traversal.  And with most CS students out of college learning C# and Java, they really do not understand what is happening at the raw RAM level&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.danks.org/mark/2008/03/16/cross-core-code/feed/</wfw:commentRss>
		</item>
		<item>
		<title>GDC 2008 Prep Work</title>
		<link>http://www.danks.org/mark/2008/02/17/gdc-2008-prep-work/</link>
		<comments>http://www.danks.org/mark/2008/02/17/gdc-2008-prep-work/#comments</comments>
		<pubDate>Sun, 17 Feb 2008 23:50:28 +0000</pubDate>
		<dc:creator>mdanks</dc:creator>
		
		<category><![CDATA[Code]]></category>

		<category><![CDATA[Games]]></category>

		<guid isPermaLink="false">http://www.danks.org/mark/2008/02/17/gdc-2008-prep-work/</guid>
		<description><![CDATA[Sunday afternoon&#8230;mostly nice day outside.  I&#8217;m trapped inside working on my presentations for GDC.  So many good things have happened over the past year with the PS3 that it is taking quite a while to put it all together.  It does not mean that we are done improving it, but it certainly makes me feel [...]]]></description>
			<content:encoded><![CDATA[<p>Sunday afternoon&#8230;mostly nice day outside.  I&#8217;m trapped inside working on my presentations for GDC.  So many good things have happened over the past year with the PS3 that it is taking quite a while to put it all together.  It does not mean that we are done improving it, but it certainly makes me feel good about the future.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.danks.org/mark/2008/02/17/gdc-2008-prep-work/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
