<?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>MHGames &#187; programming</title> <atom:link href="http://www.mhgames.org/tag/programming/feed/" rel="self" type="application/rss+xml" /><link>http://www.mhgames.org</link> <description>Games by Mika Halttunen.</description> <lastBuildDate>Mon, 30 Aug 2010 12:05:07 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.0.1</generator> <item><title>iPhone 4 testers wanted</title><link>http://www.mhgames.org/2010/08/iphone-4-testers-wanted/</link> <comments>http://www.mhgames.org/2010/08/iphone-4-testers-wanted/#comments</comments> <pubDate>Fri, 13 Aug 2010 08:52:29 +0000</pubDate> <dc:creator>Mika</dc:creator> <category><![CDATA[Development]]></category> <category><![CDATA[Games]]></category> <category><![CDATA[iphone]]></category> <category><![CDATA[jewels]]></category> <category><![CDATA[programming]]></category><guid
isPermaLink="false">http://www.mhgames.org/?p=437</guid> <description><![CDATA[Do you have a brand new iPhone 4? I&#8217;m looking for a couple of people to help testing Jewels for iPhone on the actual iPhone 4 device. I have been working on to make sure that Jewels works also in the iPhone 4 resolution (and yes, I have crisp, pixel perfect high resolution graphics included, [...]]]></description> <content:encoded><![CDATA[<p>Do you have a brand new <strong>iPhone 4</strong>? I&#8217;m looking for a couple of people to help testing <strong>Jewels for iPhone</strong> on the actual iPhone 4 device. I have been working on to make sure that Jewels works also in the iPhone 4 resolution (and yes, I have crisp, pixel perfect high resolution graphics included, as well! <img
src='http://www.mhgames.org/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> ) and while I can test in the simulator just fine, I&#8217;m interested in how the game performs on the real device. I think it should run about 50-60 fps (hopefully the max), but it is possible that the high res graphics bring it down, which means more optimizing work for myself.. <img
src='http://www.mhgames.org/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /></p><p>Unfortunately, I think the testers will need to be in the <strong>iPhone Developer Program</strong> to be able to install the game on their devices. (Correct me if I&#8217;m wrong!) But it doesn&#8217;t hurt to ask, right? So, any iPhone devs willing to test it for me? Drop me a comment if you&#8217;re interested. If not, I could try to find people on some dev forums. I do have my own iPhone 4 ordered as well, but I&#8217;m unsure if I get it before the game is finished.. <img
src='http://www.mhgames.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /></p><p><strong>UPDATE:</strong> I did get my own phone, so there is no need for this anymore. <img
src='http://www.mhgames.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> It worked quite well, I had to optimize text rendering though. Now it works pretty much 60 fps all the time. The optimizations also benefit older devices (except 3GS, which was running at 60 fps already) so it was time well spent. <img
src='http://www.mhgames.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /></p> ]]></content:encoded> <wfw:commentRss>http://www.mhgames.org/2010/08/iphone-4-testers-wanted/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Turned out I lied&#8230;</title><link>http://www.mhgames.org/2010/07/turned-out-i-lied/</link> <comments>http://www.mhgames.org/2010/07/turned-out-i-lied/#comments</comments> <pubDate>Wed, 14 Jul 2010 10:53:34 +0000</pubDate> <dc:creator>Mika</dc:creator> <category><![CDATA[Development]]></category> <category><![CDATA[Games]]></category> <category><![CDATA[News]]></category> <category><![CDATA[iphone]]></category> <category><![CDATA[jewels]]></category> <category><![CDATA[programming]]></category><guid
isPermaLink="false">http://www.mhgames.org/?p=418</guid> <description><![CDATA[..about making the final post about Jewels. Sorry! I wanted announce that I&#8217;ve managed to start working on bringing Jewels to the iDevices (at least for iPhone + iPod touch), even with the taking-care-of-the-baby-business! I&#8217;ve only recently started writing it from the grounds up in C++ with some Objective-C (or actually Objective-C++). (If anybody remembers, [...]]]></description> <content:encoded><![CDATA[<p><a
href="http://www.mhgames.org/wp-content/uploads/jewels_iphone_firstshot1.png"><img
class="alignright size-medium wp-image-433" title="First screenshot of Jewels for iPhone.." src="http://www.mhgames.org/wp-content/uploads/jewels_iphone_firstshot1-141x300.png" alt="" width="141" height="300" /></a>..about making the final post about <strong>Jewels</strong>. Sorry!</p><p>I wanted announce that I&#8217;ve managed to start working on bringing <em>Jewels to the iDevices</em> (at least for <strong>iPhone</strong> + <strong>iPod touch</strong>), even with the taking-care-of-the-baby-business! <img
src='http://www.mhgames.org/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> I&#8217;ve only recently started writing it from the grounds up in <strong>C++</strong> with some <strong>Objective-C</strong> (or actually <strong>Objective-C++</strong>). (If anybody remembers, the original PC-Jewels is written in <strong>C#/XNA</strong>, while the Android-version is naturally in <strong>Java</strong>.)</p><p>This time I&#8217;ll be using <strong>OpenGL ES</strong> (which, in retrospect, I should have used for the Android-version as well), so iPhone gamers will be getting the smoothest Jewels experience yet! I might even throw in some extra eye candy, just for the heck of it! <img
src='http://www.mhgames.org/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /></p><p>I&#8217;ve registered to the iPhone developer program, so I can test on the real devices, which is great. I&#8217;m aiming on making the game run perfectly on iPhone 3GS (and newer devices) hardware while still keeping it working fairly well on the older HW (like iPhone 3G). These are of course still only estimates, but something of a goal nevertheless. I&#8217;m liking the iPhone SDK so far, and even Objective-C isn&#8217;t as scary as it looked like before! <img
src='http://www.mhgames.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> But as I said, the majority of the code will be in C++. This actually makes a full circle: I had been using C++ for years before I made a switch to Java, and now I&#8217;m back in C++ along with learning Objective-C as well! Neat how things turn out.</p><p>As to why I&#8217;m doing Jewels again (for the third time!), instead of doing something else. Well, it has become a pattern of some sorts for me; while learning a new platform / language / API, I&#8217;ve ported Jewels over. The original was simply because I wanted to try coding with XNA. Android-version sprung out from the desire of learning to write for Android. It was a better game as well. And now it is iPhone. I&#8217;m learning new stuff and I firmly believe that this will be (again) the best Jewels yet! <img
src='http://www.mhgames.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /></p><p>Oh, I also noticed (only a few days ago) that there is already a game named JEWELS at the <strong>App Store</strong>! Just my luck. <img
src='http://www.mhgames.org/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> Any ideas for the name? I think I&#8217;ll have to go with <strong>iJewels</strong> or something like that, which I really didn&#8217;t want to do, but I guess there is no option but to change the name&#8230; <img
src='http://www.mhgames.org/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /></p><p>So there you have it. Hopefully iJewels (still don&#8217;t like that!) will gather some following on the iDevices &#8212; now I don&#8217;t expect it to be a mass hit like on Android, the competition is much tougher, but then again there is nothing to lose in doing the port (or rewrite, actually). I&#8217;m gaining some valuable code to reuse in future iPhone projects, even if the game was a flop. <img
src='http://www.mhgames.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /></p> ]]></content:encoded> <wfw:commentRss>http://www.mhgames.org/2010/07/turned-out-i-lied/feed/</wfw:commentRss> <slash:comments>8</slash:comments> </item> <item><title>Jewels for Android released!</title><link>http://www.mhgames.org/2009/11/jewels-for-android-released/</link> <comments>http://www.mhgames.org/2009/11/jewels-for-android-released/#comments</comments> <pubDate>Thu, 05 Nov 2009 16:24:20 +0000</pubDate> <dc:creator>Mika</dc:creator> <category><![CDATA[Development]]></category> <category><![CDATA[Games]]></category> <category><![CDATA[News]]></category> <category><![CDATA[android]]></category> <category><![CDATA[java]]></category> <category><![CDATA[jewels]]></category> <category><![CDATA[programming]]></category><guid
isPermaLink="false">http://www.mhgames.org/?p=368</guid> <description><![CDATA[Just wanted to announce that I&#8217;ve finished the Android port of Jewels. It is now available through the Android Market, for free. The comments so far have been very positive, thank you. I&#8217;ll probably release an update later with some fixes and tweaks, but after that I think it&#8217;s time to start thinking about the [...]]]></description> <content:encoded><![CDATA[<p
style="text-align: justify;"><a
href="http://www.mhgames.org/wp-content/uploads/JewelsAndroid.jpg"><img
class="alignright size-thumbnail wp-image-369" title="Jewels for Android" src="http://www.mhgames.org/wp-content/uploads/JewelsAndroid-100x150.jpg" alt="Jewels for Android" width="100" height="150" /></a>Just wanted to announce that I&#8217;ve finished the <strong>Android</strong> port of <strong>Jewels</strong>. It is now available through the Android Market, for free. <img
src='http://www.mhgames.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> The comments so far have been very positive, thank you. I&#8217;ll probably release an update later with some fixes and tweaks, but after that I think it&#8217;s time to start thinking about the next project.</p><p
style="text-align: justify;">I&#8217;ll write something about the porting experience from programmers point of view later; it definitely has been interesting as I have not done any mobile coding before this.</p><h3 style="text-align: justify;">UPDATE on 13th of November:</h3><p
style="text-align: justify;">Now that Jewels has been on the Market for a week, I&#8217;d like to share some statistics with you. Turned out that the game is a huge success (ok, it&#8217;s mainly because it&#8217;s <em>Bewejeled</em>, but interesting still), I had not anticipated this at all! At first I thought it&#8217;d break 5000 downloads before the last weekend (the game was released on Thursday). It did, Sunday the downloads were over 16 000. On Monday, it was over 32 000. And now, it&#8217;s over <strong>100 000 installs</strong>, 92% of them active (i.e. still on users&#8217; phones)!</p><p
style="text-align: justify;">Jewels is actually the second most popular (free) game in the Market right now with a average rating of 4.5 stars (596 ratings at the moment), only behind a Solitaire-game. Very nice. <img
src='http://www.mhgames.org/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> I&#8217;ve actually gotten more comments about Android-Jewels in a week, than I have from all my previous games combined during all these years, wow! So there&#8217;s definately market for good Android-games. I&#8217;m planning to make something a bit more original next,  so stay tuned.</p><p
style="text-align: justify;">Of course, it&#8217;s not all roses: I&#8217;ve released about a dozen updates but still there remains some mysterious bugs that don&#8217;t occur in most of the phones, but do in some.. Partly that is because Jewels was not originally writting  for phones (XNA as an environment is way simpler than Android!), and partly because I&#8217;ve probably screwed up something (my first Android app, after all). I will definitely try to design the next game to more solid and not so prone to these various bugs and crashes. But one thing bugs me: the Anroid phones are truly different from each other, although in theory the same code should work in most of them, in reality it won&#8217;t.. I&#8217;ve seeing reports of some really weird crashes that really should not be happening. <img
src='http://www.mhgames.org/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /></p> ]]></content:encoded> <wfw:commentRss>http://www.mhgames.org/2009/11/jewels-for-android-released/feed/</wfw:commentRss> <slash:comments>23</slash:comments> </item> <item><title>Enter the Android</title><link>http://www.mhgames.org/2009/10/enter-the-android/</link> <comments>http://www.mhgames.org/2009/10/enter-the-android/#comments</comments> <pubDate>Sun, 11 Oct 2009 18:53:43 +0000</pubDate> <dc:creator>Mika</dc:creator> <category><![CDATA[Development]]></category> <category><![CDATA[Personal]]></category> <category><![CDATA[android]]></category> <category><![CDATA[java]]></category> <category><![CDATA[jewels]]></category> <category><![CDATA[programming]]></category><guid
isPermaLink="false">http://www.mhgames.org/?p=361</guid> <description><![CDATA[Hi, everybody! (&#8220;Hi, doctor Nick!&#8221; &#8230;sorry.) Little background on today&#8217;s topic: When I first heard of the Google Android-platform some years back, I thought it was interesting but never actually expected to see proper devices (i.e. mobile phones) coming to reality. Now that there is several Android phones from a few manufacturers, I&#8217;ve been eyeing [...]]]></description> <content:encoded><![CDATA[<p><img
class="alignright size-full wp-image-362" title="Android logo" src="http://www.mhgames.org/wp-content/uploads/androidlogo.png" alt="Android logo" width="125" height="125" /></p><p
style="text-align: justify;">Hi, everybody! <small>(&#8220;Hi, doctor Nick!&#8221; &#8230;sorry.)</small></p><p
style="text-align: justify;">Little background on today&#8217;s topic: When I first heard of the <a
href="http://www.android.com/">Google Android</a>-platform some years back, I thought it was interesting but never actually expected to see proper devices (i.e. mobile phones) coming to reality. Now that there is several <strong>Android</strong> phones from a few manufacturers, I&#8217;ve been eyeing out the devices with great interest for a while now, I guess closer to a year actually. Waiting for them to arrive here in Finland. And, as you might have guessed already, they have arrived. <img
src='http://www.mhgames.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /></p><h2>The Hero emerges..</h2><p
style="text-align: justify;">So, I got myself a brand new <a
href="http://www.htc.com/europe/product/hero/overview.html"><strong>HTC Hero</strong></a>! Obviously, the main interest for me was the prospect of developing software (ok, games) for the Android-platform. Also, it&#8217;s darn good phone as well, who would have thought of it? <img
src='http://www.mhgames.org/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> My previous phone was a few years old Nokia, just a basic model with no bells and/or whistles — so this is all new to me.</p><p><a
href="http://www.mhgames.org/wp-content/uploads/htchero.jpg"><img
class="aligncenter size-medium wp-image-364" title="My HTC Hero." src="http://www.mhgames.org/wp-content/uploads/htchero-300x286.jpg" alt="My HTC Hero." width="300" height="286" /></a></p><p
style="text-align: justify;">Why not <strong>iPhone</strong>, then? Well, there are several reasons I went with Android:</p><ol
style="text-align: justify;"><li>The development environment. It&#8217;s free, cross-platform and well integrated into Eclipse. Plus I get to write in <strong>Java</strong>, which I very much prefer over <strong>Objective-C</strong>.</li><li>I don&#8217;t need a freaking <strong>Mac</strong> for developing (as if the phone wasn&#8217;t expensive enough..)! I can use my old, cruddy PC instead.  <img
src='http://www.mhgames.org/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /></li><li
style="text-align: justify;"><strong>Android Market</strong>, while still in its early stages, has great potential. Plus not nearly as much competition as in the iPhones <strong>App Store</strong> (obviously this also means less customers, but things improve when Android-phones gain more market, I hope).</li></ol><p><span
id="more-361"></span></p><h2 style="text-align: justify;">Developing for Android</h2><p
style="text-align: justify;">What this all means, is that I will be making some Android-games in the future. To get myself familiar with the new platform, I chose to port <a
href="http://www.mhgames.org/jewels"><strong>Jewels</strong></a> over to Android. It&#8217;s still in very early stages, as I really started working on it only yesterday. It remains to be seen if the standard software accelerated 2d <strong>Canvas API</strong> is fast enough for my purposes (should be for <em>Jewels</em>), or if I have to go over the <strong>OpenGL ES</strong> route. If / when I get it completed, I plan on making it available through the Android Market, for free. Actually, at this time it is not even possible to submit paid apps to the Market from Finland, nor it is possible to purchase apps. Hopefully Finland gets the full Market support in the coming months. <img
src='http://www.mhgames.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /></p><p
style="text-align: justify;">After Jewels, anybody up for <strong>Steroids³</strong>? <img
src='http://www.mhgames.org/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> Just wondering.</p> ]]></content:encoded> <wfw:commentRss>http://www.mhgames.org/2009/10/enter-the-android/feed/</wfw:commentRss> <slash:comments>1</slash:comments> </item> <item><title>Geez, it&#8217;s been a while&#8230;</title><link>http://www.mhgames.org/2009/07/geez-its-been-a-while/</link> <comments>http://www.mhgames.org/2009/07/geez-its-been-a-while/#comments</comments> <pubDate>Sun, 05 Jul 2009 08:59:00 +0000</pubDate> <dc:creator>Mika</dc:creator> <category><![CDATA[Development]]></category> <category><![CDATA[java]]></category> <category><![CDATA[programming]]></category> <category><![CDATA[random]]></category><guid
isPermaLink="false">http://www.mhgames.org/2009/07/geez-its-been-a-while/</guid> <description><![CDATA[Time for an update, I reckon. Although PolyAnim is generally on hold due to the game project, I made a few optimizations (reducing garbage generation mostly, still quite high though) to it. As for the game, I&#8217;m still working on the engine side &#8212; BUT &#8212; I&#8217;ve written down some things on the game plot [...]]]></description> <content:encoded><![CDATA[<p>Time for an update, I reckon.</p><p
style="text-align: justify;">Although <span
style="font-weight: bold;">PolyAnim</span> is generally on hold due to the game project, I made a few optimizations (reducing garbage generation mostly, still quite high though) to it. As for the game, I&#8217;m still working on the engine side &#8212; BUT &#8212; I&#8217;ve written down some things on the game plot and other design! I have a vision of the game beginning, but the actual plot still needs to be thought up. Sooo yes, I don&#8217;t have much at all, but it&#8217;s a start. <span
style="font-weight: bold;"> <img
src='http://www.mhgames.org/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </span>Luckily I don&#8217;t have too much pressures on the story side, as even if it ends up sucking donkey balls (excuse my language), it&#8217;s still infinitely better than the &#8220;stories&#8221; of my previous games combined! <span
style="font-weight: bold;"> <img
src='http://www.mhgames.org/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </span></p><h2>Meanwhile, in the programming land&#8230;</h2><p
style="text-align: justify;">It&#8217;s been so long since my last update, I&#8217;ve worked on so many things I don&#8217;t even remember them all. Instead of trying to remember the details, I&#8217;ll just list the things I do remember:</p><ul
style="text-align: justify;"><li>First of all, I started using <span
style="font-style: italic;">revision control</span> for the source code (+ related resources). Instead of using the familiar <span
style="font-weight: bold;">Subversion</span>, I decided to try something new and thus chose <span
style="font-weight: bold;"><a
href="http://en.wikipedia.org/wiki/Git_%28software%29">Git</a>.</span> All in all, this helps me keeping track of the things I do and also serves as a backup in case my computer decides to blow up. Git is nice since you can use it locally, on any directory without a server.</li><li><span
style="font-style: italic;">VBO (</span><a
style="font-style: italic;" href="http://en.wikipedia.org/wiki/Vertex_Buffer_Object">Vertex Buffer Object</a><span
style="font-style: italic;">) support</span>. This means storing geometry to the GPU and rendering it in one batch. Basically it means better performance. Using VBOs I could optimize the text rendering by buffering the rendered glyphs into a batch, up until the buffer fills up (or the texture changes). The buffered glyphs are rendered in one go, and the process starts again.</li><li><span
style="font-style: italic;">Particle systems!</span> I started doing a &#8220;particle engine&#8221; a while back, got it done except for the different emitters. I still need to finish this up: complete the basic point emitter, add more emitters and add the ability to load particle systems from resources (perhaps a <a
href="http://en.wikipedia.org/wiki/Yaml">YAML</a> or XML file). VBOs are used to render the systems, when supported by the GPU.</li><li><span
style="font-style: italic;">Lighting system improvements</span>. Lights can now have different effects on them, like flickering, fading and pulsating. The effects are defined in a YAML file of properties.</li><li><span
style="font-style: italic;">Player character designs</span>. I&#8217;m not sure if this guy ends up being the final character, but might be. I did a quick idle animation for him (need to adjust that a bit, though), I should add a walk cycle next as it&#8217;s quite boring to watch now. (The previous animation, test from PolyAnim, did walk!)</li><li>And now for something completely different: <span
style="font-style: italic;">Water effects.</span> Yes. This is mostly eye candy (as Box2D doesn&#8217;t support buoyancy yet, I think the water is only going to be used for restricting player movements as in the player can&#8217;t swim..) so it made no sense to do it at this phase of development. But I did it anyway, I&#8217;m childish like that.. <span
style="font-weight: bold;"> <img
src='http://www.mhgames.org/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> </span> The water reflects the scenery above (provided the GPU supports Render-to-texture) and I even wrote a fragment shader to make it all wavy and twirling..</li></ul><p
style="text-align: justify;">I have noticed a problem during the development of this game, which was not apparent on my previous game projects (since they were much shorter): I have this annoying tendency to start working on different (sub)projects even when the previous stuff is still not finished. That means I have heaps of unfinished subsystems in this engine, like the particles, scripting, triggers, etc. And I&#8217;m already thinking of doing the sprite system and other things as well! I mean, what the hell, it should be bloody obvious I should concentrate on the unfinished things and finish them.. <span
style="font-weight: bold;"> <img
src='http://www.mhgames.org/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> </span> Argh, hopefully I can sort this mess out. Speaking of which, I guess I should start coding the particle system to an usable state.</p><p
style="text-align: justify;">And of course, to all aspiring game developers: <em>design the game first</em>, damnit! Figure out the plot, setting, characters and whatnot <span
style="font-weight: bold;">BEFORE</span> getting sucked in the bottomless fathoms of <span
style="font-weight: bold;">Teh Engine(tm)</span>! Yes, I really should take my own advice some day! <span
style="font-weight: bold;"> <img
src='http://www.mhgames.org/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> </span></p> ]]></content:encoded> <wfw:commentRss>http://www.mhgames.org/2009/07/geez-its-been-a-while/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>More progress: Quad trees</title><link>http://www.mhgames.org/2009/04/more-progress-quad-trees/</link> <comments>http://www.mhgames.org/2009/04/more-progress-quad-trees/#comments</comments> <pubDate>Mon, 27 Apr 2009 16:52:00 +0000</pubDate> <dc:creator>Mika</dc:creator> <category><![CDATA[Development]]></category> <category><![CDATA[java]]></category> <category><![CDATA[programming]]></category><guid
isPermaLink="false">http://www.mhgames.org/2009/04/more-progress-quad-trees/</guid> <description><![CDATA[Today&#8217;s subject: quad trees. Here is a nice little tutorial on the subject. Until now I was using a naive method of rendering the level shapes (polygons and circles): I looped through them all, did a bounding box check* to see if they&#8217;re visible in camera, and rendered if they were. This works fine for [...]]]></description> <content:encoded><![CDATA[<p>Today&#8217;s subject: <span
style="font-weight: bold;">quad trees</span>. Here is a <a
href="http://www.kyleschouviller.com/wsuxna/quadtree-source-included/">nice little tutorial</a> on the subject.</p><p
style="text-align: justify;">Until now I was using a naive method of rendering the level shapes (polygons and circles): I looped through them all, did a bounding box check<span
style="font-weight: bold;">*</span> to see if they&#8217;re visible in camera, and rendered if they were. This works fine for small levels (and indeed for the current test level, although I keep adding more and more stuff to it &#8212; nevertheless it&#8217;s still quite modest in size), but for larger levels it can become a problem, especially on slower machines.</p><p
style="text-align: justify;">So I decided to add quad trees to speed up the level rendering process. The level shapes are stored in three different quad trees (one for collidables, one for background and one for foreground shapes). The trees are queried for visible objects, which then get rendered. Works nice and smooth, and the performance goes through the roof, right? Well&#8230; not quite.</p><p
style="text-align: justify;">Since the level shapes can have various opacities, it is important to render them exactly in the order that is specified during level creation (in the <span
style="font-style: italic;">Inkscape SVG</span> file). In the triangulation &amp; convex decomposition process the original shapes get split up. It was not a problem during the naive approach &#8212; the shape parts were in a list and the original order was preserved. Quad tree on the other hand doesn&#8217;t necessarily preserve that order, to my great disappointment. It makes sense of course,  I just hadn&#8217;t thought about it until I saw the effect: a few of the level shapes were rendered out of order.</p><p
style="text-align: justify;">At first I tried to come up with a way to partition the quad tree so that the order would stay correct, but that didn&#8217;t work too well. In the end I ended up just sorting the queried objects before rendering. That works perfectly, but introduces a new speed hit; the sort. So in all, the supposedly great speed increases of the mighty quad tree turned out to be only a modest gain, since I now need to sort the visible pieces.. Still, I&#8217;m confident that the quad trees were worth it, as the levels keep getting bigger and more complex it will surely show more greater effect. <span
style="font-weight: bold;"> <img
src='http://www.mhgames.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </span> And at least I found that enormous bug in the bounding box culling! <img
src='http://www.mhgames.org/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /></p><p
style="text-align: justify;">Check out a few debug screens below, quad trees are the white lines.</p><p
style="text-align: justify;"><span
style="font-size:85%;"><span
style="font-weight: bold;">*)</span> I actually found one of the most stupid bugs I&#8217;ve ever done in the bounding box check code. It was actually checking bounds from the world origin (0,0) to the object lower right corner, instead of from the object upper left to lower right! That means that the bounding boxes got very big and only the objects to right and down from the camera view were culled properly.. Ouch.</span></p><p
style="text-align: center;"><a
href="http://2.bp.blogspot.com/_idHQSV4cE3E/SfXhyL1KoXI/AAAAAAAAAFI/COfWeAXxOF4/s1600-h/quadtree3.png"><img
id="BLOGGER_PHOTO_ID_5329413986348343666" style="text-align: center; cursor: pointer; width: 200px; height: 158px;" src="http://2.bp.blogspot.com/_idHQSV4cE3E/SfXhyL1KoXI/AAAAAAAAAFI/COfWeAXxOF4/s200/quadtree3.png" border="0" alt="" /></a> <a
href="http://3.bp.blogspot.com/_idHQSV4cE3E/SfXhx6GMpKI/AAAAAAAAAFA/0yYVmjslcEs/s1600-h/quadtree2.png"><img
id="BLOGGER_PHOTO_ID_5329413981587940514" style="text-align: center; cursor: pointer; width: 200px; height: 158px;" src="http://3.bp.blogspot.com/_idHQSV4cE3E/SfXhx6GMpKI/AAAAAAAAAFA/0yYVmjslcEs/s200/quadtree2.png" border="0" alt="" /></a></p> ]]></content:encoded> <wfw:commentRss>http://www.mhgames.org/2009/04/more-progress-quad-trees/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Engine progressing slowly but not-so-steadily..</title><link>http://www.mhgames.org/2009/03/engine-progressing-slowly-but-not-so-steadily/</link> <comments>http://www.mhgames.org/2009/03/engine-progressing-slowly-but-not-so-steadily/#comments</comments> <pubDate>Sun, 29 Mar 2009 13:29:00 +0000</pubDate> <dc:creator>Mika</dc:creator> <category><![CDATA[Development]]></category> <category><![CDATA[java]]></category> <category><![CDATA[programming]]></category><guid
isPermaLink="false">http://www.mhgames.org/2009/03/engine-progressing-slowly-but-not-so-steadily/</guid> <description><![CDATA[Once again, I&#8217;ve been improving the platformer engine. I have done a lot of internal restructuring which isn&#8217;t directly visible on the screen. Remember, this project started as a quick hack testing JBox2D, so the oldest parts of the code were a total mess. Cleaning it up, I implemented modules, that the engine keeps processing. [...]]]></description> <content:encoded><![CDATA[<p
style="text-align: justify;"><a
href="http://4.bp.blogspot.com/_idHQSV4cE3E/Sc93SVlhLtI/AAAAAAAAAE4/ZwFV1QfA4w8/s1600-h/Kuvakaappaus-2.png"><img
id="BLOGGER_PHOTO_ID_5318600841863704274" style="margin: 0pt 0pt 10px 10px; float: right; cursor: pointer; width: 200px; height: 158px;" src="http://4.bp.blogspot.com/_idHQSV4cE3E/Sc93SVlhLtI/AAAAAAAAAE4/ZwFV1QfA4w8/s200/Kuvakaappaus-2.png" border="0" alt="" /></a>Once again, I&#8217;ve been improving the platformer engine. I have done a lot of internal restructuring which isn&#8217;t directly visible on the screen. Remember, this project started as a quick hack testing <span
style="font-weight: bold;">JBox2D</span>, so the oldest parts of the code were a total mess. Cleaning it up, I implemented modules, that the engine keeps processing. These modules (e.g. <span
style="font-family:courier new;">GameModule, MenuModule, OptionsMenuModule</span>) are basically separate states and can be ran separately of each other. They also support transitions, so a title screen could fade into the main menu, which could then roll off the screen presenting the actual game. Currently I have an initial loading screen that fades into the game. Yes, all this doesn&#8217;t sound very exciting (and in reality it isn&#8217;t), but it makes the code much more cleaner and modular. Hopefully, one my biggest pet peeves &#8212; which is writing the menus after the game is complete &#8212; will be a more pleasant experience with these module supports in place. <span
style="font-weight: bold;"> <img
src='http://www.mhgames.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </span> I still have some old physics related code there which needs some refactoring love, so there&#8217;s still work to be done..</p><p
style="text-align: justify;"><a
href="http://1.bp.blogspot.com/_idHQSV4cE3E/Sc93SQ_aN1I/AAAAAAAAAEw/-3Y6fGyCMYE/s1600-h/Kuvakaappaus-1.png"><img
id="BLOGGER_PHOTO_ID_5318600840630122322" style="margin: 0pt 0pt 10px 10px; float: right; cursor: pointer; width: 200px; height: 158px;" src="http://1.bp.blogspot.com/_idHQSV4cE3E/Sc93SQ_aN1I/AAAAAAAAAEw/-3Y6fGyCMYE/s200/Kuvakaappaus-1.png" border="0" alt="" /></a>I also did the different <span
style="font-style: italic;">rendering path</span> thing I was talking about earlier. The best rendering path allows for some neat shader effects, I did initial tests with a distortion shader &#8212; it was nice but  didn&#8217;t work with the bloom effect, something I hadn&#8217;t realised before. I guess I will need to implement somekind of a post processing subsystem, that does the bloom among other effects. Oh well. <span
style="font-weight: bold;"> <img
src='http://www.mhgames.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </span></p><p
style="text-align: justify;">Another thing I added is an ingame profiler. While extremely simple, it still presents some very useful data so I can see what part of the game takes most time at runtime. So far the slowest thing is the text rendering. Luckily that won&#8217;t be a problem, since I don&#8217;t plan having much text on screen in the game (apart from dialogue, but that can be prerendered into a texture). In the current demo I draw the yellow text with a nice shadowy border around it &#8212; that is a very brute force approach which just draws the same string a bunch of times. That&#8217;s very slow. Also the text rendering could probably be optimized more, should the need arise.</p><p
style="text-align: justify;"><a
href="http://2.bp.blogspot.com/_idHQSV4cE3E/Sc93R9c1LtI/AAAAAAAAAEo/h9jBdb6IkBM/s1600-h/Kuvakaappaus.png"><img
id="BLOGGER_PHOTO_ID_5318600835384815314" style="margin: 0pt 0pt 10px 10px; float: right; cursor: pointer; width: 200px; height: 158px;" src="http://2.bp.blogspot.com/_idHQSV4cE3E/Sc93R9c1LtI/AAAAAAAAAEo/h9jBdb6IkBM/s200/Kuvakaappaus.png" border="0" alt="" /></a>I&#8217;ve been also improving the controller support (yes, the game will support game pads! That&#8217;s the first time in my [released] games &#8212; better late than never, right! <span
style="font-weight: bold;"> <img
src='http://www.mhgames.org/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </span> ). The basic support was actually added months ago, I just forgot to mention about it earlier. It&#8217;s still pretty much unusable, since the buttons cannot be assigned: it just uses the first two buttons on the game pad. And that varies per model, a lot. On mine they&#8217;re positioned logigally, but on another pad they were almost unusable.. So the game needs a controller configuration screen, where the player can assign the actions to the preferred controller buttons. But that&#8217;s thinking way too much ahead, I need the game first! <span
style="font-weight: bold;"> <img
src='http://www.mhgames.org/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> </span></p><p
style="text-align: justify;">One more thing: I made a simple<span
style="font-style: italic;"> test release of the engine</span>, so that I could collect some data on how it works on different machines. (I mainly test it on two computers, which isn&#8217;t that much.) Head over to the <a
href="http://www.javagaming.org/index.php/topic,20159.0.html">JavaGaming.org</a> forums and take it for a spin! Hopefully somebody confirms it works on <span
style="font-weight: bold;">Mac OS X</span> as well.. <img
src='http://www.mhgames.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> <span
style="font-size:85%;"> [<span
style="font-weight: bold;">Update:</span> Yes it does!]</span> By the way, I will probably take the thing down in some time, since it&#8217;s still in very early stages and doesn&#8217;t have any gameplay in it anyways..</p><p
style="text-align: justify;">That is all this time, stay tuned for more! <span
style="font-weight: bold;">EDIT:</span> I just realised I had used this very same line to end the previous posting.. Am I really this unoriginal!? Apparently, yes. Yes I am.</p> ]]></content:encoded> <wfw:commentRss>http://www.mhgames.org/2009/03/engine-progressing-slowly-but-not-so-steadily/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Platformer progress</title><link>http://www.mhgames.org/2009/02/platformer-progress/</link> <comments>http://www.mhgames.org/2009/02/platformer-progress/#comments</comments> <pubDate>Tue, 10 Feb 2009 05:48:00 +0000</pubDate> <dc:creator>Mika</dc:creator> <category><![CDATA[Development]]></category> <category><![CDATA[java]]></category> <category><![CDATA[programming]]></category><guid
isPermaLink="false">http://www.mhgames.org/2009/02/platformer-progress/</guid> <description><![CDATA[After a long break I&#8217;ve started working on the platformer engine again. I&#8217;ve added a material system, where every level shape (i.e. polygon) has a material assigned to them, which defines the texture and physical properties (friction, restitution and density) for the shape. Later on this could be used to trigger different sounds or other [...]]]></description> <content:encoded><![CDATA[<p
style="text-align: justify;"><a
href="http://2.bp.blogspot.com/_idHQSV4cE3E/SZETswi7urI/AAAAAAAAAEI/rNRBis5zO_4/s1600-h/level1.png"><img
id="BLOGGER_PHOTO_ID_5301039896058378930" style="margin: 0pt 0pt 10px 10px; float: right; cursor: pointer; width: 200px; height: 150px;" src="http://2.bp.blogspot.com/_idHQSV4cE3E/SZETswi7urI/AAAAAAAAAEI/rNRBis5zO_4/s200/level1.png" border="0" alt="" /></a>After a long break I&#8217;ve started working on the platformer engine again. I&#8217;ve added a material system, where every level shape (i.e. polygon) has a material assigned to them, which defines the texture and physical properties (friction, restitution and density) for the shape. Later on this could be used to trigger different sounds or other effects based on where the player walks, for example.</p><p
style="text-align: justify;">I improved the lighting system to support rotating lights and finally enabled them to be placed to the level in <span
style="font-weight: bold;">Inkscape</span> (the lights were previously completely randomly generated). To test these new features, I abandoned the ugly mess of a test map I had been using from the start, and built my first &#8220;real&#8221; level. It&#8217;s not too detailed yet (and yes, ugly in some points too!) but at least it&#8217;s better than some random polygons. I do plan to expand it to test new features as they get implemented. Check out these screenshots to see the brand new level in action. <span
style="font-weight: bold;"> <img
src='http://www.mhgames.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </span> Disclaimer: All the textures etc. and even the whole style are temporary and not representative of the final game (if I manage to complete it some day), purely because I have not decided on the final style yet! I may opt for more stylished visuals, as in not using &#8220;realistic&#8221; (photograph based) textures, contrary to what you see in these images. But as I said, I&#8217;m not sure yet.<a
href="http://3.bp.blogspot.com/_idHQSV4cE3E/SZETtPUbi-I/AAAAAAAAAEQ/7VWcZW-XA1k/s1600-h/level2.png"><img
id="BLOGGER_PHOTO_ID_5301039904319048674" style="margin: 0pt 0pt 10px 10px; float: right; cursor: pointer; width: 200px; height: 150px;" src="http://3.bp.blogspot.com/_idHQSV4cE3E/SZETtPUbi-I/AAAAAAAAAEQ/7VWcZW-XA1k/s200/level2.png" border="0" alt="" /></a></p><p
style="text-align: justify;">Speaking of new features, I added support for &#8220;floor shapes&#8221; &#8211; shapes that act as a floor but not as a ceiling. That means you can stand on them but jump through them only from below. You can also drop down when needed. These things are so common in platformers, so I had to have them in. Unfortunately I had to restrict them to be straight horizontal lines &#8211; &#8220;floor lines&#8221; like I call them in the code &#8211; due to technical difficulties with the <span
style="font-weight: bold;">Box2D </span>physics. At first I tried doing this with Box2D sensors/contact listener but it seemed like a bad hack and would probably have not worked correctly in some cases, so I deemed it too much trouble and went for a simpler approach. My biggest gripe with Box2D <span
style="font-style: italic;">is</span> actually the contact listener, it&#8217;s somewhat hard to use it nicely..<br
/> <a
href="http://1.bp.blogspot.com/_idHQSV4cE3E/SZETtHd9EbI/AAAAAAAAAEY/BRMGlpE8mgo/s1600-h/level3.png"><img
id="BLOGGER_PHOTO_ID_5301039902211510706" style="margin: 0pt 0pt 10px 10px; float: right; cursor: pointer; width: 200px; height: 150px;" src="http://1.bp.blogspot.com/_idHQSV4cE3E/SZETtHd9EbI/AAAAAAAAAEY/BRMGlpE8mgo/s200/level3.png" border="0" alt="" /></a></p><p
style="text-align: justify;">One of the things I&#8217;ll start coding next is sprites, which will be used in several places: as normal level decoration, level decals, in the background and so forth. Currently everything you see is crafted from polygons, which is wasteful on the resources. In the current test level, at least the mailbox, arrow sign and mushrooms should be sprites.</p><p
style="text-align: justify;">That is all this time (got to run to the school soon.. <span
style="font-weight: bold;">:/</span>), stay tuned for more! <span
style="font-weight: bold;"> <img
src='http://www.mhgames.org/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </span></p> ]]></content:encoded> <wfw:commentRss>http://www.mhgames.org/2009/02/platformer-progress/feed/</wfw:commentRss> <slash:comments>2</slash:comments> </item> <item><title>Random things..</title><link>http://www.mhgames.org/2008/11/random-things/</link> <comments>http://www.mhgames.org/2008/11/random-things/#comments</comments> <pubDate>Tue, 18 Nov 2008 16:00:00 +0000</pubDate> <dc:creator>Mika</dc:creator> <category><![CDATA[Development]]></category> <category><![CDATA[java]]></category> <category><![CDATA[programming]]></category> <category><![CDATA[random]]></category><guid
isPermaLink="false">http://www.mhgames.org/2008/11/random-things/</guid> <description><![CDATA[Before getting carried away with the platformer rambling, again, here&#8217;s something about PolyAnim. Yesterday I added automatic polygon triangulation for concave polygons into PolyAnims LWJGL-renderer. This is mainly for convenience, since the triangulation is quite expensive &#8211; it remains to be seen if this is fast enough for more general use. At least with simpler [...]]]></description> <content:encoded><![CDATA[<p
style="text-align: justify;">Before getting carried away with the platformer rambling, again, here&#8217;s something about <a
href="http://polyanim.googlecode.com">PolyAnim</a>. Yesterday I added <span
style="font-style: italic;">automatic polygon triangulation</span> for concave polygons into <a
href="http://polyanim.googlecode.com/"></a>PolyAnims LWJGL-renderer. This is mainly for convenience, since the triangulation is quite expensive &#8211; it remains to be seen if this is fast enough for more general use. At least with simpler scenes it might work alright. Convex polygons should still be preferred for speed reasons, but I admit it: they&#8217;re major pain in the ass when animating. It&#8217;s cumbersome to build and animate non-convex shapes from several convex pieces.. Hopefully somebody will contribute faster triangulation code at some point! <span
style="font-weight: bold;"> <img
src='http://www.mhgames.org/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </span></p><p
style="text-align: justify;">What else.. I&#8217;ve been working a lot on the platformer engine. <a
href="http://www.box2d.org/">JBox2D</a> got an update, so I ditched the old polygonal approach (which had a lot of problems, as Box2D is very picky about the shape of the collision polygons) and implemented the collision geometry using the new feature: edge chains. They work nicely and are just perfect for this kind of usage. I use triangulation with convex decomposition now only for the renderer, which luckily doesn&#8217;t mind very thin triangles. I&#8217;ve added more eye candy as well, generation of level outlines and support for background/foreground polygons (which are not collidable, of course). I still need to implement other decoration elements, such as a stripe of grass blades running along top edge of things, for example. Parallax scrolling is something I want to have in too, I mean, if you&#8217;re making a side scroller, why shouldn&#8217;t there be parallax scrolling!?<span
style="font-weight: bold;"> <img
src='http://www.mhgames.org/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </span></p><p
style="text-align: justify;"><a
href="http://3.bp.blogspot.com/_idHQSV4cE3E/SSLmUoUoazI/AAAAAAAAAD0/wYIYy35spzE/s1600-h/pbuffers_fail.png"><img
id="BLOGGER_PHOTO_ID_5270027756072626994" style="margin: 0pt 0pt 10px 10px; float: right; cursor: pointer; width: 320px; height: 251px;" src="http://3.bp.blogspot.com/_idHQSV4cE3E/SSLmUoUoazI/AAAAAAAAAD0/wYIYy35spzE/s320/pbuffers_fail.png" border="0" alt="" /></a>And finally I did bite the bullet and implemented those damn PBuffers (enjoy the picture there, that&#8217;s them buffers giving me hard time!). They work okay when FBO is not available, but they&#8217;re yucky to code. Luckily LWJGL makes it a bit less painful than it truly is. Looking back, in <a
href="http://funguloids.sourceforge.net/">Funguloids</a> things were almost too easy, as I had <a
href="http://www.ogre3d.org/">Ogre</a> at my disposal! Along with PBuffers the thing now supports plain old frame buffer copying as well, though I couldn&#8217;t be bothered to make bloom work with it (lighting does, though, which is more important anyway).</p><p
style="text-align: justify;">While fighting with PBuffers, I noticed I could make the bloom much faster and more importantly allow for more shader effects if I used RTT (<span
style="font-style: italic;">render-to-texture</span>) same size as the screen dimensions. I could then render the scene only once to the RTT (currently I have to render twice!), have bloom shaders use that and actually do the final additive composition in the fragment shader too. Having a screen sized RTT would allow some neat shader effects like screen distortions and shock waves. There&#8217;s one problem, many cards don&#8217;t support rectangular (non power-of-two) RTTs.. The solution: separate rendering paths. I would implement several render paths with varying amount of shader and RTT usage, then determine what the host system supports and have things running nice and solid. Sounds like bit of work to me, but I guess the end results would be worth the trouble. We shall see. <span
style="font-weight: bold;"> <img
src='http://www.mhgames.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </span></p><p
style="text-align: justify;">Oh, and I&#8217;ve finished my bachelor&#8217;s thesis, like a month ago. Forgot to mention that earlier. <span
style="font-weight: bold;"> <img
src='http://www.mhgames.org/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> </span> Now I&#8217;d need to decide if I continue to write master&#8217;s thesis on the same subject, or choose something completely different. If only I could think of a subject having to do with game programming, that would certainly help with the motivation..</p> ]]></content:encoded> <wfw:commentRss>http://www.mhgames.org/2008/11/random-things/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Shader goodness: Bloom!</title><link>http://www.mhgames.org/2008/10/shader-goodness-bloom/</link> <comments>http://www.mhgames.org/2008/10/shader-goodness-bloom/#comments</comments> <pubDate>Mon, 20 Oct 2008 15:13:00 +0000</pubDate> <dc:creator>Mika</dc:creator> <category><![CDATA[Development]]></category> <category><![CDATA[java]]></category> <category><![CDATA[programming]]></category><guid
isPermaLink="false">http://www.mhgames.org/2008/10/shader-goodness-bloom/</guid> <description><![CDATA[In the last post I talked about lighting, this time it&#8217;s shaders and more specifically bloom. I must say I like the effect when it&#8217;s used subtly as a mood enhancement and dislike it in it&#8217;s quite common burn-your-eyes-out -form.. For the platformer game I&#8217;m planning to use the effect for a nice and quiet [...]]]></description> <content:encoded><![CDATA[<p
style="text-align: justify;"><a
href="http://1.bp.blogspot.com/_idHQSV4cE3E/SPyaCLemDiI/AAAAAAAAADE/2fAI1ptAh8k/s1600-h/bloomsample.jpg"><img
id="BLOGGER_PHOTO_ID_5259247827093425698" style="margin: 0pt 0pt 10px 10px; float: right; cursor: pointer;" src="http://1.bp.blogspot.com/_idHQSV4cE3E/SPyaCLemDiI/AAAAAAAAADE/2fAI1ptAh8k/s320/bloomsample.jpg" border="0" alt="" /></a>In the last post I talked about <span
style="font-style: italic;">lighting</span>, this time it&#8217;s <span
style="font-style: italic;">shaders </span>and more specifically <span
style="font-style: italic;">bloom</span>. I must say I like the effect when it&#8217;s used subtly as a mood enhancement and dislike it in it&#8217;s quite common <span
style="font-style: italic;">burn-your-eyes-out</span> -form..</p><p
style="text-align: justify;">For the platformer game I&#8217;m planning to use the effect for a nice and quiet dreamlike feel, although I&#8217;m still not sure what kind of game it will be (except that it&#8217;s a 4-way scrolling platformer!).. And as I often do, I find myself getting carried away doing all sorts of graphical effects (lighting, shaders) when I don&#8217;t even have the basic game mechanics in place! Can&#8217;t help it though, I must have some eye candy going on to keep myself motivated in a project. <span
style="font-size:85%;"><span
style="font-weight: bold;">*shrugs*</span></span></p><p
style="text-align: justify;">So I coded a quick &amp; dirty shader support to the engine, and today I&#8217;ve been trying to get the bloom working. And now it does.<span
style="font-weight: bold;"> <img
src='http://www.mhgames.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </span> I&#8217;m still not done with it, needs some tweaking &#8211; and that&#8217;s somewhat impossible right now since I have no final assets for the game yet! Everything you see in those screens is temporary and/or random. For anyone interested, here&#8217;s some technical details on the subject.</p><p
style="text-align: justify;"><a
href="http://4.bp.blogspot.com/_idHQSV4cE3E/SPyaCa-cCwI/AAAAAAAAADM/cYm6SQyiPeQ/s1600-h/bloomcomparison.jpg"><img
id="BLOGGER_PHOTO_ID_5259247831253519106" style="margin: 0pt 0pt 10px 10px; float: right; cursor: pointer;" src="http://4.bp.blogspot.com/_idHQSV4cE3E/SPyaCa-cCwI/AAAAAAAAADM/cYm6SQyiPeQ/s320/bloomcomparison.jpg" border="0" alt="" /></a>I based the implementation on the <span
style="font-weight: bold;">GLSL</span> bloom shaders from <a
href="http://funguloids.sourceforge.net">Funguloids</a>, which in turn are modified from <a
href="http://www.ogre3d.org">Ogre</a> sample shaders. I&#8217;m still a beginner with the shader programming as I may have mentioned, so having anything to work from was invaluable. I tweaked the shaders to get the subtle look I was aiming for.</p><p
style="text-align: justify;">I&#8217;m using two small render textures (which are FBOs, no support for Pbuffers yet &#8211; and I think I&#8217;ll have to do those at some point, as my laptop doesn&#8217;t support FBOs), 128&#215;128 in dimension and one bigger 512&#215;512 RT. I render the scene normally to the bigger RT. The blurring is then done in two passes: first the scene RT gets rendered to 128&#215;128 RT #1 using a horizontal blur shader (it also does some luminance stuff to have the bright parts more bright and dim parts more dim). Then RT #1 gets rendered to RT #2, this time with a vertical blur shader. Finally the RT #2 contents are blended additively over a normal 1:1 render of the scene. It needs quite a lot of tweaking, but I think it looks quite nice now.</p><p
style="text-align: justify;">In another news, my thesis is now almost complete! <span
style="font-weight: bold;">^^</span></p> ]]></content:encoded> <wfw:commentRss>http://www.mhgames.org/2008/10/shader-goodness-bloom/feed/</wfw:commentRss> <slash:comments>1</slash:comments> </item> </channel> </rss>
<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk
Page Caching using disk (enhanced)
Database Caching 3/11 queries in 0.123 seconds using disk

Served from: www.mhgames.org @ 2010-09-09 13:19:45 -->