<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Knut's Projects</title>
	<atom:link href="http://knut80.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://knut80.wordpress.com</link>
	<description>Making beautiful things with beautiful code</description>
	<lastBuildDate>Sun, 30 Jan 2011 11:31:43 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='knut80.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Knut's Projects</title>
		<link>http://knut80.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://knut80.wordpress.com/osd.xml" title="Knut&#039;s Projects" />
	<atom:link rel='hub' href='http://knut80.wordpress.com/?pushpress=hub'/>
		<item>
		<title>A new hobby project</title>
		<link>http://knut80.wordpress.com/2010/11/13/a-new-hobby-project/</link>
		<comments>http://knut80.wordpress.com/2010/11/13/a-new-hobby-project/#comments</comments>
		<pubDate>Fri, 12 Nov 2010 23:59:24 +0000</pubDate>
		<dc:creator>Knut Erik</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[GUI]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://knut80.wordpress.com/?p=237</guid>
		<description><![CDATA[I&#8217;ve been looking to start a new (semi-serious) hobby project. As usual with these things, the hard part is deciding what to make, not doing it (although I think this will be more than hard enough to make it interesting). I know I want to try creating a small(ish) game, and preferably something that I [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=knut80.wordpress.com&amp;blog=6800080&amp;post=237&amp;subd=knut80&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been looking to start a new (semi-serious) hobby project. As usual with these things, the hard part is deciding what to make, not doing it (although I think this will be more than hard enough to make it interesting). I know I want to try creating a small(ish) game, and preferably something that I would enjoy myself. I also wanted to do it somewhat relevant to my job, where I use Java, so I decided to not use C++, which is the traditional language for these things. Should be exciting to see how that works.</p>
<p>To get started, I have been playing around with GUI programming, which is something I don&#8217;t usually do(at work I work on the server side of things). I created a small program to show panels on the screen, like so.</p>
<div id="attachment_238" class="wp-caption aligncenter" style="width: 460px"><a href="http://knut80.files.wordpress.com/2010/11/mainmenu.png"><img class="size-full wp-image-238" title="Main menu" src="http://knut80.files.wordpress.com/2010/11/mainmenu.png?w=450&#038;h=253" alt="A panel being shown on screen" width="450" height="253" /></a><p class="wp-caption-text">A panel being shown on screen</p></div>
<p>The panel shown is within the borders in the picture. Other examples.</p>
<div id="attachment_240" class="wp-caption aligncenter" style="width: 460px"><a href="http://knut80.files.wordpress.com/2010/11/programoptions.png"><img class="size-full wp-image-240" title="ProgramOptions" src="http://knut80.files.wordpress.com/2010/11/programoptions.png?w=450&#038;h=253" alt="Program options panel" width="450" height="253" /></a><p class="wp-caption-text">Program options panel</p></div>
<div id="attachment_241" class="wp-caption aligncenter" style="width: 460px"><a href="http://knut80.files.wordpress.com/2010/11/gameoptions.png"><img class="size-full wp-image-241" title="GameOptions" src="http://knut80.files.wordpress.com/2010/11/gameoptions.png?w=450&#038;h=253" alt="Game options panel" width="450" height="253" /></a><p class="wp-caption-text">Game options panel</p></div>
<p>For the program options panel, I also wrote some code for changing the screen resolution. I&#8217;m designing the program to run in fullscreen mode by default, and so far the resolution is the only option(supported resolutions taken from the OS). So, what happens when clicking on start in that last panel?</p>
<div id="attachment_242" class="wp-caption aligncenter" style="width: 460px"><a href="http://knut80.files.wordpress.com/2010/11/nothing.png"><img class="size-full wp-image-242" title="Nothing" src="http://knut80.files.wordpress.com/2010/11/nothing.png?w=450&#038;h=253" alt="An empty panel to be precise" width="450" height="253" /></a><p class="wp-caption-text">An empty panel to be precise</p></div>
<p>Well, right now, nothing. Or to be precise, an empty panel with a single functionality, which is to return to the main menu if ESC is pressed. So now I just need to make something interesting to fill that empty space with. Server side programming is more my turf, so this should hopefully go smoothly.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/knut80.wordpress.com/237/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/knut80.wordpress.com/237/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/knut80.wordpress.com/237/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/knut80.wordpress.com/237/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/knut80.wordpress.com/237/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/knut80.wordpress.com/237/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/knut80.wordpress.com/237/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/knut80.wordpress.com/237/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/knut80.wordpress.com/237/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/knut80.wordpress.com/237/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/knut80.wordpress.com/237/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/knut80.wordpress.com/237/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/knut80.wordpress.com/237/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/knut80.wordpress.com/237/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=knut80.wordpress.com&amp;blog=6800080&amp;post=237&amp;subd=knut80&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://knut80.wordpress.com/2010/11/13/a-new-hobby-project/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/6baa331c6911af110bb7a77450dc4662?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">knut80</media:title>
		</media:content>

		<media:content url="http://knut80.files.wordpress.com/2010/11/mainmenu.png" medium="image">
			<media:title type="html">Main menu</media:title>
		</media:content>

		<media:content url="http://knut80.files.wordpress.com/2010/11/programoptions.png" medium="image">
			<media:title type="html">ProgramOptions</media:title>
		</media:content>

		<media:content url="http://knut80.files.wordpress.com/2010/11/gameoptions.png" medium="image">
			<media:title type="html">GameOptions</media:title>
		</media:content>

		<media:content url="http://knut80.files.wordpress.com/2010/11/nothing.png" medium="image">
			<media:title type="html">Nothing</media:title>
		</media:content>
	</item>
		<item>
		<title>Adding GUI</title>
		<link>http://knut80.wordpress.com/2010/05/23/adding-gui/</link>
		<comments>http://knut80.wordpress.com/2010/05/23/adding-gui/#comments</comments>
		<pubDate>Sun, 23 May 2010 18:50:47 +0000</pubDate>
		<dc:creator>Knut Erik</dc:creator>
				<category><![CDATA[Universal]]></category>
		<category><![CDATA[c++]]></category>
		<category><![CDATA[graphics]]></category>
		<category><![CDATA[GUI]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[SDL]]></category>

		<guid isPermaLink="false">http://knut80.wordpress.com/?p=232</guid>
		<description><![CDATA[If this project is going to end anywhere interesting, it needs a GUI. And GUI means windows, buttons etc etc. I created a GUI model, with elements, containers and all that good stuff. Or at least a prototype: Not too bad. But what is a GUI without mouse support? And windows that can be selected? [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=knut80.wordpress.com&amp;blog=6800080&amp;post=232&amp;subd=knut80&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>If this project is going to end anywhere interesting, it needs a GUI. And GUI means windows, buttons etc etc. I created a GUI model, with elements, containers and all that good stuff. Or at least a prototype:</p>
<div id="attachment_233" class="wp-caption aligncenter" style="width: 410px"><a href="http://knut80.files.wordpress.com/2010/05/firstwindows.png"><img class="size-full wp-image-233" title="FirstWindows" src="http://knut80.files.wordpress.com/2010/05/firstwindows.png?w=400&#038;h=300" alt="First Windows" width="400" height="300" /></a><p class="wp-caption-text">First Windows</p></div>
<p>Not too bad. But what is a GUI without mouse support? And windows that can be selected?</p>
<div id="attachment_234" class="wp-caption aligncenter" style="width: 410px"><a href="http://knut80.files.wordpress.com/2010/05/firstwindows2.png"><img class="size-full wp-image-234" title="FirstWindows2" src="http://knut80.files.wordpress.com/2010/05/firstwindows2.png?w=400&#038;h=300" alt="First Windows Show Off" width="400" height="300" /></a><p class="wp-caption-text">First Windows Show Off</p></div>
<p>So I have a GUI that can draw windows, and responds to mouse input. Not a bad start, although it still needs a lot of work. First job will be to allow text rendering.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/knut80.wordpress.com/232/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/knut80.wordpress.com/232/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/knut80.wordpress.com/232/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/knut80.wordpress.com/232/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/knut80.wordpress.com/232/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/knut80.wordpress.com/232/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/knut80.wordpress.com/232/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/knut80.wordpress.com/232/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/knut80.wordpress.com/232/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/knut80.wordpress.com/232/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/knut80.wordpress.com/232/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/knut80.wordpress.com/232/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/knut80.wordpress.com/232/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/knut80.wordpress.com/232/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=knut80.wordpress.com&amp;blog=6800080&amp;post=232&amp;subd=knut80&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://knut80.wordpress.com/2010/05/23/adding-gui/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/6baa331c6911af110bb7a77450dc4662?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">knut80</media:title>
		</media:content>

		<media:content url="http://knut80.files.wordpress.com/2010/05/firstwindows.png" medium="image">
			<media:title type="html">FirstWindows</media:title>
		</media:content>

		<media:content url="http://knut80.files.wordpress.com/2010/05/firstwindows2.png" medium="image">
			<media:title type="html">FirstWindows2</media:title>
		</media:content>
	</item>
		<item>
		<title>Improving the configuration framework</title>
		<link>http://knut80.wordpress.com/2010/03/28/improving-the-configuration-framework/</link>
		<comments>http://knut80.wordpress.com/2010/03/28/improving-the-configuration-framework/#comments</comments>
		<pubDate>Sun, 28 Mar 2010 22:06:28 +0000</pubDate>
		<dc:creator>Knut Erik</dc:creator>
				<category><![CDATA[Universal]]></category>
		<category><![CDATA[c++]]></category>
		<category><![CDATA[graphics]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://knut80.wordpress.com/?p=228</guid>
		<description><![CDATA[In the last post I described the configuration framework I created for the Universal project. I also discovered an important limitation, I had not included list functionality. So I revised my visual guide: I changed all the star types and icons to a new configuration file, and also added a new star type, witch is [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=knut80.wordpress.com&amp;blog=6800080&amp;post=228&amp;subd=knut80&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>In the last post I described the configuration framework I created for the Universal project. I also discovered an important limitation, I had not included list functionality. So I revised my visual guide:</p>
<div id="attachment_229" class="wp-caption aligncenter" style="width: 421px"><a href="http://knut80.files.wordpress.com/2010/03/configtree3.png"><img class="size-full wp-image-229" title="ConfigTree3" src="http://knut80.files.wordpress.com/2010/03/configtree3.png?w=411&#038;h=524" alt="Config Tree" width="411" height="524" /></a><p class="wp-caption-text">Config Tree</p></div>
<p>I changed all the star types and icons to a new configuration file, and also added a new star type, witch is easy now, no code changes are needed.</p>
<div id="attachment_230" class="wp-caption aligncenter" style="width: 460px"><a href="http://knut80.files.wordpress.com/2010/03/starlist.png"><img class="size-full wp-image-230" title="StarList" src="http://knut80.files.wordpress.com/2010/03/starlist.png?w=450&#038;h=335" alt="Stars" width="450" height="335" /></a><p class="wp-caption-text">Pretty?</p></div>
<p>Now I think it&#8217;s time to start adding some form of user interface.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/knut80.wordpress.com/228/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/knut80.wordpress.com/228/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/knut80.wordpress.com/228/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/knut80.wordpress.com/228/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/knut80.wordpress.com/228/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/knut80.wordpress.com/228/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/knut80.wordpress.com/228/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/knut80.wordpress.com/228/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/knut80.wordpress.com/228/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/knut80.wordpress.com/228/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/knut80.wordpress.com/228/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/knut80.wordpress.com/228/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/knut80.wordpress.com/228/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/knut80.wordpress.com/228/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=knut80.wordpress.com&amp;blog=6800080&amp;post=228&amp;subd=knut80&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://knut80.wordpress.com/2010/03/28/improving-the-configuration-framework/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/6baa331c6911af110bb7a77450dc4662?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">knut80</media:title>
		</media:content>

		<media:content url="http://knut80.files.wordpress.com/2010/03/configtree3.png" medium="image">
			<media:title type="html">ConfigTree3</media:title>
		</media:content>

		<media:content url="http://knut80.files.wordpress.com/2010/03/starlist.png" medium="image">
			<media:title type="html">StarList</media:title>
		</media:content>
	</item>
		<item>
		<title>Adding a configuration framework</title>
		<link>http://knut80.wordpress.com/2010/03/10/adding-a-configuration-framework/</link>
		<comments>http://knut80.wordpress.com/2010/03/10/adding-a-configuration-framework/#comments</comments>
		<pubDate>Wed, 10 Mar 2010 17:57:29 +0000</pubDate>
		<dc:creator>Knut Erik</dc:creator>
				<category><![CDATA[Universal]]></category>
		<category><![CDATA[c++]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://knut80.wordpress.com/?p=224</guid>
		<description><![CDATA[The goal of this project is to generate an interesting universe from scratch. Any form of procedural generation needs quite a few parameters to work properly, in my case things like galaxy size, star density etc. I&#8217;m sure a lot of other values will be added later, I&#8217;m already thinking of different star types and [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=knut80.wordpress.com&amp;blog=6800080&amp;post=224&amp;subd=knut80&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>The goal of this project is to generate an interesting universe from scratch. Any form of procedural generation needs quite a few parameters to work properly, in my case things like galaxy size, star density etc. I&#8217;m sure a lot of other values will be added later, I&#8217;m already thinking of different star types and planet types. Even just adding stars to a universe requires between five and ten parameters, maybe even more, especially since I want different types. Even at this very early stage, it&#8217;s a good idea to have all of these in one place, and when the project has grown large and fat, it&#8217;s absolutely essential. Preferably with the ability to group parameters together. I considered a few approaches to this problem:</p>
<ul>
<li>I could have all the parameters in a header file, or maybe more files as the project grows. This would be the fastest approach, but it&#8217;s not very flexible since I would need to recompile every time I make a change. Very inconvenient. Also, if I ever want to add saving/loading of parameters, this method would not be good enough.</li>
<li>I considered having a text file with parameters, which would then be loaded into a special class, or a set of classes, containing all the values, and making them available to the rest of the program. I&#8217;ve used this approach before, so I know how to make it work. It&#8217;s also quite fast, and it&#8217;s easy enough to group parameters together. However, the container classes will grow very large, and it&#8217;s tough to add new values.</li>
<li>I could place the parameters in a text file as above, but create a framework that would load them at runtime into a generic configuration tree. This is flexible, easy enough to work with, and I can group the parameters into branches of the tree. However, it might be a bit slower than the other approaches. However, it&#8217;s also the most interesting to implement. This is the approach I selected.</li>
</ul>
<p>Having never implemented a system like this in C++ before, I thought it would be a good idea to make a visual guide.</p>
<div id="attachment_225" class="wp-caption aligncenter" style="width: 310px"><a href="http://knut80.files.wordpress.com/2010/03/configtreet.png"><img class="size-medium wp-image-225" title="ConfigTreet" src="http://knut80.files.wordpress.com/2010/03/configtreet.png?w=300&#038;h=275" alt="The configuration tree visualized" width="300" height="275" /></a><p class="wp-caption-text">The configuration tree visualized</p></div>
<p>So I implemented it pretty much like that, using maps and void pointers in the ConfigEntry class, and creating a ConfigHandler class to deal with the loading of the configuration files. The configuration files are very simple, sort of &#8220;poor mans xml&#8221;. I think I might change it to use real xml in the future. But it works fine for the time being, I can define parameters, their type and name, and group them into complex attributes.</p>
<p>So with the system ready, I moved the (currently three) parameters from their previous place in a header file, to the new configuration file. And it works very well.:) The file gets loaded at startup, so I don&#8217;t have to recompile, and it&#8217;s pretty easy to get the attribute I want, with all the maps wrapped in a nice ConfigEntry object.</p>
<p>And then I thought, what else should I add to the configuration system. The list of images used as the star icons maybe? Good idea. But no list&#8230;hmmm&#8230;already showing limitations&#8230;</p>
<p>Guess it still needs some work. But that should be pretty easy and quick I hope. <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/knut80.wordpress.com/224/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/knut80.wordpress.com/224/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/knut80.wordpress.com/224/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/knut80.wordpress.com/224/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/knut80.wordpress.com/224/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/knut80.wordpress.com/224/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/knut80.wordpress.com/224/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/knut80.wordpress.com/224/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/knut80.wordpress.com/224/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/knut80.wordpress.com/224/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/knut80.wordpress.com/224/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/knut80.wordpress.com/224/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/knut80.wordpress.com/224/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/knut80.wordpress.com/224/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=knut80.wordpress.com&amp;blog=6800080&amp;post=224&amp;subd=knut80&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://knut80.wordpress.com/2010/03/10/adding-a-configuration-framework/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/6baa331c6911af110bb7a77450dc4662?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">knut80</media:title>
		</media:content>

		<media:content url="http://knut80.files.wordpress.com/2010/03/configtreet.png?w=300" medium="image">
			<media:title type="html">ConfigTreet</media:title>
		</media:content>
	</item>
		<item>
		<title>Adding more star icons</title>
		<link>http://knut80.wordpress.com/2010/02/21/adding-more-star-icons/</link>
		<comments>http://knut80.wordpress.com/2010/02/21/adding-more-star-icons/#comments</comments>
		<pubDate>Sun, 21 Feb 2010 20:18:16 +0000</pubDate>
		<dc:creator>Knut Erik</dc:creator>
				<category><![CDATA[Universal]]></category>
		<category><![CDATA[c++]]></category>
		<category><![CDATA[graphics]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://knut80.wordpress.com/?p=216</guid>
		<description><![CDATA[The graphical output of the Universal program is not surprisingly better than the text, but it still looks quite dull and flat. To help with this, I added a background image. But to ensure some randomness, I created an image bigger than the sector size, and a random part of it will be selected. Both [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=knut80.wordpress.com&amp;blog=6800080&amp;post=216&amp;subd=knut80&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>The graphical output of the Universal program is not surprisingly better than the text, but it still looks quite dull and flat. To help with this, I added a background image. But to ensure some randomness, I created an image bigger than the sector size, and a random part of it will be selected.</p>
<div id="attachment_217" class="wp-caption aligncenter" style="width: 212px"><a href="http://knut80.files.wordpress.com/2010/02/background1.png"><img class="size-full wp-image-217" title="Background1" src="http://knut80.files.wordpress.com/2010/02/background1.png?w=202&#038;h=206" alt="Background added" width="202" height="206" /></a><p class="wp-caption-text">Added background</p></div>
<div id="attachment_218" class="wp-caption aligncenter" style="width: 225px"><a href="http://knut80.files.wordpress.com/2010/02/background2.png"><img class="size-full wp-image-218" title="Background2" src="http://knut80.files.wordpress.com/2010/02/background2.png?w=215&#038;h=201" alt="Another background" width="215" height="201" /></a><p class="wp-caption-text">Another background</p></div>
<p>Both star positions and the background image are different for each time the program runs. To add even more variance, O created some more star icons, and had the program choose between these. The result is quite nice:</p>
<div id="attachment_219" class="wp-caption aligncenter" style="width: 249px"><a href="http://knut80.files.wordpress.com/2010/02/differentstaricons.png"><img class="size-full wp-image-219" title="DifferentStarIcons" src="http://knut80.files.wordpress.com/2010/02/differentstaricons.png?w=239&#038;h=223" alt="Different star icons" width="239" height="223" /></a><p class="wp-caption-text">Different star icons</p></div>
<p>I also created some red stars, but just for show. I&#8217;ve add the different star types later, with different planet types etc. For now, it&#8217;s just for the visuals.</p>
<div id="attachment_220" class="wp-caption aligncenter" style="width: 232px"><a href="http://knut80.files.wordpress.com/2010/02/redstars.png"><img class="size-full wp-image-220" title="RedStars" src="http://knut80.files.wordpress.com/2010/02/redstars.png?w=222&#038;h=219" alt="Some red star icons" width="222" height="219" /></a><p class="wp-caption-text">Some red star icons</p></div>
<p>Thats the visuals for a while, next i need to look at adding configuration files to the project.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/knut80.wordpress.com/216/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/knut80.wordpress.com/216/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/knut80.wordpress.com/216/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/knut80.wordpress.com/216/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/knut80.wordpress.com/216/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/knut80.wordpress.com/216/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/knut80.wordpress.com/216/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/knut80.wordpress.com/216/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/knut80.wordpress.com/216/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/knut80.wordpress.com/216/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/knut80.wordpress.com/216/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/knut80.wordpress.com/216/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/knut80.wordpress.com/216/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/knut80.wordpress.com/216/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=knut80.wordpress.com&amp;blog=6800080&amp;post=216&amp;subd=knut80&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://knut80.wordpress.com/2010/02/21/adding-more-star-icons/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/6baa331c6911af110bb7a77450dc4662?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">knut80</media:title>
		</media:content>

		<media:content url="http://knut80.files.wordpress.com/2010/02/background1.png" medium="image">
			<media:title type="html">Background1</media:title>
		</media:content>

		<media:content url="http://knut80.files.wordpress.com/2010/02/background2.png" medium="image">
			<media:title type="html">Background2</media:title>
		</media:content>

		<media:content url="http://knut80.files.wordpress.com/2010/02/differentstaricons.png" medium="image">
			<media:title type="html">DifferentStarIcons</media:title>
		</media:content>

		<media:content url="http://knut80.files.wordpress.com/2010/02/redstars.png" medium="image">
			<media:title type="html">RedStars</media:title>
		</media:content>
	</item>
		<item>
		<title>A new project</title>
		<link>http://knut80.wordpress.com/2010/02/21/a-new-project/</link>
		<comments>http://knut80.wordpress.com/2010/02/21/a-new-project/#comments</comments>
		<pubDate>Sun, 21 Feb 2010 19:04:32 +0000</pubDate>
		<dc:creator>Knut Erik</dc:creator>
				<category><![CDATA[Universal]]></category>
		<category><![CDATA[c++]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[SDL]]></category>

		<guid isPermaLink="false">http://knut80.wordpress.com/?p=211</guid>
		<description><![CDATA[I thought it would be fun to do a little program that creates a universe from scratch. Not a &#8220;real&#8221; universe, but maybe a sci-fi one. Perhaps I&#8217;ll make it into a little game or something, I&#8217;m not sure. I started the project by using SDL to fire up a window. I thought that my [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=knut80.wordpress.com&amp;blog=6800080&amp;post=211&amp;subd=knut80&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I thought it would be fun to do a little program that creates a universe from scratch. Not a &#8220;real&#8221; universe, but maybe a sci-fi one. Perhaps I&#8217;ll make it into a little game or something, I&#8217;m not sure.</p>
<p>I started the project by using SDL to fire up a window. I thought that my galaxy should consists of sectors. So a good start would be to add some stars to one sector, randomly. Here&#8217;s the first result, in glorious text mode:</p>
<div id="attachment_212" class="wp-caption aligncenter" style="width: 112px"><a href="http://knut80.files.wordpress.com/2010/02/textout.png"><img class="size-full wp-image-212" title="Text output" src="http://knut80.files.wordpress.com/2010/02/textout.png?w=102&#038;h=186" alt="The first output" width="102" height="186" /></a><p class="wp-caption-text">Text output. Stars being stars and dots being empty space</p></div>
<p>Not too bad start, although I really would prefer to have some graphic output instead. So, using Gimp, I created a star icon. Then I used SDL to create an image for the sector, and added star icons where applicable. The result is not too bad:</p>
<div id="attachment_213" class="wp-caption aligncenter" style="width: 267px"><a href="http://knut80.files.wordpress.com/2010/02/staricons.png"><img class="size-full wp-image-213" title="StarIcons" src="http://knut80.files.wordpress.com/2010/02/staricons.png?w=257&#038;h=191" alt="Star icons" width="257" height="191" /></a><p class="wp-caption-text">Star icons of a sector</p></div>
<p>The program generates this image at startup, and therefore will only draw one image each time it iterates through the main loop. So it&#8217;s fast. Not that it would have mattered at this stage, but hopefully I will expand this program enough that it will matter.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/knut80.wordpress.com/211/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/knut80.wordpress.com/211/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/knut80.wordpress.com/211/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/knut80.wordpress.com/211/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/knut80.wordpress.com/211/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/knut80.wordpress.com/211/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/knut80.wordpress.com/211/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/knut80.wordpress.com/211/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/knut80.wordpress.com/211/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/knut80.wordpress.com/211/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/knut80.wordpress.com/211/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/knut80.wordpress.com/211/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/knut80.wordpress.com/211/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/knut80.wordpress.com/211/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=knut80.wordpress.com&amp;blog=6800080&amp;post=211&amp;subd=knut80&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://knut80.wordpress.com/2010/02/21/a-new-project/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/6baa331c6911af110bb7a77450dc4662?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">knut80</media:title>
		</media:content>

		<media:content url="http://knut80.files.wordpress.com/2010/02/textout.png" medium="image">
			<media:title type="html">Text output</media:title>
		</media:content>

		<media:content url="http://knut80.files.wordpress.com/2010/02/staricons.png" medium="image">
			<media:title type="html">StarIcons</media:title>
		</media:content>
	</item>
		<item>
		<title>Creating a server/client application in Java</title>
		<link>http://knut80.wordpress.com/2009/08/28/creating-a-server-client-application-in-java/</link>
		<comments>http://knut80.wordpress.com/2009/08/28/creating-a-server-client-application-in-java/#comments</comments>
		<pubDate>Fri, 28 Aug 2009 20:15:10 +0000</pubDate>
		<dc:creator>Knut Erik</dc:creator>
				<category><![CDATA[Network programming]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://knut80.wordpress.com/?p=193</guid>
		<description><![CDATA[I&#8217;m experimenting with network programming in Java, and writing a server/client application. The basic socket handling in Java is pretty simple. Just create a ServerSocket and instruct it to listen. It will return a Socket object whenever it receives an incoming connection. try{ Socket socket = new ServerSocket(10000); } catch (IOException ioe) { throw new [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=knut80.wordpress.com&amp;blog=6800080&amp;post=193&amp;subd=knut80&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m experimenting with network programming in Java, and writing a server/client application. The basic socket handling in Java is pretty simple. Just create a ServerSocket and instruct it to listen. It will return a Socket object whenever it receives an incoming connection.</p>
<pre>
		try{
			Socket socket = new ServerSocket(10000);
		} catch (IOException ioe) {
			throw new IOException("Could not open server socket 10000", ioe);
		}
</pre>
<p>On the client it&#8217;s even easier.</p>
<pre>
		try {
			Socket socket = new Socket("127.0.0.1", 10000);
		} catch (IOException ioe) {
			throw new IOException("Could not open connection to 127.0.0.1", ioe);
		}
</pre>
<p>This will open a socket using port 10000 on the server and client side. However, a server written like this can only handle one client. This is fine for many applications, but I wanted to create a server capable of handling several clients at the same time. Therefore I created a class in the server project that represents the clients. A new instance of these will be created for each client that connects to the server.</p>
<pre>
	private LinkedList&lt;Client&gt; clients = new LinkedList&lt;Client&gt;();

	...

	private void HandleNewClient(Socket newSocket) {
		clients.addLast(new Client(newSocket));		//Add a new client to the list
	}
</pre>
<p>Each instance of the Client class spawns a thread listening for messages from the client program, and handles them by itself.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/knut80.wordpress.com/193/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/knut80.wordpress.com/193/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/knut80.wordpress.com/193/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/knut80.wordpress.com/193/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/knut80.wordpress.com/193/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/knut80.wordpress.com/193/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/knut80.wordpress.com/193/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/knut80.wordpress.com/193/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/knut80.wordpress.com/193/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/knut80.wordpress.com/193/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/knut80.wordpress.com/193/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/knut80.wordpress.com/193/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/knut80.wordpress.com/193/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/knut80.wordpress.com/193/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=knut80.wordpress.com&amp;blog=6800080&amp;post=193&amp;subd=knut80&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://knut80.wordpress.com/2009/08/28/creating-a-server-client-application-in-java/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/6baa331c6911af110bb7a77450dc4662?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">knut80</media:title>
		</media:content>
	</item>
		<item>
		<title>Generating random terrain</title>
		<link>http://knut80.wordpress.com/2009/06/26/generating-random-terrain/</link>
		<comments>http://knut80.wordpress.com/2009/06/26/generating-random-terrain/#comments</comments>
		<pubDate>Fri, 26 Jun 2009 20:35:48 +0000</pubDate>
		<dc:creator>Knut Erik</dc:creator>
				<category><![CDATA[Terrain engine]]></category>
		<category><![CDATA[c++]]></category>
		<category><![CDATA[graphics]]></category>
		<category><![CDATA[OpenGL]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[Terrain]]></category>

		<guid isPermaLink="false">http://knut80.wordpress.com/?p=181</guid>
		<description><![CDATA[I have implemented a random terrain generator, and after some tweaking it, it produces pretty good results. I can seed the generator as I wish, and get the same result every time, or use some other value like the system time to get a new terrain every time. Also, the artifacts from the previous post [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=knut80.wordpress.com&amp;blog=6800080&amp;post=181&amp;subd=knut80&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I have implemented a random terrain generator, and after some tweaking it, it produces pretty good results.</p>
<div id="attachment_182" class="wp-caption aligncenter" style="width: 460px"><img class="size-full wp-image-182" title="randomgenerated1" src="http://knut80.files.wordpress.com/2009/06/randomgenerated1.png?w=450&#038;h=240" alt="Randomly generated terrain" width="450" height="240" /><p class="wp-caption-text">Randomly generated terrain</p></div>
<p>I can seed the generator as I wish, and get the same result every time, or use some other value like the system time to get a new terrain every time.</p>
<div id="attachment_183" class="wp-caption aligncenter" style="width: 460px"><img class="size-full wp-image-183" title="randomgenerated2" src="http://knut80.files.wordpress.com/2009/06/randomgenerated2.png?w=450&#038;h=270" alt="Another view" width="450" height="270" /><p class="wp-caption-text">Another view</p></div>
<div id="attachment_184" class="wp-caption aligncenter" style="width: 460px"><img class="size-full wp-image-184" title="randomgenerated3" src="http://knut80.files.wordpress.com/2009/06/randomgenerated3.png?w=450&#038;h=286" alt="Another view" width="450" height="286" /><p class="wp-caption-text">Another view of the terrain</p></div>
<p>Also, the artifacts from the previous post have been eliminated.:) The light is working as I want it now.</p>
<div id="attachment_185" class="wp-caption aligncenter" style="width: 460px"><img class="size-full wp-image-185" title="randomgenerated4" src="http://knut80.files.wordpress.com/2009/06/randomgenerated4.png?w=450&#038;h=303" alt="Light model working" width="450" height="303" /><p class="wp-caption-text">Light model working</p></div>
<p>The lighting is nice, but it doesn&#8217;t do shadows. At least not yet. That will be the next focus for me.</p>
<p>-Knut</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/knut80.wordpress.com/181/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/knut80.wordpress.com/181/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/knut80.wordpress.com/181/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/knut80.wordpress.com/181/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/knut80.wordpress.com/181/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/knut80.wordpress.com/181/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/knut80.wordpress.com/181/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/knut80.wordpress.com/181/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/knut80.wordpress.com/181/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/knut80.wordpress.com/181/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/knut80.wordpress.com/181/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/knut80.wordpress.com/181/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/knut80.wordpress.com/181/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/knut80.wordpress.com/181/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=knut80.wordpress.com&amp;blog=6800080&amp;post=181&amp;subd=knut80&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://knut80.wordpress.com/2009/06/26/generating-random-terrain/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/6baa331c6911af110bb7a77450dc4662?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">knut80</media:title>
		</media:content>

		<media:content url="http://knut80.files.wordpress.com/2009/06/randomgenerated1.png" medium="image">
			<media:title type="html">randomgenerated1</media:title>
		</media:content>

		<media:content url="http://knut80.files.wordpress.com/2009/06/randomgenerated2.png" medium="image">
			<media:title type="html">randomgenerated2</media:title>
		</media:content>

		<media:content url="http://knut80.files.wordpress.com/2009/06/randomgenerated3.png" medium="image">
			<media:title type="html">randomgenerated3</media:title>
		</media:content>

		<media:content url="http://knut80.files.wordpress.com/2009/06/randomgenerated4.png" medium="image">
			<media:title type="html">randomgenerated4</media:title>
		</media:content>
	</item>
		<item>
		<title>Adding light part 2</title>
		<link>http://knut80.wordpress.com/2009/06/20/adding-light-part-2/</link>
		<comments>http://knut80.wordpress.com/2009/06/20/adding-light-part-2/#comments</comments>
		<pubDate>Sat, 20 Jun 2009 18:35:58 +0000</pubDate>
		<dc:creator>Knut Erik</dc:creator>
				<category><![CDATA[Terrain engine]]></category>
		<category><![CDATA[c++]]></category>
		<category><![CDATA[graphics]]></category>
		<category><![CDATA[OpenGL]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[Terrain]]></category>
		<category><![CDATA[texture]]></category>

		<guid isPermaLink="false">http://knut80.wordpress.com/?p=176</guid>
		<description><![CDATA[I&#8217;ve changed the way the program calculates the light level on the textures, so it should be more realistic. The sun&#8217;s position is configurable, and is used to shade one side of a hill, while the other one will be bright. The sun would on the left side of this picture, you can see a [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=knut80.wordpress.com&amp;blog=6800080&amp;post=176&amp;subd=knut80&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve changed the way the program calculates the light level on the textures, so it should be more realistic. The sun&#8217;s position is configurable, and is used to shade one side of a hill, while the other one will be bright.</p>
<div id="attachment_177" class="wp-caption aligncenter" style="width: 460px"><img class="size-full wp-image-177" title="light4" src="http://knut80.files.wordpress.com/2009/06/light4.png?w=450&#038;h=337" alt="Better light model" width="450" height="337" /><p class="wp-caption-text">Better light model</p></div>
<p>The sun would on the left side of this picture, you can see a small valley in the middle with a hill behind it. Notice the difference in light levels between the right and left sides of the valley and hill. This is actually looking very nice. <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<div id="attachment_178" class="wp-caption aligncenter" style="width: 460px"><img class="size-full wp-image-178" title="light5" src="http://knut80.files.wordpress.com/2009/06/light5.png?w=450&#038;h=337" alt="From above" width="450" height="337" /><p class="wp-caption-text">From above</p></div>
<p>Same valley, seen from above. The walls are about the same steepness. However, there are a few problems and limitations. Firstly, the sun&#8217;s position can only be specified in the east-west range. This is not much of a problem, and is easily corrected if necessary. Secondly, there are no shadows yet, but I plan to add support for this. And thirdly, there are these artifacts here on the textures:</p>
<div id="attachment_179" class="wp-caption aligncenter" style="width: 460px"><img class="size-full wp-image-179" title="light6" src="http://knut80.files.wordpress.com/2009/06/light6.png?w=450&#038;h=337" alt="Artifacts on the terrain" width="450" height="337" /><p class="wp-caption-text">Artifacts on the terrain</p></div>
<p>See those lines there. They are everywhere. Actually, they appeared when I implemented the texture splatting as well, but then I managed to work around them, for the most part. But now, I have a plan to get rid of them. The problem is, the height map has integer values. So on many slopes the steepness map will be like a stair instead of a smooth slope. To counter this, I think I need to create a random terrain generator.</p>
<p>I&#8217;ve been searching around a bit, and I want too implement a fractal generator for the terrain, preferably in a way that allow me to feed it a number to generate a terrain from(seed), or use an random one. Hopefully this will get me smooth slopes as well as interesting terrain, and i hope to complete this as soon as possible.</p>
<p>-Knut</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/knut80.wordpress.com/176/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/knut80.wordpress.com/176/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/knut80.wordpress.com/176/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/knut80.wordpress.com/176/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/knut80.wordpress.com/176/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/knut80.wordpress.com/176/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/knut80.wordpress.com/176/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/knut80.wordpress.com/176/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/knut80.wordpress.com/176/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/knut80.wordpress.com/176/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/knut80.wordpress.com/176/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/knut80.wordpress.com/176/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/knut80.wordpress.com/176/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/knut80.wordpress.com/176/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=knut80.wordpress.com&amp;blog=6800080&amp;post=176&amp;subd=knut80&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://knut80.wordpress.com/2009/06/20/adding-light-part-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/6baa331c6911af110bb7a77450dc4662?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">knut80</media:title>
		</media:content>

		<media:content url="http://knut80.files.wordpress.com/2009/06/light4.png" medium="image">
			<media:title type="html">light4</media:title>
		</media:content>

		<media:content url="http://knut80.files.wordpress.com/2009/06/light5.png" medium="image">
			<media:title type="html">light5</media:title>
		</media:content>

		<media:content url="http://knut80.files.wordpress.com/2009/06/light6.png" medium="image">
			<media:title type="html">light6</media:title>
		</media:content>
	</item>
		<item>
		<title>Adding light to the terrain</title>
		<link>http://knut80.wordpress.com/2009/06/07/adding-light-to-the-terrain/</link>
		<comments>http://knut80.wordpress.com/2009/06/07/adding-light-to-the-terrain/#comments</comments>
		<pubDate>Sun, 07 Jun 2009 18:25:16 +0000</pubDate>
		<dc:creator>Knut Erik</dc:creator>
				<category><![CDATA[Terrain engine]]></category>
		<category><![CDATA[c++]]></category>
		<category><![CDATA[graphics]]></category>
		<category><![CDATA[OpenGL]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[Terrain]]></category>
		<category><![CDATA[texture]]></category>

		<guid isPermaLink="false">http://knut80.wordpress.com/?p=170</guid>
		<description><![CDATA[I wanted to add lighting to the terrain engine, but I did not want to use OpenGL&#8217;s implementation, instead I wanted to create my own. So I added a light map to the terrain data, and set the program to modify the pixels when creating the textures. Then I added a very simple algorithm to [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=knut80.wordpress.com&amp;blog=6800080&amp;post=170&amp;subd=knut80&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I wanted to add lighting to the terrain engine, but I did not want to use OpenGL&#8217;s implementation, instead I wanted to create my own. So I added a light map to the terrain data, and set the program to modify the pixels when creating the textures. Then I added a very simple algorithm to fill it with some interesting data; I just use the height map so that hight pixels will be bright, and low pixels will be dark. The result is better than I hoped for:</p>
<div id="attachment_171" class="wp-caption aligncenter" style="width: 460px"><img class="size-full wp-image-171" title="light1" src="http://knut80.files.wordpress.com/2009/06/light1.png?w=450&#038;h=192" alt="With light" width="450" height="192" /><p class="wp-caption-text">With light</p></div>
<p>Even with this very simple light scheme, the terrain looks a lot better <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  It looks even better when moving the camera around. This was a lot easier to add than I expected. Here is another angle:</p>
<div id="attachment_172" class="wp-caption aligncenter" style="width: 460px"><img class="size-full wp-image-172" title="light2" src="http://knut80.files.wordpress.com/2009/06/light2.png?w=450&#038;h=191" alt="Another angle" width="450" height="191" /><p class="wp-caption-text">Another angle</p></div>
<p>But as you can see, the deep valleys are where the simple scheme falls through. The terrain is just too dark.</p>
<div id="attachment_173" class="wp-caption aligncenter" style="width: 460px"><img class="size-full wp-image-173" title="light3" src="http://knut80.files.wordpress.com/2009/06/light3.png?w=450&#038;h=337" alt="Dark valley" width="450" height="337" /><p class="wp-caption-text">Dark valley</p></div>
<p>I need to change the lighting scheme to use normals compared to a artificial sun. I will also add some minimum amount of light, to simulate ambient light. Hopefully this will not be too difficult. <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>-Knut</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/knut80.wordpress.com/170/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/knut80.wordpress.com/170/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/knut80.wordpress.com/170/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/knut80.wordpress.com/170/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/knut80.wordpress.com/170/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/knut80.wordpress.com/170/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/knut80.wordpress.com/170/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/knut80.wordpress.com/170/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/knut80.wordpress.com/170/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/knut80.wordpress.com/170/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/knut80.wordpress.com/170/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/knut80.wordpress.com/170/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/knut80.wordpress.com/170/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/knut80.wordpress.com/170/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=knut80.wordpress.com&amp;blog=6800080&amp;post=170&amp;subd=knut80&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://knut80.wordpress.com/2009/06/07/adding-light-to-the-terrain/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/6baa331c6911af110bb7a77450dc4662?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">knut80</media:title>
		</media:content>

		<media:content url="http://knut80.files.wordpress.com/2009/06/light1.png" medium="image">
			<media:title type="html">light1</media:title>
		</media:content>

		<media:content url="http://knut80.files.wordpress.com/2009/06/light2.png" medium="image">
			<media:title type="html">light2</media:title>
		</media:content>

		<media:content url="http://knut80.files.wordpress.com/2009/06/light3.png" medium="image">
			<media:title type="html">light3</media:title>
		</media:content>
	</item>
	</channel>
</rss>
