<?xml version="1.0"?>
<rss version="2.0.">
  <channel>
    <title>Advogato blog for fzort</title>
    <link>http://www.advogato.org/person/fzort/</link>
    <description>Advogato blog for fzort</description>
    <language>en-us</language>
    <generator>mod_virgule</generator>
    <pubDate>Wed, 9 Jul 2008 09:12:38 GMT</pubDate>
    <item>
      <pubDate>Mon, 30 Jun 2008 12:01:02 GMT</pubDate>
      <title>30 Jun 2008</title>
      <link>http://www.advogato.org/person/fzort/diary.html?start=119</link>
      <guid>http://www.advogato.org/person/fzort/diary.html?start=119</guid>
      <description>&lt;b&gt;We have pew-pew&lt;/b&gt;&#xD;
&#xD;
&lt;p&gt; &lt;p&gt; New &lt;a href="http://youtube.com/watch?v=fh7mVEu6bdg" &gt;gameplay&#xD;
video&lt;/a&gt;, with audio this time.&#xD;
&#xD;
&lt;p&gt; &lt;p&gt; Creating this one was a bit*h. Basically, I can capture&#xD;
whatever is going out the speakers with &lt;code&gt;arecord&lt;/code&gt;&#xD;
(comes with Alsa). I also have a way to capture video (see&#xD;
my previous post). The problem is that capturing video the&#xD;
way I'm doing (dumping raw frames to the disk) is a CPU&#xD;
killer, so capturing audio while doing that is a no-no. What&#xD;
I ended up doing is adding an option to the code to dump the&#xD;
joypad state to standard output at every frame, and another&#xD;
option to play it back from standard input. So, after&#xD;
playing the game once while recording the joypad, I played&#xD;
it back&#xD;
while capturing&#xD;
the video, and played it back again while capturing the audio. I&#xD;
multiplexed both tracks with &lt;code&gt;ffmpeg&lt;/code&gt; (I also changed&#xD;
the frame dumping code to dump frames as yuv420p instead of&#xD;
PPM, so I could encode the&#xD;
video with &lt;code&gt;ffmpeg&lt;/code&gt; directly).&#xD;
&#xD;
&lt;p&gt; &lt;p&gt; Sounds get a bit out of sync near the end but it's hard&#xD;
to notice.&#xD;
&#xD;
&lt;p&gt; &lt;p&gt; Retro sound effects were generated with DrPetter's&#xD;
very nice &lt;a href="http://www.cyd.liu.se/~tompe573/hp/project_sfxr.html" &gt;sfxr&lt;/a&gt;&#xD;
and filtered in Audacity. Music by "Oz" (real identity as of&#xD;
yet unknown).</description>
    </item>
    <item>
      <pubDate>Fri, 27 Jun 2008 15:31:26 GMT</pubDate>
      <title>27 Jun 2008</title>
      <link>http://www.advogato.org/person/fzort/diary.html?start=118</link>
      <guid>http://www.advogato.org/person/fzort/diary.html?start=118</guid>
      <description>&lt;b&gt;Mind is the fear killer&lt;/b&gt;&#xD;
&#xD;
&lt;p&gt; &lt;p&gt; Uploaded a new &lt;a href="http://youtube.com/watch?v=Ab50I2j-x5I" &gt;gameplay&#xD;
video&lt;/a&gt; to YouTube. It looks kind of... boring (maybe&#xD;
needs more colors?), but with less than four days to the&#xD;
deadline I'd better work on the music and sound effects now.&#xD;
&#xD;
&lt;p&gt; &lt;p&gt; I'm developing it on (GNU/)Linux, of course. To&#xD;
create that&#xD;
video, I made the game retrieve the contents of the&#xD;
framebuffer every other frame and (after averaging 2x2 pixel&#xD;
blocks to reduce the resolution) write&#xD;
it as a PPM to standard output. I can then encode the result&#xD;
to MPEG with some command-line tools in the&#xD;
&lt;code&gt;mjpegtools&lt;/code&gt; package.&#xD;
&#xD;
&lt;p&gt; &lt;p&gt; In fact, I can even encode it on-the-fly, with something&#xD;
like this:&#xD;
&#xD;
&lt;p&gt; &lt;p&gt; &lt;pre&gt;&#xD;
game | ppmtoy4m | y4mscaler -O chromass=420mpeg2 | mpeg2enc&#xD;
-F 5 -q 4 -V 230k -b 7500 -o capture.mpg&#xD;
&lt;/pre&gt;&#xD;
&#xD;
&lt;p&gt; &lt;p&gt; Unfortunately, it's a CPU killer. Nice pipeline though. Got&#xD;
to love *nix.&#xD;
&#xD;
&lt;p&gt; &lt;p&gt; (thanks to "spectre" for this post's title)</description>
    </item>
    <item>
      <pubDate>Thu, 26 Jun 2008 11:02:10 GMT</pubDate>
      <title>26 Jun 2008</title>
      <link>http://www.advogato.org/person/fzort/diary.html?start=117</link>
      <guid>http://www.advogato.org/person/fzort/diary.html?start=117</guid>
      <description>&lt;a href="http://www.advogato.org/person/ncm/diary/270.html" &gt;ncm&lt;/a&gt;&#xD;
: I realize that my last post looks like flame bait. Sorry&#xD;
for that. I should have hastened to add that the problem is&#xD;
with me, not C++. Years of "design patterns" indoctrination&#xD;
while working as a Java code monkey in the "enterprise" have&#xD;
done that to me. I'm in dire need of detox.&#xD;
&#xD;
&lt;p&gt; I'm using a sort of "class hierarchy" in the game, though.&#xD;
For instance, different types of enemies behave and are&#xD;
drawn in different ways, but share common traits, so&#xD;
"virtual functions" become useful there. In those&#xD;
situations, I'm using run-of-the-mill "object-oriented C":&#xD;
&#xD;
&lt;p&gt; &lt;pre&gt;&#xD;
typedef union foe foe;&#xD;
&amp;nbsp;&#xD;
/* the "abstract superclass" */&#xD;
struct foe_common {&#xD;
    vector2 position;&#xD;
    void (*update)(foe *);&#xD;
    void (*draw)(const foe *);&#xD;
    /* ... */&#xD;
};&#xD;
&amp;nbsp;&#xD;
/* a "concrete subclass" */&#xD;
struct foe_sitting_duck {&#xD;
    struct foe_common common;&#xD;
    vector2 direction;&#xD;
    /* ... */&#xD;
};&#xD;
&amp;nbsp;&#xD;
union foe {&#xD;
    struct foe_common common;&#xD;
    struct foe_sitting_duck sitting_duck;&#xD;
    struct foe_ninja ninja;&#xD;
    /* ... and so on */&#xD;
};&#xD;
&lt;/pre&gt;</description>
    </item>
    <item>
      <pubDate>Mon, 23 Jun 2008 18:12:45 GMT</pubDate>
      <title>23 Jun 2008</title>
      <link>http://www.advogato.org/person/fzort/diary.html?start=116</link>
      <guid>http://www.advogato.org/person/fzort/diary.html?start=116</guid>
      <description>Haven't been getting much sleep lately. I'm working on an&#xD;
entry for the &lt;a href="http://softwarecontests.intel.com/gamedemo/index.php" &gt;Intel&#xD;
Game Demo Contest&lt;/a&gt;. &lt;a href="http://youtube.com/watch?v=RgupYhwT4UY" &gt;Here&lt;/a&gt;'s a&#xD;
link to a gameplay video at YouTube (YouTube really crapped out&#xD;
the quality). If you want, you can vote for the demo &lt;a href="http://softwarecontests.intel.com/gamedemo/entrydetail.php?entryid=208" &gt;here&lt;/a&gt;&#xD;
(outdated screenshots over there!).&#xD;
&#xD;
&lt;p&gt; When I started the project, I decided to use C++, and wasted&#xD;
a lot of time with false starts and rewrites on the grounds&#xD;
of design considerations (&lt;i&gt;"like, I'll have an&#xD;
AbstractFoeFactory class that inherits from class&#xD;
Singleton, and it will hand me concrete instances of&#xD;
AbstractFoe, the superclass representing foes in the game,&#xD;
with operators new and delete overloaded so that instances&#xD;
will actually come from an object pool, hmmmyeah"&lt;/i&gt;). Then&#xD;
I said "screw it", and decided to just &lt;b&gt;get the damn thing&#xD;
done&lt;/b&gt;. I'm now happily and productively using plain C. If&#xD;
I want the benefits of virtual methods I just stick a&#xD;
function pointer in a struct.</description>
    </item>
    <item>
      <pubDate>Fri, 2 May 2008 21:10:48 GMT</pubDate>
      <title>2 May 2008</title>
      <link>http://www.advogato.org/person/fzort/diary.html?start=115</link>
      <guid>http://www.advogato.org/person/fzort/diary.html?start=115</guid>
      <description>Today is my last day here. Lured by the prospect of working &#xD;
without a tie, with Linux on my workstation, at an actual &#xD;
tech company, and arguably against common sense, I'm&#xD;
starting at &lt;a href="http://yahoo.com" &gt;Yahoo!&lt;/a&gt; next Monday.&#xD;
&#xD;
&lt;p&gt; &lt;p&gt; &lt;p&gt;I'm pretty excited. Needless to say, I've been following &#xD;
the tech news with utmost interest.</description>
    </item>
    <item>
      <pubDate>Tue, 29 Apr 2008 11:51:28 GMT</pubDate>
      <title>29 Apr 2008</title>
      <link>http://www.advogato.org/person/fzort/diary.html?start=114</link>
      <guid>http://www.advogato.org/person/fzort/diary.html?start=114</guid>
      <description>&lt;a href="http://www.advogato.org/person/shlomif/diary/347.html" &gt;shlomif&lt;/a&gt;: did you actually &lt;i&gt;read&lt;/i&gt; the &#xD;
Nichomachean Ethics? The thing is repulsive. If it really &#xD;
is, as some say, one of the central works of western &#xD;
civilization, it's no wonder we're in such bad shape. &#xD;
Bertrand Russell said it better:&#xD;
&#xD;
&lt;p&gt; &lt;blockquote&gt;&#xD;
There is in Aristotle an almost complete absence of what &#xD;
may be called benevolence or philanthropy. The sufferings &#xD;
of mankind, in so far as he is aware of them, do not move &#xD;
him emotionally; he holds them intellectually to be an &#xD;
evil, but there is no evidence that they cause him &#xD;
unhappiness except when the sufferers happen to be his &#xD;
friends.&#xD;
&lt;/blockquote&gt;</description>
    </item>
    <item>
      <pubDate>Tue, 22 Apr 2008 02:50:51 GMT</pubDate>
      <title>22 Apr 2008</title>
      <link>http://www.advogato.org/person/fzort/diary.html?start=113</link>
      <guid>http://www.advogato.org/person/fzort/diary.html?start=113</guid>
      <description>&lt;b&gt;Implementation of logical operations on a domino&#xD;
substrate&lt;/b&gt;&#xD;
&#xD;
&lt;p&gt; &lt;p&gt; &lt;blockquote&gt;&lt;b&gt;Abstract.&lt;/b&gt; This paper presents some &#xD;
simple&#xD;
ideas about domino gates. Domino gates are implementations&#xD;
of logical operations using toppling dominos to represent&#xD;
the movement of information (bits). (...) The domino model&#xD;
can be used as a representation of single-shot wave gates in&#xD;
unconstrained media, such as sub-excitable&#xD;
Belousov-Zhabotinsky reactors. On a practical note, they are&#xD;
slightly easier to set up and use than collision models&#xD;
using 'billiard balls'.&#xD;
&lt;/blockquote&gt;&#xD;
&#xD;
&lt;p&gt; &lt;p&gt; More at the &lt;a href="http://uncomp.uwe.ac.uk/" &gt;International Center of&#xD;
Unconventional Computing&lt;/a&gt;.</description>
    </item>
    <item>
      <pubDate>Fri, 18 Apr 2008 22:40:21 GMT</pubDate>
      <title>18 Apr 2008</title>
      <link>http://www.advogato.org/person/fzort/diary.html?start=112</link>
      <guid>http://www.advogato.org/person/fzort/diary.html?start=112</guid>
      <description>It's been a hectic day in production support land. My head &#xD;
hurts. And I still have stuff to do - will probably leave &#xD;
at around 21:30 PM, making this a 14 hours day.&#xD;
&#xD;
&lt;p&gt; Anyway, I skipped lunch and instead worked a bit on &#xD;
&lt;a href="http://spoj.pl/problems/DSUBSEQ/" &gt;this&lt;/a&gt; &#xD;
problem. After much head scratching, came up with a O&#xD;
(N^2*M) dynamic programming solution (with N the length of &#xD;
the sequence and M the size of the alphabet). Was really &#xD;
proud of myself for about 3 minutes, until I noticed that N &#xD;
can be as large as 100000. Boom. Anyway, my worthless non-&#xD;
solution is &lt;a href="http://fzort.org/mpr/junk/DistinctSubSequences.java.tx&#xD;
t" &gt;here&lt;/a&gt; (sorry, in Java - as I said, I did it at work). &#xD;
Space can be reduced to just O(N*M), but that doesn't help &#xD;
with time.&#xD;
&#xD;
&lt;p&gt; &lt;a href="http://www.advogato.org/person/laburu/" &gt;laburu&lt;/a&gt;: I'll get around &#xD;
to answering your e-mail eventually, I swear.</description>
    </item>
    <item>
      <pubDate>Thu, 17 Apr 2008 16:25:34 GMT</pubDate>
      <title>17 Apr 2008</title>
      <link>http://www.advogato.org/person/fzort/diary.html?start=111</link>
      <guid>http://www.advogato.org/person/fzort/diary.html?start=111</guid>
      <description>Dang. I can't get any hacking time during the week.&#xD;
&#xD;
&lt;p&gt; Ah well. Lunch break, and I've just solved &lt;a href="http://spoj.pl/problems/KPSORT" &gt;this&lt;/a&gt; problem. It &#xD;
requires more insight than code, so I could work on it &#xD;
for the past couple of days while in the train, in the &#xD;
bathroom, etc. The resulting program is small and &#xD;
simple, but I had to deploy some hardcore permutation group &#xD;
theory to arrive at the solution. I wonder if there's a &#xD;
simple "Aha!" insight that I'm missing. If you think there &#xD;
is, I'd really love to hear.</description>
    </item>
    <item>
      <pubDate>Wed, 16 Apr 2008 01:18:52 GMT</pubDate>
      <title>16 Apr 2008</title>
      <link>http://www.advogato.org/person/fzort/diary.html?start=110</link>
      <guid>http://www.advogato.org/person/fzort/diary.html?start=110</guid>
      <description>&lt;a href="http://fzort.org/mpr/junk/game-screenshot-2.png" &gt;Here's&lt;/a&gt;&#xD;
another screenshot. But better make that &lt;i&gt;next&lt;/i&gt; week...</description>
    </item>
  </channel>
</rss>
