<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
  <author>
    <name>Henning Hasemann</name>
  </author>
  <title>Leetless Coding Blog</title>
  <link href="http://leetless.de/" />
  <id>http://leetless.de</id>
  <updated>2010-09-07T09:59:59.217032</updated>
  <entry>
    <title>Keepalive</title>
    <link href="http://leetless.de/article-keepalive.html"/>
    <id>http://leetless.de/article-keepalive.html</id>
    <updated>2010-09-07T09:52:00</updated>
    <content type="html">&lt;p&gt;Hey guys.&lt;/p&gt;
&lt;p&gt;I know it was very quiet here in the past 2 months. Good news for me is that I
really like my new job. Bad news for grail is that I don&#39;t have much time for
it at the moment. That does not mean its dead though. For my part, the commit
rate hos &amp;quot;only&amp;quot; slowed down remarkably.&lt;/p&gt;
&lt;p&gt;&lt;a class=&#34;reference external&#34; href=&#34;http://github.com/zdctb&#34;&gt;zdctb&lt;/a&gt; also mentioned that he might have some
more time to work on grail in the near future. However we&#39;d prefer a more
regular stream of updates. So if you&#39;re a C++ developer who always wanted to
participate in an adventure game engine (or you know of one), don&#39;t hesitate
to contact us!&lt;/p&gt;
&lt;p&gt;For the holy grail!&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>IRC Channel</title>
    <link href="http://leetless.de/article-irc_channel.html"/>
    <id>http://leetless.de/article-irc_channel.html</id>
    <updated>2010-07-03T17:45:00</updated>
    <content type="html">&lt;p&gt;Just got over it in my previous post: There is an IRC channel for Grail on
&lt;a class=&#34;reference external&#34; href=&#34;http://freenode.net/&#34;&gt;Freenode&lt;/a&gt; now, its called
&lt;a class=&#34;reference external&#34; href=&#34;irc://chat.freenode.net/#grail&#34;&gt;#grail&lt;/a&gt; (creative, eh?).
Feel free to join there for any questions/suggestions regarding grail or any
other stuff related to me or this site.&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>Site updates</title>
    <link href="http://leetless.de/article-site_updates.html"/>
    <id>http://leetless.de/article-site_updates.html</id>
    <updated>2010-07-03T17:24:00</updated>
    <content type="html">&lt;p&gt;Hey guys. I&#39;m glad to announce that I finished my diploma thesis a few weeks
ago and am now working at the &lt;a class=&#34;reference external&#34; href=&#34;http://www.tu-bs.de&#34;&gt;TU Braunschweig&lt;/a&gt; as PhD
student.&lt;/p&gt;
&lt;p&gt;As I&#39;m not sure yet how the regulations regarding publication are, I will not
publish my thesis here yet (probably its not of much interest to any usual
leetless reader anyways).&lt;/p&gt;
&lt;p&gt;There are also some changes in the &lt;a class=&#34;reference external&#34; href=&#34;/vim.html&#34;&gt;VIM Section&lt;/a&gt;: I removed lots of the older themes in order
to focus on the real good ones. Also I&#39;m proud to present a new theme, called
&lt;em&gt;PhD&lt;/em&gt;, hopefully its useful to someone.&lt;/p&gt;
&lt;p&gt;Another thing, which I neglected to post for months now is that the
&lt;a class=&#34;reference external&#34; href=&#34;http://gmansion2.wordpress.com/&#34;&gt;Giga Mansion 2&lt;/a&gt; adventure game project is
dead. They used the Indiana engine (the predecessor of &lt;a class=&#34;reference external&#34; href=&#34;/grail.html&#34;&gt;Grail&lt;/a&gt;)
which I developed in parallel to the game.
At first I wanted to wait until they announce the end of the project
themselves which seemingly never happened. Nevertheless it had been fun
working with these guys and really pushed the adventure game engine stuff
forwards a lot.&lt;/p&gt;
&lt;p&gt;And while I&#39;m at it: Because of the diploma thesis there was some pause, but I
managed to include &lt;a class=&#34;reference external&#34; href=&#34;http://www.opengl.org/&#34;&gt;OpenGL&lt;/a&gt; into Grail, which makes
it run about 10 times faster (at least on my machine).
Check out the &lt;a class=&#34;reference external&#34; href=&#34;http://github.com/Droggelbecher/Grail/tree/opengl&#34;&gt;OpenGL Branch&lt;/a&gt;
if you want to try it. If during compiling there is no OpenGL found,
the engine will be compiled with plain old SDL, so this can not come
to anyones disadvantage.&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>Going to github</title>
    <link href="http://leetless.de/article-github.html"/>
    <id>http://leetless.de/article-github.html</id>
    <updated>2010-05-03T16:15:00</updated>
    <content type="html">&lt;p&gt;Currently data is being pushed to &lt;a class=&#34;reference external&#34; href=&#34;http://github.com&#34;&gt;GitHub&lt;/a&gt;. I plan to
let this run in parallel to the current self-hosted solution for a while and
if it is good I&#39;ll shot down the self hosted git repository.&lt;/p&gt;
&lt;p&gt;Reasons for github in favor of hosting the repository myself:&lt;/p&gt;
&lt;ul class=&#34;simple&#34;&gt;
&lt;li&gt;Wider audience&lt;/li&gt;
&lt;li&gt;Integrated issue tracking system&lt;/li&gt;
&lt;li&gt;My git web CSS is broken and I&#39;m too lazy to fix it ;)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Check it out at &lt;a class=&#34;reference external&#34; href=&#34;http://github.com/Droggelbecher/Grail/commits/master&#34;&gt;The grail github repository&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Oh by the way, you may have noticed the latest commit is already a few days
ago. That&#39;s because I&#39;m currently very busy with university stuff. But don&#39;t
you be afraid, I have no intent to give up this project. If you want to
contribute though, it will probably advance somewhat faster :)&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>First Grail screenshot</title>
    <link href="http://leetless.de/article-first_screenshots.html"/>
    <id>http://leetless.de/article-first_screenshots.html</id>
    <updated>2010-02-16T19:09:00</updated>
    <content type="html">&lt;img alt=&#34;images/screenshots/grail001.jpg&#34; src=&#34;images/screenshots/grail001.jpg&#34; /&gt;
&lt;p&gt;Whats new:&lt;/p&gt;
&lt;ul class=&#34;simple&#34;&gt;
&lt;li&gt;Parallax scrolling of background/foreground layers&lt;/li&gt;
&lt;li&gt;Animations don&#39;t require annoying to produce &amp;quot;stripe&amp;quot; format anymore,
additionaly theres a script now that extracts layers from an xcf (Gimp
format) file into a directory so its useable by grail.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;em&gt;Edit:&lt;/em&gt; I substituted the .png with a .jpg so the page load times should be lots
less annoying.&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>First steps</title>
    <link href="http://leetless.de/article-first_steps.html"/>
    <id>http://leetless.de/article-first_steps.html</id>
    <updated>2010-02-02T22:13:00</updated>
    <content type="html">&lt;p&gt;&lt;a class=&#34;reference external&#34; href=&#34;http://www.rasterbar.com/products/luabind.html&#34;&gt;Luabind&lt;/a&gt; is so cool.
Wrapping really is the easy part now, so I finally focus
on implementing stuff again. The main character already can walk around on the
screen, now I&#39;m concentrating on a user interface and then on interactions
with other scene actors.&lt;/p&gt;
&lt;p&gt;Thats sounds like the biggest part but keep in mind, theres still a lot to do:&lt;/p&gt;
&lt;ul class=&#34;simple&#34;&gt;
&lt;li&gt;User interface already is a big topic (buttons, inventory display, etc...)&lt;/li&gt;
&lt;li&gt;Loading/Saving (will hopefully be easy due to boosts serialization lib)&lt;/li&gt;
&lt;li&gt;Scene/walkpath stuff (the &amp;quot;algorithmic&amp;quot; corner yay)&lt;/li&gt;
&lt;li&gt;Loading scenes directly from atlantis files&lt;/li&gt;
&lt;li&gt;Dialogs (talking)&lt;/li&gt;
&lt;li&gt;Sound/Music/Voice output&lt;/li&gt;
&lt;li&gt;From time to time try to get the stuff to compile &amp;amp; run under windows ;)&lt;/li&gt;
&lt;/ul&gt;
</content>
  </entry>
  <entry>
    <title>Feed problems</title>
    <link href="http://leetless.de/article-feed_problems.html"/>
    <id>http://leetless.de/article-feed_problems.html</id>
    <updated>2010-01-18T16:20:00</updated>
    <content type="html">&lt;p&gt;Sorry for the feed problems lately (wrong urls, complete feed gets pulled twice
etc...).
Should now be fixed.&lt;/p&gt;
&lt;p&gt;In general: When you discover something doesn&#39;t work well/correctly, please
report, I can only keep the site up with proper feedback.&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>Good bye NIH, hello luabind &amp; boost!</title>
    <link href="http://leetless.de/article-luabind_boost.html"/>
    <id>http://leetless.de/article-luabind_boost.html</id>
    <updated>2010-01-18T15:45:00</updated>
    <content type="html">&lt;p&gt;I have to confess something.
To you all.&lt;/p&gt;
&lt;p&gt;I am ill. What I have is called the &lt;a class=&#34;reference external&#34; href=&#34;http://en.wikipedia.org/wiki/Not_Invented_Here&#34;&gt;NIH&lt;/a&gt; syndrome.
For those of you who never heard of it: It means preferring to code stuff
yourself instead of learning how to use a library somebody else wrote.
So its all about reinventing the wheel. &lt;a class=&#34;footnote-reference&#34; href=&#34;#id2&#34; id=&#34;id1&#34;&gt;[1]&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;For example I was inventing a &lt;a class=&#34;reference external&#34; href=&#34;http://en.wikipedia.org/wiki/Domain-specific_language&#34;&gt;DSL&lt;/a&gt;
for describing c++/lua bindings together with a handcrafted (and ugly) parser
which generated c++ code from that DSL etc...
although I knew there was &lt;a class=&#34;reference external&#34; href=&#34;http://www.rasterbar.com/products/luabind.html&#34;&gt;luabind&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Now that I tried it, let me say: luabind rocks. Don&#39;t dare to invent something
yourself until you tried that one.&lt;/p&gt;
&lt;p&gt;Same goes for &lt;a class=&#34;reference external&#34; href=&#34;http://www.boost.org/doc/libs/1_41_0/libs/smart_ptr/shared_ptr.htm&#34;&gt;boost::shared_ptr&lt;/a&gt;.
It is fun to invent a reference counting mechanism, but seriously: Use
shared_ptr, its really cool, luabind supports it already and it simply makes
your life so much easier.&lt;/p&gt;
&lt;p&gt;I also plan to use/learn more parts of &lt;a class=&#34;reference external&#34; href=&#34;http://www.boost.org/&#34;&gt;boost&lt;/a&gt; such
as the serialization library which seems to be even more flexible than
the &lt;a class=&#34;reference external&#34; href=&#34;http://leetless.de/gitweb?p=indiana-game-engine.git;a=tree;f=lib/indiana_lib/s11n;h=c768ac21abd266ee78180f5b4c3325ec564c2062;hb=HEAD&#34;&gt;serialization stuff in D&lt;/a&gt;
I wrote and was kinda proud of.&lt;/p&gt;
&lt;p&gt;Stay tuned for more.&lt;/p&gt;
&lt;table class=&#34;docutils footnote&#34; frame=&#34;void&#34; id=&#34;id2&#34; rules=&#34;none&#34;&gt;
&lt;colgroup&gt;&lt;col class=&#34;label&#34; /&gt;&lt;col /&gt;&lt;/colgroup&gt;
&lt;tbody valign=&#34;top&#34;&gt;
&lt;tr&gt;&lt;td class=&#34;label&#34;&gt;&lt;a class=&#34;fn-backref&#34; href=&#34;#id1&#34;&gt;[1]&lt;/a&gt;&lt;/td&gt;&lt;td&gt;&lt;p class=&#34;first&#34;&gt;Note that this &lt;em&gt;can&lt;/em&gt; be a good idea actually. Say you decide to use
$big_library and it works quite well. You save valuable time in your early
project phases by not having to write all that stuff yourself.&lt;/p&gt;
&lt;p class=&#34;last&#34;&gt;But then, as you project evolves you have more special needs and demands to
that library.  Depending on how its designed and what it is about you might
have to actually patch the library which suddenly requires a huge amount of
time, because you have to learn the internals of $big_library for just one
little change.&lt;/p&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
</content>
  </entry>
  <entry>
    <title>libregamewiki.org linking</title>
    <link href="http://leetless.de/article-libre_game_wiki.html"/>
    <id>http://leetless.de/article-libre_game_wiki.html</id>
    <updated>2009-12-12T18:57:00</updated>
    <content type="html">&lt;p&gt;Grail is now findable on the &lt;a class=&#34;reference external&#34; href=&#34;http://libregamewiki.org/Main_Page&#34;&gt;Libregamewiki&lt;/a&gt;
thanks to BAM, so another reason for me to spend more time on grail in the
future.&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>Somebody feel like making CSS?</title>
    <link href="http://leetless.de/article-gitweb_css.html"/>
    <id>http://leetless.de/article-gitweb_css.html</id>
    <updated>2009-12-10T13:38:00</updated>
    <content type="html">&lt;p&gt;My current &lt;a class=&#34;reference external&#34; href=&#34;http://leetless.de/gitweb&#34;&gt;gitweb&lt;/a&gt; CSS looks terrible, the standard stuff doesn&#39;t fit very well
into the rest of the page so I started this but I didn&#39;t really finish and
now lost fun on it ;)&lt;/p&gt;
&lt;p&gt;So if somebody feels like making the existing CSS more pretty/useable (or, if you prefer,
creating a complete new set of CSS rules for the gitweb area) your help is
very welcome, just drop me a mail.&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>A few thoughts on memory management in grail</title>
    <link href="http://leetless.de/article-memory_management.html"/>
    <id>http://leetless.de/article-memory_management.html</id>
    <updated>2009-12-10T09:42:00</updated>
    <content type="html">&lt;p&gt;In D we had a garbage collector that made things really easy: Just allocate an
object and never think about what happens to the memory of that object again,
the gc does it for you.
In C++ there is no garbage collector built in so you have to delete old
objects yourself.
That per se is not so much a problem as long as the question of &lt;strong&gt;ownership&lt;/strong&gt;
is always cleared.&lt;/p&gt;
&lt;p&gt;Ownership means: Object &lt;tt class=&#34;docutils literal&#34;&gt;a&lt;/tt&gt; has a reference to object &lt;tt class=&#34;docutils literal&#34;&gt;b&lt;/tt&gt; and is
responsible for deleting it. Normally with a little thought its easy to say
which object should own which one(s). However, if you let the user allocate
and play around with objects in lua, things can get a little more complicated.&lt;/p&gt;
&lt;div class=&#34;section&#34; id=&#34;current-non-solution&#34;&gt;
&lt;h2&gt;Current non-solution&lt;/h2&gt;
&lt;p&gt;Currently I&#39;m using a thingy I call &amp;quot;registry&amp;quot;. This holds references to all
objects allocated in lua and destroys them when they aren&#39;t useful anymore.
To find out when that is, you tell it to the registry. There are two possible
scopes: CHAPTER and APPLICATION. Objects with CHAPTER scope exist until the
current chapter runs. This is most useful for scenes and the actors running
around in them.&lt;/p&gt;
&lt;p&gt;The APPLICATION scope holds objects as long as the program runs. This can be
useful for the main menu or other user interface stuff.&lt;/p&gt;
&lt;p&gt;However this approach now leads to some Problems:&lt;/p&gt;
&lt;ul class=&#34;simple&#34;&gt;
&lt;li&gt;Currently it can happen that a Scene &amp;quot;s&amp;quot; holds an actor &amp;quot;a&amp;quot; and its not in
general known if &amp;quot;a&amp;quot; is in the registry.
In this case its not known if the scene should destroy &amp;quot;a&amp;quot; when its
destroyed itself or if the registry would do it. Also it might be that the
user wants a longer lifetime for &amp;quot;a&amp;quot; than &amp;quot;s&amp;quot; has.&lt;/li&gt;
&lt;li&gt;The user has a lot of ways to fuck up everything when creating an object
with chapter scope. For example what happens when a chapter-scope object is
created outside of any running chapter? What if the user by accident holds a
reference to a chapter-object after the object has been destroyed?&lt;/li&gt;
&lt;li&gt;Its annoying to always have to write &amp;quot;chapter&amp;quot; or &amp;quot;application&amp;quot; for each
object you create.&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div class=&#34;section&#34; id=&#34;possible-solution-1-register-everything&#34;&gt;
&lt;h2&gt;Possible solution 1: Register everything&lt;/h2&gt;
&lt;p&gt;Just force everything to be in the registry for example by giving the user no
way to create an object without registering it. Especially when objects internally
create other objects, put them in the registry too, &amp;quot;inheriting&amp;quot; scope from
the parent object. Then no object would ever use &lt;tt class=&#34;docutils literal&#34;&gt;delete&lt;/tt&gt;, that would
completely be &lt;tt class=&#34;docutils literal&#34;&gt;Registry&lt;/tt&gt; s job.&lt;/p&gt;
&lt;p&gt;Problem: This still allows the user to reference objects beyond their lifetime
and to produce similar fuckups. And its still annoying to always tell the
scope when creating an object.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;section&#34; id=&#34;possible-solution-2-register-only-certain-object-types&#34;&gt;
&lt;h2&gt;Possible solution 2: Register only certain object types&lt;/h2&gt;
&lt;p&gt;We could only register &lt;tt class=&#34;docutils literal&#34;&gt;Scene&lt;/tt&gt; s and let them have ownership for things like
actors etc... However there is no guarantee that the user doesn&#39;t try to use
the same image in two different scenes and there we have the double free
corruption again.
So this one is really a no-go&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;section&#34; id=&#34;possible-solution-3-use-reference-counting&#34;&gt;
&lt;h2&gt;Possible solution 3: Use reference counting&lt;/h2&gt;
&lt;p&gt;Build a simple reference counting mechanism so each object knows how many
places reference to it. This would mostly make the registry unecessary, except
maybe for holding scenes for the current chapter and giving names to objects
for the user.
The only problem with reference counting is that it can&#39;t handle reference
circles well (ie A has a pointer to B and B has a pointer to A), so I have to
think about the whole structure a little more to guarantee there won&#39;t be such
circles (although I&#39;m already pretty sure there won&#39;t).&lt;/p&gt;
&lt;p&gt;Below is a little examplary code. I didn&#39;t even try to compile it so forgive
me if its not correct, it should just illustrate the idea.&lt;/p&gt;
&lt;div class=&#34;codeblock c++&#34;&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre&gt;&lt;span class=&#34;k&#34;&gt;class&lt;/span&gt; &lt;span class=&#34;nc&#34;&gt;ReferenceCounted&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;{&lt;/span&gt;
  &lt;span class=&#34;k&#34;&gt;public&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;:&lt;/span&gt;
    &lt;span class=&#34;kt&#34;&gt;unsigned&lt;/span&gt; &lt;span class=&#34;kt&#34;&gt;int&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;referenceCount&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;;&lt;/span&gt;

    &lt;span class=&#34;n&#34;&gt;ReferenceCounted&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;()&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;referenceCount&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;0&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;{&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;}&lt;/span&gt;
&lt;span class=&#34;p&#34;&gt;};&lt;/span&gt;

&lt;span class=&#34;k&#34;&gt;template&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&#34;k&#34;&gt;typename&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;T&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;&amp;gt;&lt;/span&gt;
&lt;span class=&#34;k&#34;&gt;class&lt;/span&gt; &lt;span class=&#34;nc&#34;&gt;Reference&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;{&lt;/span&gt;
    &lt;span class=&#34;n&#34;&gt;T&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;*&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;obj&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;;&lt;/span&gt;

    &lt;span class=&#34;c1&#34;&gt;// Forbid copying of references&lt;/span&gt;
    &lt;span class=&#34;n&#34;&gt;Reference&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;k&#34;&gt;const&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;Reference&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;T&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;&amp;gt;&amp;amp;&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;other&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;{&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;}&lt;/span&gt;
    &lt;span class=&#34;n&#34;&gt;Reference&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;T&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&#34;k&#34;&gt;operator&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;k&#34;&gt;const&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;Reference&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;T&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;&amp;gt;&amp;amp;&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;other&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;{&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;}&lt;/span&gt;

  &lt;span class=&#34;k&#34;&gt;public&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;:&lt;/span&gt;
    &lt;span class=&#34;n&#34;&gt;Reference&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;()&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;obj&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;0&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;{&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;}&lt;/span&gt;

    &lt;span class=&#34;n&#34;&gt;Reference&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;T&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;*&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;obj&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;obj&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;obj&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;{&lt;/span&gt;
      &lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;obj&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;referenceCount&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;++&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;;&lt;/span&gt;
    &lt;span class=&#34;p&#34;&gt;}&lt;/span&gt;

    &lt;span class=&#34;k&#34;&gt;virtual&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;~&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;Reference&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;()&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;{&lt;/span&gt;
      &lt;span class=&#34;k&#34;&gt;if&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;obj&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;{&lt;/span&gt;
        &lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;obj&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;referenceCount&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;--&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;;&lt;/span&gt;
        &lt;span class=&#34;k&#34;&gt;if&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;obj&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;referenceCount&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;==&lt;/span&gt; &lt;span class=&#34;mi&#34;&gt;0&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;{&lt;/span&gt;
          &lt;span class=&#34;k&#34;&gt;delete&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;obj&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;;&lt;/span&gt;
        &lt;span class=&#34;p&#34;&gt;}&lt;/span&gt;
      &lt;span class=&#34;p&#34;&gt;}&lt;/span&gt;
    &lt;span class=&#34;p&#34;&gt;}&lt;/span&gt;

    &lt;span class=&#34;kt&#34;&gt;void&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;ref&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;T&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;*&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;o&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;{&lt;/span&gt;
      &lt;span class=&#34;k&#34;&gt;if&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;obj&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;{&lt;/span&gt;
        &lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;obj&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;referenceCount&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;--&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;;&lt;/span&gt;
        &lt;span class=&#34;k&#34;&gt;if&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;obj&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;referenceCount&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;==&lt;/span&gt; &lt;span class=&#34;mi&#34;&gt;0&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;{&lt;/span&gt;
          &lt;span class=&#34;k&#34;&gt;delete&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;obj&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;;&lt;/span&gt;
        &lt;span class=&#34;p&#34;&gt;}&lt;/span&gt;
      &lt;span class=&#34;p&#34;&gt;}&lt;/span&gt;
      &lt;span class=&#34;n&#34;&gt;obj&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;o&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;;&lt;/span&gt;
      &lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;obj&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;referenceCount&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;++&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;;&lt;/span&gt;
    &lt;span class=&#34;p&#34;&gt;}&lt;/span&gt;

    &lt;span class=&#34;n&#34;&gt;T&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&#34;k&#34;&gt;operator&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;*&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;()&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;{&lt;/span&gt; &lt;span class=&#34;k&#34;&gt;return&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;*&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;obj&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;;&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;}&lt;/span&gt;
    &lt;span class=&#34;n&#34;&gt;T&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;*&lt;/span&gt; &lt;span class=&#34;k&#34;&gt;operator&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;()&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;{&lt;/span&gt; &lt;span class=&#34;k&#34;&gt;return&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;obj&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;;&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;}&lt;/span&gt;
&lt;span class=&#34;p&#34;&gt;};&lt;/span&gt;

&lt;span class=&#34;c1&#34;&gt;// Usage:&lt;/span&gt;

&lt;span class=&#34;k&#34;&gt;class&lt;/span&gt; &lt;span class=&#34;nc&#34;&gt;Foo&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;k&#34;&gt;public&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;ReferenceCounted&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;{&lt;/span&gt;
  &lt;span class=&#34;k&#34;&gt;public&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;:&lt;/span&gt;
    &lt;span class=&#34;kt&#34;&gt;void&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;foo&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;()&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;{&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;...&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;}&lt;/span&gt;
&lt;span class=&#34;p&#34;&gt;}&lt;/span&gt;

&lt;span class=&#34;kt&#34;&gt;void&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;f&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;()&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;{&lt;/span&gt;
  &lt;span class=&#34;n&#34;&gt;Reference&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;Foo&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;r&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;;&lt;/span&gt;

  &lt;span class=&#34;n&#34;&gt;r&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;ref&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;k&#34;&gt;new&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;Foo&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;());&lt;/span&gt;
  &lt;span class=&#34;n&#34;&gt;r&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;foo&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;();&lt;/span&gt;

&lt;span class=&#34;p&#34;&gt;}&lt;/span&gt; &lt;span class=&#34;c1&#34;&gt;// &amp;quot;r&amp;quot; is removed from the stack here&lt;/span&gt;
&lt;span class=&#34;c1&#34;&gt;// that reduces the reference count for the Foo&lt;/span&gt;
&lt;span class=&#34;c1&#34;&gt;// object and thus deletes it! Nice isn&amp;#39;t it?&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;

&lt;/div&gt;
&lt;/div&gt;
</content>
  </entry>
  <entry>
    <title>Compiles under Windows!</title>
    <link href="http://leetless.de/article-windows_compile.html"/>
    <id>http://leetless.de/article-windows_compile.html</id>
    <updated>2009-12-05T10:48:00</updated>
    <content type="html">&lt;p&gt;BAM reported yesterday that he managed to make Grail compile under windows,
good work BAM :)&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>Gas gas gas</title>
    <link href="http://leetless.de/article-gasgasgas.html"/>
    <id>http://leetless.de/article-gasgasgas.html</id>
    <updated>2009-12-04T19:59:00</updated>
    <content type="html">&lt;p&gt;I have been a little lazy regarding Grail in the past week (8 days without a
commit! Thats near a desaster!). Ill accelerate development as good as I can
in the next time, promised.&lt;/p&gt;
&lt;p&gt;To give you an update, currently a friend of mine which I&#39;ll only call &amp;quot;BAM&amp;quot;
here is working on compiling grail under windows with CMake and MingW. I wish
I had more such tasks that one can delegate a little but except for the build
system currently I don&#39;t think there is much to do than port the ole Indiana
code. I think that&#39;ll change once all classes are basically ported so there is
a structure with only holes that need to be filled.&lt;/p&gt;
&lt;p&gt;By the way we already have an animated sprite that walks around depending on
where you click, so there is at least something already ;)&lt;/p&gt;
&lt;p&gt;Stay tuned!&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>What kind of GUI-Editor for grail?</title>
    <link href="http://leetless.de/article-grail_gui.html"/>
    <id>http://leetless.de/article-grail_gui.html</id>
    <updated>2009-11-27T14:13:00</updated>
    <content type="html">&lt;p&gt;I&#39;m currently thinking about how the future GUI for grail will look.
Basically there are 2 approaches that I would say are worth considering at the
moment:&lt;/p&gt;
&lt;ul class=&#34;simple&#34;&gt;
&lt;li&gt;Step-by-step fix Atlantis to become the new grail editor. The first step
would be to have it generate lua code instead of D code, in the future it
would be extended with a lua editor component etc...&lt;/li&gt;
&lt;li&gt;As grail is basically starting from scratch this would be the perfect
opportunity to include some editor capabilities directly into grail.&lt;ul&gt;
&lt;li&gt;(-) There would never be a code-editing component, I would keep the additional
GUI elements to a bare minimum.
I guess the control would be over a one-line shell-like command line at
the bottom where you enter commands like &amp;quot;create polygon&amp;quot; or something. No
checkboxes, no dialogs.&lt;/li&gt;
&lt;li&gt;(+) Having the editor directly combined with the engine allows some
interesting things like running parts of the game while working on it.
Although I must confess this point is very weak: Due to the lua scripting
engine one could realise similar behaviour by sending lua commands to the
runtime via a network socket or similar approaches.&lt;/li&gt;
&lt;li&gt;(+) Another good thing would be: Having a command line and the
capabilities for displaying polygons etc... inside the engine allows for
advanced debugging utilities, that could be really cool.&lt;/li&gt;
&lt;li&gt;(-) Probably this approach would mean more work :(&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Comments welcome!&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>&#34;Relaunch&#34;</title>
    <link href="http://leetless.de/article-relaunch.html"/>
    <id>http://leetless.de/article-relaunch.html</id>
    <updated>2009-11-21T14:24:00</updated>
    <content type="html">&lt;p&gt;I dunno why but I hate the word &amp;quot;relaunch&amp;quot;. Maybe it&#39;s because it makes more
fuss about the thing than its worth it.&lt;/p&gt;
&lt;p&gt;Nevertheless, you might have already noticed some of the changes. To sum up:&lt;/p&gt;
&lt;ul class=&#34;simple&#34;&gt;
&lt;li&gt;Everything on the page except for the comment function is now static html,
ie I post with creating text files in my git repository and running a html
generation script, which I think is very cool/geeky.&lt;/li&gt;
&lt;li&gt;I tried a new style, hope this one looks a little more
serious/professional/friendly.&lt;/li&gt;
&lt;li&gt;I cleaned up a bit, since I&#39;m now moving towards &amp;quot;Grail&amp;quot; instead of
&amp;quot;Indiana&amp;quot; (see previous post).
So things like the indiana screenshots etc... are missing now partly
because of lazyness and partly for a reason: I want to avoid yielding more
confusion about Grail vs. Indiana then necessary.
Some blog posts are missing too because I was to lazy to convert them, if
you really miss something lemme know, but I think the most important ones
should be there.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;So that&#39;s it for now, stay tuned!&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>The thing with D</title>
    <link href="http://leetless.de/article-thethingwithd.html"/>
    <id>http://leetless.de/article-thethingwithd.html</id>
    <updated>2009-11-21T10:31:00</updated>
    <content type="html">&lt;div class=&#34;section&#34; id=&#34;suddenly&#34;&gt;
&lt;h2&gt;Suddenly...&lt;/h2&gt;
&lt;p&gt;Some of you might already know, I experienced some severe/general problems with D compilers lately, namingly I ran into a situation where I was not able to find a D compiler(version) that would have no compiler bugs that influenced indiana and would run with phobos/d1. Another constraint was that we need one compiler on windows and one on linux (preferrably x86_64), both naturally being able to compile &amp;amp; link the same code.&lt;/p&gt;
&lt;p&gt;I wont get in any further detail here, I just say: I really tried for about 2 full days and at least 8 compiler versions on 3 different platforms and I came to the conclusion that these were my options:&lt;/p&gt;
&lt;ul class=&#34;simple&#34;&gt;
&lt;li&gt;An old version of gdc I used until then had only one compiler bug that nulled a pointer in some circumstances, rendering &amp;quot;only&amp;quot; the serialization module (and thus the whole savegame system) unusable. I could have tried to stick with the old version and ship the code around the bug.&lt;/li&gt;
&lt;li&gt;llvmdc would have been interesting to try, unfortunately it doesn&#39;t seem to support phobos, so for this maybe-solution a switch to tango or at least tangobos would have been necessary.&lt;/li&gt;
&lt;li&gt;Take the newest available gdc/dmd and fix indiana that seemed to actually lay behind the current D1.0 &amp;quot;stable&amp;quot; language definition so the compilers would work with it. Note that the most current gdc releases (from sourceforge/goshaw) both couldnt even build phobos correctly (at least that day).&lt;/li&gt;
&lt;li&gt;Do a complete rewrite in a different language with more stable toolchain.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;I decided for the last one for a lot of reasons:&lt;/p&gt;
&lt;ul class=&#34;simple&#34;&gt;
&lt;li&gt;The incident that GDC didn&#39;t receive updates for at least a year (or so) while DMD did shows that the D community is not yet &amp;quot;mature&amp;quot;/&amp;quot;stable&amp;quot;/&amp;quot;big&amp;quot; whatever you wanna call it. I wouldn&#39;t call the D community &amp;quot;unreliable&amp;quot;, but at least for gdc you never know what you get.&lt;/li&gt;
&lt;li&gt;A complete rewrite offers some interesting opportunities of restructuring the code, kicking some old mistakes that werent worth the effort to do it up to now.&lt;/li&gt;
&lt;li&gt;When I started with indiana in D, I didn&#39;t plan the lua part from the beginning, now when rewriting I can keep it in mind and/or do it on the way.&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div class=&#34;section&#34; id=&#34;so-which-language-did-i-choose&#34;&gt;
&lt;h2&gt;So which language did I choose?&lt;/h2&gt;
&lt;p&gt;Well it had to be a language that runs at least on windows and linux, allowed relatively easy usage of SDL and lua on those platforms, could somehow produce binaries for easy distribution on windows and needless to say that I&#39;m now looking for a big community.&lt;/p&gt;
&lt;p&gt;This, and my knowledge of languages in mind (learning a complete new one would cost lots of additional time), there weren&#39;t many options:&lt;/p&gt;
&lt;ul class=&#34;simple&#34;&gt;
&lt;li&gt;&lt;strong&gt;C#/other .NET stuff&lt;/strong&gt;, possible, but I&#39;m really not experienced with it, nor do I have knowledge about how reliable the linux toolchain is, how easy you can bind to SDL etc...&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Java&lt;/strong&gt;: No wai. For a &amp;quot;dynamic&amp;quot; language the syntax is way too clumsy, distribution of small binaries isnt possible (at least not that I know of), performance can be a problem. Plus a personal dislike + lacking experience ;)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Python&lt;/strong&gt;: Confessed, I like python. Naturally with python I wouldn&#39;t have built a lua interface, I&#39;d just have the games be written in python. The windows executable would be made with py2exe, which afaik just stuffs the complete python interpreter and all libraries into one big exe file. All in all, a good candidate, development speed has been always fast in python (at least for me), but definetely we would run into performance problems sooner or later and thus would need to have some parts in C/pyrex/whatever.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;C++&lt;/strong&gt;: There you are. Long time I ran around and told people: The only reason for choosing C++ over D is popularity/interfacing with existing code. I still believe so (except for some little language parts maybe), but this is all about community, so no need to lie to myself here. Also it might not be too hard to find a few helpers when I feel I need them.&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div class=&#34;section&#34; id=&#34;so-what-happens-next&#34;&gt;
&lt;h2&gt;So what happens next?&lt;/h2&gt;
&lt;p&gt;At the moment I&#39;m coding what I will call &amp;quot;grail&amp;quot; (you know, the holy grail from indiana jones III / last crusade) in C++ right along with lua support. I&#39;m not sure yet what I will do about the gui part (ie if I just alter atlantis to generate lua-code, if I extend it to be a more full-fledged editor, or if I build something new).&lt;/p&gt;
&lt;p&gt;But one way or another in the end there will be&lt;/p&gt;
&lt;ul class=&#34;simple&#34;&gt;
&lt;li&gt;libgrail - Similar to what indiana is now, just in C++. This will theoretically allow you to build your adventure games directly in C++ without using/linking lua at all, although regarding documentation and &amp;quot;making it easy/fun to use&amp;quot;, I&#39;ll focus on the runtime first as I think most game developers will rather use lua than C++.&lt;/li&gt;
&lt;li&gt;grail-runtime - A binary application that takes a game as input and runs it. Where a game is a directory full of lua code, graphics, sounds, etc... Naturally later on it will be possible to stuff the game into a zipfile and append it to the grail-runtime so you can distribute you game in a single binary. Also I&#39;m thinking about an open lua interface that developers can enable, so you (or the gui) can control the engine while it is running allowing cool debugging/testing things.&lt;/li&gt;
&lt;li&gt;The GUI, as said, I&#39;m not sure yet what it will be. Maybe not much more than atlantis is now (for first at least), just that it generates lua code. Maybe a full-fledged visionaire/wintermute - like editing system that does most of the work you have to do.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Later, I&#39;ll put up my grail git directory, don&#39;t judge me for the code yet, it has been a while since I did real c++ coding. And naturally at this state you can&#39;t expect something to look at really. When I have it that far that a character can walk around again, I&#39;ll post some screenies and inform you!&lt;/p&gt;
&lt;/div&gt;
</content>
  </entry>
  <entry>
    <title>It&#39;s a trap - Multilingual web applications</title>
    <link href="http://leetless.de/article-trap_multilingual.html"/>
    <id>http://leetless.de/article-trap_multilingual.html</id>
    <updated>2009-11-21T10:26:00</updated>
    <content type="html">&lt;p&gt;Say you&#39;re designing a multilingual web application. Where would you put the language information?&lt;/p&gt;
&lt;ul class=&#34;simple&#34;&gt;
&lt;li&gt;Carry it over with each request (generate hidden inputs)&lt;/li&gt;
&lt;li&gt;Into the users session&lt;/li&gt;
&lt;li&gt;Into the URL&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The first approach is obviously quite tedious and more or less just included for completeness. No doubt you don&#39;t wanna do this except for a really small app or some rather unusual constraints (no cookies, framework that has hard constraints on URL scheme).&lt;/p&gt;
&lt;p&gt;The second one looks like a really good idea:&lt;/p&gt;
&lt;ul class=&#34;simple&#34;&gt;
&lt;li&gt;You don&#39;t need to find out the users language with each request with url parsing or similar things,&lt;/li&gt;
&lt;li&gt;You can freely choose your URLs after whatever scheme you like, language doesn&#39;t have to be a part of it.&lt;/li&gt;
&lt;li&gt;You URLs can be exchanged between users of different languages, they will be displayed in each users favourite language to them.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;So wheres the TRAP? Here a hint: Think of search engines.&lt;/p&gt;
&lt;p&gt;Still don&#39;t see it?&lt;/p&gt;
&lt;p&gt;Well took me some time, too. The problem is: If a search engine from some country indexes your page its bot will most probably not emulate/have cookie support. So all search engines in all countries will see and thus index the page in its default language (that one that appears when a user has no cookies enabled). This way the search engines won&#39;t find your site when the users enter keywords in their own language. What a crap.&lt;/p&gt;
&lt;p&gt;So the answer is obvious: Put that information into your url. Or if you want detect it from the domain name (if you have one domain for each country/language &amp;lt;- distinguish carefully btw!)&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>It&#39;s a trap - Python object construction / reference semantics</title>
    <link href="http://leetless.de/article-trap_python_objects.html"/>
    <id>http://leetless.de/article-trap_python_objects.html</id>
    <updated>2009-11-21T10:21:00</updated>
    <content type="html">&lt;p&gt;I guess this is a common trap. I personally am python coder for years now and still, from time to time I run into it.
As the syntax for it is very concise you might sometimes be tempted to give default values for members in a classes definition.
Code says more then thousand words. This works fine:&lt;/p&gt;
&lt;div class=&#34;codeblock python&#34;&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre&gt;&lt;span class=&#34;k&#34;&gt;class&lt;/span&gt; &lt;span class=&#34;nc&#34;&gt;Foo&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;nb&#34;&gt;object&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;):&lt;/span&gt;
  &lt;span class=&#34;n&#34;&gt;x&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;mi&#34;&gt;7&lt;/span&gt;

&lt;span class=&#34;n&#34;&gt;f1&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;Foo&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;()&lt;/span&gt;
&lt;span class=&#34;n&#34;&gt;f2&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;Foo&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;()&lt;/span&gt;

&lt;span class=&#34;n&#34;&gt;f2&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;x&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;mi&#34;&gt;42&lt;/span&gt;

&lt;span class=&#34;k&#34;&gt;print&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;f1&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;x&lt;/span&gt; &lt;span class=&#34;c&#34;&gt;# prints 7&lt;/span&gt;
&lt;span class=&#34;k&#34;&gt;print&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;f2&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;x&lt;/span&gt; &lt;span class=&#34;c&#34;&gt;# prints 42&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;

&lt;/div&gt;
&lt;p&gt;Now say we have something else for x, say it will contain a list most of the time and thus by default it should be the empty list:&lt;/p&gt;
&lt;div class=&#34;codeblock python&#34;&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre&gt;&lt;span class=&#34;k&#34;&gt;class&lt;/span&gt; &lt;span class=&#34;nc&#34;&gt;Foo&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;nb&#34;&gt;object&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;):&lt;/span&gt;
  &lt;span class=&#34;n&#34;&gt;x&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;[]&lt;/span&gt;

  &lt;span class=&#34;k&#34;&gt;def&lt;/span&gt; &lt;span class=&#34;nf&#34;&gt;append&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;bp&#34;&gt;self&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;y&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;):&lt;/span&gt; &lt;span class=&#34;bp&#34;&gt;self&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;x&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;append&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;y&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt;

&lt;span class=&#34;n&#34;&gt;f1&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;Foo&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;()&lt;/span&gt;
&lt;span class=&#34;n&#34;&gt;f2&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;Foo&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;()&lt;/span&gt;

&lt;span class=&#34;n&#34;&gt;f1&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;append&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;s&#34;&gt;&amp;quot;Take evasive action!&amp;quot;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt;

&lt;span class=&#34;k&#34;&gt;print&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;f1&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;x&lt;/span&gt; &lt;span class=&#34;c&#34;&gt;# prints [&amp;quot;Take evasive action!&amp;quot;]&lt;/span&gt;
&lt;span class=&#34;k&#34;&gt;print&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;f2&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;x&lt;/span&gt; &lt;span class=&#34;c&#34;&gt;# prints [&amp;quot;Take evasive action!&amp;quot;] &amp;lt;- WTF?&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;

&lt;/div&gt;
&lt;p&gt;The somewhat experienced programmer immediately sees what happens. Let&#39;s look at this step by step.&lt;/p&gt;
&lt;div class=&#34;section&#34; id=&#34;what-does-python-do-when-you-access-f1-x&#34;&gt;
&lt;h2&gt;What does python do when you access f1.x?&lt;/h2&gt;
&lt;p&gt;It first looks if the object has a member x, if it can not find any, it accesses the class member x.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;section&#34; id=&#34;so-what-exactly-happens-in-the-first-example&#34;&gt;
&lt;h2&gt;So what exactly happens in the first example?&lt;/h2&gt;
&lt;p&gt;Directly after construction the objects f1 and f2 point both to Foo.x that is at the same x. Thes with f2.x = 42 we add a member x to the object f2 so that we have a situation like the following:&lt;/p&gt;
&lt;ul class=&#34;simple&#34;&gt;
&lt;li&gt;Foo.x points to the value 7&lt;/li&gt;
&lt;li&gt;f1 does not have a member x, so access to f1.x will be redirected to Foo.x&lt;/li&gt;
&lt;li&gt;f2.x points to the value 42&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Note that you never &amp;quot;change&amp;quot; an integer in python, you can only reference a different integer, ie integers are immutable.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;section&#34; id=&#34;what-exactly-happens-in-the-second-example&#34;&gt;
&lt;h2&gt;What exactly happens in the second example?&lt;/h2&gt;
&lt;p&gt;As in the first example, after construction, both f1 and f2 don&#39;t even have a member x, they just redirect to Foo.x. Whats different here is that in this example we don&#39;t ever create an x-member in one of the objects!&lt;/p&gt;
&lt;p&gt;Instead of integers, lists are mutable. In our append call, we actually change Foo.x instead of creating a new member. As both f1 and f2 still pass through to Foo.x, we see the change on both objects.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;section&#34; id=&#34;yet-another-trap&#34;&gt;
&lt;h2&gt;Yet another trap!&lt;/h2&gt;
&lt;p&gt;Now you might think &amp;quot;Okay, then I do it like this:&amp;quot;&lt;/p&gt;
&lt;div class=&#34;codeblock python&#34;&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre&gt;&lt;span class=&#34;k&#34;&gt;class&lt;/span&gt; &lt;span class=&#34;nc&#34;&gt;Foo&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;nb&#34;&gt;object&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;):&lt;/span&gt;
  &lt;span class=&#34;k&#34;&gt;def&lt;/span&gt; &lt;span class=&#34;nf&#34;&gt;__init__&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;bp&#34;&gt;self&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;x&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;[]):&lt;/span&gt;
    &lt;span class=&#34;bp&#34;&gt;self&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;x&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;x&lt;/span&gt;

&lt;span class=&#34;n&#34;&gt;f1&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;Foo&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;()&lt;/span&gt;
&lt;span class=&#34;n&#34;&gt;f2&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;Foo&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;()&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;

&lt;/div&gt;
&lt;p&gt;But this is basically the same problem, with a slightly different background. The default value for x you type there is only created once. So what you do here would be creating members f1.x and f2.x but still having them point to the same object which leads to the same unwanted result.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;section&#34; id=&#34;so-what-should-i-do&#34;&gt;
&lt;h2&gt;So what should I do?&lt;/h2&gt;
&lt;p&gt;Don&#39;t use this as a way for giving default values for object members. Instead do something like:&lt;/p&gt;
&lt;div class=&#34;codeblock python&#34;&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre&gt;&lt;span class=&#34;k&#34;&gt;class&lt;/span&gt; &lt;span class=&#34;nc&#34;&gt;Foo&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;nb&#34;&gt;object&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;):&lt;/span&gt;
  &lt;span class=&#34;k&#34;&gt;def&lt;/span&gt; &lt;span class=&#34;nf&#34;&gt;__init__&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;bp&#34;&gt;self&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;**&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;kwargs&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;):&lt;/span&gt;
    &lt;span class=&#34;bp&#34;&gt;self&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;x&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;kwargs&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;get&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;s&#34;&gt;&amp;#39;x&amp;#39;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;[])&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;

&lt;/div&gt;
&lt;p&gt;This way you have the default value defined inside __init__, which guarantees that each defaultly-initialized object gets a different &amp;quot;[]&amp;quot;.&lt;/p&gt;
&lt;p&gt;Depending on your actual needs you might also do something like:&lt;/p&gt;
&lt;div class=&#34;codeblock python&#34;&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre&gt;&lt;span class=&#34;k&#34;&gt;class&lt;/span&gt; &lt;span class=&#34;nc&#34;&gt;Foo&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;nb&#34;&gt;object&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;):&lt;/span&gt;
  &lt;span class=&#34;k&#34;&gt;def&lt;/span&gt; &lt;span class=&#34;nf&#34;&gt;__init__&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;bp&#34;&gt;self&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;x&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;&lt;span class=&#34;bp&#34;&gt;None&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;):&lt;/span&gt;
    &lt;span class=&#34;bp&#34;&gt;self&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;x&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;x&lt;/span&gt;
    &lt;span class=&#34;k&#34;&gt;if&lt;/span&gt; &lt;span class=&#34;bp&#34;&gt;self&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;x&lt;/span&gt; &lt;span class=&#34;ow&#34;&gt;is&lt;/span&gt; &lt;span class=&#34;bp&#34;&gt;None&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;bp&#34;&gt;self&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;x&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;[]&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;

&lt;/div&gt;
&lt;p&gt;Or you could copy every received value:&lt;/p&gt;
&lt;div class=&#34;codeblock python&#34;&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre&gt;&lt;span class=&#34;k&#34;&gt;class&lt;/span&gt; &lt;span class=&#34;nc&#34;&gt;Foo&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;nb&#34;&gt;object&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;):&lt;/span&gt;
  &lt;span class=&#34;k&#34;&gt;def&lt;/span&gt; &lt;span class=&#34;nf&#34;&gt;__init__&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;bp&#34;&gt;self&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;x&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;[]):&lt;/span&gt;
    &lt;span class=&#34;bp&#34;&gt;self&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;x&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;x&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;[:]&lt;/span&gt; &lt;span class=&#34;c&#34;&gt;# assumes, passed x is always a list!&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;

&lt;/div&gt;
&lt;p&gt;For those of you that are still very new to python: Try to always keep one eye on what references what. Be aware that everything in python has reference semantics although for immutable values that can&#39;t lead to this problem (and in lots of situations this &amp;quot;feels&amp;quot; like value semantic). Also note that my approaches are far from perfect too. And: Don&#39;t use any of that code if you do not fully understand it, play around with everything in the python interpreter, you can learn a lot of things there.&lt;/p&gt;
&lt;/div&gt;
</content>
  </entry>
  <entry>
    <title>It&#39;s a trap!</title>
    <link href="http://leetless.de/article-trap.html"/>
    <id>http://leetless.de/article-trap.html</id>
    <updated>2009-11-21T10:16:00</updated>
    <content type="html">&lt;p&gt;I&#39;m hereby creating a new kind of postings on this site: I want to post about common programming traps, you know that kind of stuff you think at first &amp;quot;Obviously it works this way&amp;quot; and later on you feel... trapped!&lt;/p&gt;
&lt;p&gt;For general reference to this topic see:&lt;/p&gt;
&lt;p&gt;&lt;a class=&#34;reference external&#34; href=&#34;http://www.youtube.com/watch?v=dddAi8FF3F4&#34;&gt;Admiral Ackbar&lt;/a&gt;,
&lt;a class=&#34;reference external&#34; href=&#34;http://www.youtube.com/watch?v=mdMaZlWkK8o&#34;&gt;Sheldon&lt;/a&gt; and/or
&lt;a class=&#34;reference external&#34; href=&#34;http://www.youtube.com/watch?v=hQbtBfPmjJk&#34;&gt;Captain Picard&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Traps ahead, be prepared!&lt;/p&gt;
</content>
  </entry>
</feed>