<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Managing Data Relationships</title>
	<atom:link href="http://gamesfromwithin.com/managing-data-relationships/feed" rel="self" type="application/rss+xml" />
	<link>http://gamesfromwithin.com/managing-data-relationships</link>
	<description>Living the indie life</description>
	<lastBuildDate>Thu, 09 Feb 2012 12:36:00 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: Noel</title>
		<link>http://gamesfromwithin.com/managing-data-relationships/comment-page-1#comment-8220</link>
		<dc:creator>Noel</dc:creator>
		<pubDate>Mon, 02 Aug 2010 00:15:43 +0000</pubDate>
		<guid isPermaLink="false">http://gamesfromwithin.com/?p=942#comment-8220</guid>
		<description>Right. I was assuming you have a serialization system in place (memory dump, XML, whatever). Objects that are referred to by a handle have the handle included as part of their data (so that &quot;23&quot; for the handle gets saved out). When you restore, the object has that handle (which is invalid), and all you have to do is update the handle manager with the new pointer value for that handle.</description>
		<content:encoded><![CDATA[<p>Right. I was assuming you have a serialization system in place (memory dump, XML, whatever). Objects that are referred to by a handle have the handle included as part of their data (so that &#8220;23&#8243; for the handle gets saved out). When you restore, the object has that handle (which is invalid), and all you have to do is update the handle manager with the new pointer value for that handle.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rachel 'Groby' Blum</title>
		<link>http://gamesfromwithin.com/managing-data-relationships/comment-page-1#comment-8219</link>
		<dc:creator>Rachel 'Groby' Blum</dc:creator>
		<pubDate>Sun, 01 Aug 2010 23:40:06 +0000</pubDate>
		<guid isPermaLink="false">http://gamesfromwithin.com/?p=942#comment-8219</guid>
		<description>Yes, but you do need to map the handle to an object &#039;name&#039; for lack of a better word, no? &#039;Handle 23&#039; after all can be just about anything. Alternatively, you serialize all objects, I guess.  (Also, don&#039;t let my ramblings distract you from your move ;)

I guess I&#039;m trying to figure out how it helps you with de/serializing subsets of your object graph at different points in time. Looking forward to the blog post!</description>
		<content:encoded><![CDATA[<p>Yes, but you do need to map the handle to an object &#8216;name&#8217; for lack of a better word, no? &#8216;Handle 23&#8242; after all can be just about anything. Alternatively, you serialize all objects, I guess.  (Also, don&#8217;t let my ramblings distract you from your move <img src='http://gamesfromwithin.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>I guess I&#8217;m trying to figure out how it helps you with de/serializing subsets of your object graph at different points in time. Looking forward to the blog post!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Noel</title>
		<link>http://gamesfromwithin.com/managing-data-relationships/comment-page-1#comment-8199</link>
		<dc:creator>Noel</dc:creator>
		<pubDate>Sun, 01 Aug 2010 03:13:42 +0000</pubDate>
		<guid isPermaLink="false">http://gamesfromwithin.com/?p=942#comment-8199</guid>
		<description>Good eyes! That&#039;s something I totally glossed over in the original article and I meant to write a blog post to supplement it. I&#039;ll try to do it in the next few weeks (when I&#039;m done with the move).

The quick answer is that you can serialize the contents of the handle manager. The pointers are irrelevant, but the handles aren&#039;t. At load time, when you re-create the objects, instead of adding them to the handle manager, all you say is &quot;update this handle with this new location&quot;. It&#039;s pretty much the same as doing a pointer fixup, just through the handle manager (but the good thing is that you only have to do it for the object itself, and any other data that contained that handle will be valid after loading).</description>
		<content:encoded><![CDATA[<p>Good eyes! That&#8217;s something I totally glossed over in the original article and I meant to write a blog post to supplement it. I&#8217;ll try to do it in the next few weeks (when I&#8217;m done with the move).</p>
<p>The quick answer is that you can serialize the contents of the handle manager. The pointers are irrelevant, but the handles aren&#8217;t. At load time, when you re-create the objects, instead of adding them to the handle manager, all you say is &#8220;update this handle with this new location&#8221;. It&#8217;s pretty much the same as doing a pointer fixup, just through the handle manager (but the good thing is that you only have to do it for the object itself, and any other data that contained that handle will be valid after loading).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rachel 'Groby' Blum</title>
		<link>http://gamesfromwithin.com/managing-data-relationships/comment-page-1#comment-8197</link>
		<dc:creator>Rachel 'Groby' Blum</dc:creator>
		<pubDate>Sun, 01 Aug 2010 01:53:08 +0000</pubDate>
		<guid isPermaLink="false">http://gamesfromwithin.com/?p=942#comment-8197</guid>
		<description>I&#039;ll bite - how does a handle manager help you serialize data? After all, you explicitly allow for the re-use of handles. And unless there&#039;s a completely deterministic scheme of how counters map to a specific object, how does that help?

Or are you simply referring to a serialization scheme that *also* stores every single object currently pointed to as an array?</description>
		<content:encoded><![CDATA[<p>I&#8217;ll bite &#8211; how does a handle manager help you serialize data? After all, you explicitly allow for the re-use of handles. And unless there&#8217;s a completely deterministic scheme of how counters map to a specific object, how does that help?</p>
<p>Or are you simply referring to a serialization scheme that *also* stores every single object currently pointed to as an array?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Erik E</title>
		<link>http://gamesfromwithin.com/managing-data-relationships/comment-page-1#comment-7527</link>
		<dc:creator>Erik E</dc:creator>
		<pubDate>Mon, 05 Jul 2010 20:10:20 +0000</pubDate>
		<guid isPermaLink="false">http://gamesfromwithin.com/?p=942#comment-7527</guid>
		<description>Your articles have been very inspiring, especially the one on data-oriented design. But this article confuse me. Your handle manager has pointers to entities (if I am reading you correctly), but doesn&#039;t data-oriented design suggest that there is no such thing as continuous chunk of memory representing an entity? An entity have its properties spread across multiple arrays of simple data types. Doesn&#039;t that mean that an entity can only be accessed by an index? I realize there must be something I don&#039;t quite get. I was very excited about the data-oriented design article and started designing my simple 2D game engine around those ideas. A separate array for an entity&#039;s matrix, a separate array for velocity etc. But referring back an individual entity can be difficult. I am wondering if I misunderstood the data-oriented design article and this was only meant for a more primitive subsystem and you use a more OO like system for higher level objects??</description>
		<content:encoded><![CDATA[<p>Your articles have been very inspiring, especially the one on data-oriented design. But this article confuse me. Your handle manager has pointers to entities (if I am reading you correctly), but doesn&#8217;t data-oriented design suggest that there is no such thing as continuous chunk of memory representing an entity? An entity have its properties spread across multiple arrays of simple data types. Doesn&#8217;t that mean that an entity can only be accessed by an index? I realize there must be something I don&#8217;t quite get. I was very excited about the data-oriented design article and started designing my simple 2D game engine around those ideas. A separate array for an entity&#8217;s matrix, a separate array for velocity etc. But referring back an individual entity can be difficult. I am wondering if I misunderstood the data-oriented design article and this was only meant for a more primitive subsystem and you use a more OO like system for higher level objects??</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Amir</title>
		<link>http://gamesfromwithin.com/managing-data-relationships/comment-page-1#comment-7497</link>
		<dc:creator>Amir</dc:creator>
		<pubDate>Fri, 02 Jul 2010 07:13:04 +0000</pubDate>
		<guid isPermaLink="false">http://gamesfromwithin.com/?p=942#comment-7497</guid>
		<description>http://www.yosefk.com/blog/code-data-and-interactive-programming.html
Also an interesting read about code/data/environment. I also highly recommand reading his C++ FQA.</description>
		<content:encoded><![CDATA[<p><a href="http://www.yosefk.com/blog/code-data-and-interactive-programming.html" rel="nofollow">http://www.yosefk.com/blog/code-data-and-interactive-programming.html</a><br />
Also an interesting read about code/data/environment. I also highly recommand reading his C++ FQA.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Noel</title>
		<link>http://gamesfromwithin.com/managing-data-relationships/comment-page-1#comment-7451</link>
		<dc:creator>Noel</dc:creator>
		<pubDate>Tue, 29 Jun 2010 21:40:45 +0000</pubDate>
		<guid isPermaLink="false">http://gamesfromwithin.com/?p=942#comment-7451</guid>
		<description>@Pal, Agreed, especially for multi-threading code like you said. It really helps to cut down on synchronization locks and instead just rely on dependencies between &quot;jobs&quot;. Even for single core, it&#039;s sometimes beneficial to have different input and output buffers for performance reasons (like a particle system).</description>
		<content:encoded><![CDATA[<p>@Pal, Agreed, especially for multi-threading code like you said. It really helps to cut down on synchronization locks and instead just rely on dependencies between &#8220;jobs&#8221;. Even for single core, it&#8217;s sometimes beneficial to have different input and output buffers for performance reasons (like a particle system).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Pal-Kristian Engstad</title>
		<link>http://gamesfromwithin.com/managing-data-relationships/comment-page-1#comment-7450</link>
		<dc:creator>Pal-Kristian Engstad</dc:creator>
		<pubDate>Tue, 29 Jun 2010 21:27:57 +0000</pubDate>
		<guid isPermaLink="false">http://gamesfromwithin.com/?p=942#comment-7450</guid>
		<description>Nice stuff, thanks for that.

I would mention though, that we&#039;re currently tending to question mutable structures in general. For multi-threaded code, we&#039;ve found that it is much clearer (and simpler!) to always generate new data instead of mutating the old. This is in the spirit of functional programming, but it works out really well. So, instead of modifying/deleting/tracking old pointers - all you need to care about is how to build up your arrays/structures (including &quot;updating&quot; your state) at every frame. The con of that approach is that you might use a little more (temporary) memory, but the simplicity and speed advantage more than compensates for that.</description>
		<content:encoded><![CDATA[<p>Nice stuff, thanks for that.</p>
<p>I would mention though, that we&#8217;re currently tending to question mutable structures in general. For multi-threaded code, we&#8217;ve found that it is much clearer (and simpler!) to always generate new data instead of mutating the old. This is in the spirit of functional programming, but it works out really well. So, instead of modifying/deleting/tracking old pointers &#8211; all you need to care about is how to build up your arrays/structures (including &#8220;updating&#8221; your state) at every frame. The con of that approach is that you might use a little more (temporary) memory, but the simplicity and speed advantage more than compensates for that.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jim Tilander</title>
		<link>http://gamesfromwithin.com/managing-data-relationships/comment-page-1#comment-7443</link>
		<dc:creator>Jim Tilander</dc:creator>
		<pubDate>Tue, 29 Jun 2010 07:44:22 +0000</pubDate>
		<guid isPermaLink="false">http://gamesfromwithin.com/?p=942#comment-7443</guid>
		<description>Well, my point for the m_ is really that if you remember the old liquid code, it only had m_ for private/protected. For all publics (and there were quite a few of them), there were no prefixes. No really. :) So your coding style didn&#039;t change *that* much.

Sure, for the uint32 v/s uint32_t, I&#039;m with your there -- I used to hate the trailing &quot;_t&quot;, but I&#039;ve just sucked it up and I&#039;m now using the standard types everywhere, even on MS&#039;s platforms... 

I think the main thing today is that I&#039;ve left a lot of the ticks behind, I don&#039;t *have* to have all the variables lined up in the same column, or neatly aligned in a row. I guess I&#039;ve just become better at reading code and can tolerate a wider range of inputs :)</description>
		<content:encoded><![CDATA[<p>Well, my point for the m_ is really that if you remember the old liquid code, it only had m_ for private/protected. For all publics (and there were quite a few of them), there were no prefixes. No really. <img src='http://gamesfromwithin.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  So your coding style didn&#8217;t change *that* much.</p>
<p>Sure, for the uint32 v/s uint32_t, I&#8217;m with your there &#8212; I used to hate the trailing &#8220;_t&#8221;, but I&#8217;ve just sucked it up and I&#8217;m now using the standard types everywhere, even on MS&#8217;s platforms&#8230; </p>
<p>I think the main thing today is that I&#8217;ve left a lot of the ticks behind, I don&#8217;t *have* to have all the variables lined up in the same column, or neatly aligned in a row. I guess I&#8217;ve just become better at reading code and can tolerate a wider range of inputs <img src='http://gamesfromwithin.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Noel</title>
		<link>http://gamesfromwithin.com/managing-data-relationships/comment-page-1#comment-7440</link>
		<dc:creator>Noel</dc:creator>
		<pubDate>Tue, 29 Jun 2010 04:24:06 +0000</pubDate>
		<guid isPermaLink="false">http://gamesfromwithin.com/?p=942#comment-7440</guid>
		<description>@Jim, Chalk it up to the ever-changing coding style. Right now I only ue stdint.h and no m_ at all. Funny what a couple of years does to my code.</description>
		<content:encoded><![CDATA[<p>@Jim, Chalk it up to the ever-changing coding style. Right now I only ue stdint.h and no m_ at all. Funny what a couple of years does to my code.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jim Tilander</title>
		<link>http://gamesfromwithin.com/managing-data-relationships/comment-page-1#comment-7439</link>
		<dc:creator>Jim Tilander</dc:creator>
		<pubDate>Tue, 29 Jun 2010 03:58:21 +0000</pubDate>
		<guid isPermaLink="false">http://gamesfromwithin.com/?p=942#comment-7439</guid>
		<description>I can&#039;t believe you had the m_ prefix on public stuff here and I didn&#039;t call you on it :) Didn&#039;t we have the uint32 v/s uint32_t argument as well? :P Go stdint.h !</description>
		<content:encoded><![CDATA[<p>I can&#8217;t believe you had the m_ prefix on public stuff here and I didn&#8217;t call you on it <img src='http://gamesfromwithin.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  Didn&#8217;t we have the uint32 v/s uint32_t argument as well? <img src='http://gamesfromwithin.com/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' />  Go stdint.h !</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Drealmer</title>
		<link>http://gamesfromwithin.com/managing-data-relationships/comment-page-1#comment-7429</link>
		<dc:creator>Drealmer</dc:creator>
		<pubDate>Mon, 28 Jun 2010 12:22:11 +0000</pubDate>
		<guid isPermaLink="false">http://gamesfromwithin.com/?p=942#comment-7429</guid>
		<description>Thanks for the article!

Indeed, smart pointers can cause some data to hang around, but I don&#039;t think it is such a bad thing, it is only a symptom of something going wrong somewhere else in the code. Without smart pointers, the data would have been deleted and there would now be a dangling pointer somewhere that might or might not crash any time later. So I tend to use reference counting to determine if it is safe or not to destroy an object, but I still keep the destruction itself explicit, within a manager. Best of both worlds, imho.

The only big problems I see with this system are due to cyclic references. But in my experience, it has been relatively easy to track down the leaks, and it gives me better confidence about the code being free of dangling pointers.

Just my two cents anyway :)</description>
		<content:encoded><![CDATA[<p>Thanks for the article!</p>
<p>Indeed, smart pointers can cause some data to hang around, but I don&#8217;t think it is such a bad thing, it is only a symptom of something going wrong somewhere else in the code. Without smart pointers, the data would have been deleted and there would now be a dangling pointer somewhere that might or might not crash any time later. So I tend to use reference counting to determine if it is safe or not to destroy an object, but I still keep the destruction itself explicit, within a manager. Best of both worlds, imho.</p>
<p>The only big problems I see with this system are due to cyclic references. But in my experience, it has been relatively easy to track down the leaks, and it gives me better confidence about the code being free of dangling pointers.</p>
<p>Just my two cents anyway <img src='http://gamesfromwithin.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Noel</title>
		<link>http://gamesfromwithin.com/managing-data-relationships/comment-page-1#comment-7421</link>
		<dc:creator>Noel</dc:creator>
		<pubDate>Sun, 27 Jun 2010 23:00:09 +0000</pubDate>
		<guid isPermaLink="false">http://gamesfromwithin.com/?p=942#comment-7421</guid>
		<description>@Billy, What I meant is that I&#039;m not a fan of objects/memory being freed whenever the reference count reaches zero for the game runtime. Yes, it&#039;s well defined, but I don&#039;t feel it&#039;s explicit enough. You never really know when that will happen just by looking at the code.

All too often, I&#039;ve seen objects hang around just because their ref count hasn&#039;t reached zero (either because of a logic error, or because of crazy structures designers created). It&#039;s no fun tracking down why invisible explosion effects are hanging around indefinitely, trust me.

But my main objection is that you never have a good sense of how your memory is used, and how much there is left. Will the console run out of memory after the Nth enemy is spawned? Who knows. On the other hand, if you&#039;re controlling in code explicitely memory allocation and destruction, you know for sure how much there is, when it goes away, and when there&#039;s more, which for a game runtime, I think it&#039;s pretty crucial.

For tools on the other hand, ref counting seems perfectly fine if you&#039;re into that. No objections there.</description>
		<content:encoded><![CDATA[<p>@Billy, What I meant is that I&#8217;m not a fan of objects/memory being freed whenever the reference count reaches zero for the game runtime. Yes, it&#8217;s well defined, but I don&#8217;t feel it&#8217;s explicit enough. You never really know when that will happen just by looking at the code.</p>
<p>All too often, I&#8217;ve seen objects hang around just because their ref count hasn&#8217;t reached zero (either because of a logic error, or because of crazy structures designers created). It&#8217;s no fun tracking down why invisible explosion effects are hanging around indefinitely, trust me.</p>
<p>But my main objection is that you never have a good sense of how your memory is used, and how much there is left. Will the console run out of memory after the Nth enemy is spawned? Who knows. On the other hand, if you&#8217;re controlling in code explicitely memory allocation and destruction, you know for sure how much there is, when it goes away, and when there&#8217;s more, which for a game runtime, I think it&#8217;s pretty crucial.</p>
<p>For tools on the other hand, ref counting seems perfectly fine if you&#8217;re into that. No objections there.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Billy</title>
		<link>http://gamesfromwithin.com/managing-data-relationships/comment-page-1#comment-7420</link>
		<dc:creator>Billy</dc:creator>
		<pubDate>Sun, 27 Jun 2010 22:47:15 +0000</pubDate>
		<guid isPermaLink="false">http://gamesfromwithin.com/?p=942#comment-7420</guid>
		<description>Thanks for the article. Can you elaborate more on &quot;I prefer to have very explicit object lifetime management&quot; under the Smart Pointers section? It can be one of two things (or both), right?

1. Free the data immediately after the reference count reaches zero.

2. Free that data at anytime, regardless of how many things are still referencing it.

Aren&#039;t there ways to solve either of these problems?</description>
		<content:encoded><![CDATA[<p>Thanks for the article. Can you elaborate more on &#8220;I prefer to have very explicit object lifetime management&#8221; under the Smart Pointers section? It can be one of two things (or both), right?</p>
<p>1. Free the data immediately after the reference count reaches zero.</p>
<p>2. Free that data at anytime, regardless of how many things are still referencing it.</p>
<p>Aren&#8217;t there ways to solve either of these problems?</p>
]]></content:encoded>
	</item>
</channel>
</rss>

