<?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>.simplicity &#187; C++</title>
	<atom:link href="http://www.dotsimplicity.net/tag/c/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.dotsimplicity.net</link>
	<description>Simple, reliable, simplicity. A software discussion blog</description>
	<lastBuildDate>Sun, 04 Jul 2010 09:44:42 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Sirrf version 0.2.1 released!</title>
		<link>http://www.dotsimplicity.net/2009/08/sirrf-version-0-2-1-released/</link>
		<comments>http://www.dotsimplicity.net/2009/08/sirrf-version-0-2-1-released/#comments</comments>
		<pubDate>Sun, 30 Aug 2009 13:00:59 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[Gaming]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[Irrlicht]]></category>
		<category><![CDATA[Sirrf]]></category>

		<guid isPermaLink="false">http://www.dotsimplicity.net/?p=465</guid>
		<description><![CDATA[0.2.1 is here, 9 days later the simple irrlicht framework team re-emerges with a feature and bug release. Some bugs have been fixed and some new features introduced, the changes include : 

Script-side GameStates
It is now truely possible to derive from the GameState class (through CGameState) in scripts. A bug in previous versions prevented this, [...]]]></description>
			<content:encoded><![CDATA[<p>0.2.1 is here, 9 days later the simple irrlicht framework team re-emerges with a feature and bug release. Some bugs have been fixed and some new features introduced, the changes include : </p>
<ul>
<li><strong>Script-side GameStates</strong><br />
It is now truely possible to derive from the GameState class (through CGameState) in scripts. A bug in previous versions prevented this, but this bug has now been fixed. </li>
<p></p>
<li><strong>Script-side Components</strong><br />
EntityComponent can be derived from script-side (through CEntityComponent), classes in script can now create components and register them with entities from script or engine side. </li>
<p></p>
<li><strong>Script-side Events</strong><br />
The event system is now integrated into the script engine. Script-side classes can derive from IHasSlots and can register, connect and disconnect from slot events. </li>
<p></p>
<li><strong>Important Bug Fixes: </strong>
<ul>
<li>Construction of entity components with parent is now relatively safe. If you are not sure whether your component has a parent, check it after construction. If the component has no parent, destroy it as quickly as possible </li>
<li>AssetProcessors on windows were never loading assets unless the files were all lowercase, restrictions were irrlicht related but solved. </li>
<li>Minor bug fixes with script side things, Scolor fixes, asset groups on entities and much much more. </li>
</ul>
</ul>
<p></p>
<p><strong>Useful links</strong><br />
SourceForge.net page &#8211; <a href="http://sourceforge.net/projects/sirrf">http://sourceforge.net/projects/sirrf</a><br />
Downloads &#8211; <a href="http://sourceforge.net/projects/sirrf/files/">http://sourceforge.net/projects/sirrf/files/</a> | <a href="http://www.ohloh.net/p/sirrf/download?package=Sirrf">http://www.ohloh.net/p/sirrf/download?package=Sirrf </a><br />
Documentation &#8211; <a href="http://sirrf.sourceforge.net/docs/0.2.1/">API</a> | <a href="http://sourceforge.net/apps/trac/sirrf/wiki/Tutorials/v0.2.1">Tutorials</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.dotsimplicity.net/2009/08/sirrf-version-0-2-1-released/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Sirrf version 0.2.0 released!</title>
		<link>http://www.dotsimplicity.net/2009/08/sirrf-version-0-2-0-released/</link>
		<comments>http://www.dotsimplicity.net/2009/08/sirrf-version-0-2-0-released/#comments</comments>
		<pubDate>Fri, 21 Aug 2009 14:44:01 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[Gaming]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[Irrlicht]]></category>
		<category><![CDATA[Sirrf]]></category>

		<guid isPermaLink="false">http://www.dotsimplicity.net/?p=454</guid>
		<description><![CDATA[The latest release of Sirrf, the Simple Irrlicht Framework, version 0.2.0, is now available for download. In the two months since the previous release a lot of changes have taken place. These changes range from small API changes to major feature additions. The most noticeable changes include:

Asset Management
The biggest new feature is asset management. Assets [...]]]></description>
			<content:encoded><![CDATA[<p>The latest release of Sirrf, the Simple Irrlicht Framework, version 0.2.0, is now available for download. In the two months since the previous release a lot of changes have taken place. These changes range from small API changes to major feature additions. The most noticeable changes include:</p>
<ul>
<li><strong>Asset Management</strong><br />
The biggest new feature is asset management. Assets are managed by the AssetManager class. This manager manages so-called asset groups, which represent a collection of assets (meshes, textures, etc). These assets are retrieved from a directory with the appropriate directory structure. In turn the found assets are processed by asset processors. And at the end of the road, the user can use these assets without having to deal with paths. Furthermore asset management makes it possible to reload all assets in realtime, with direct results on the current scene. Reloading assets is as simple as one function call.</li>
<li><strong>XML-based Entity files</strong><br />
It is now possible to load data concerning entities and their components from XML-files. This means that you can now define a scene through XML-files.</li>
<li><strong>Local Event System</strong><br />
As of version 0.2.0 a HasEvents class, which provides the base for a local event system, is available. The availability of local event systems makes the entire framework more performant. Currently the HasEvents class is used by entities and asset groups.</li>
<li><strong>Microsoft Visual C++ 2008 support</strong><br />
Version 0.2.0 is the first release that officialy supports Microsoft Visual C++ 2008. This should make it easier to set up Sirrf-based projects accros multiple platforms.</li>
</ul>
<p>See the change log for more information regarding the changes in Sirrf version 0.2.0.</p>
<p>This is not the end of Sirrf&#8217;s development, though. Sirrf&#8217;s development will continue and Sirrf will undoubtely become even better in the future. And you, as a Sirrf user, as a member of the Irrlicht community, can help us improve the framework. This can be done by contributing code to the project, but also by testing the framework. Either way, we hope that Sirrf will be of use.<br />
</p>
<p><strong>Useful links</strong><br />
SourceForge.net page &#8211; <a href="http://sourceforge.net/projects/sirrf">http://sourceforge.net/projects/sirrf</a><br />
Downloads &#8211; <a href="http://sourceforge.net/projects/sirrf/files/">http://sourceforge.net/projects/sirrf/files/</a> | <a href="http://www.ohloh.net/p/sirrf/download?package=Sirrf">http://www.ohloh.net/p/sirrf/download?package=Sirrf</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.dotsimplicity.net/2009/08/sirrf-version-0-2-0-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sirrf version 0.1.1 released!</title>
		<link>http://www.dotsimplicity.net/2009/06/sirrf-version-0-1-1-released/</link>
		<comments>http://www.dotsimplicity.net/2009/06/sirrf-version-0-1-1-released/#comments</comments>
		<pubDate>Sun, 21 Jun 2009 15:38:14 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[Gaming]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[Irrlicht]]></category>
		<category><![CDATA[Sirrf]]></category>

		<guid isPermaLink="false">http://www.dotsimplicity.net/?p=349</guid>
		<description><![CDATA[It is only two weeks ago since the first official version of Sirrf, the Simple Irrlicht Framework, was released. But now it is already time for the next release: 0.1.1. In comparison to the previous release, this new release adds few new features. Yet the new release can be considered as an important one. Sirrf [...]]]></description>
			<content:encoded><![CDATA[<p>It is only two weeks ago since the first official version of Sirrf, the Simple Irrlicht Framework, was released. But now it is already time for the next release: 0.1.1. In comparison to the previous release, this new release adds few new features. Yet the new release can be considered as an important one. Sirrf 0.1.1 brings an improved scripting architecture; all AngelScript binding code has been moved into its own dedicated directory. Not only does this tidy up the code, but it also to remove scripting quite easily (if desired). This has become even easier with the addition of compilation flags which can be used to easily enable/disable certain features of the framework. Furthermore the have been various small bug fixes and other improvements. See the change log for more information.</p>
<p><strong>Useful links</strong><br />
SourceForge.net page &#8211; <a href="http://sourceforge.net/projects/sirrf">http://sourceforge.net/projects/sirrf</a><br />
Downloads &#8211; <a href="http://sourceforge.net/project/showfiles.php?group_id=260711">http://sourceforge.net/project/showfiles.php?group_id=260711</a> | <a href="http://www.ohloh.net/p/sirrf/download?package=Sirrf">http://www.ohloh.net/p/sirrf/download?package=Sirrf</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.dotsimplicity.net/2009/06/sirrf-version-0-1-1-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sirrf version 0.1.0 released!</title>
		<link>http://www.dotsimplicity.net/2009/06/sirrf-version-010-released/</link>
		<comments>http://www.dotsimplicity.net/2009/06/sirrf-version-010-released/#comments</comments>
		<pubDate>Mon, 08 Jun 2009 17:25:09 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[Gaming]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[Irrlicht]]></category>
		<category><![CDATA[Sirrf]]></category>

		<guid isPermaLink="false">http://www.dotsimplicity.net/?p=299</guid>
		<description><![CDATA[Today the first official version of Sirrf, the Simple Irrlicht Framework, has been released. After two months of steady development Sirrf has finally reached the initial goals of Sirrf 0.1.0: being an extensive, but simple open source framework to enable rapid game development. In its current state Sirrf is able to do exactly that. That&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<p>Today the first official version of Sirrf, the Simple Irrlicht Framework, has been released. After two months of steady development Sirrf has finally reached the initial goals of Sirrf 0.1.0: being an extensive, but simple open source framework to enable rapid game development. In its current state Sirrf is able to do exactly that. That&#8217;s also the reason why Sirrf has jumped directly from pre-alpha status to beta status.</p>
<p>But what can Sirrf do for you? In it&#8217;s current state Sirrf offers game logic, graphics, scripting and sound control. Some noticeable features are:</p>
<ul>
<li><strong>Data Store</strong><br />
The Data Store allows you to store primitive value types such as integers, floats and doubles in a type-independent format. These variables can be accessed from anywhere within the framework, from both native and interpreted code, through the DataStore and DataStack classes.</li>
<li><strong>Entity Management</strong><br />
In Sirrf entities are component-oriented. The idea behind Component Oriented Entities is to make entities data-driven. In order to do this the functionalities are split in various individual components. As a result an entity is in fact nothing more than a collection of components. So, what an entity represents, is defined by its components. Sirrf currently offers various components in the fields of graphics and sound. Furthermore Sirrf also provides an Entity Manager which should be seen as the central interface point to all entity related issues.</li>
<li><strong>Event Management</strong><br />
Sirrf&#8217;s event management is build upon sigslot. This means that Sirrf follows an observer model where objects have to subscribe to an event if they want to react to that event. Currently observers can subscribe to game logic events, input events (passed from Irrlicht) and GUI events (again, passed from Irrlicht).</li>
<li><strong>Game Management</strong><br />
The Game Manager performs generic game initialization and deinitialization. It also provides functions to access sub-systems of the framework, such as the Event Manager and the Entity Manager. It&#8217;s main function, though, is to control the flow of the game through game state management. This class provides various features to this end.</li>
<li><strong>Scripting</strong><br />
Sirrf is almost completely accessible through AngelScript, a free and open source scripting language. AngelScript allows users to extend applications on run-time using scripts that follow a C/C++ like syntax. Furthermore it&#8217;s easy to extend Sirrf&#8217;s AngelScript bindings even further.</li>
</ul>
<p>You might be wondering, though, if Sirrf is really something for you. It&#8217;s obvious that Sirrf is ideal for newcomers to Irrlicht and game development, but Sirrf should also be useful for experts. Especially now experts are more than welcome as Sirrf is still in beta status.</p>
<p>In the coming time focus will lie primarily at adding additional documentation. This will be an crucial step to make the framework more accessible to newcomers. And of course Sirrf will also be extended with new features.</p>
<p><strong>Useful links</strong><br />
Development Hub &#8211; <a href="http://sourceforge.net/projects/sirrf">http://sourceforge.net/projects/sirrf</a><br />
Downloads &#8211; <a href="https://sourceforge.net/project/showfiles.php?group_id=260711">https://sourceforge.net/project/showfiles.php?group_id=260711</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.dotsimplicity.net/2009/06/sirrf-version-010-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sirrf &#8211; Simple Irrlicht Framework (Help Wanted)</title>
		<link>http://www.dotsimplicity.net/2009/05/sirrf-simple-irrlicht-framework-help-wanted/</link>
		<comments>http://www.dotsimplicity.net/2009/05/sirrf-simple-irrlicht-framework-help-wanted/#comments</comments>
		<pubDate>Fri, 15 May 2009 15:19:49 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[Gaming]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[Irrlicht]]></category>
		<category><![CDATA[Sirrf]]></category>

		<guid isPermaLink="false">http://www.dotsimplicity.net/?p=266</guid>
		<description><![CDATA[Team name
The Sirrf Project
Project name
Sirrf &#8211; Simple Irrlicht Framework
Brief description
Sirrf, the Simple Irrlicht Framework, is an extensive, but open source and simple framework for rapid game development. Sirrf provides end-users a game skeleton which implements concepts such as states, component-based entities and a datastore. Newer hobbyist game developers will probably benefit most from the project, [...]]]></description>
			<content:encoded><![CDATA[<h3>Team name</h3>
<p>The Sirrf Project</p>
<h3>Project name</h3>
<p>Sirrf &#8211; Simple Irrlicht Framework</p>
<h3>Brief description</h3>
<p>Sirrf, the Simple Irrlicht Framework, is an extensive, but open source and simple framework for rapid game development. Sirrf provides end-users a game skeleton which implements concepts such as states, component-based entities and a datastore. Newer hobbyist game developers will probably benefit most from the project, but hopefully Sirrf will also be useful for experienced developers.</p>
<h3>Target aim</h3>
<p><em>Long term</em></p>
<p>Making a game isn&#8217;t a simple task. The goal of the Sirrf project is to create an extensive, but simple framework to enable rapid game development. Furthermore, Sirrf is aimed for as broad of a target audience as possible. Sirrf hopes to accomplish this by maintaining a cross-platform nature and a lack of genre specialization. Additionally, the framework is not-for-profit and open source, licensed under the zlib/libpng license.</p>
<p><em>Short term</em></p>
<p>At the moment the main priority is to finish the core, which will form the base for future releases. The first release is expected after Irrlicht 1.6 and AngelScript 2.17.0 are released.</p>
<h3>Compensation</h3>
<p>Sirrf is open to donations, but this doesn&#8217;t guarantee regular financial compensation. So expect to work largely without financial compensation.</p>
<h3>Technology</h3>
<p>There are no requirements for developers to use specific tools; developers are free to choose their own tools. Please note that Sirrf currently uses the following languages and APIs:</p>
<p>Programming Language: C++<br />
Scripting Language: AngelScript<br />
Rendering: Irrlicht<br />
Sound: SFML-Audio</p>
<h3>Talent needed</h3>
<p><em>C++ Programmers</em></p>
<p>Sirrf is looking for additional programmers. Moderate knowledge of C++ is required. Knowledge of other components, such as AngelScript and Irrlicht, is preferred. You&#8217;ll work with other programmers over the SVN of Sirrf. As programmer you&#8217;ll be working on multiple different areas of the code, but it&#8217;s possible to specialize on one part of the code. Additional programmers on the following topics would be much appreciated:</p>
<p>- Core Development (graphics, scripting, I/O)<br />
- Physics</p>
<p><em>Windows and Mac OSX Maintainers</em></p>
<p>Sirrf is currently only supported on Linux; maintainers for Windows and Mac OSX are needed.</p>
<h3>Team structure</h3>
<p><em>Michael Bartsch</em></p>
<p>In the past I&#8217;ve worked on several projects. The smaller projects nearly always involved some implementation of Irrlicht. My bigger projects, however, are mostly unrelated to Irrlicht. My latest project was the <a href="http://code.google.com/p/aia-project/">Aia-project</a>, a project with the goal to create a small artificial intelligent robot. And before that I worked on <a href="http://sf.net/projects/ewrpg/">Entwined Worlds</a>, a 2D Action-RPG, that has never been released. Furthermore, I&#8217;m one of the editors of .simplicity.</p>
<h3>Contact Information</h3>
<p>Contact me via <a href="http://sourceforge.net/users/zccdark203/">SourceForge</a>.</p>
<h3>Additional Information</h3>
<p><em>Links</em></p>
<p>Development Hub &#8211; <a href="http://apps.sourceforge.net/trac/sirrf/">http://apps.sourceforge.net/trac/sirrf/</a><br />
SourceForge Project Page &#8211; <a href="http://sf.net/projects/sirrf/">http://sf.net/projects/sirrf/</a><br />
Subversion Repository &#8211; <a href="http://sirrf.svn.sourceforge.net/viewvc/sirrf/">http://sirrf.svn.sourceforge.net/viewvc/sirrf/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.dotsimplicity.net/2009/05/sirrf-simple-irrlicht-framework-help-wanted/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>STF Utility (updated!)</title>
		<link>http://www.dotsimplicity.net/2009/04/sss-parser/</link>
		<comments>http://www.dotsimplicity.net/2009/04/sss-parser/#comments</comments>
		<pubDate>Sat, 25 Apr 2009 21:51:29 +0000</pubDate>
		<dc:creator>Nick</dc:creator>
				<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Software Idea]]></category>
		<category><![CDATA[!XML]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[parser]]></category>
		<category><![CDATA[SSS]]></category>
		<category><![CDATA[Templates]]></category>
		<category><![CDATA[w00t]]></category>

		<guid isPermaLink="false">http://www.dotsimplicity.net/?p=191</guid>
		<description><![CDATA[The SSS STF (a cool new format for storing data with multiple levels but still &#62; XML, more info here) parser is almost finished. I&#8217;m trying to simplify it up as we speak. C++ Templates sure can be frustrating! &#8220;/me twitches with his eyes.&#8221;
So the parser was working, but it didn&#8217;t utilize C++ all the [...]]]></description>
			<content:encoded><![CDATA[<p>The <span style="text-decoration: line-through;">SSS</span> STF (a cool new format for storing data with multiple levels but still &gt; XML, more info <a href="http://www.dotsimplicity.net/?p=188">here</a>) parser is almost finished. I&#8217;m trying to simplify it up as we speak. C++ Templates sure can be frustrating! <em>&#8220;/me twitches with his eyes.&#8221;</em></p>
<p>So the parser was working, but it didn&#8217;t utilize C++ all the way. I&#8217;m trying to reduce the code and thus ease further development and maintainability.</p>
<p><em>Some hours later&#8230;</em></p>
<p>It is finished! As far as I can tell anyway.  It has a nice example app with it, here&#8217;s a (now already dated) sneak peek:</p>
<pre class="brush: cpp;">    prettyprint(&quot;Welcome to the SSS example app&quot;);
cout
&lt;&lt; &quot;This application shows how easy it is to use SSS.\n&quot;
&lt;&lt; &quot;STF is a \&quot;new\&quot; way to store leveled data, just as XML can do, for example.\n&quot;
&lt;&lt; &quot;The format looks like a C(++) struct, which we think is easier to read than XML.\n&quot;
&lt;&lt; &quot;Each :{ is a node, a node has other nodes and values. The first node is unnamed.\n&quot;
&lt;&lt; endl;
</pre>
<p>So what are you waiting for? <a href="http://sourceforge.net/projects/STFU">Grab the source with example app from the SourceForge page</a> (either checkout from the SVN or select &#8220;Browse SVN&#8221; -&gt; &#8220;Download GNU tarball&#8221; (all the way down) ), and use this neat alternative to XML! More information after the break.</p>
<p><span id="more-191"></span> Its documentation is made with Doxygen (nice program by the way, never used it until today, and it creates nice documentation) and can be found <a href="http://www.dotsimplicity.net/SSSParser/doc/index.html">here(with left explorer style bar)</a> and <a href="http://www.dotsimplicity.net/SSSParser/doc/main.html">here(without)</a>. With the documentation is the code for review by you, because I&#8217;d like some comments where I could improve. About half of it was first written by Maurice Bos of BosByte and then completely reviewed and altered by me. Then I added the other half. I tried to use C++&#8217;s features where I could, and I&#8217;m quite happy with the results.</p>
<p>So again, comments on the code are welcome! You can view the code in the documentation.</p>
<p>What did you say? How it looks?</p>
<p>Like this:</p>
<pre>imthefirst: "The first value!"
name with spaces: "Names can contain spaces"
name
with
newlines: "And even newlines!"

test: {
    blah: "The value of [root].test.blah"
    newlines: "newlines and all their whitespace
             get stored"
    comment: This comment value contains some information about how to comment in SSS files.
    "You can place comment before the quotes, the parser will ignore it."
    output this: "This particular value is retrieved in the code."
    output child:
    Same goes for children. The parser ignores anything until a curly bracket is found. {
        info: "Awwwwwwright! Tree output oh yeah."
        coolness: "+20"
    }
    Array: { :"This" :"is" :"like" :"an" :"array" }

    2D array:
    {
            : { :"First" :"Row" }
            : { :"Second" :"Row" :"!" }
    }
}</pre>
<p>But seriously, go check out the SF page, download the STFU and play around with it. It oozes simplicity.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dotsimplicity.net/2009/04/sss-parser/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Component Oriented Entities &#8211; Updated (and some more&#8230;)</title>
		<link>http://www.dotsimplicity.net/2009/04/component-oriented-entities-updated-and-some-more/</link>
		<comments>http://www.dotsimplicity.net/2009/04/component-oriented-entities-updated-and-some-more/#comments</comments>
		<pubDate>Sat, 25 Apr 2009 20:24:17 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Software Idea]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[Component]]></category>
		<category><![CDATA[DataStore]]></category>
		<category><![CDATA[Entities]]></category>

		<guid isPermaLink="false">http://www.dotsimplicity.net/?p=193</guid>
		<description><![CDATA[The code I posted in the article Component Oriented Entities has been updated. The code in that article contained some documentation mistakes. Thanks to Nick these mistakes have been corrected. Besides that I&#8217;ve also added some new methods (Entity::remove*) which were somehow forgotten in the first implementation. And of course the code has also been [...]]]></description>
			<content:encoded><![CDATA[<p>The code I posted in the article <a title="Component Oriented Entities" href="http://www.dotsimplicity.net/?p=181">Component Oriented Entities</a> has been updated. The code in that article contained some documentation mistakes. Thanks to Nick these mistakes have been corrected. Besides that I&#8217;ve also added some new methods (Entity::remove*) which were somehow forgotten in the first implementation. And of course the code has also been slightly improved. Unfortunately the Event Management part of the implementation still hasn&#8217;t been included. Still I would like to encourage people who are using the code or parts of it to update their own code.</p>
<p>Also, a sneak peek on what I&#8217;m currently working on.</p>
<p><span id="more-193"></span></p>
<p>DataStore.h</p>
<pre class="brush: cpp;">

#ifndef __DATASTORE_H__
#define __DATASTORE_H__

// Include files
#include &quot;../dependencies.h&quot;
#include &quot;DataStack.h&quot;

// Forward declarations
class DataStack;

// DataStore class.
class DataStore
{
public:

    // Initialisation and deinitialisation
    DataStore();
    ~DataStore();

    void init();
    void clear();

    // Methods
    bool addDataStack(DataStack *stack);
    DataStack* createDataStack(const std::string &amp;name);

    DataStack* getDataStack(const unsigned int id);
    DataStack* getDataStack(const std::string &amp;name);

    void removeAll();
    bool removeDataStack(DataStack *stack);
    bool removeDataStack(const unsigned int);
    bool removeDataStack(const std::string &amp;name);

private:

    // Normal members
    std::vector&lt;DataStack*&gt; mStacks;

};

#endif
</pre>
<p>DataStore.cpp</p>
<pre class="brush: cpp;">

// Include files
#include &quot;DataStore.h&quot;

// DataStore class
// DataStore constructor.
DataStore::DataStore()
{
    init();
}

// DataStore deconstructor.
DataStore::~DataStore()
{
    clear();
}

// Initialises the Data Store.
void DataStore::init()
{
}

// Clears the Data Store.
void DataStore::clear()
{
    removeAll();
}

// Adds the given Data Stack to the Data Store.
bool DataStore::addDataStack(DataStack *stack)
{
    // Did we get a valid pointer?
    if(stack == NULL)
      return false;

    // Does a Data Stack with the same name exist?
    if(getDataStack(stack-&gt;getName()))
      return false;

    // Add the Data Stack to the vector.
    mStacks.push_back(stack);

    return true;
}

// Creates a Data Stack with the given name.
DataStack* DataStore::createDataStack(const std::string &amp;name)
{
    // Does a Data Stack with the same name exist?
    if(getDataStack(name))
      return NULL;

    // Create the Data Stack and add it to the vector.
    DataStack *stack = new DataStack(name);
    mStacks.push_back(stack);

    return stack;
}

// Gets the Data Stack with the given id.
DataStack* DataStore::getDataStack(const unsigned int id)
{
    for(unsigned int i = 0; i &lt; mStacks.size(); i++)
    {
       if(mStacks[i]-&gt;getID() == id)
         return mStacks[i];
    }

    return NULL;
}

// Gets the Data Stack with the given name.
DataStack* DataStore::getDataStack(const std::string &amp;name)
{
    for(unsigned int i = 0; i &lt; mStacks.size(); i++)
    {
       if(mStacks[i]-&gt;getName() == name)
         return mStacks[i];
    }

    return NULL;
}

// Removes all Data Stacks from this Data Store.
void DataStore::removeAll()
{
    // Clear the Data Stacks.
    for(unsigned int i = 0; i &lt; mStacks.size(); i++)
      delete mStacks[i];

    mStacks.clear();
}

// Removes the given Data Stack.
bool DataStore::removeDataStack(DataStack *stack)
{
    // Did we get a valid pointer?
    if(stack == NULL)
      return false;

    // Try to remove the Data Stack.
    vector&lt;DataStack*&gt;::iterator it;

    for(it = mStacks.begin(); it &lt; mStacks.end(); it++)
    {
        DataStack *dstack = *it;

        if(dstack == stack)
        {
           delete dstack;
           mStacks.erase(it);
           return true;
        }
    }

    // We couldn't find the Data Stack and thus couldn't remove it.
    return false;

}

// Removes the given Data Stack with the given id.
bool DataStore::removeDataStack(const unsigned int id)
{
    // Try to remove the Data Stack.
    vector&lt;DataStack*&gt;::iterator it;

    for(it = mStacks.begin(); it &lt; mStacks.end(); it++)
    {
        DataStack *dstack = *it;

        if(dstack-&gt;getID() == id)
        {
           delete dstack;
           mStacks.erase(it);
           return true;
        }
    }

    // We couldn't find the Data Stack and thus couldn't remove it.
    return false;
}

// Removes the given Data Stack with the given name.
bool DataStore::removeDataStack(const std::string &amp;name)
{
    // Try to remove the Data Stack.
    vector&lt;DataStack*&gt;::iterator it;

    for(it = mStacks.begin(); it &lt; mStacks.end(); it++)
    {
        DataStack *dstack = *it;

        if(dstack-&gt;getName() == name)
        {
           delete dstack;
           mStacks.erase(it);
           return true;
        }
    }

    // We couldn't find the Data Stack and thus couldn't remove it.
    return false;
}

// End of File
</pre>
<p>DataStack.h</p>
<pre class="brush: cpp;">

#ifndef __DATASTACK_H__
#define __DATASTACK_H__

// Include files
#include &quot;../dependencies.h&quot;
#include &quot;DataStore.h&quot;

// Forward declarations.
class DataStore;

// DataStack class.
class DataStack
{

    friend class DataStore;

public:

    // Initialisation and deinitialisation
    DataStack(const std::string &amp;name);
    ~DataStack();

    void init();
    void clear();

    // Methods
    unsigned int getID() const;
    const std::string&amp; getName() const;

    unsigned int getSize() const;

    // Sets the variable with the given name.
    template&lt;typename T&gt;
    bool setVar(const std::string &amp;name, const T &amp;value)
    {
        std::stringstream ss;
        ss &lt;&lt; value;

        if(ss.good())
        {
           mVars[name] = ss.str();
           return true;
        }

        else return false;
    };

    // Gets the variable with the given name.
    template&lt;typename T&gt;
    T getVar(const std::string &amp;name)
    {
        std::map&lt;std::string, std::string&gt;::iterator it;
        it = mVars.find(name);

        if(it != mVars.end())
        {
           std::stringstream ss(it-&gt;second);

           T t;
           ss &gt;&gt; t;
           return t;
        }

        else return NULL;
    };

    void removeAll();
    bool removeVar(const std::string &amp;name);

    //bool save(const std::string &amp;filename); TODO
    //bool load(const std::string &amp;filename); TODO

private:

    // Static members
    static unsigned int mIDCount;

    // Normal members
    unsigned int mID;
    std::string mName;

    std::map&lt;std::string, std::string&gt; mVars;
};

#endif
</pre>
<p>DataStack.cpp</p>
<pre class="brush: cpp;">

// Include files.
#include &quot;DataStack.h&quot;

// DataStack class
// Static variables.
unsigned int DataStack::mIDCount = 0;

// DataStack constructor.
DataStack::DataStack(const std::string &amp;name)
: mName(name)
{
    mID = mIDCount++;
}

// DataStack deconstructor.
DataStack::~DataStack()
{
    clear();
}

// Initialises the Data Stack.
void DataStack::init()
{
}

// Clears the Data Stack.
void DataStack::clear()
{
    removeAll();
}

// Gets the ID of the Data Stack.
unsigned int DataStack::getID() const
{
    return mID;
}

// Gets the name of the Data Stack.
const std::string&amp; DataStack::getName() const
{
    return mName;
}

// Gets the number of variables on the Data Stack.
unsigned int DataStack::getSize() const
{
    return mVars.size();
}

// Removes all variables from this Data Stack.
void DataStack::removeAll()
{
    mVars.clear();
}

// Removes the variable with the given name.
bool DataStack::removeVar(const std::string &amp;name)
{
    std::map&lt;std::string, std::string&gt;::iterator it;
    it = mVars.find(name);

    if(it != mVars.end())
    {
       mVars.erase(it);
       return true;
    }

    else return false;
}

// End of File
</pre>
<p>Remember that all of the above code has been placed in the public domain and that I’ll take no responsibility or liability of any kind for any use that you may make of this code.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dotsimplicity.net/2009/04/component-oriented-entities-updated-and-some-more/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Component Oriented Entities</title>
		<link>http://www.dotsimplicity.net/2009/04/component-oriented-entities/</link>
		<comments>http://www.dotsimplicity.net/2009/04/component-oriented-entities/#comments</comments>
		<pubDate>Fri, 10 Apr 2009 12:26:22 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[Gaming]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Software Idea]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[Component]]></category>
		<category><![CDATA[Entities]]></category>

		<guid isPermaLink="false">http://www.dotsimplicity.net/?p=181</guid>
		<description><![CDATA[Recently I started working at a game framework. The idea is to create a reusable framework that can be used across multiple platforms and libraries (I.e. Irrlicht, OGRE, SDL). Myself, I already have some experience with game programming (Entwined Worlds). However, all my previous game implementations were based upon the traditional deep hierarchy approach. At [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I started working at a game framework. The idea is to create a reusable framework that can be used across multiple platforms and libraries (I.e. Irrlicht, OGRE, SDL). Myself, I already have some experience with game programming (<a href="http://sf.net/projects/ewrpg/">Entwined Worlds</a>). However, all my previous game implementations were based upon the traditional deep hierarchy approach. At first sight this seems like a good idea, but I noticed that this approach always leads to very specialized entities. The true problem with this is that those entities often share various functionalities. And in order to prevent rewriting the same code over and over again, these functionalities are often put in a derived class from the base entity class. And the specialized entities then inherit from that class. The problem should become clear now: for every set of shared functionalities the programmer has to inherit from the base class (or maybe even an derived class). This can result in a gigantic unmaintainable tree of entities. Luckily, there is another approach called Component Oriented Entities.</p>
<p>The idea behind Component Oriented Entities is to make entities data-driven. In order to do this the functionalities are split in various individual components. As a result an entity is in fact nothing more than a collection of components. An added advantage is the ability to describe these components (and thus the entities) in XML or a similar mark-up language.</p>
<p>Yesterday I actually had a discussion with Nick about Component Oriented Entities. Initially he disagreed with me as I had some trouble explaining the &#8220;dangers&#8221; of the blob anti-pattern (a huge single class with a large amount of complex functionality). Later on, he agreed with me, but he also pointed out some things to keep in mind. One of those things was the implementation. And I really agree with that as these kind of things stand or fall based upon the implementation. Which brings me to my own implementation of Component Oriented Entities. Please note that all of the following code has been placed in the public domain and that I&#8217;ll take no responsibility or liability of any kind for any use that you may make of this code.</p>
<p><span id="more-181"></span></p>
<p>Lets start with the Entity Manager.</p>
<p>EntityManager.h</p>
<pre class="brush: cpp;">
#ifndef __ENTITYMANAGER_H__
#define __ENTITYMANAGER_H__

// Include files
#include &quot;../dependencies.h&quot;
#include &quot;Entity.h&quot;

// Forward declarations
class Entity;

// EntityManager class
class EntityManager
{
public:

    // Initialisation and deinitialisation
    EntityManager();
    ~EntityManager();

    void init();
    void clear();

    // Methods
    bool addEntity(Entity *entity);
    Entity* createEntity(const std::string &amp;name);

    Entity* getEntity(const unsigned int id);
    Entity* getEntity(const std::string &amp;name);

    void removeAll();
    bool removeEntity(Entity *entity);
    bool removeEntity(const unsigned int id);
    bool removeEntity(const std::string &amp;name);

private:

    vector&lt;Entity*&gt; mEntities;
};

#endif
</pre>
<p>EntityManager.cpp</p>
<pre class="brush: cpp;">

// Include files
#include &quot;EntityManager.h&quot;

// EntityManager class
// EntityManager constructor.
EntityManager::EntityManager()
{
    init();
}

// EntityManager deconstructor.
EntityManager::~EntityManager()
{
    clear();
}

// Initialises the Entity Manager.
void EntityManager::init()
{
}

// Clears the Entity Manager.
void EntityManager::clear()
{
    // Clear entities.
    removeAll();
}

// Adds an entity to the Entity Manager.
bool EntityManager::addEntity(Entity *entity)
{
    // Did we get a valid pointer?
    if(entity == NULL)
      return false;

    // Look if a entity with given name doesn't already exist.
    if(getEntity(entity-&gt;getName()))
      return false;

    // Add the entity.
    mEntities.push_back(entity);

    return true;
}

// Creates an entity with the given name and adds it to the Entity Manager.
Entity* EntityManager::createEntity(const std::string &amp;name)
{
    // Look if a entity with given name doesn't already exist.
    if(getEntity(name))
      return NULL;

    // Add the entity.
    Entity *entity = new Entity(name);
    mEntities.push_back(entity);

    return entity;
}

// Gets the entity with the given ID.
Entity* EntityManager::getEntity(const unsigned int id)
{
    for(unsigned int i = 0; i &lt; mEntities.size(); i++)
    {
       if(mEntities[i]-&gt;getID() == id)
         return mEntities[i];
    }

    return NULL;
}

// Gets the entity with the given name.
Entity* EntityManager::getEntity(const std::string &amp;name)
{
    for(unsigned int i = 0; i &lt; mEntities.size(); i++)
    {
       if(mEntities[i]-&gt;getName() == name)
         return mEntities[i];
    }

    return NULL;
}

// Removes all entities.
void EntityManager::removeAll()
{
    for(unsigned int i = 0; i &lt; mEntities.size(); i++)
      delete mEntities[i];

    mEntities.clear();
}

// Removes the given entity.
bool EntityManager::removeEntity(Entity *entity)
{
    // Did we get a valid pointer?
    if(entity == NULL)
      return false;

    // Try to remove the entity.
    vector&lt;Entity*&gt;::iterator it;

    for(it = mEntities.begin(); it &lt; mEntities.end(); it++)
    {
        Entity *ent = *it;

        if(ent == entity)
        {
           delete ent;
           mEntities.erase(it);
           return true;
        }
    }

    // We couldn't find the entity and thus couldn't remove it.
    return false;
}

// Removes the entity with the given ID.
bool EntityManager::removeEntity(const unsigned int id)
{
    // Try to remove the entity.
    vector&lt;Entity*&gt;::iterator it;

    for(it = mEntities.begin(); it &lt; mEntities.end(); it++)
    {
        Entity *ent = *it;

        if(ent-&gt;getID() == id)
        {
           delete ent;
           mEntities.erase(it);
           return true;
        }
    }

    // We couldn't find the entity and thus couldn't remove it.
    return false;
}

// Removes the entity with the given name.
bool EntityManager::removeEntity(const std::string &amp;name)
{
    // Try to remove the entity.
    vector&lt;Entity*&gt;::iterator it;

    for(it = mEntities.begin(); it &lt; mEntities.end(); it++)
    {
        Entity *ent = *it;

        if(ent-&gt;getName() == name)
        {
           delete ent;
           mEntities.erase(it);
           return true;
        }
    }

    // We couldn't find the entity and thus couldn't remove it.
    return false;
}

// End of File
</pre>
<p>The Entity Manager takes care of organizing all entities. Through the Entity Manager it&#8217;s possible to create, add, get and remove entities. To this end the Entity Manager offers various methods.</p>
<p>Now lets look at the Entity class.</p>
<p>Entity.h</p>
<pre class="brush: cpp;">
#ifndef __ENTITY_H__
#define __ENTITY_H__

// Include files
#include &quot;../dependencies.h&quot;
#include &quot;EntityComponent.h&quot;

// Forward declarations
class EntityComponent;

// Entity class
class Entity
{
public:

    // Initialisation and deinitialisation
    Entity(const std::string &amp;name);
    ~Entity();

    void init();
    void clear();

    // Methods
    unsigned int getID() const;
    const std::string&amp; getName() const;

    bool addComponent(EntityComponent* component);

    EntityComponent* getComponent(const unsigned int id);
    EntityComponent* getComponent(const std::string &amp;name);

    void removeAll();
    bool removeComponent(EntityComponent *component);
    bool removeComponent(const unsigned int id);
    bool removeComponent(const std::string &amp;name);

private:

    // Static members
    static unsigned int mIDCount;

    // Normal members
    unsigned int mID;
    std::string mName;

    vector&lt;EntityComponent*&gt; mComponents;
};

#endif
</pre>
<p>Entity.cpp</p>
<pre class="brush: cpp;">

// Include files
#include &quot;Entity.h&quot;

// Entity class
// Static variables.
unsigned int Entity::mIDCount = 0;

// Entity constructor.
Entity::Entity(const std::string &amp;name)
: mName(name)
{
    mID = mIDCount++;

    init();
}

// Entity deconstructor.
Entity::~Entity()
{
    clear();
}

// Initialises the entity.
void Entity::init()
{
}

// Clears the entity.
void Entity::clear()
{
    // Remove all components.
    removeAll();
}

// Gets the ID of this entity.
unsigned int Entity::getID() const
{
    return mID;
}

// Gets the name of this entity.
const std::string&amp; Entity::getName() const
{
    return mName;
}

// Adds a component to the entity.
bool Entity::addComponent(EntityComponent *component)
{
    // Did we get a pointer to a component?
    if(component == NULL)
      return false;

    // Check if a component of the given type doesn't already exist.
    if(getComponent(component-&gt;getName()))
      return false;

    // Add new component.
    mComponents.push_back(component);

    return true;
}

// Gets the component with the given ID from this entity.
EntityComponent* Entity::getComponent(const unsigned int id)
{
    for(unsigned int i = 0; i &lt; mComponents.size(); i++)
    {
       if(mComponents[i]-&gt;getID() == id)
         return mComponents[i];
    }

    return NULL;
}

// Gets the component with the given name from this entity.
EntityComponent* Entity::getComponent(const std::string &amp;name)
{
    for(unsigned int i = 0; i &lt; mComponents.size(); i++)
    {
       if(mComponents[i]-&gt;getName() == name)
         return mComponents[i];
    }

    return NULL;
}

// Removes all components.
void Entity::removeAll()
{
    for(unsigned int i = 0; i &lt; mComponents.size(); i++)
       delete mComponents[i];

    mComponents.clear();
}

// Removes the given component.
bool Entity::removeComponent(EntityComponent *component)
{
    // Did we get a valid pointer?
    if(component == NULL)
      return false;

    // Try to remove the entity.
    vector&lt;EntityComponent*&gt;::iterator it;

    for(it = mComponents.begin(); it &lt; mComponents.end(); it++)
    {
        EntityComponent *comp = *it;

        if(comp == component)
        {
           delete comp;
           mComponents.erase(it);
           return true;
        }
    }

    // We couldn't find the entity and thus couldn't remove it.
    return false;
}

// Removes the component with the given ID.
bool Entity::removeComponent(const unsigned int id)
{
    // Try to remove the entity.
    vector&lt;EntityComponent*&gt;::iterator it;

    for(it = mComponents.begin(); it &lt; mComponents.end(); it++)
    {
        EntityComponent *comp = *it;

        if(comp-&gt;getID() == id)
        {
           delete comp;
           mComponents.erase(it);
           return true;
        }
    }

    // We couldn't find the entity and thus couldn't remove it.
    return false;
}

// Removes the component with the given name.
bool Entity::removeComponent(const std::string &amp;name)
{
    // Try to remove the entity.
    vector&lt;EntityComponent*&gt;::iterator it;

    for(it = mComponents.begin(); it &lt; mComponents.end(); it++)
    {
        EntityComponent *comp = *it;

        if(comp-&gt;getName() == name)
        {
           delete comp;
           mComponents.erase(it);
           return true;
        }
    }

    // We couldn't find the entity and thus couldn't remove it.
    return false;
}

// End of File
</pre>
<p>As you can see an entity is a collection of an ID, name and a vector of components. That means that an entity is largely defined by its components. These are in my implementation described by the EntityComponent class.</p>
<p>EntityComponent.h</p>
<pre class="brush: cpp;">

#ifndef __ENTITYCOMPONENT_H__
#define __ENTITYCOMPONENT_H__

// Include files
#include &quot;../dependencies.h&quot;
#include &quot;Entity.h&quot;

// Forward declarations
class Entity;

// EntityComponent class
class EntityComponent
{
public:

    // Initialisation and deinitialisation
    EntityComponent(Entity *parent);
    virtual ~EntityComponent();

    // Methods
    unsigned int getID() const;
    const std::string&amp; getName() const;

    const Entity* getParent();

protected:

    void setName(const std::string &amp;name);

private:

    // Static members
    static unsigned int mIDCount;

    // Normal members
    Entity *pParent;

    unsigned int mID;
    std::string mName;
};

#endif
</pre>
<p>EntityComponent.cpp</p>
<pre class="brush: cpp;">

// Include files
#include &quot;EntityComponent.h&quot;

// EntityComponent class
// Static variables.
unsigned int EntityComponent::mIDCount = 0;

// EntityComponent constructor.
EntityComponent::EntityComponent(Entity *parent)
: pParent(parent)
{
    // Get new unique ID.
    mID = mIDCount++;

    // Check if we got a valid pointer.
    if(parent == NULL)
      delete this;

    else parent-&gt;addComponent(this);
}

// EntityComponent deconstructor.
EntityComponent::~EntityComponent()
{
}

// Sets the name of the component.
void EntityComponent::setName(const std::string &amp;name)
{
    mName = name;
}

// Gets the ID of the component.
unsigned int EntityComponent::getID() const
{
    return mID;
}

// Gets the name of the component.
const std::string&amp; EntityComponent::getName() const
{
    return mName;
}

// Gets the parent of this component.
const Entity* EntityComponent::getParent()
{
    return pParent;
}

// End of File
</pre>
<p>And just as the Entity class, the EntityComponent is also fairly simple. You might be wondering, though, how these components communicate with each other and other parts of the framework. The truth is that I&#8217;ve build an Event Manager on top of this entity system that takes care of that. Unfortunately that Event Manager depends on a third-party library called <a href="http://sigslot.sf.net/">Sigslot</a> And I think that such thing is beyond the scope of this post. Partly, also because I&#8217;m still tweaking my Event Manager myself and don&#8217;t feel comfortable yet showing that.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dotsimplicity.net/2009/04/component-oriented-entities/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
