<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Limegarden.net</title>
	<atom:link href="http://limegarden.net/feed/" rel="self" type="application/rss+xml" />
	<link>http://limegarden.net</link>
	<description>Personal site of Wouter Lindenhof</description>
	<lastBuildDate>Tue, 06 Jul 2010 06:31:43 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Comments</title>
		<link>http://limegarden.net/2010/07/06/comments/</link>
		<comments>http://limegarden.net/2010/07/06/comments/#comments</comments>
		<pubDate>Tue, 06 Jul 2010 06:31:43 +0000</pubDate>
		<dc:creator>Wouter Lindenhof</dc:creator>
				<category><![CDATA[Game development]]></category>
		<category><![CDATA[Software development]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Style]]></category>

		<guid isPermaLink="false">http://limegarden.net/?p=353</guid>
		<description><![CDATA[This part is almost straight from my programming style document. This might sound stupid, but try to comment every other line (unless you have a lot of repeating or similar tasks). By doing so you get two advantages: Someone unskilled in programming or unfamiliar with what you are doing is able to read your code. [...]]]></description>
			<content:encoded><![CDATA[<p>This part is almost straight from my programming style document. </p>
<p>This might sound stupid, but try to comment every other line (unless you have a lot of repeating or similar tasks). By doing so you get two advantages:</p>
<ol>
<li>Someone unskilled in programming or unfamiliar with what you are doing is able to read your code.</li>
<li>You know what you are doing</li>
</ol>
<p>The first advantage is important unless you are working alone and never expect to see your code again. In that case you should really ask yourself if you should even be writing that code.</p>
<p>The second one is important even if you have no trouble reading code. Let's take a look at the following example.</p>
<pre class="brush: cpp; ">
for(int index_person = 0; index_person &lt; persons.size(); ++index_person)
{
    for(int index_kids = 0; index_kids &lt; person[index_person].kids.size(); ++index_kids)
    {
        /* ... */
    }
}
</pre>
<p>And then take a look at this example:</p>
<pre class="brush: cpp; ">
/* Iterating through the persons in the lists */
for(int index_person = 0; index_person &lt; persons.size(); ++index_person)
{
    /* Iterating through the kids of the persons in the list */
    for(int index_kids = 0; index_kids &lt; person[index_person].kids.size(); ++index_kids)
    {
        /* checking if any of the persons in the list have a kid who is dead */
        /* ... */
    }
}
</pre>
<p>In the last example I only have to track back to the first comment prior to my line of code to know what I'm doing here. It's a pain to write so many comments but it makes code a whole lot easier to read.</p>
]]></content:encoded>
			<wfw:commentRss>http://limegarden.net/2010/07/06/comments/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Lady luck is using a loaded dice&#8230;</title>
		<link>http://limegarden.net/2010/06/29/lady-luck-is-using-loaded-dice/</link>
		<comments>http://limegarden.net/2010/06/29/lady-luck-is-using-loaded-dice/#comments</comments>
		<pubDate>Tue, 29 Jun 2010 15:54:24 +0000</pubDate>
		<dc:creator>Wouter Lindenhof</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[outlook]]></category>
		<category><![CDATA[rant]]></category>

		<guid isPermaLink="false">http://limegarden.net/?p=349</guid>
		<description><![CDATA[The one thing that I didn't backup was Outlook. My email is handled by GMail and since Outlook also syncs with my mobile phone, I already had a backup of my mail and my contacts. So being the adventurous type I decided against wasting my time and do a proper backup. Well, today, when I [...]]]></description>
			<content:encoded><![CDATA[<p>The one thing that I didn't backup was Outlook. My email is handled by GMail and since Outlook also syncs with my mobile phone, I already had a backup of my mail and my contacts.</p>
<p>So being the adventurous type I decided against wasting my time and do a proper backup. Well, today, when I wanted to call someone, I found out that all my contacts had been wiped from my mobile phone and as a result my backup was gone.<br />
I suspect that it has been my own fault, but based on the bad luck I'm having lately I'm suspecting Lady Luck to uses loaded dice to decide my chances...</p>
]]></content:encoded>
			<wfw:commentRss>http://limegarden.net/2010/06/29/lady-luck-is-using-loaded-dice/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Wierd evening</title>
		<link>http://limegarden.net/2010/06/25/wierd-evening/</link>
		<comments>http://limegarden.net/2010/06/25/wierd-evening/#comments</comments>
		<pubDate>Thu, 24 Jun 2010 23:49:47 +0000</pubDate>
		<dc:creator>Wouter Lindenhof</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[rant]]></category>

		<guid isPermaLink="false">http://limegarden.net/?p=346</guid>
		<description><![CDATA[Today went well, as far days go, that was until it hit 11 o'clock (I had been watching the football match between the Netherlands and Cameroon, which we won ). I went up to my room to see if my laptop had completed some maintenance work and was surprised to find "The computer has been [...]]]></description>
			<content:encoded><![CDATA[<p>Today went well, as far days go, that was until it hit 11 o'clock (I had been watching the football match between the Netherlands and Cameroon, which we won <img src='http://limegarden.net/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  ). I went up to my room to see if my laptop had completed some maintenance work and was surprised to find "The computer has been recovered"-message which is signal that something has gone horribly wrong. Clicking 'Ok' caused it to reboot and after swiping my finger (gotta love the fingerprint protection system) the computer logged in and Bang! Blue Screen followed by a reboot after which the computer tried to recover again.<br />
I decided to let the computer have another try before I would try and find out what was wrong, but needless to say, this rant is not about how happy I am that it has been fixed but that I didn't complete it.</p>
<p>To make a long story short I decided that it was quicker to just reinstall everything so as I was busy back up, my mom asked me to pick up my brother who had gone party. It was already the next day (it's now almost two in the morning) and to my suprise I found out that my bike (who he borrowed) was suddenly a folding bike and I'm prety sure that was not possible when he left. Apperantly he had to evade something which caused him to ride in to a low wall. The result: Bike broken and my favorite brother had a few scratches. </p>
<p>So now I'm reinstalling my system for the first time I bought it (almost four years ago, which is a record) and I'm without a bike. If the sky would drop on my head right now I wouldn't even be suprised. <img src='http://limegarden.net/wp-includes/images/smilies/icon_biggrin.gif' alt=':-D' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://limegarden.net/2010/06/25/wierd-evening/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Splash screens</title>
		<link>http://limegarden.net/2010/06/24/splash-screens/</link>
		<comments>http://limegarden.net/2010/06/24/splash-screens/#comments</comments>
		<pubDate>Thu, 24 Jun 2010 16:29:24 +0000</pubDate>
		<dc:creator>Wouter Lindenhof</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Software development]]></category>

		<guid isPermaLink="false">http://limegarden.net/?p=344</guid>
		<description><![CDATA[I always have my doubts about splash screens. As far as I know the majority of the splash screens have no function. A minority does have a function (they do background loading). The main purpose of splash screen is, in my opinion, advertising. For a few second the user sees the name of the application [...]]]></description>
			<content:encoded><![CDATA[<p>I always have my doubts about splash screens. As far as I know the majority of the splash screens have no function. A minority does have a function (they do background loading). </p>
<p>The main purpose of splash screen is, in my opinion, advertising. For a few second the user sees the name of the application and the company behind it. I admit that you can use it to load things in the background, but showing a splash screen also takes time. In that case you are better off loading the application and showing a progress bar. At that point the user sees it as the application is loading content. If you are using a splash screen for that (and I'm going to assume it makes no difference in performance or time that it requires) than the users perceives it as an annoyance.<br />
This is a weird thing. Because showing a splash screen that does nothing but is only showed for a 2 seconds after which the application starts loading is seemed to be less intrusive than a splash screen that takes longer but actually causes the application to load faster (it doesn't require two useless seconds).</p>
<p>So how do you create a splash screen?<br />
First of all start with a small image (take the dimensions of the office 2007 splash screens), add some abstract art (not something complex). Then create a form without borders in C# that closes after a few seconds and then modify the program.cs so that it looks like this.</p>
<pre class="brush: csharp; ">

using System;
using System.Collections.Generic;
using System.Windows.Forms;

namespace Client
{
    static class Program
    {
        /// &lt;summary&gt;
        /// The main entry point for the application.
        /// &lt;/summary&gt;
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new SplashScreen()); // load the splash screen
            Application.Run(new MainWindow()); // load the application
        }
    }
}
</pre>
<p>I know it's a cheap trick, but it looks nice if you do it well. And most customers care a lot about appearance. </p>
]]></content:encoded>
			<wfw:commentRss>http://limegarden.net/2010/06/24/splash-screens/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Only one more day</title>
		<link>http://limegarden.net/2010/06/22/only-one-more-day/</link>
		<comments>http://limegarden.net/2010/06/22/only-one-more-day/#comments</comments>
		<pubDate>Tue, 22 Jun 2010 06:44:14 +0000</pubDate>
		<dc:creator>Wouter Lindenhof</dc:creator>
				<category><![CDATA[Brick4]]></category>
		<category><![CDATA[Project]]></category>
		<category><![CDATA[graduation project]]></category>
		<category><![CDATA[rant]]></category>
		<category><![CDATA[School]]></category>

		<guid isPermaLink="false">http://limegarden.net/?p=316</guid>
		<description><![CDATA[Tomorrow I will be defending my graduation work and if all goes well (it must be a strange turn of events if doesn't go well) I will know if I have completed my graduation. Only one more day]]></description>
			<content:encoded><![CDATA[<p>Tomorrow I will be defending my graduation work and if all goes well (it must be a strange turn of events if doesn't go well) I will know if I have completed my graduation.</p>
<p>Only one more day <img src='http://limegarden.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  </p>
]]></content:encoded>
			<wfw:commentRss>http://limegarden.net/2010/06/22/only-one-more-day/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Reverse updates</title>
		<link>http://limegarden.net/2010/06/09/reverse-updates/</link>
		<comments>http://limegarden.net/2010/06/09/reverse-updates/#comments</comments>
		<pubDate>Wed, 09 Jun 2010 06:45:02 +0000</pubDate>
		<dc:creator>Wouter Lindenhof</dc:creator>
				<category><![CDATA[Game development]]></category>
		<category><![CDATA[algorithms]]></category>
		<category><![CDATA[design]]></category>
		<category><![CDATA[ideas]]></category>
		<category><![CDATA[rant]]></category>

		<guid isPermaLink="false">http://limegarden.net/?p=314</guid>
		<description><![CDATA[It has been a while since I last posted something, but that is because I have been busy with my graduation (in case you were wondering). Anyway, today, while I was walking the dog, I suddenly realized how to fix a bottleneck for a certain game idea. The game idea was that the hero can [...]]]></description>
			<content:encoded><![CDATA[<p>It has been a while since I last posted something, but that is because I have been busy with my graduation (in case you were wondering).</p>
<p>Anyway, today, while I was walking the dog, I suddenly realized how to fix a bottleneck for a certain game idea. The game idea was that the hero can interact and affect lives of other characters in the game directly, the bottleneck however was that each character affects another character, which affects another character and so on. A simple example would be if you decide to buy a weapon or not. If you do buy a weapon the merchant will be able to stay in business, buy some bread. When he buys bread, the baker will be able to buy the next shipment of grain from the miller and the miller we be able to pay the farmer and everybody will be happy. Now if you don't the miller might not be able to some bread (he needs to eat also) which means that he goes out of business. Since he is the only miller in the entire region, there will be no more bread for quite some time and everybody dies from the hunger.</p>
<p>The problem with that game idea is that if you even simulate a small village (say 25 people) you will have a lot of relationships to go through. Even if it goes in one direction it will still be 1 hero times 1 person times 25 people times 24 people times 23 people et cetera. The total amount of relationships within the village would be 1.6E+25 (16 with 24 zeros behind it). Even if we say that any action will have not have any affect after 7 relationships that would still be 2.4 billion relationships that are affected. If we limit the amount of relationships to 7 for each person (so 7x7x7x7x7x7x7) it will be 823543 of relationships that need to be updated when the hero does something. And maybe one of those persons affected will need to perform an action that affects the community which means the entire process starts over again.</p>
<p>Of course the game is real time and the other people in the village don't require you to perform any action so if you have 3 or 4 villages you will have almost a constant rate of large social updates. Until this morning it was my firm belief that the above game idea should be hard if not impossible to execute unless you have some monster system. </p>
<p>I always thought in forward direction, what happened now dictates the future, until I thought about reversing the flow, the past is dictated by the future.</p>
<p>Lets take the previous example of buying a weapon or not. Although this is a fact now by the player, the game does not have access at that information at the current time. Let's say you meet the miller and find out he is alive. No matter what happened in the past, the future dictates past events that no matter what the miller survived and kept his job. And the only way that he has kept his job if the baker bought his grain and the only way that the baker could buy his grain was if some paid for his bread. If you made a major investment by buying a weapon (say a gold weapon) then he might credit you for it. If you weren't the cause something else must have happened for the influx of money that allowed the community to stay alive.</p>
<p>Now lets take the same example but the miller is dead. The past generated from that point on could dictate that the hero not buying could have caused it. Or if he did buy the past could credit something else (disease, war, bad crops et cetera).<br />
So what is so different about the reverse update compared to the forward update that it allows us to compact information in such a manner that the above game idea is possible?</p>
<p>Simply put: Forward updates are simulations, calculating exact future behavior, while reverse updates are emulations, imitation of past behavior. A forward update always has one cause (generally the hero) but has many effects (the merchant, the baker, the miller and the farmer). A reverse update has one effect (the baker) and will look for one cause for its current state which is a linear path. </p>
<p>I'm not certain if the solution always works as the past needs to be consistent (you can't undo the past) and certain actions always have a forward update, but for now the game idea seems possible again.</p>
]]></content:encoded>
			<wfw:commentRss>http://limegarden.net/2010/06/09/reverse-updates/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Events in C++</title>
		<link>http://limegarden.net/2010/05/17/events-in-c/</link>
		<comments>http://limegarden.net/2010/05/17/events-in-c/#comments</comments>
		<pubDate>Mon, 17 May 2010 17:27:15 +0000</pubDate>
		<dc:creator>Wouter Lindenhof</dc:creator>
				<category><![CDATA[C++]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[code snippit]]></category>
		<category><![CDATA[event]]></category>
		<category><![CDATA[example]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://limegarden.net/?p=312</guid>
		<description><![CDATA[This week I have decided to do some little work on Nova as I would like to use it for a game. But I’m currently missing a GUI. Since writing a GUI is often a pain while a nice GUI is its weight worth in gold it was worth to invest some time in it. [...]]]></description>
			<content:encoded><![CDATA[<p>This week I have decided to do some little work on Nova as I would like to use it for a game. But I’m currently missing a GUI. Since writing a GUI is often a pain while a nice GUI is its weight worth in gold it was worth to invest some time in it.<br />
One of the very first things I have decided on is that I want a good and proper event management system. I like how it is done in C#</p>
<pre class="brush: c#; ">

myButton.Click += new EventHandler(this.myButton_Click);
</pre>
<p>However something equally nice doesn't exist in plain C++, so I have decided to write one.</p>
<pre class="brush: c++; ">

struct GuiEvent
{
	bool cancel;
	GuiEvent() : cancel(false) {}
};

class Button
{
public:
	Event&lt;GuiEvent&gt; OnDown;
	Event&lt;GuiEvent&gt; OnUp;

	void FireClickEvent()
	{
		size_t cycle = 0; GuiEvent e;
		while(OnDown.Fire(cycle, e)) {
			if(e.cancel == true) return;
		}
		e = GuiEvent(); cycle = 0;
		while(OnUp.Fire(cycle, e));
	}
};

class Application : public BaseEvent::Receiver&lt;Application&gt;
{
	Button m_StartButton;
public:
	Application()
	{
		RegisterEvent&lt;GuiEvent&gt;(m_StartButton.OnDown, &amp;Application::StartDown);
		RegisterEvent&lt;GuiEvent&gt;(m_StartButton.OnUp,	&amp;Application::StartUp);
		m_StartButton.FireClickEvent();
	}

	void StartUp(GuiEvent&amp; eventParam)
	{
		std::cout &lt;&lt; &quot;The start button was released&quot; &lt;&lt; &quot;\n&quot;;
	}
	void StartDown(GuiEvent&amp; eventParam)
	{
		// If you set event param to true the release will never be called
		//eventParam.cancel = true;
		std::cout &lt;&lt; &quot;The start button is pressed down&quot; &lt;&lt; &quot;\n&quot;;
	}
};

int main(int argc, const char* argv[])
{
	Application myApp;
	return 0;
}
</pre>
<p>The above is rather primitive as I have written it quickly, but it looks nice and is code that is easy to understand. For the full source <a href='http://limegarden.net/wp-content/uploads/2010/05/main.cpp'>click here (C++ example of events)</a></p>
]]></content:encoded>
			<wfw:commentRss>http://limegarden.net/2010/05/17/events-in-c/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to write school papers</title>
		<link>http://limegarden.net/2010/05/04/how-to-write-school-papers/</link>
		<comments>http://limegarden.net/2010/05/04/how-to-write-school-papers/#comments</comments>
		<pubDate>Tue, 04 May 2010 08:32:13 +0000</pubDate>
		<dc:creator>Wouter Lindenhof</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[paper]]></category>
		<category><![CDATA[writing]]></category>

		<guid isPermaLink="false">http://limegarden.net/?p=311</guid>
		<description><![CDATA[Everybody who knows me only a little bit now that I have a huge dislike for writing papers. Papers are too much theory and to little substance for me. Because of school I'm finding myself on the other side and I have to write a paper instead which, as you might guess, I find even [...]]]></description>
			<content:encoded><![CDATA[<p>Everybody who knows me only a little bit now that I have a huge dislike for writing papers. Papers are too much theory and to little substance for me. </p>
<p>Because of school I'm finding myself on the other side and I have to write a paper instead which, as you might guess, I find even less enjoyable than having to read one.</p>
<p>The problem however is that if I don't write a good paper I won't graduate and frankly I do want to graduate.</p>
<p>So instead of focusing myself on the problem (me disliking papers) I try to focus on the solution (write a good paper to get my pass) and here are a few tips and ideas to write your school paper.</p>
<h4>1. A thousand words each day</h4>
<p>When I first started working on my paper the progress was slow. I know that my paper needs to have 4000 words at least and after a week I had only 1200 words. Since I only work a few days in the week on my school work I would come at an average of 400 words every day, which is about a page a day. So I decided that for every day in the week I would write at least 1 thousand new words and remove at most 1 thousand words. Because of that I will always add more words than I remove.<br />
As soon as I have added a thousand new words I would allow myself to take the rest of the day free. If I would write 17 words each minute and keep it up for an hour I would be done with my work within an hour. If you have four weeks left and only work on your paper three days of the week you would have a total of 4*3*1000 = 12000, which would be 3 times the required minimum. </p>
<p>If you keep track of your word count from day to day it becomes something enjoyable (and rewarding since it takes only an hour a day) instead of tedious.</p>
<h4>2. Learn how to use Word</h4>
<p>The majority of the people don't know how to use Microsoft Word but if you want to write a lot (and you want to write quickly) try to not use custom formatting at all (don't touch bold, cursive, etc) but use the styles ("Header 1", "Header 2" and so on). Formatting the text is something you will do only when everything is finished and if you have used styles the formatting is easy as you only have to adjust the style.<br />
Images are the one thing that only always cause me trouble. I know that they need to be there, but I don't want to waste time now on creating them. What I always do is reserve one style in which I describe what image should be placed there. Later I just look for that style and I know how to replace it.<br />
Also using comments and "keep track of changes" can be an aid. And using the grammar checker is useful to ensure that you are writing normal sentences. </p>
<h4>3. Ignore spelling and grammar</h4>
<p>Normally I would strongly advise against the above but I learned from creative writing (stories) that there are times you don't want to know that you type a certain word wrong or that your grammar is a long way off, but if you are typing about some complex algorithm (which is the part I really hate, just give me the code instead) you just want to continue typing. Fixing can be done later.</p>
<p>That are a few of the things I use to write my school paper. I hope they provide some aid if you have also the same amount of trouble writing paper.</p>
]]></content:encoded>
			<wfw:commentRss>http://limegarden.net/2010/05/04/how-to-write-school-papers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Evil dutch internet law proposal</title>
		<link>http://limegarden.net/2010/04/26/evil-dutch-internet-law-proposal/</link>
		<comments>http://limegarden.net/2010/04/26/evil-dutch-internet-law-proposal/#comments</comments>
		<pubDate>Mon, 26 Apr 2010 11:09:44 +0000</pubDate>
		<dc:creator>Wouter Lindenhof</dc:creator>
				<category><![CDATA[Legal]]></category>
		<category><![CDATA[Dutch Law]]></category>
		<category><![CDATA[rant]]></category>

		<guid isPermaLink="false">http://limegarden.net/?p=310</guid>
		<description><![CDATA[This morning I got a mail which was about a dutch law proposal. In the mail it said that the proposal basically means that you need to pay more when you download certain things from the internet. (the proposal can be found here however it's in dutch) I haven't read it as I don't know [...]]]></description>
			<content:encoded><![CDATA[<p>This morning I got a mail which was about a dutch law proposal. In the mail it said that the proposal basically means that you need to pay more when you download certain things from the internet. (the proposal can be found <a href="http://static.limegarden.net/dutch%20law%20documents/Wet%20rl%20136%20en%20140%20consultatieversie.pdf">here</a> however it's in dutch)</p>
<p>I haven't read it as I don't know the original and basically 21 pages of legal stuff is not what I see as entertaining. But after asking around it seems that the dutch government wants Internet providers to split. If you want access to certain things (like filesharing) you will need to pay extra.</p>
<p>Besides the fact that this is entirely evil, I only wonder "why?".<br />
Does the government (because that is where your money goes) need the money so bad, that they think of this?<br />
Or is it because to counter file sharing?</p>
<p>In either case there are tons of ways around it and besides: <strong>File sharing is legal</strong>. Sharing files you don't have the rights to (like the latest movie) is of course illegal. But using bittorrent, DC++, emule, IRC, Kazzaa (god forbids) or whatever tool you use is legal. Uploading material which you don't own (the "legal own" not the "physical, I-have-it-in-my-hands, own") is also not legal, and that seems common sense to me.</p>
<p>But if this change in the law is accepted than it means that legal sharing (for example sharing huge files to the other office overseas) requires you to pay extra for it. Even a kid would think of this as unfair and any adult should know better.</p>
<p>Sigh, I'm ranting but the Netherlands is slowly turning in a police state, where it seems you have to proof your innocence. :S </p>
]]></content:encoded>
			<wfw:commentRss>http://limegarden.net/2010/04/26/evil-dutch-internet-law-proposal/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Large scene rendering</title>
		<link>http://limegarden.net/2010/04/26/large-scene-rendering/</link>
		<comments>http://limegarden.net/2010/04/26/large-scene-rendering/#comments</comments>
		<pubDate>Mon, 26 Apr 2010 08:41:15 +0000</pubDate>
		<dc:creator>Wouter Lindenhof</dc:creator>
				<category><![CDATA[Game development]]></category>
		<category><![CDATA[algorithms]]></category>
		<category><![CDATA[graphics]]></category>
		<category><![CDATA[hardware]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[rant]]></category>

		<guid isPermaLink="false">http://limegarden.net/?p=308</guid>
		<description><![CDATA[There is one thing I don't like about floating point and integers and that is that they consist out of only certain amount of bits. An integer is at least 32 bits (on 32 systems at least). A float is also 32 bits. A double is 64 bits. Since I'm currently thinking about a space [...]]]></description>
			<content:encoded><![CDATA[<p>There is one thing I don't like about floating point and integers and that is that they consist out of only certain amount of bits. An integer is at least 32 bits (on 32 systems at least). A float is also 32 bits. A double is 64 bits.</p>
<p>Since I'm currently thinking about a space game, I was wondering how to create a huge battle field (a whole solar system) in real time while having all the precision I need. </p>
<p>Doubles are not fast and take a lot of space and although I don't worry about space, speed is a bigger issue. If I want a huge battle and here I'm going to throw some numbers: One side can have as maximum 85 huge ships, 3010 fighters, makes 3960 weapon slots, which makes 19800 bullets flying around. And that is only one side. Since I need two sides for a war, I need to double the values (190 ships, 6020 fighters, 7920 hardpoints, 39600 bullets). Lets say that everything is represented by one location (which a 3D vector) it would mean 53730 locations. 53730 locations times 3 would be 161190 and that times <code class="codecolorer cpp geshi"><span class="cpp"><span style="color: #0000dd;">sizeof</span><span style="color: #008000;">&#40;</span><span style="color: #0000ff;">double</span><span style="color: #008000;">&#41;</span></span></code> would be 161190 * 8 bytes = 1289520 bytes (about 1MB) which is a lot to start with even if you ignore the fact that the problem is more that I have a lot than the doubles are bigger.</p>
<p>As I was considering the problem I realized something else. When I'm rendering, I will need to use floats. DirectX 9 requires floats and although I could send doubles it would half my data bandwidth. So what ever I choose, in the end I will need to use floats unless I want to have some penalty.</p>
<p>Using doubles for vertices are is a bad idea for the sake of precision alone.</p>
<p>But then I started thinking...</p>
<p>I don't need to render using doubles, I can simply render everything with floats and to ensure that precision is maintained. If something is not within the safe area of floating point rendering (let's say floats can have a maximum of 1024, and yes I now it can be a lot more) but the object in question is 2048 units away, I still want to render it. You can't simply let a sun disappear because it is beyond the range of your numbers, that would be weird.</p>
<p>Instead everything that is more than 1024 units away will be rendered first (farthest away first) and the distance also scales it down. Than I clear the Z buffer and render everything in the 1024 range.</p>
<div class="codecolorer-container text geshi" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">Sun has a size of 100<br />
Sun is 2048 units away<br />
Sun needs to be rendered.<br />
<br />
To render it but maintain the correct look:<br />
Scale sun down so that at 1024 it would have the same <br />
size on screen as if it was rendered at 2048.</div></td></tr></tbody></table></div>
<p>It was so simple that I thought it was silly I never thought about it. How you scale it however depends on the view and projection matrix. </p>
<p>I'm still not certain if I want to use doubles, but for my second problem I have a solution. Now I need to find one for my first.</p>
]]></content:encoded>
			<wfw:commentRss>http://limegarden.net/2010/04/26/large-scene-rendering/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
