<?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>Fatal Abstraction &#187; Alexander Hofstädter</title>
	<atom:link href="http://blog.fatal-abstraction.net/author/alex/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.fatal-abstraction.net</link>
	<description>Piling things on top of other things results in huge piles of things, duh!</description>
	<lastBuildDate>Sat, 19 Oct 2013 15:35:12 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
		<item>
		<title>KoreTech Profiler</title>
		<link>http://blog.fatal-abstraction.net/2012/02/koretech-profiler/</link>
		<comments>http://blog.fatal-abstraction.net/2012/02/koretech-profiler/#comments</comments>
		<pubDate>Tue, 07 Feb 2012 20:43:54 +0000</pubDate>
		<dc:creator>Alexander Hofstädter</dc:creator>
				<category><![CDATA[Projects]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[Source Code]]></category>
		<category><![CDATA[Utilities]]></category>

		<guid isPermaLink="false">http://blog.fatal-abstraction.net/?p=128</guid>
		<description><![CDATA[&#160; Facts Type Utility For Private, to be used in future projects Platform(s) Platform agnostic, only tested on Windows Language(s) C++ Libraries - Effort ~ 10 hours Download(s) KoreTech Profiler Source(zip &#124; 10KB), KoreTech Profiler Sample(VS2010, zip &#124; 14KB) About &#8230; <a href="http://blog.fatal-abstraction.net/2012/02/koretech-profiler/">Weiterlesen <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>&nbsp;</p>
<p style="text-align: center;"><img class=" wp-image-126 aligncenter" title="Project Thumbnail" src="http://blog.fatal-abstraction.net/wp-content/uploads/2012/02/Project-Thumbnail1-300x168.png" alt="Project Thumbnail" width="320" height="175" /></p>
<table border="0">
<tbody>
<tr>
<td style="text-align: center;" colspan="2">
<h1 style="text-align: left;">Facts</h1>
</td>
</tr>
<tr>
<td>Type</td>
<td>Utility</td>
</tr>
<tr>
<td>For</td>
<td>Private, to be used in future projects</td>
</tr>
<tr>
<td>Platform(s)</td>
<td>Platform agnostic, only tested on Windows</td>
</tr>
<tr>
<td>Language(s)</td>
<td>C++</td>
</tr>
<tr>
<td>Libraries</td>
<td>-</td>
</tr>
<tr>
<td>Effort</td>
<td>~ 10 hours</td>
</tr>
<tr>
<td>Download(s)</td>
<td><a href="http://blog.fatal-abstraction.net/wp-content/uploads/2012/02/KoreTech-Profiler-Source.zip">KoreTech Profiler Source</a>(zip | 10KB),<br />
<a href="http://blog.fatal-abstraction.net/wp-content/uploads/2012/02/KoreTech-Profiler-Sample.zip">KoreTech Profiler Sample</a>(VS2010, zip | 14KB)</td>
</tr>
</tbody>
</table>
<p><span id="more-128"></span></p>
<h1>About</h1>
<p>Even though it was eventually integrated into the KoreTech framework (and hence also <a title="ColorIt" href="http://blog.fatal-abstraction.net/2012/02/colorit/">ColorIt</a>), this simple profiler I wrote can be seen as a project of its own. I rolled it around half a year earlier, when I felt the urge to have a look at how some of the stuff I played around with performed. It&#8217;s a simple scope-based profiler (meaning it puts a tiny object on the stack for the sole purpose of recording the time that has passed between its creation and its going out of scope)  for single-threaded use that lets users hook up their own custom functions for memory allocation and deallocation as well as getting timestamps and printing. Everything the profiler does is wrapped in preprocessor macros so profiling can instantly be disabled if so desired. It requires only two files, but it kind of depends on  KORE_ASSERT as I was too lazy to rip out all those handy assertions just for presentation or publishing purposes. Actually doing that, if need be, is left as an exercise to the user.</p>
<p>It comes (just for once&#8230;) with fairly thorough documentation by way of comments so don&#8217;t sweat reading all of the following, if you really want to use it and are more of a hands-on guy.</p>
<h1>Usage</h1>
<p>The module must be initialized by calling</p>
<p></p><pre class="crayon-plain-tag">PROFILE_INITIALIZE(ALLOCATE, GET_CYCLES_FUNCTION, CYCLES_TO_SECONDS_FUNCTION, PRINT_FUNCTION, PRINT_OSD_FUNCTION)</pre><p></p>
<p>(or kore::profile::profile_initialize(&#8230;), if you hate macros) and passing function pointers for allocation and printing. The Alloc function pointer requires malloc-signature and the Print function pointer requires printf-signature. Users must also pass pointers to functions that return the current number of cycles passed since system start (or something like that, it&#8217;s only about time increments anyway) and that can convert that number into seconds. The rationale behind this is that I didn&#8217;t want to muck around with conversion from cycles to seconds for every value the profiler records but rather store all values as uints of sufficient size and only do the conversion when statistics are evaluated. Once everything is initialized, users can either use</p>
<p></p><pre class="crayon-plain-tag">PROFILE_SCOPE_ONCE(VARIABLE_NAME, MESSAGE)</pre><p></p>
<p>providing a unique name for the scoped object and a message to be printed upon entering and leaving the scope or</p>
<p></p><pre class="crayon-plain-tag">PROFILE_SCOPE_STATISTICS(VARIABLE_NAME, PROFILE_IDENTIFIER_ENUM_VALUE)</pre><p></p>
<p>providing again a unique name for the scoped object and a profiling identifier as added to the enumeration in profile.h. PROFILE_SCOPE_ONCE will instantly attempt to print the duration the created object was alive in both cycles and seconds, while PROFILE_SCOPE_STATISTICS just records the duration for the specified category this turn and that&#8217;s that. Every hundred frames or so, users can call</p>
<p></p><pre class="crayon-plain-tag">PROFILE_PRINT_STATISTICS()</pre><p></p>
<p>to have a brief summary printed using the supplied print function. That summary contains for each profile identifier the minimum/maximum and average duration. Users can adjust the number of samples that should be taken for the running average by modifying NUM_SAMPLES_MODIFIER in profile.h. Note that the number of samples must always be a power of two, so that modifier actually results in</p>
<p></p><pre class="crayon-plain-tag">const uint32_t MAX_NUM_SAMPLES = (1 &amp;lt;&amp;lt; NUM_SAMPLES_MODIFIER);</pre><p></p>
<p>When all is said and done, just kill the damn thing by calling</p>
<p></p><pre class="crayon-plain-tag">PROFILE_SHUTDOWN(DEALLOCATE)</pre><p></p>
<p>where DEALLOCATE is the pointer to a deallocation function with free-signature and be done with it.</p>
<h1>Remarks</h1>
<p>First of all, yes, it&#8217;s very simple and has almost no functionality. But sometimes you don&#8217;t need much and settle with the tool that will just about do the job. I&#8217;ll definitely make the (now global) profiler-state bundled into an object so we can instantiate profilers (the whole thing, not ProfileScopes) in thread-local memory in order to be able to profile multi-threaded stuff. This will have to wait until I get around to implement the job-system for KoreTech, though.</p>
<p>Even though not part of the profiler itself, it should be noted that the kore::timer-thingy in the source folder is just a wrapper around <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/ms644904(v=vs.85).aspx">QueryPerformanceCounter</a>/<a href="http://msdn.microsoft.com/en-us/library/windows/desktop/ms644905(v=vs.85).aspx">QueryPerformanceFrequency</a> on Windows and thus suffers from the same limitations. Most notably that your process could be migrated between cores and thus readings could not be correct. IF (and I haven&#8217;t seen this yet on any of the few PCs I  have around) your mainboard vendor has not properly implemented this in their drivers. Most halfway decent vendors seem to use dedicated hardware for getting timestamps (that&#8217;s often not clocked as fast the actual CPU, at least on my Intel  P58) and that also does not seem to suffer from thread migration issues. But as always, you can&#8217;t count on that.</p>
<p>There&#8217;s some other stuff like the PrintScreenFunction pointer that can be provided upon PROFILE_INITIALIZE(&#8230;) that I use to print a less verbose version of the statistics stuff onto the screen in KoreTech or the possibility to feed it an Allocator object instead of an allocate function that I also use in KoreTech. Omitting that stuff upon init won&#8217;t do anything bad. The profiler will just print a message telling the user that it will use the fallback of printing statistics via PrintFunction rather than using the default PrintScreenFunction.</p>
<div class="share-this"><div id="twitter-share-button" style="width:100px;float:left"><a href="http://twitter.com/share" class="twitter-share-button" data-count="horizontal">Tweet</a></div><div class="plusone" style="width:70px;float:left"><g:plusone size="" annotation="" href="http://blog.fatal-abstraction.net/2012/02/koretech-profiler/"></g:plusone></div><div class="facebook-share-button">
					<iframe src="https://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fblog.fatal-abstraction.net%2F2012%2F02%2Fkoretech-profiler%2F&amp;send=&amp;layout=&amp;width=&amp;show_faces=&amp;action=&amp;colorscheme=&amp;font=&amp;height=21" 
						scrolling="no" 
						frameborder="0" 
						style="border:none; overflow:hidden; width:px; height:21px;" 
						allowTransparency="true"></iframe>
				</div></div>]]></content:encoded>
			<wfw:commentRss>http://blog.fatal-abstraction.net/2012/02/koretech-profiler/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ColorIt &#8211; Post-Mortem</title>
		<link>http://blog.fatal-abstraction.net/2012/02/post-mortem-colorit/</link>
		<comments>http://blog.fatal-abstraction.net/2012/02/post-mortem-colorit/#comments</comments>
		<pubDate>Sun, 05 Feb 2012 15:45:39 +0000</pubDate>
		<dc:creator>Alexander Hofstädter</dc:creator>
				<category><![CDATA[Postmortems]]></category>
		<category><![CDATA[ColorIt]]></category>
		<category><![CDATA[Post-Mortem]]></category>

		<guid isPermaLink="false">http://blog.fatal-abstraction.net/?p=42</guid>
		<description><![CDATA[History ColorIt is a project I worked on together with four other students of the Master&#8217;s Program for Game Engineering and Simulation at the UAS Technikum Wien. My colleague Martin Nieratschker came up with the idea of a game in &#8230; <a href="http://blog.fatal-abstraction.net/2012/02/post-mortem-colorit/">Weiterlesen <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<h1>History</h1>
<p><a href="http://blog.fatal-abstraction.net/2012/02/colorit/">ColorIt</a> is a project I worked on together with four other students of the Master&#8217;s Program for <a href="http://www.technikum-wien.at/en/study_programs/master_s/game_engineering_and_simulation_technology/">Game Engineering and Simulation</a> at the <a href="http://www.technikum-wien.at/en/home/">UAS Technikum Wien</a>.</p>
<p><span id="more-42"></span></p>
<p>My colleague Martin Nieratschker came up with the idea of a game in which the player fights for territory by manipulating a canvas and applying color to it. As part of a design class, we were tasked with prototyping an idea for the game project we were supposed to deliver by the end of the third semester. I quickly cooked up a simple 2D-prototype that let four players paint the canvas using an XBox 360 pad that allowed us to evaluate our ideas. Even though the prototype was buggy as hell on the gameplay side, we quickly realized that there was something cool about the concept and kept going.</p>
<p>In the course of a few weeks, I hunched down and built a simple 3D rendering framework that would suffice our needs. After those awkward weeks where no playable version was available, we could finally test how well our initial design had translated to a 3D-splitscreen multiplayer game. That was when we first started killing holy cows and began truly iterating on the concept.</p>
<h1>What went right</h1>
<ul>
<li><strong>Prototyping</strong> &#8211; Helped build confidence in our coding abilities</li>
<li><strong>Scope</strong> &#8211; Intentionally aiming low made any progress all the more motivating</li>
<li><strong>Constraints</strong> &#8211; Deciding early on what we did not want to do paid off in droves</li>
<li><strong>Iterating</strong> &#8211; The best design decisions were made halfway through the dev cycle</li>
<li><strong>Cutting</strong> &#8211; Even though we aimed low, some things had to go without any tears</li>
<li><strong>Visuals</strong> &#8211; For a game almost entirely made of programmer art, it looks pretty rad,  if you ask me</li>
<li><strong>Build Organization</strong> &#8211; Having a clean system and neat build output made testing so much easier</li>
<li><strong>Model Converter</strong> &#8211; Transforming geometry to vertex-buffer format allowed keeping the FBX-SDK out of the game application</li>
<li><strong>Simple Engine Systems</strong> &#8211; An engine where every single module can be rewritten in a day or two if need be empowers creative freedom</li>
<li><strong>In-game Console</strong> &#8211; Making it the central controlling organ of the game made testing that much easier</li>
<li><strong>Zealous Assertions</strong> &#8211; Hardly ever was there an instance where the game crashed and we didn&#8217;t instantly know why</li>
</ul>
<h1>What went wrong</h1>
<ul>
<li><strong>Team size</strong> &#8211; We were not free to decide on this but five people is just too much for a project of this small scope</li>
<li><strong>My hesitance to delegate work</strong> &#8211; Progress was held back by me not wanting to give up responsibility</li>
<li><strong>Prematurely ruling out skeletal animation</strong> &#8211; Even though flexible, our own hard-coded system was just too hard on the art department</li>
<li><strong>Not patching the model converter</strong> - Converter output had the wrong vertex order; not fixing it in the tool resulted in artists having to work around</li>
<li><strong>Not considering automated testing enough </strong>- Even though we did use unit testing, most of the systems were not designed with testability in mind</li>
<li><strong>Not solving seemingly hard problems up-front</strong></li>
</ul>
<h1>Selected Details on what went right</h1>
<h2>Scope</h2>
<p>There&#8217;s one advice I have heard pretty much all professionals give when asked about tips for aspiring game developers: Don&#8217;t over-scope. Keep stuff small and basic. Don&#8217;t try to compete with AAA productions. We took this advice by heart. This resulted not only in a game design that was simple enough to almost completely re-arrange mid-project but that was also simple enough to not rely on top-notch visuals. No matter how much blood you put into your pet-project shooter, it will always look mediocre in comparison- But try to make something different and competition will be much more forgiving.</p>
<p>I&#8217;m not sure whether I should point this out or not, but aiming so low also resulted in a very relaxed semester. While other teams were literally working their asses of, I&#8217;ve had plenty of time that semester, which came in quite handy when my father got very, very sick. Still, we&#8217;ve got something to show and it&#8217;s not too shabby for what was  basically a 2.5 people project.</p>
<h2>Constraints</h2>
<p>It was pretty clear we did not have the capacity to add anything but an incredibly half-assed AI or networked multiplayer mode, so we decided to make a split-screen multiplayer game very early on. That makes it hard to show off and a tough sell for the PC but in the end, this project was about education and getting something fun done. Focussing on local multiplayer also resulted in the decision to require game pads which makes the game an even tougher sell but it also sparked the development of the radial menu that  many testers explicitly stated they loved and a simple yet effective control scheme that would not have been possible with a mouse/keyboard combo.</p>
<h2>Iterating</h2>
<p>Early on, outposts were designed to not only fortify  but also spread your color. Iteration made us recognize that this concept was way too fuzzy to make for interesting trade-offs. This may sound like a no-brainer and more experienced designers might have spotted this sooner, but for us it was vital to just try alternatives and instantly see what works and what doesn&#8217;t.</p>
<p>Another system that only became as good as it is today is the controlling of the player cursor. Initially, we had a scheme were the left stick controlled the cursor and the right stick made the view pan as it would be in classical PC RTS games. Constant iteration gave us the chance to play around and come up with the final scheme that just works so much better.</p>
<p>The bridge and nuke abilities were only introduced when we were already halfway through development and test games got longer and longer. They now add the necessary spice to quickly  topple stalemates and situations in which players are entrenched.</p>
<h2>Cutting</h2>
<p>The initial design draft included not only strategic points to be captured but also ability points that would grant the occupying player stat increases and abilities. What sounded pretty cool on paper was clearly a lot of work and leaving that feature out made for much tighter and more focused gameplay. Throughout the dev cycle it was tempting to re-introduce the concept to provide some strategic trade-offs and more meta-game but having external persons play the game quickly revealed that increased complexity would be out of the question for the initial release.</p>
<h2>Build Organization</h2>
<p>Having the code build depend on shader-compilation, texture compression, geometry-transformation and archive packing made for nice and clean build output and builds where assets never got stale or outdated. It was a breeze just having the build process publish the outpot to a <a href="https://www.dropbox.com/">dropbox</a> directory and wait for tester feedback. I was tempted to set up a <a href="http://jenkins-ci.org/">Jenkins</a> server but that probably would have been overkill. Also, having the game&#8217;s <a href="http://subversion.tigris.org/">SVN</a>-revision appear on screen and in the console logs made tracking open/fixed issues in <a href="http://trac.edgewall.org/">Trac</a> pretty easy.</p>
<h2>Model Converter</h2>
<p>Initially, I didn&#8217;t even consider this worth noting, but the fact that all the other student projects loaded their models from AutoDesk *.fbx using the FBX-SDK made me really appreciate our approach. We just rolled a quick and dirty command line application that reads an FBX file, strips some unecessary vertices and generates a file with a byte stream that could be directly fread() into a vertex buffer. Not only did that result in faster loading times and simpler run-time code, it also eliminated the need for a leaky 6MB dll next to our neat and tidy 200KB executable.</p>
<h2>Simple Engine Systems</h2>
<p>As you might  have guessed from the title of this blog, I&#8217;m not a big fan of over-engineering. Keeping engine systems as isolated and straight-forward as possible at the cost of flexibility made it way easier to <a href="http://cam.ly/blog/2010/12/code-fearlessly/">code fearlessly</a>. Sometimes, something turned out to be poorly designed and had to be ripped out and rewritten but having lightweight interfaces made that process enjoyable instead of dreadful. Mind that I&#8217;m talking about literal interfaces as in &#8220;what&#8217;s the functionality I can import by including that header&#8221; rather than slapping <em>virtual</em> onto everything. People might disagree with my design-pattern-agnostic low-tech approach. That&#8217;s okay. I&#8217;ll gladly tip my hat to those should my ways ever come back to bite my&#8230; err&#8230; posterior.</p>
<h2>In-game Console</h2>
<p>In the beginning, I wanted to  have one for the hell of it &#8211; Later on it became more and more clear how it made things easier. The ability to alter sound/graphics settings, starting, pausing and quitting games might not sound like much. But it can really be nice when you allow commands to be put in a file and executed any time or allow them to be provided as startup parameters. Debugging shaders becomes a lot more enjoyable when <a href="http://msdn.microsoft.com/en-us/library/ee417062(v=VS.85).aspx">PIX</a> is set up to start the game with</p>
<p>start_game map_4_0</p>
<p>and spares you the hassle of having to whip out a controller and navigate through the menu every damn time you want to double-check. Having the console initiate game-state transitions and settings also made setting up menus pretty easy. All that  buttons need to do is call console_execute(&#8230;) with the appropriate command in a const char* and be done with it. A possible downside I see looming over all of this is the console becoming some kind of god module that depends on every other module because it has access to all of them. This is definitely something I need to watch out for, going forward.</p>
<h2> Zealous Assertions</h2>
<p>Having read quite a lot about custom assertions (especially the <a href="http://cnicholson.net/2009/02/stupid-c-tricks-adventures-in-assert/">POW2-Assert on Charles Nicholson&#8217;s blog</a> that I ended up using with a few slight additions) I knew using them would be a Good Thing™. However only reading <a href="http://home.comcast.net/~tom_forsyth/blog.wiki.html">Tom Forsyth</a>&#8216;s take on them, as in</p>
<blockquote><p>I&#8217;ll put them on PARANOIA&gt;=3. That&#8217;s basically the setting where it&#8217;s such a nasty bug to find that I&#8217;m happy to leave it running for an hour a frame if in exchange an ASSERT fires to show me where it is</p></blockquote>
<p>made me use them zealously throughout the code and  boy was it worth it. It worked so well that I could start implementing a feature and try to run the game worrying stuff would <a href="http://www.youtube.com/watch?v=Bxy20bgot0Q#t=0m05s">literally explode into may face <em>Star Trek-Style</em></a><em> </em>to find out every oversight was caught by another assertion and I could simply add code to satisfy conditions until everything worked like a charm. Now don&#8217;t get me wrong, I don&#8217;t put my brain to sleep and rely on that when I code. But it sure feels good to have a safety net that keeps you from spending nights debugging only to find out there was one weeny error in that damn support function someone (probably yourself) cooked up that one day two minutes before midnight.</p>
<h1>Selected Details on what went wrong</h1>
<h2>Team Size</h2>
<p>Even though we were not free to decide how many people would  be working on the game, I feel the need to re-iterate what I took from <a href="http://en.wikipedia.org/wiki/Fred_Brooks">Fred Brooks</a>&#8216; teachings. And a bunch of guys thrown together just like that makes no surgical team, that&#8217;s for sure. Also, as hopefully anyone can imagine &#8211; students come with wildly different levels of skill and motivation. Having more of them decreases your chances to maintain a certain level of motivation and proficiency. And before you know it, you&#8217;ll spend your time fixing frigging compile errors that somehow made it into the repository.</p>
<h2>My hesitance to delegate work</h2>
<p>I&#8217;ll  be frank about this. My presence on the team severely hampered general motivation. In the  beginning people could not wait to run off in all directions and start churning out code. We could have accomplished so much more, hadn&#8217;t I been such a wet blanket. What I did was tell people to spend a little more brains on stuff. When that didn&#8217;t seem to produce better code, I more and more turned to telling them not to do do anything before we at least had a chance to talk about it. In the end, the team had pretty much boiled down to  just Martin and me.</p>
<p>I stand by my decisions. People who just paste tutorial code everywhere and then bitch and moan about how nothing works and it could not possibly <em>their</em> fault because <em>their code</em> worked flawlessly in isolation should not be on any project. But sadly, they exist and I should try  harder to come up with remedies for situations like that- I won&#8217;t always be able to choose my colleagues out there so I must learn to cope with things.</p>
<h2>Prematurely ruling out skeletal animation</h2>
<p>From the get-go there was not really a need for skeletal animation in ColorIt. We did not consider implementing it because there would be no one willing to rig and animate models anyway. So I hacked together an animator component that was able to interpolate factors, vectors and quaternions so we could at least have things become bigger and smaller or float up and down. The system turned out pretty powerful and extensible for how little code it was  but it was also error-prone because it operated on plain memory. Furthermore, it took some brains to get what you wanted since key frames had to  be hard-coded and there was no way to preview any of that stuff other than running the game. It may have been just enough this time around, but a solid animation pipeline would have brought much to the table.</p>
<h2>Not patching the model converter</h2>
<p>When exporting Maya binaries to FBX, the vertex winding order for front-faces is clock-wise by default. Of course, our engine assumed the opposite but thankfully someone came up with an allegedly simple way to turn around vertex order in Maya prior to export. Only that it wasn&#8217;t simple at all and since I did not feel the pain of that contrived workaround myself, I did not push for the model converter to be updated so that it would fix winding order regardless of the output Maya produced. Which meant that our sole artist (Go Martin!) had to Z-scale every model with -1, rotate it by 180° about Y and then spill chicken blood over his keyboard and poke a goat in the eye before exporting it in Maya.</p>
<h2>Not considering automated testing enough</h2>
<p>After reading <a href="http://gamesfromwithin.com/exploring-the-c-unit-testing-framework-jungle">Noel Llopis&#8217; excellent rundown on unit testing frameworks</a>, I wanted to try to unit test stuff using <a href="http://code.google.com/p/googletest/">googletest</a> which was definitely a good decision. The framework is top notch and it all worked very well. Testing systems like the HeapAllocator, console buffer population and the AnimationPlayer component greatly increased my confidence with complicated code. But especially testing the console stuff showed how physical dependence kills unit testing. I could eventually hack my way out of the dependency jungle with forward declarations and some mocking but the point to take away was clear: Even though unit testing is not a silver bullet to make systems better, <em>designing systems with any kind of automated testing in mind</em> helps keep interfaces clean and dependencies few. Something I definitely want to mind when I rewrite some of the systems in KoreTech.</p>
<h2>Not solving seemingly hard problems  up-front</h2>
<p>Rigid separation of concerns as well as cutting down on <a href="http://gamesfromwithin.com/physical-structure-and-c-part-1-a-first-look">physical dependencies</a> was definitely a good thing. Storing components in  memory linearly and passing integer IDs  across system boundaries <a href="http://bitsquid.blogspot.com/2011/09/managing-decoupling-part-4-id-lookup.html">as suggested by Niklas Frykholm</a> opens up lots of optimization opportunities. I&#8217;ve put everything in place that would allow me to use clever stuff like <a href="http://realtimecollisiondetection.net/blog/?p=86">render queue sorting</a> but I never really got around to actually implement the damn thing. My list of neat engine enhancements is filled to the brim because I kept delaying them for weeks with the excuse being that other guys on the project NEED FEATURES NAO and I guess that was still valid. But at the end of the day, the lesson to be learned is that even though sacrifices have to be made, one should not shy away from <a href="https://twitter.com/#!/ChristerEricson/status/79838130366193664">taking on daunting tasks</a>.</p>
<div class="share-this"><div id="twitter-share-button" style="width:100px;float:left"><a href="http://twitter.com/share" class="twitter-share-button" data-count="horizontal">Tweet</a></div><div class="plusone" style="width:70px;float:left"><g:plusone size="" annotation="" href="http://blog.fatal-abstraction.net/2012/02/post-mortem-colorit/"></g:plusone></div><div class="facebook-share-button">
					<iframe src="https://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fblog.fatal-abstraction.net%2F2012%2F02%2Fpost-mortem-colorit%2F&amp;send=&amp;layout=&amp;width=&amp;show_faces=&amp;action=&amp;colorscheme=&amp;font=&amp;height=21" 
						scrolling="no" 
						frameborder="0" 
						style="border:none; overflow:hidden; width:px; height:21px;" 
						allowTransparency="true"></iframe>
				</div></div>]]></content:encoded>
			<wfw:commentRss>http://blog.fatal-abstraction.net/2012/02/post-mortem-colorit/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ColorIt</title>
		<link>http://blog.fatal-abstraction.net/2012/02/colorit/</link>
		<comments>http://blog.fatal-abstraction.net/2012/02/colorit/#comments</comments>
		<pubDate>Sun, 05 Feb 2012 15:42:56 +0000</pubDate>
		<dc:creator>Alexander Hofstädter</dc:creator>
				<category><![CDATA[Projects]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[ColorIt]]></category>
		<category><![CDATA[Game]]></category>

		<guid isPermaLink="false">http://blog.fatal-abstraction.net/?p=31</guid>
		<description><![CDATA[Facts Type Game / Framework For University Course, Group Project Platform(s) Windows Vista, Windows 7 Language(s) C++, HLSL Libraries DirectX 11, XAudio, XInput, C stdlib, LibRocket, PhysFS Effort ~ 190 hours What I did Contribute Simple modular framework in which &#8230; <a href="http://blog.fatal-abstraction.net/2012/02/colorit/">Weiterlesen <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><img class="size-full wp-image-14 aligncenter" title="ColorIt_Thumb" src="http://blog.fatal-abstraction.net/wp-content/uploads/2012/02/ColorIt_Thumb.png" alt="A scene from the game &quot;ColorIt&quot;" width="320" height="175" /></p>
<table border="0">
<tbody>
<tr>
<td style="text-align: center;" colspan="2">
<h1 style="text-align: left;">Facts</h1>
</td>
</tr>
<tr>
<td>Type</td>
<td>Game / Framework</td>
</tr>
<tr>
<td>For</td>
<td>University Course, Group Project</td>
</tr>
<tr>
<td>Platform(s)</td>
<td>Windows Vista, Windows 7</td>
</tr>
<tr>
<td>Language(s)</td>
<td>C++, HLSL</td>
</tr>
<tr>
<td>Libraries</td>
<td>DirectX 11, XAudio, XInput, C stdlib, <a href="http://librocket.com/">LibRocket</a>, <a href="http://icculus.org/physfs/">PhysFS</a></td>
</tr>
<tr>
<td>Effort</td>
<td>~ 190 hours</td>
</tr>
</tbody>
</table>
<p><span id="more-31"></span></p>
<h1>What I did Contribute</h1>
<ul>
<li>Simple modular framework in which the game runs</li>
<li>Component based object model &#8211; Entities are integer IDs, components are retrieved from stores where they are kept in cache-friendly pools</li>
<li>Renderer, Shaders for Phong Shading and Normal Mapping, Material System supporting Selective Bloom Post Processing and selective specularity</li>
<li>Simple, extensible key frame animation system for model position, orientation, scaling and also material properties such as bloom-intensity or specular exponent/intensity</li>
<li>Scriptable in-game console that mediates between sub-systems</li>
<li>Various debugging facilities such as a tracing heap allocator, static and run-time assertions (thanks <a href="http://bitsquid.blogspot.com/2010/09/custom-memory-allocation-in-c.html">Niklas Frykholm</a>, <a href="http://cnicholson.net/2009/02/stupid-c-tricks-adventures-in-assert/">Charles Nicholson</a> and <a href="http://home.comcast.net/~tom_forsyth/blog.wiki.html">Tom Forsyth</a>) as well as logging of various debug-streams to files</li>
<li>Lightweight in-engine scope profiler</li>
<li><a href="http://librocket.com/">LibRocket</a> render interface</li>
<li>Sane build configuration (checkout, build, copy the BuildOutput folder containing just the executable, two 3rd-party dlls and an asset archive containing everything from textures to models to compiled shaders)</li>
<li>SIMD-optimized cellular automaton simulation and bitmap painting code</li>
<li>Cache-efficient Flood Filling algorithm</li>
</ul>
<h1>What I did not contribute</h1>
<ul>
<li>Most of the design and gameplay code (Thanks, Martin!)</li>
<li>Our cool radial menu (again, Thanks Martin!)</li>
<li>Any art assets (would you have guessed: Thanks, Martin! Also thanks Thomas G.!)</li>
<li>The Audio Module (even though I regret it)</li>
<li>Loading of compressed assets (thanks <a href="http://icculus.org/physfs/">PhysFS</a>!)</li>
<li>Font Rasterization and UI Layout (thanks <a href="http://librocket.com/">LibRocket</a>!)</li>
<li>Offline Model Converter (fbx &gt; vertex buffer ready model format, thanks Georg!)</li>
</ul>
<h1>The Game</h1>
<p>ColorIt is a real time tactics game for two to four players in splitscreen-mode. Players use a Microsoft XBox 360 Controller for Windows to control their cursor across the map. Pressing the A-button will mark the area below their cursor with each player&#8217;s respective color. Holding that same button, players can paint paths and figures onto the neutral map. Paths that are connected to their own base building will gradually be conquered by their color. Using this mechanic, players need to first mark and then conquer strategic points that are scattered across the map. As long as strategic points are held by a player, they will contiguously increase that player&#8217;s victory score by a fixed amount per time quantum. The player that first manages to completely fill their victory score wins the game.</p>
<p>Players can paint across opponent&#8217;s paths and by doing so, cut off their supply. Any territory that is not connected to a player&#8217;s base building by at least one path will gradually deteriorate and finally vanish unless it is connected again.</p>
<p>Players can utilize three additional abilities:</p>
<ul>
<li>Placing an outpost by pressing B &#8211; This will fortify their own color in the outpost&#8217;s vicinity so that opponents cannot simply paint over it</li>
<li>Placing bridge heads by pressing X &#8211; The first bridge head must be located in their own territory, the second one can be placed anywhere. Once a certain amount of time, dependent on the distance between the bridge heads has passed, the bridge heads will be connected by a path of the building player&#8217;s color. Such paths can be interrupted  by placing outposts between bridge heads</li>
<li>Placing a nuke by pressing Y &#8211; Nukes will detonate after a certain amount of time, neutralizing any territory in their vicinity, even the placing player&#8217;s. Nukes can be defused by cutting of their supply line to the base building.</li>
</ul>
<h1>Post-Mortem</h1>
<p>Read my <a href="http://blog.fatal-abstraction.net/2012/02/post-mortem-colorit/">post-mortem analysis</a> of the ColorIt project!</p>
<h1>Downloads</h1>
<p>Sadly, I can&#8217;t yet offer the complete game for download, as we ponder publishing it with added bells and whistles. That&#8217;s also the reason why I can&#8217;t offer the complete source code yet, even though I&#8217;d like to. I will, however, publish the source code for some interesting modules and link them in the details section of this page.</p>
<ul>
<li><a href="http://blog.fatal-abstraction.net/wp-content/uploads/2012/02/ColorIt_Trailer.mp4">ColorIt Trailer</a> (mp4 | 180MB, also available on <a href="http://www.youtube.com/watch?v=744K2EYzYtA">YouTube</a>)</li>
</ul>
<h1>Media</h1>
<div class="youtube" style="width: 350; height: 300;"><object width="350" height="300" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="wmode" value="transparent" /><param name="src" value="http://www.youtube.com/v/744K2EYzYtA&amp;rel=0&amp;hd=1" /><embed width="350" height="300" type="application/x-shockwave-flash" src="http://www.youtube.com/v/744K2EYzYtA&amp;rel=0&amp;hd=1" wmode="transparent" /></object></div>
<ul>
<li> <a title="ColorIt – Screenshots" href="http://blog.fatal-abstraction.net/2012/02/colorit-screenshots/">Screenshots</a></li>
</ul>
<h1>Details</h1>
<ul>
<li><a title="KoreTech Profiler" href="http://blog.fatal-abstraction.net/2012/02/koretech-profiler/">The KoreTech Profiler (+source)</a></li>
<li>The Building Blocks of KoreTech (+source) &#8211; <em>Coming soon!</em></li>
<li>The KoreTech Console (+source) &#8211; <em>Coming soon!</em></li>
</ul>
<div class="share-this"><div id="twitter-share-button" style="width:100px;float:left"><a href="http://twitter.com/share" class="twitter-share-button" data-count="horizontal">Tweet</a></div><div class="plusone" style="width:70px;float:left"><g:plusone size="" annotation="" href="http://blog.fatal-abstraction.net/2012/02/colorit/"></g:plusone></div><div class="facebook-share-button">
					<iframe src="https://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fblog.fatal-abstraction.net%2F2012%2F02%2Fcolorit%2F&amp;send=&amp;layout=&amp;width=&amp;show_faces=&amp;action=&amp;colorscheme=&amp;font=&amp;height=21" 
						scrolling="no" 
						frameborder="0" 
						style="border:none; overflow:hidden; width:px; height:21px;" 
						allowTransparency="true"></iframe>
				</div></div>]]></content:encoded>
			<wfw:commentRss>http://blog.fatal-abstraction.net/2012/02/colorit/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="http://blog.fatal-abstraction.net/wp-content/uploads/2012/02/ColorIt_Trailer.mp4" length="188828239" type="video/mp4" />
		</item>
		<item>
		<title>ColorIt &#8211; Screenshots</title>
		<link>http://blog.fatal-abstraction.net/2012/02/colorit-screenshots/</link>
		<comments>http://blog.fatal-abstraction.net/2012/02/colorit-screenshots/#comments</comments>
		<pubDate>Sun, 05 Feb 2012 15:42:14 +0000</pubDate>
		<dc:creator>Alexander Hofstädter</dc:creator>
				<category><![CDATA[Projects]]></category>
		<category><![CDATA[ColorIt]]></category>
		<category><![CDATA[Screenshots]]></category>

		<guid isPermaLink="false">http://blog.fatal-abstraction.net/?p=62</guid>
		<description><![CDATA[These are some in-game screenshots from the project ColorIt. &#160; &#160; &#160; &#160; Tweet]]></description>
			<content:encoded><![CDATA[<p>These are some in-game screenshots from the project <a title="ColorIt" href="http://blog.fatal-abstraction.net/2012/02/colorit/">ColorIt</a>.</p>
<div id="attachment_65" class="wp-caption aligncenter" style="width: 594px"><a href="http://blog.fatal-abstraction.net/wp-content/uploads/2012/02/ColorIt-Menu.png"><img class="size-large wp-image-65" title="ColorIt Menu" src="http://blog.fatal-abstraction.net/wp-content/uploads/2012/02/ColorIt-Menu-1024x598.png" alt="The Radial Menu of ColorIt" width="584" height="341" /></a><p class="wp-caption-text">ColorIt features fancy radial menus throughout the game to make controller navigation a breeze</p></div>
<p>&nbsp;</p>
<div id="attachment_73" class="wp-caption aligncenter" style="width: 594px"><a href="http://blog.fatal-abstraction.net/wp-content/uploads/2012/02/ColorIt_Tutorial_Screen.png"><img class="size-large wp-image-73" title="ColorIt_Tutorial_Screen" src="http://blog.fatal-abstraction.net/wp-content/uploads/2012/02/ColorIt_Tutorial_Screen-1024x598.png" alt="The ColorIt Tutorial" width="584" height="341" /></a><p class="wp-caption-text">The ColorIt Tutorial Slideshow is displayed at the start of every game until all players are ready</p></div>
<div id="attachment_66" class="wp-caption aligncenter" style="width: 594px"><a href="http://blog.fatal-abstraction.net/wp-content/uploads/2012/02/ColorIt_2P_Bridge.png"><img class="size-large wp-image-66" title="ColorIt_2P_Bridge" src="http://blog.fatal-abstraction.net/wp-content/uploads/2012/02/ColorIt_2P_Bridge-1024x598.png" alt="A two player game of ColorIt on the map &quot;No place too far&quot;" width="584" height="341" /></a><p class="wp-caption-text">Red attempts to cut off Blue&#39;s strategic point by placing a bridge</p></div>
<div id="attachment_71" class="wp-caption aligncenter" style="width: 594px"><a href="http://blog.fatal-abstraction.net/wp-content/uploads/2012/02/ColorIt_Profiler.png"><img class="size-large wp-image-71" title="ColorIt_Profiler" src="http://blog.fatal-abstraction.net/wp-content/uploads/2012/02/ColorIt_Profiler-1024x598.png" alt="The On-Screen-Display for the KoreTech-Profiler in ColorIt" width="584" height="341" /></a><p class="wp-caption-text">The KoreTech-Profiler On-Screen-Display is being used for run-time performance analysis.</p></div>
<div id="attachment_70" class="wp-caption aligncenter" style="width: 594px"><a href="http://blog.fatal-abstraction.net/wp-content/uploads/2012/02/ColorIt_Console.png"><img class="size-large wp-image-70" title="ColorIt_Console" src="http://blog.fatal-abstraction.net/wp-content/uploads/2012/02/ColorIt_Console-1024x598.png" alt="The KoreTech-Console front end" width="584" height="341" /></a><p class="wp-caption-text">We use LibRocket to render the KoreTech-Console frontend with a simple markup system for better legibility</p></div>
<div id="attachment_67" class="wp-caption aligncenter" style="width: 594px"><a href="http://blog.fatal-abstraction.net/wp-content/uploads/2012/02/ColorIt_3P_Nuke.png"><img class="size-large wp-image-67" title="ColorIt_3P_Nuke" src="http://blog.fatal-abstraction.net/wp-content/uploads/2012/02/ColorIt_3P_Nuke-1024x598.png" alt="A three player game of ColorIt on the map &quot;Equal Opportunities&quot;" width="584" height="341" /></a><p class="wp-caption-text">Red attempts to eradicate Green&#39;s heavily fortified strategic point with a nuke, while Blue gleefully captures the remaining points</p></div>
<div id="attachment_69" class="wp-caption aligncenter" style="width: 594px"><a href="http://blog.fatal-abstraction.net/wp-content/uploads/2012/02/ColorIt_4P_OrganicValley.png"><img class="size-large wp-image-69" title="ColorIt_4P_OrganicValley" src="http://blog.fatal-abstraction.net/wp-content/uploads/2012/02/ColorIt_4P_OrganicValley-1024x598.png" alt="A four player match of ColorIt on the map &quot;Organic Valley&quot;" width="584" height="341" /></a><p class="wp-caption-text">The Blue player is about to win as Red and Green attempt an assault on Blue&#39;s positions</p></div>
<div id="attachment_68" class="wp-caption aligncenter" style="width: 594px"><a href="http://blog.fatal-abstraction.net/wp-content/uploads/2012/02/ColorIt_4P_Labyrinth.png"><img class="size-large wp-image-68" title="ColorIt_4P_Labyrinth" src="http://blog.fatal-abstraction.net/wp-content/uploads/2012/02/ColorIt_4P_Labyrinth-1024x598.png" alt="A four player game of ColorIt on the map &quot;Laybrinth&quot;" width="584" height="341" /></a><p class="wp-caption-text">Fierce opponents: Blue and Red duke it out while Green and Purple measure strengths</p></div>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<div class="share-this"><div id="twitter-share-button" style="width:100px;float:left"><a href="http://twitter.com/share" class="twitter-share-button" data-count="horizontal">Tweet</a></div><div class="plusone" style="width:70px;float:left"><g:plusone size="" annotation="" href="http://blog.fatal-abstraction.net/2012/02/colorit-screenshots/"></g:plusone></div><div class="facebook-share-button">
					<iframe src="https://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fblog.fatal-abstraction.net%2F2012%2F02%2Fcolorit-screenshots%2F&amp;send=&amp;layout=&amp;width=&amp;show_faces=&amp;action=&amp;colorscheme=&amp;font=&amp;height=21" 
						scrolling="no" 
						frameborder="0" 
						style="border:none; overflow:hidden; width:px; height:21px;" 
						allowTransparency="true"></iframe>
				</div></div>]]></content:encoded>
			<wfw:commentRss>http://blog.fatal-abstraction.net/2012/02/colorit-screenshots/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
