<?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 &#187; Game development</title>
	<atom:link href="http://limegarden.net/category/game-development/feed/" rel="self" type="application/rss+xml" />
	<link>http://limegarden.net</link>
	<description>Personal site of Wouter Lindenhof</description>
	<lastBuildDate>Wed, 01 Feb 2012 23:07:09 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>The state of the game</title>
		<link>http://limegarden.net/2011/04/02/the-state-of-the-game/</link>
		<comments>http://limegarden.net/2011/04/02/the-state-of-the-game/#comments</comments>
		<pubDate>Sat, 02 Apr 2011 15:00:34 +0000</pubDate>
		<dc:creator>Wouter Lindenhof</dc:creator>
				<category><![CDATA[Developer Diary]]></category>
		<category><![CDATA[Game development]]></category>

		<guid isPermaLink="false">http://limegarden.net/?p=466</guid>
		<description><![CDATA[The game that I have been working on will most likely be delayed as in the past month I have been distracted by my new job, my younger brother graduating, looking for a place to stay and a few other things. In addition I also bought four games which of course need to be played [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://limegarden.net/wp-content/uploads/2011/04/pauze-yogi-hulk1.gif"><img class="alignleft size-thumbnail wp-image-467" title="pauze-yogi-hulk[1]" src="http://limegarden.net/wp-content/uploads/2011/04/pauze-yogi-hulk1-150x150.gif" alt="" width="150" height="150" /></a>The game that I have been working on will most likely be delayed as in the past month I have been distracted by my new job, my younger brother graduating, looking for a place to stay and a few other things. In addition I also bought four games which of course need to be played as well.</p>
<p>Because of all those distractions I have decided that I will take some extra time, relax, smell the roses and stuff and then start again this month. The result is that I will be behind, but that is OK and knowning myself I will most likely catch up at one point.</p>
<p>Image from: http://www.studiohajo.nl/ (license unknown)</p>
]]></content:encoded>
			<wfw:commentRss>http://limegarden.net/2011/04/02/the-state-of-the-game/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The editor</title>
		<link>http://limegarden.net/2011/03/09/the-editor/</link>
		<comments>http://limegarden.net/2011/03/09/the-editor/#comments</comments>
		<pubDate>Wed, 09 Mar 2011 09:00:02 +0000</pubDate>
		<dc:creator>Wouter Lindenhof</dc:creator>
				<category><![CDATA[Developer Diary]]></category>
		<category><![CDATA[Game development]]></category>
		<category><![CDATA[Project]]></category>

		<guid isPermaLink="false">http://limegarden.net/?p=458</guid>
		<description><![CDATA[I have written a few level editors, often only intended to be used with a certain project and once something that was intended to be used a common tool. Often I see it as welcome change and use the chance to work on something else. For my current project I was conflicted about what to [...]]]></description>
			<content:encoded><![CDATA[<p>I have written a few level editors, often only intended to be used with a certain project and once something that was intended to be used a common tool. Often I see it as welcome change and use the chance to work on something else.</p>
<p>For my current project I was conflicted about what to do with the terrain editor. I had two choices, either create a seperate tool or integrate the editor in the game. The first choice always has my preference as a tool and a game have different usage requirements which is reflected in the way they are programmed. The second choice is also a risk in my opinion as you might couple part of your codes that should not be coupled. Decoupling them afterwards is, as many programmers can tastify, a pain.</p>
<p>However the advantage of combining the code is that I don't need to duplicate code or functionality. This is also the reason why I have decided to create the editor in the game. The cool thing however will be I can review the results of my work in realtime.</p>
<p>However before I can start working on terrain editing, I need to write the terrain code, which means that I need to start thinking about the culling acceleration structure and refresh the knowledge about terrains.</p>
]]></content:encoded>
			<wfw:commentRss>http://limegarden.net/2011/03/09/the-editor/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Scared to code</title>
		<link>http://limegarden.net/2011/03/06/scared-to-code/</link>
		<comments>http://limegarden.net/2011/03/06/scared-to-code/#comments</comments>
		<pubDate>Sun, 06 Mar 2011 11:24:16 +0000</pubDate>
		<dc:creator>Wouter Lindenhof</dc:creator>
				<category><![CDATA[Game development]]></category>
		<category><![CDATA[Project]]></category>

		<guid isPermaLink="false">http://limegarden.net/?p=453</guid>
		<description><![CDATA[The project I'm working on at home is making steady progress. I'm on schedule, the code is of high quality (even higher than I had expected it to be at this point) and as the architecture becomes more and more mature I'm getting more and more optimistic about my goal: A commercial game. So why, [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://limegarden.net/wp-content/uploads/2011/03/Boo1.png"><img class="alignleft size-medium wp-image-454" title="Boo[1]" src="http://limegarden.net/wp-content/uploads/2011/03/Boo1-300x254.png" alt="" width="150" height="127" /></a>The project I'm working on at home is making steady progress. I'm on schedule, the code is of high quality (even higher than I had expected it to be at this point) and as the architecture becomes more and more mature I'm getting more and more optimistic about my goal: A commercial game.</p>
<p>So why, if everything is going so well, do I write an blogpost that is titled "scared to code"? Was I not getting more and more optimistic?</p>
<p>That is because soon I will be done with the majority of the architecture and I have to actually write the game code and to be honest there I no complete design document only an feeling that I want others to have when they play the game. The game design is therefor mostly informal which means that without a formal definition I won't be able to measure how far the game is complete. Now I know there are plenty of people who are able to work that way and get incredible results, but I know that unless I have a formal definition I will continue working on the game forever. So either I have to make a formal game design or learn how to cope work with informal game designs. I don't think I can do the first part as good as I used to and I fear what would happen if I choose the second option.</p>
<p>Now don't get me wrong, I have worked in both ways and got results. I do prefer formal game design as they are more predictable and it is easier to know what is inside or outside the scope of the project. The problem in this case however is that I have decided on a hybrid method. The game should be developed until the end of Juli which means that somewhere in August I need to release the game, as this is one of the restrictions I have applied on the project. So what I at least have is an schedule and I'm happy to say that I'm good with scheduling tasks and projects. However I have never made a schedule without having a formal definition of the end result of the product. It's not the way that I usually work and most certainly not the way that I prefer to work.</p>
<p>Writing a decent engine is pretty straight forward, there are some things you need to take in account, but if you have written a few, than writing a new one is more like a warming up then actually trouble. Each game however is a different so there are no warming ups. You might be able to use a few tricks that you have used for other projects and use it here, but overal the code is completely new. Now next to me is a single piece of paper on which I have written the schedule. The schedule is quite decent but at the moment I'm afraid of moving on to the game code.</p>
<p>The strange thing is however that once I start working on the game code, I know that the fear will disappear, but until then I'm scared to death, uhm.. scared to code. <img src='http://limegarden.net/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://limegarden.net/2011/03/06/scared-to-code/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Burning the midnight oil</title>
		<link>http://limegarden.net/2011/02/07/burning-the-midnight-oil/</link>
		<comments>http://limegarden.net/2011/02/07/burning-the-midnight-oil/#comments</comments>
		<pubDate>Mon, 07 Feb 2011 22:01:33 +0000</pubDate>
		<dc:creator>Wouter Lindenhof</dc:creator>
				<category><![CDATA[Game development]]></category>
		<category><![CDATA[rant]]></category>

		<guid isPermaLink="false">http://limegarden.net/?p=417</guid>
		<description><![CDATA[Since a month I have been burning the midnight oil at creating a game, which is why this blog is a little bit inactive. The goal I have set is to create the first version (the so called "gold" version) within 6 months after starting. Meanwhile I'm ten days away of having the first month [...]]]></description>
			<content:encoded><![CDATA[<p>Since a month I have been burning the midnight oil at creating a game, which is why this blog is a little bit inactive.</p>
<p>The goal I have set is to create the first version (the so called "gold" version) within 6 months after starting. Meanwhile I'm ten days away of having the first month passing by and frankly not much is ready. I'm also running in a few challenges like how I would need do the terrain and whether I should focus on game-play first and then on the terrain.</p>
<p>This project has a huge experimental factor (I always try to add something knew in attempt to increase either my knowledge or frustration <img src='http://limegarden.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  ). In this case the biggest one is to create a commercial game within 6 months using nothing else except my spare time (which turns out to be like 16 hours or so each week). At the same time I'm also running a smaller experiment which is a developer diary. Every day I write a post on a private site in which I explain what I have done, what can be improved and what I should do the next day.</p>
<p>Having to keep track of logs is a nightmare for me but that small experiment is turning out to be quite a life saver. Not only can I look back and see what I was suppose to be working on but it also gives me a form of accountablity, which is important if you want to create similar products.</p>
<p>Anway I hope that next month or so I'm able to report that the gameplay is working.</p>
]]></content:encoded>
			<wfw:commentRss>http://limegarden.net/2011/02/07/burning-the-midnight-oil/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Picking an engine</title>
		<link>http://limegarden.net/2010/10/27/picking-an-engine/</link>
		<comments>http://limegarden.net/2010/10/27/picking-an-engine/#comments</comments>
		<pubDate>Wed, 27 Oct 2010 21:00:36 +0000</pubDate>
		<dc:creator>Wouter Lindenhof</dc:creator>
				<category><![CDATA[Game development]]></category>
		<category><![CDATA[game]]></category>
		<category><![CDATA[Game Development]]></category>

		<guid isPermaLink="false">http://limegarden.net/?p=400</guid>
		<description><![CDATA[As my design notebook grows and ideas are being solidified I need to seriously think about what kind of graphics engine I should pick. I had three choices: Unity, NeoAxis Game Engine and Ogre3D. My past favorite Irrlicht is not in the list as I had some compatibility issues in the past and frankly I [...]]]></description>
			<content:encoded><![CDATA[<p>As my design notebook grows and ideas are being solidified I need to seriously think about what kind of graphics engine I should pick. I had three choices: <a href="http://unity3d.com/">Unity</a>, <a href="http://www.neoaxisgroup.com/">NeoAxis Game Engine</a> and <a href="http://www.ogre3d.org/">Ogre3D</a>. My past favorite <a href="http://irrlicht.sourceforge.net/">Irrlicht</a> is not in the list as I had some compatibility issues in the past and frankly I don't see a lot of action there. The last time I checked, granted that was quite a while ago, the development seems to be grinding to a halt because the API required huge refactoring to make use of threading and shaders. Not that there is anything wrong Irrlicht, it is a fantastic engine to start learning game development but for some reason I don't think it no longer suits my needs. Anyway, enough compliments about Irrlicht.</p>
<p>So I have checked out three engines (well, not Ogre3D, I have used that before and except a few minor (and I do mean minor) things I have no issues with it) and I noticed a few things. Neither NeoAxis and Unity are C++, which is weird since I favor C++ over almost any language, but being brave I decided to check it out. </p>
<p>I can be brief about NeoAxis, it has an incomplete documentation, which wouldn't be so bad if at least the functions were documented or the example code was clear. But instead it is not clear for me nor were the functions documented. Maybe I should put some more time in it, well, I should, but the lack of documentation is a huge turn down for me.</p>
<p>Unity on the other side, I can be quite positive about. It is basically the same as NeoAxis, except with proper documentation. The downside is that it uses C# scripts (among a variety of other formats) which means scripting and I'm not a big fan of that. Ignoring that I had tiny bit of time to check it out, but overall it seems quite decent. Now if only the price of the full version goes down, I might be really tempted.</p>
<p>So after checking out those two engines, the only one that remains is Ogre3D, which by now I believe is my best choice. My forte is C++ (even though I now develop in C#) and although I have no problem trying to do it in another language, I do prefer C++. Preference might not seem like a big deal, but it is for me. </p>
<p>So for now the odds seem to be Ogre3D (oh yes, it is also only one free). But I might experiment with unity some more before I make a final decision.</p>
]]></content:encoded>
			<wfw:commentRss>http://limegarden.net/2010/10/27/picking-an-engine/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>New game design: Inclusion of zombies</title>
		<link>http://limegarden.net/2010/10/25/new-game-design-inclusion-of-zombies/</link>
		<comments>http://limegarden.net/2010/10/25/new-game-design-inclusion-of-zombies/#comments</comments>
		<pubDate>Mon, 25 Oct 2010 09:00:03 +0000</pubDate>
		<dc:creator>Wouter Lindenhof</dc:creator>
				<category><![CDATA[Game development]]></category>
		<category><![CDATA[game]]></category>
		<category><![CDATA[game design]]></category>
		<category><![CDATA[zombie]]></category>

		<guid isPermaLink="false">http://limegarden.net/?p=397</guid>
		<description><![CDATA[Sorry for the long period of silence, but there simply is not much going on besides me adjusting from being a student to a full time employee. Also I have decided to take it a little bit easy as I have been working my ass off the last 18 months. Anyway, I have been working [...]]]></description>
			<content:encoded><![CDATA[<p>Sorry for the long period of silence, but there simply is not much going on besides me adjusting from being a student to a full time employee. Also I have decided to take it a little bit easy as I have been working my ass off the last 18 months.</p>
<p>Anyway, I have been working on a new game design which slowly starts getting form. I'm actually surprised that is taking so long, but that is because I want to have certain core mechanic in the game (oh yeah, it's going to be released as a commercial game) and to implement that core mechanic is a pain when I take in account what I'm working with.</p>
<p>I can't go in much detail, simply because not everything is fixed and almost anything is subject to change, but one of the weirdest choices that I have made is the inclusion of zombies. And frankly I never ever cared about zombies. Zombies are slow moving, dumb and one of the undeads that should be easy to kill. I know that in some fiction zombies are fast, but I could never buy that. Why would a zombie suddenly be faster after it dies? Why do they suddenly have super human strength?</p>
<p>No for all I care zombies remain slow, dumb and easy to kill. </p>
<p>The reason why I start liking the zombie theme is because of the comic: <a href="http://en.wikipedia.org/wiki/The_Walking_Dead">The Walking Dead</a>, which has quite a realistic view on a zombie apocalypse. Of course <a href="http://en.wikipedia.org/wiki/Shaun_of_the_dead">Shaun of the Dead</a>, a comedy which is also nice horror movie, is a favorite of mine. The rest not. <a href="http://en.wikipedia.org/wiki/Left_4_Dead">Left 4 Dead</a> contains an example of zombies which I think are not zombies, although it is cited in the manual that the game doesn't contain "traditional dead zombies" but infected humans. </p>
<p>Anyway if you take a look at my research material (if you can call it that), it's obvious that I'm interested in the horror survival genre and I will try to tell more about it once I have more to talk about</p>
]]></content:encoded>
			<wfw:commentRss>http://limegarden.net/2010/10/25/new-game-design-inclusion-of-zombies/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<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[code]]></category>
		<category><![CDATA[Game development]]></category>
		<category><![CDATA[Software development]]></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; persons[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; persons[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>2</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>4</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 [cci_cpp]sizeof(double)[/cci_cpp] 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>
<p>[cc_text]<br />
Sun has a size of 100<br />
Sun is 2048 units away<br />
Sun needs to be rendered.</p>
<p>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.<br />
[/cc_text]</p>
<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>
		<item>
		<title>Combo hit!! in code</title>
		<link>http://limegarden.net/2010/04/06/combo-hit-in-code/</link>
		<comments>http://limegarden.net/2010/04/06/combo-hit-in-code/#comments</comments>
		<pubDate>Tue, 06 Apr 2010 07:17:24 +0000</pubDate>
		<dc:creator>Wouter Lindenhof</dc:creator>
				<category><![CDATA[C++]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[Game development]]></category>
		<category><![CDATA[code snippit]]></category>
		<category><![CDATA[demo]]></category>
		<category><![CDATA[example]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://limegarden.net/?p=302</guid>
		<description><![CDATA[I have always wondered how hard it would be to write a combo system. Not that hard I guess. And after a bit of morning programming I already got it working. The only reason it took longer than anticipated was because of muscle memory. One of the features I wanted to test was the delay. [...]]]></description>
			<content:encoded><![CDATA[<p>I have always wondered how hard it would be to write a combo system. Not that hard I guess. And after a bit of morning programming I already got it working. </p>
<p>The only reason it took longer than anticipated was because of muscle memory. One of the features I wanted to test was the delay. For example you want to do the "asdf" combo, but you are for some reason not fast enough, than the combo should not start. Simulating this is easy, just begin the combo and stop somewhere for a second and then complete the combo. So "asd", pause and then "f".<br />
However when I tried that for some reason the combo was sometimes completed. Only after adding the debug messages I noticed that I often automatically did complete the combo. The problem was muscle memory.</p>
<p>Anyway below is the code and if anyone wants to extend it (wrong next key, combo breakers, roman cancel, and follow-up combos) feel free to do so and let me know.</p>
<pre class="brush: c++; ">

/*******************************************************************************
 * The MIT License
 *
 * Licensed under the MIT license:
 *   http://www.opensource.org/licenses/mit-license.php
 *
 * Copyright (c) 2010 Wouter Lindenhof (http://limegarden.net)
 *
 * Demonstration of a simple ComboHit system
 *******************************************************************************/

#include &lt;Windows.h&gt;
#include &lt;iostream&gt;
#include &lt;vector&gt;
#pragma comment(lib, &quot;Winmm.lib&quot;)

#define DEBUGLOG 1 // Set to 0 to turn debug messages off

class KeyHit
{
public:
	UINT m_Key;
	UINT m_Delay;
	UINT m_Waiting;
public:
	KeyHit(UINT key, UINT delay) : m_Key(key), m_Delay(delay), m_Waiting(0) { }
};

class HitCombo
{
	UINT m_SequenceIndex;
	std::vector&lt;KeyHit&gt; m_Keys;
public:
	HitCombo() : m_SequenceIndex(0) { }

	void Cancel();
	void Update(DWORD ms);
	operator bool();
	HitCombo&amp; operator &lt;&lt; (const KeyHit&amp; hit);
};

int main(int argc, const char* argv[])
{
	std::cout &lt;&lt; &quot;-----------------------------------------------&quot; &lt;&lt; std::endl;
	std::cout &lt;&lt; &quot;This is a combo key tester: &quot; &lt;&lt; std::endl;
	std::cout &lt;&lt; &quot;Press \&quot;ASDF\&quot; quickly to do a combo hit&quot; &lt;&lt; std::endl;
	std::cout &lt;&lt; &quot;Press \&quot;Wouter\&quot; quickly to write my name&quot; &lt;&lt; std::endl;
	std::cout &lt;&lt; &quot;Press SHIFT and then escape to quit&quot; &lt;&lt; std::endl;
	std::cout &lt;&lt; &quot;-----------------------------------------------&quot; &lt;&lt; std::endl;
	HitCombo QuitApplication, ComboHit, WouterCombo;
	QuitApplication &lt;&lt; KeyHit(VK_SHIFT, 250) &lt;&lt; KeyHit(VK_ESCAPE, 250);
	ComboHit		&lt;&lt; KeyHit(&#039;A&#039;, 250) &lt;&lt; KeyHit(&#039;S&#039;, 250) &lt;&lt; KeyHit(&#039;D&#039;, 250)
					&lt;&lt; KeyHit(&#039;F&#039;, 250);
	WouterCombo		&lt;&lt; KeyHit(&#039;W&#039;, 250) &lt;&lt; KeyHit(&#039;O&#039;, 250) &lt;&lt; KeyHit(&#039;U&#039;, 250)
					&lt;&lt; KeyHit(&#039;T&#039;, 250) &lt;&lt; KeyHit(&#039;E&#039;, 250) &lt;&lt; KeyHit(&#039;R&#039;, 250);

	DWORD lastTime = timeGetTime();
	DWORD curTime = lastTime;
	DWORD difference = 0;

	while(true)
	{
		curTime = timeGetTime();
		difference = curTime - lastTime;
		lastTime = curTime;
		if(ComboHit)
		{
			std::cout &lt;&lt; &quot;You did a combo hit!!&quot; &lt;&lt; std::endl;
			WouterCombo.Cancel();
			QuitApplication.Cancel();
		}
		if(WouterCombo)
		{
			std::cout &lt;&lt; &quot;You wrote &#039;Wouter&#039;, good for you!&quot; &lt;&lt; std::endl;
			ComboHit.Cancel();
			QuitApplication.Cancel();
		}
		if(QuitApplication)
		{
			std::cout &lt;&lt; &quot;You quit the application!&quot; &lt;&lt; std::endl;
			ComboHit.Cancel();
			WouterCombo.Cancel();
			break;
		}
		ComboHit.Update(difference);
		QuitApplication.Update(difference);
		WouterCombo.Update(difference);
	}

	return 0;
}

void HitCombo::Cancel() {
	m_SequenceIndex = 0;
}

// Implementation
HitCombo&amp; HitCombo::operator &lt;&lt;(const KeyHit &amp;hit) {
	m_Keys.push_back(hit);
	return *this;
}

HitCombo::operator bool() {
	return m_SequenceIndex == m_Keys.size();
}
void HitCombo::Update(DWORD ms)
{
	if(m_SequenceIndex &lt; m_Keys.size())
	{
		KeyHit&amp; hit = m_Keys[m_SequenceIndex];
		hit.m_Waiting += ms;
		if(GetAsyncKeyState(hit.m_Key) != 0)
		{
			if(hit.m_Waiting &lt; hit.m_Delay)
			{
				hit.m_Waiting = 0;
				m_SequenceIndex++;
#if DEBUGLOG = 1
				std::cout &lt;&lt; &quot;you pressed key &quot; &lt;&lt; (char)hit.m_Key &lt;&lt; std::endl;
#endif
			}else
			{
#if DEBUGLOG = 1
				std::cout &lt;&lt; &quot;Delay too long&quot; &lt;&lt; std::endl;
#endif
				hit.m_Waiting = 0;
				m_SequenceIndex = 0;
			}
			if(m_SequenceIndex == 0)
			{
				hit.m_Waiting = 0;
			}
		}else if(m_SequenceIndex==0)
		{
			hit.m_Waiting = 0;
		}else
		{
			if(hit.m_Waiting &gt; hit.m_Delay)
			{
				m_SequenceIndex = 0;
				hit.m_Waiting = 0;
#if DEBUGLOG
				std::cout &lt;&lt; &quot;Delay too long&quot; &lt;&lt; std::endl;
#endif
			}
		}
	}else
	{
		m_SequenceIndex = 0;
		KeyHit&amp; hit = m_Keys[m_SequenceIndex];
		hit.m_Waiting = 0;
	}
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://limegarden.net/2010/04/06/combo-hit-in-code/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

