<?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: Entity Systems are the Future of MMOs Part 5</title>
	<atom:link href="http://t-machine.org/index.php/2009/10/26/entity-systems-are-the-future-of-mmos-part-5/feed/" rel="self" type="application/rss+xml" />
	<link>http://t-machine.org/index.php/2009/10/26/entity-systems-are-the-future-of-mmos-part-5/</link>
	<description>Internet Gaming, Computer Games, Technology, MMO, and Web 2.0</description>
	<lastBuildDate>Sun, 05 Sep 2010 20:30:54 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
	<item>
		<title>By: adam</title>
		<link>http://t-machine.org/index.php/2009/10/26/entity-systems-are-the-future-of-mmos-part-5/comment-page-2/#comment-8336</link>
		<dc:creator>adam</dc:creator>
		<pubDate>Wed, 01 Sep 2010 06:44:11 +0000</pubDate>
		<guid isPermaLink="false">http://t-machine.org/?p=700#comment-8336</guid>
		<description>You&#039;re into the realms of SQL optimization with that question... 

My flippant comment was assuming that you chose a deterministic naming scheme for your components, so that e.g. for component &quot;Position&quot; you knew (without having to look it up) that the table name would be &quot;CPosition&quot; (or maybe &quot;Component_Position&quot; or whatever).

Component-class names are going to be unique anyway (whether you &quot;name&quot; them with strings, or with integers, or some other scheme) - so you should in theory be able to invent a DB schema that avoids looking up the table-name for each component.</description>
		<content:encoded><![CDATA[<p>You&#8217;re into the realms of SQL optimization with that question&#8230; </p>
<p>My flippant comment was assuming that you chose a deterministic naming scheme for your components, so that e.g. for component &#8220;Position&#8221; you knew (without having to look it up) that the table name would be &#8220;CPosition&#8221; (or maybe &#8220;Component_Position&#8221; or whatever).</p>
<p>Component-class names are going to be unique anyway (whether you &#8220;name&#8221; them with strings, or with integers, or some other scheme) &#8211; so you should in theory be able to invent a DB schema that avoids looking up the table-name for each component.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Barakat</title>
		<link>http://t-machine.org/index.php/2009/10/26/entity-systems-are-the-future-of-mmos-part-5/comment-page-2/#comment-8334</link>
		<dc:creator>Barakat</dc:creator>
		<pubDate>Wed, 01 Sep 2010 02:34:13 +0000</pubDate>
		<guid isPermaLink="false">http://t-machine.org/?p=700#comment-8334</guid>
		<description>&quot;If you know the entity-id, you may only need one table lookup to get the data for an entire component&quot;

I have a work in progress ES based off of what I learned from your article. I am trying to make a function that loads an entity from the database including all its component data. My question is, can you give an example of how to do this with the least number of queries?

 I have a table for each component&#039;s data, with the table name being in the &quot;component&quot; table. Right now I have it so it does one query to get a list of the component IDs and their table names, and then it does a query for each component table to get all the data.</description>
		<content:encoded><![CDATA[<p>&#8220;If you know the entity-id, you may only need one table lookup to get the data for an entire component&#8221;</p>
<p>I have a work in progress ES based off of what I learned from your article. I am trying to make a function that loads an entity from the database including all its component data. My question is, can you give an example of how to do this with the least number of queries?</p>
<p> I have a table for each component&#8217;s data, with the table name being in the &#8220;component&#8221; table. Right now I have it so it does one query to get a list of the component IDs and their table names, and then it does a query for each component table to get all the data.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: T=Machine &#187; Entity Systems are the future of MMOG development &#8211; Part 1</title>
		<link>http://t-machine.org/index.php/2009/10/26/entity-systems-are-the-future-of-mmos-part-5/comment-page-2/#comment-8308</link>
		<dc:creator>T=Machine &#187; Entity Systems are the future of MMOG development &#8211; Part 1</dc:creator>
		<pubDate>Mon, 30 Aug 2010 20:07:14 +0000</pubDate>
		<guid isPermaLink="false">http://t-machine.org/?p=700#comment-8308</guid>
		<description>[...] Part 5 &#8211; initialization, storage, and data [...]</description>
		<content:encoded><![CDATA[<p>[...] Part 5 &#8211; initialization, storage, and data [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Neo Liang</title>
		<link>http://t-machine.org/index.php/2009/10/26/entity-systems-are-the-future-of-mmos-part-5/comment-page-2/#comment-7547</link>
		<dc:creator>Neo Liang</dc:creator>
		<pubDate>Sun, 08 Aug 2010 13:26:36 +0000</pubDate>
		<guid isPermaLink="false">http://t-machine.org/?p=700#comment-7547</guid>
		<description>thanks for replay, you said just &quot;other code&quot; do the interactivity.but 
1.how did the system work? 
2.is every component has a specific system for it or there is a public system for all components to handle the interactivity. 
3.how does the system collaborate with each other?

and i have other more questions:
1.how to reuse the assemblage?
2.how to reuse the components as we want to make one new component with the old one?</description>
		<content:encoded><![CDATA[<p>thanks for replay, you said just &#8220;other code&#8221; do the interactivity.but<br />
1.how did the system work?<br />
2.is every component has a specific system for it or there is a public system for all components to handle the interactivity.<br />
3.how does the system collaborate with each other?</p>
<p>and i have other more questions:<br />
1.how to reuse the assemblage?<br />
2.how to reuse the components as we want to make one new component with the old one?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: adam</title>
		<link>http://t-machine.org/index.php/2009/10/26/entity-systems-are-the-future-of-mmos-part-5/comment-page-2/#comment-7523</link>
		<dc:creator>adam</dc:creator>
		<pubDate>Sat, 07 Aug 2010 13:46:50 +0000</pubDate>
		<guid isPermaLink="false">http://t-machine.org/?p=700#comment-7523</guid>
		<description>@Neo

Think of an entity as a dictionary of arrays (each array being a component). In most programming languages, implemented efficiently, that&#039;s all it is.

A dictionary doesn&#039;t &quot;interact&quot; with anything, it just sits there. You write other code that gets given refecnes to multiple dictionaries, and operates upon them. Your &quot;other code&quot; is the System(s). The entities just sit there, doing nothing.</description>
		<content:encoded><![CDATA[<p>@Neo</p>
<p>Think of an entity as a dictionary of arrays (each array being a component). In most programming languages, implemented efficiently, that&#8217;s all it is.</p>
<p>A dictionary doesn&#8217;t &#8220;interact&#8221; with anything, it just sits there. You write other code that gets given refecnes to multiple dictionaries, and operates upon them. Your &#8220;other code&#8221; is the System(s). The entities just sit there, doing nothing.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Neo Liang</title>
		<link>http://t-machine.org/index.php/2009/10/26/entity-systems-are-the-future-of-mmos-part-5/comment-page-1/#comment-7520</link>
		<dc:creator>Neo Liang</dc:creator>
		<pubDate>Sat, 07 Aug 2010 13:10:04 +0000</pubDate>
		<guid isPermaLink="false">http://t-machine.org/?p=700#comment-7520</guid>
		<description>it &#039;s same that you just talk about the store and initialize the entities,but how those entities interact with each other? does you use the system based on message or something else?</description>
		<content:encoded><![CDATA[<p>it &#8216;s same that you just talk about the store and initialize the entities,but how those entities interact with each other? does you use the system based on message or something else?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nash</title>
		<link>http://t-machine.org/index.php/2009/10/26/entity-systems-are-the-future-of-mmos-part-5/comment-page-1/#comment-6837</link>
		<dc:creator>Nash</dc:creator>
		<pubDate>Wed, 14 Jul 2010 00:12:22 +0000</pubDate>
		<guid isPermaLink="false">http://t-machine.org/?p=700#comment-6837</guid>
		<description>Thanks for taking the time to reply, I really appreciate it.

These systems always look so elegant on paper, but I&#039;ve always struggled with the implementation. I&#039;ll take the simple approach and see what I come up with :)</description>
		<content:encoded><![CDATA[<p>Thanks for taking the time to reply, I really appreciate it.</p>
<p>These systems always look so elegant on paper, but I&#8217;ve always struggled with the implementation. I&#8217;ll take the simple approach and see what I come up with :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: adam</title>
		<link>http://t-machine.org/index.php/2009/10/26/entity-systems-are-the-future-of-mmos-part-5/comment-page-1/#comment-6834</link>
		<dc:creator>adam</dc:creator>
		<pubDate>Tue, 13 Jul 2010 21:18:57 +0000</pubDate>
		<guid isPermaLink="false">http://t-machine.org/?p=700#comment-6834</guid>
		<description>@Nash - your question in your second-to-last paragraph suggests:

&quot;I&#039;m thinking too much&quot;

Don&#039;t. There is no such difference. Entities are just data. Nothing more. There is no &quot;do something&quot; part to an entity. You are thinking of OOP. Stop thinking of OOP. ES&#039;s want your life to be simpler ... don&#039;t complicate matters, just let them be as simple as they possibly can be :).</description>
		<content:encoded><![CDATA[<p>@Nash &#8211; your question in your second-to-last paragraph suggests:</p>
<p>&#8220;I&#8217;m thinking too much&#8221;</p>
<p>Don&#8217;t. There is no such difference. Entities are just data. Nothing more. There is no &#8220;do something&#8221; part to an entity. You are thinking of OOP. Stop thinking of OOP. ES&#8217;s want your life to be simpler &#8230; don&#8217;t complicate matters, just let them be as simple as they possibly can be :).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: adam</title>
		<link>http://t-machine.org/index.php/2009/10/26/entity-systems-are-the-future-of-mmos-part-5/comment-page-1/#comment-6833</link>
		<dc:creator>adam</dc:creator>
		<pubDate>Tue, 13 Jul 2010 21:17:08 +0000</pubDate>
		<guid isPermaLink="false">http://t-machine.org/?p=700#comment-6833</guid>
		<description>Obviously, this depends on the rest of your game - it depends on HOW MUCH DETAIL you choose to put into your different systems.

Off the top of my head, I&#039;d start with:
 - entity, made up of:
 - position component
 - one-use-special-action component, with an enum type with value of &quot;HEAL_POTION&quot;
 - inventory component (as in: when it&#039;s in your inventory, it has a component that gives a bitmap you can display, and says how much inventory space it takes up, is it stackable, etc)

Although, in some RPG&#039;s, the potions design is quite complex, so you might well choose to split-out the &quot;potion&quot; bit into mulitple components, e.g. a single &quot;item-use&quot; component, speciying that it&#039;s &quot;one-use&quot; and has &quot;instant-effect&quot; PLUS a set of &quot;item-effect-component&quot; instances:
 - alter-stats component, with values &quot;HEALTH&quot; and &quot;50&quot;
 - alter-stats componeont, with values &quot;STAMINA-PERCENT&quot; and &quot;100&quot;
 - alter-stats-temporary componeont, with values &quot;MAX-HEALTH&quot; and &quot;10&quot; and a variable &quot;Fade-time&quot; of value &quot;60 seconds&quot;
 - ...etc

(As much as is necessary to make the implementation of YOUR game&#039;s particular potions-logic easier to manage...)

In an RPG, that split of components also starts to make it REALLY easy to create - say - a new magic sword that has a side effect of increaing your max-health; it&#039;s actually re-using the componone from a heal potion.</description>
		<content:encoded><![CDATA[<p>Obviously, this depends on the rest of your game &#8211; it depends on HOW MUCH DETAIL you choose to put into your different systems.</p>
<p>Off the top of my head, I&#8217;d start with:<br />
 &#8211; entity, made up of:<br />
 &#8211; position component<br />
 &#8211; one-use-special-action component, with an enum type with value of &#8220;HEAL_POTION&#8221;<br />
 &#8211; inventory component (as in: when it&#8217;s in your inventory, it has a component that gives a bitmap you can display, and says how much inventory space it takes up, is it stackable, etc)</p>
<p>Although, in some RPG&#8217;s, the potions design is quite complex, so you might well choose to split-out the &#8220;potion&#8221; bit into mulitple components, e.g. a single &#8220;item-use&#8221; component, speciying that it&#8217;s &#8220;one-use&#8221; and has &#8220;instant-effect&#8221; PLUS a set of &#8220;item-effect-component&#8221; instances:<br />
 &#8211; alter-stats component, with values &#8220;HEALTH&#8221; and &#8220;50&#8243;<br />
 &#8211; alter-stats componeont, with values &#8220;STAMINA-PERCENT&#8221; and &#8220;100&#8243;<br />
 &#8211; alter-stats-temporary componeont, with values &#8220;MAX-HEALTH&#8221; and &#8220;10&#8243; and a variable &#8220;Fade-time&#8221; of value &#8220;60 seconds&#8221;<br />
 &#8211; &#8230;etc</p>
<p>(As much as is necessary to make the implementation of YOUR game&#8217;s particular potions-logic easier to manage&#8230;)</p>
<p>In an RPG, that split of components also starts to make it REALLY easy to create &#8211; say &#8211; a new magic sword that has a side effect of increaing your max-health; it&#8217;s actually re-using the componone from a heal potion.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nash</title>
		<link>http://t-machine.org/index.php/2009/10/26/entity-systems-are-the-future-of-mmos-part-5/comment-page-1/#comment-6829</link>
		<dc:creator>Nash</dc:creator>
		<pubDate>Tue, 13 Jul 2010 19:49:00 +0000</pubDate>
		<guid isPermaLink="false">http://t-machine.org/?p=700#comment-6829</guid>
		<description>I know I&#039;m late to the part, but there&#039;s a few bits that I&#039;m still struggling to wrap my head around:

In the scope of an RPG, how would things like items be handled? For example, if we have a potion that restores health, is this an entity, or an assemblage that is instantiated when a character picks it up? I think it&#039;s the latter, but I&#039;m still not sure.

I imagine when the game loads its content, it would load a list of definitions for various items, and then create them as required. So a character would have an InventoryComponent object that would just list the ID of any object entities.

Basically, I think I&#039;m having difficulty visualing the line between entities that do something (monsters, treasure chests, event trigger zones) and entities that describe something (like potions, swords etc). 

I think I answered my own question, but any advice would be very welcome.</description>
		<content:encoded><![CDATA[<p>I know I&#8217;m late to the part, but there&#8217;s a few bits that I&#8217;m still struggling to wrap my head around:</p>
<p>In the scope of an RPG, how would things like items be handled? For example, if we have a potion that restores health, is this an entity, or an assemblage that is instantiated when a character picks it up? I think it&#8217;s the latter, but I&#8217;m still not sure.</p>
<p>I imagine when the game loads its content, it would load a list of definitions for various items, and then create them as required. So a character would have an InventoryComponent object that would just list the ID of any object entities.</p>
<p>Basically, I think I&#8217;m having difficulty visualing the line between entities that do something (monsters, treasure chests, event trigger zones) and entities that describe something (like potions, swords etc). </p>
<p>I think I answered my own question, but any advice would be very welcome.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: adam</title>
		<link>http://t-machine.org/index.php/2009/10/26/entity-systems-are-the-future-of-mmos-part-5/comment-page-1/#comment-6439</link>
		<dc:creator>adam</dc:creator>
		<pubDate>Thu, 17 Jun 2010 08:40:28 +0000</pubDate>
		<guid isPermaLink="false">http://t-machine.org/?p=700#comment-6439</guid>
		<description>We often see people trying to.do.an.ES and an event-driven system together,  at the same.time. I&#039;m usually not sure why people do this. I&#039;ve no idea about your case, but in most cases it proves too much change at once - that&#039;s TWO unusual paradigms that a team is new to, each with complex.performance and behavioral changes of their own.

Im not convinced ES and Event driven systems go.well together for&quot;normal&quot; situations.. e.g. They could work extremely parallel (both approaches are.inherently parallelisable), but few people have enough processors to make that worthwhile these days.

Out of interest, why are you doing both together? Where is it working? Where is it causing yiu headaches?</description>
		<content:encoded><![CDATA[<p>We often see people trying to.do.an.ES and an event-driven system together,  at the same.time. I&#8217;m usually not sure why people do this. I&#8217;ve no idea about your case, but in most cases it proves too much change at once &#8211; that&#8217;s TWO unusual paradigms that a team is new to, each with complex.performance and behavioral changes of their own.</p>
<p>Im not convinced ES and Event driven systems go.well together for&#8221;normal&#8221; situations.. e.g. They could work extremely parallel (both approaches are.inherently parallelisable), but few people have enough processors to make that worthwhile these days.</p>
<p>Out of interest, why are you doing both together? Where is it working? Where is it causing yiu headaches?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Abhijeet P</title>
		<link>http://t-machine.org/index.php/2009/10/26/entity-systems-are-the-future-of-mmos-part-5/comment-page-1/#comment-6434</link>
		<dc:creator>Abhijeet P</dc:creator>
		<pubDate>Thu, 17 Jun 2010 04:32:19 +0000</pubDate>
		<guid isPermaLink="false">http://t-machine.org/?p=700#comment-6434</guid>
		<description>@Rick B: Figured I&#039;d see you here. I wonder if you have looked at MongoDB. Seems pretty blazing fast since it runs in memory using memory mapped files:
http://blog.mongodb.org/post/101911655/mongo-db-memory-usage</description>
		<content:encoded><![CDATA[<p>@Rick B: Figured I&#8217;d see you here. I wonder if you have looked at MongoDB. Seems pretty blazing fast since it runs in memory using memory mapped files:<br />
<a href="http://blog.mongodb.org/post/101911655/mongo-db-memory-usage" onclick="javascript:pageTracker._trackPageview('/outbound/comment/http://blog.mongodb.org/post/101911655/mongo-db-memory-usage');" rel="nofollow">http://blog.mongodb.org/post/101911655/mongo-db-memory-usage</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rick B</title>
		<link>http://t-machine.org/index.php/2009/10/26/entity-systems-are-the-future-of-mmos-part-5/comment-page-1/#comment-6348</link>
		<dc:creator>Rick B</dc:creator>
		<pubDate>Wed, 09 Jun 2010 16:11:39 +0000</pubDate>
		<guid isPermaLink="false">http://t-machine.org/?p=700#comment-6348</guid>
		<description>I have been looking at the various MMDBs but the choices are fairly limited for my platform (.Net &amp; Windows Server).

We&#039;re also trying to work out efficient ways of messaging the entities as they need to react to changes. We have hundreds of thousands of objects so we need to be careful.

Thank you for your thoughts.
.</description>
		<content:encoded><![CDATA[<p>I have been looking at the various MMDBs but the choices are fairly limited for my platform (.Net &amp; Windows Server).</p>
<p>We&#8217;re also trying to work out efficient ways of messaging the entities as they need to react to changes. We have hundreds of thousands of objects so we need to be careful.</p>
<p>Thank you for your thoughts.<br />
.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: adam</title>
		<link>http://t-machine.org/index.php/2009/10/26/entity-systems-are-the-future-of-mmos-part-5/comment-page-1/#comment-6323</link>
		<dc:creator>adam</dc:creator>
		<pubDate>Tue, 08 Jun 2010 07:18:58 +0000</pubDate>
		<guid isPermaLink="false">http://t-machine.org/?p=700#comment-6323</guid>
		<description>(FYI I recently wrote an ES for Android mobile phones; I didn&#039;t run SQL at all, I just approximated it with a lightweight in-mem abstraction layer. I can then serialize that to flash-mem using SQLite as an entirely separate chunk of code. With the new version of Android, I might try running it through SQLite as well - new Android is allegedly up to 5x faster than old android - could be intereting to try)</description>
		<content:encoded><![CDATA[<p>(FYI I recently wrote an ES for Android mobile phones; I didn&#8217;t run SQL at all, I just approximated it with a lightweight in-mem abstraction layer. I can then serialize that to flash-mem using SQLite as an entirely separate chunk of code. With the new version of Android, I might try running it through SQLite as well &#8211; new Android is allegedly up to 5x faster than old android &#8211; could be intereting to try)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: adam</title>
		<link>http://t-machine.org/index.php/2009/10/26/entity-systems-are-the-future-of-mmos-part-5/comment-page-1/#comment-6322</link>
		<dc:creator>adam</dc:creator>
		<pubDate>Tue, 08 Jun 2010 07:16:42 +0000</pubDate>
		<guid isPermaLink="false">http://t-machine.org/?p=700#comment-6322</guid>
		<description>@Rick

NEVER write-through live data to an SQL db, it&#039;s generally far too slow. Instead, send it to an in-memory SQL db of some kind (there&#039;s many available, from free to commercial). They work very well as an &quot;intelligent cache that speaks SQL directly, and avoids you having to re-write you code to speak to the cache instead of speaknig SQL&quot;.

If the in-memory DB&quot;s you can afford are still too slow, get hold of an even more lightweight/minimal SQL implementation (or roil your own), and again run it purely in memory. Or try running it off a RAMDISK, and setup your &quot;real&quot; db as a replication slave or similar.

In general, the db features you need to run the data live are a small subset of the db features you need on the persistent copy of the data. There&#039;s no reason why you have to run the same DB server (or even same DB vendor!) for the two different copies...</description>
		<content:encoded><![CDATA[<p>@Rick</p>
<p>NEVER write-through live data to an SQL db, it&#8217;s generally far too slow. Instead, send it to an in-memory SQL db of some kind (there&#8217;s many available, from free to commercial). They work very well as an &#8220;intelligent cache that speaks SQL directly, and avoids you having to re-write you code to speak to the cache instead of speaknig SQL&#8221;.</p>
<p>If the in-memory DB&#8221;s you can afford are still too slow, get hold of an even more lightweight/minimal SQL implementation (or roil your own), and again run it purely in memory. Or try running it off a RAMDISK, and setup your &#8220;real&#8221; db as a replication slave or similar.</p>
<p>In general, the db features you need to run the data live are a small subset of the db features you need on the persistent copy of the data. There&#8217;s no reason why you have to run the same DB server (or even same DB vendor!) for the two different copies&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rick B</title>
		<link>http://t-machine.org/index.php/2009/10/26/entity-systems-are-the-future-of-mmos-part-5/comment-page-1/#comment-6320</link>
		<dc:creator>Rick B</dc:creator>
		<pubDate>Tue, 08 Jun 2010 03:10:32 +0000</pubDate>
		<guid isPermaLink="false">http://t-machine.org/?p=700#comment-6320</guid>
		<description>I know this is an older post but I&#039;d thought I&#039;d ask anyways. We have our ES system running fairly well and it&#039;s very similar to what you have described even though I did not find your article until today. Our components are simply containers of data and are stored as separate tables in SQL Server with one table per component type.

We are able to load all the entities and populate the objects in memory by using projections. This all works great and is fairly efficient in terms of the queries involved (one per component table).

The tricky part, and the area I need some help with, is how to persist the data as it changes during the running of the game loop. For example, we have about 100,000 location components with x, y, z coordinates that are being updated once every ten seconds. Trying to save this data back to SQL Server is painfully slow. Serializing to disk is fast but has problems when you want to change the structure or perform maintenance on the data.

How are people handling persistence?

Has anyone used any of the main memory databases for their objects?

Thanks,

Rick</description>
		<content:encoded><![CDATA[<p>I know this is an older post but I&#8217;d thought I&#8217;d ask anyways. We have our ES system running fairly well and it&#8217;s very similar to what you have described even though I did not find your article until today. Our components are simply containers of data and are stored as separate tables in SQL Server with one table per component type.</p>
<p>We are able to load all the entities and populate the objects in memory by using projections. This all works great and is fairly efficient in terms of the queries involved (one per component table).</p>
<p>The tricky part, and the area I need some help with, is how to persist the data as it changes during the running of the game loop. For example, we have about 100,000 location components with x, y, z coordinates that are being updated once every ten seconds. Trying to save this data back to SQL Server is painfully slow. Serializing to disk is fast but has problems when you want to change the structure or perform maintenance on the data.</p>
<p>How are people handling persistence?</p>
<p>Has anyone used any of the main memory databases for their objects?</p>
<p>Thanks,</p>
<p>Rick</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ConcernedFan</title>
		<link>http://t-machine.org/index.php/2009/10/26/entity-systems-are-the-future-of-mmos-part-5/comment-page-1/#comment-4397</link>
		<dc:creator>ConcernedFan</dc:creator>
		<pubDate>Wed, 17 Feb 2010 19:18:47 +0000</pubDate>
		<guid isPermaLink="false">http://t-machine.org/?p=700#comment-4397</guid>
		<description>We want part 6!</description>
		<content:encoded><![CDATA[<p>We want part 6!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Datenhaltung mit gamedata.class.php &#171; Zeitalter3 &#8211; Browsergames Entwicklerblog</title>
		<link>http://t-machine.org/index.php/2009/10/26/entity-systems-are-the-future-of-mmos-part-5/comment-page-1/#comment-4374</link>
		<dc:creator>Datenhaltung mit gamedata.class.php &#171; Zeitalter3 &#8211; Browsergames Entwicklerblog</dc:creator>
		<pubDate>Tue, 16 Feb 2010 17:50:53 +0000</pubDate>
		<guid isPermaLink="false">http://t-machine.org/?p=700#comment-4374</guid>
		<description>[...] Klasse zur Datenhaltung (gamedata.class.php) geschrieben. Diese ist in Zeitgeist angelehnt an die Datenhaltung eines Entity-Systems. In den Kommentaren wurde mir von Gameplorer folgende Frage zu dem Prinzip gestellt: Wie gut [...]</description>
		<content:encoded><![CDATA[<p>[...] Klasse zur Datenhaltung (gamedata.class.php) geschrieben. Diese ist in Zeitgeist angelehnt an die Datenhaltung eines Entity-Systems. In den Kommentaren wurde mir von Gameplorer folgende Frage zu dem Prinzip gestellt: Wie gut [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Das Gamesystem-Modul &#171; Zeitalter3 &#8211; Browsergames Entwicklerblog</title>
		<link>http://t-machine.org/index.php/2009/10/26/entity-systems-are-the-future-of-mmos-part-5/comment-page-1/#comment-4320</link>
		<dc:creator>Das Gamesystem-Modul &#171; Zeitalter3 &#8211; Browsergames Entwicklerblog</dc:creator>
		<pubDate>Sun, 14 Feb 2010 08:42:03 +0000</pubDate>
		<guid isPermaLink="false">http://t-machine.org/?p=700#comment-4320</guid>
		<description>[...] Gamedata-Klasse nimmt sich die Datenhaltung eines Entity Systems zum Vorbild und implementiert diese in PHP. Für Details und Erklärungen der Funktionsweise [...]</description>
		<content:encoded><![CDATA[<p>[...] Gamedata-Klasse nimmt sich die Datenhaltung eines Entity Systems zum Vorbild und implementiert diese in PHP. Für Details und Erklärungen der Funktionsweise [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jay</title>
		<link>http://t-machine.org/index.php/2009/10/26/entity-systems-are-the-future-of-mmos-part-5/comment-page-1/#comment-4239</link>
		<dc:creator>jay</dc:creator>
		<pubDate>Sat, 06 Feb 2010 20:14:02 +0000</pubDate>
		<guid isPermaLink="false">http://t-machine.org/?p=700#comment-4239</guid>
		<description>I should of read the previous posts before posting since I think my question is answered already.

Thanks again.. both article and following discussions everyone.</description>
		<content:encoded><![CDATA[<p>I should of read the previous posts before posting since I think my question is answered already.</p>
<p>Thanks again.. both article and following discussions everyone.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jay</title>
		<link>http://t-machine.org/index.php/2009/10/26/entity-systems-are-the-future-of-mmos-part-5/comment-page-1/#comment-4238</link>
		<dc:creator>jay</dc:creator>
		<pubDate>Sat, 06 Feb 2010 19:28:50 +0000</pubDate>
		<guid isPermaLink="false">http://t-machine.org/?p=700#comment-4238</guid>
		<description>Thankyou for your really cool series of articles...  I really like the concept but one thing bothers me that concerns with how subsystems communicate with each other.

for eg - A simple game with 3 subsystems called renderer, physicsSim and input.  The game has 2 entities floating about.  Both entities have a physics component, a renderable component and input component set up in the database.

The work the subsystems do is just the renderer just renders the renderable components, the physics just simulates the physics components and the input just updates the input components with the state of input.  But where is the part that the input subsystem has to tell the physics system to apply forces based on input or the physics system to tell the renderer the transform to render at.

Is it ok to do a querry in the renderer to look for a physics component with the given entity id to get the transform to render at, if so I cant see the benefit and think this will cause threading issues or am I just still thinking in the wrong way to solve this problem?

Many thanks and I look forward to the next article.</description>
		<content:encoded><![CDATA[<p>Thankyou for your really cool series of articles&#8230;  I really like the concept but one thing bothers me that concerns with how subsystems communicate with each other.</p>
<p>for eg &#8211; A simple game with 3 subsystems called renderer, physicsSim and input.  The game has 2 entities floating about.  Both entities have a physics component, a renderable component and input component set up in the database.</p>
<p>The work the subsystems do is just the renderer just renders the renderable components, the physics just simulates the physics components and the input just updates the input components with the state of input.  But where is the part that the input subsystem has to tell the physics system to apply forces based on input or the physics system to tell the renderer the transform to render at.</p>
<p>Is it ok to do a querry in the renderer to look for a physics component with the given entity id to get the transform to render at, if so I cant see the benefit and think this will cause threading issues or am I just still thinking in the wrong way to solve this problem?</p>
<p>Many thanks and I look forward to the next article.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: zuii</title>
		<link>http://t-machine.org/index.php/2009/10/26/entity-systems-are-the-future-of-mmos-part-5/comment-page-1/#comment-4233</link>
		<dc:creator>zuii</dc:creator>
		<pubDate>Sat, 06 Feb 2010 11:42:49 +0000</pubDate>
		<guid isPermaLink="false">http://t-machine.org/?p=700#comment-4233</guid>
		<description>Any chance of having a part 6? I would be interested to see how an editor for this would look like.</description>
		<content:encoded><![CDATA[<p>Any chance of having a part 6? I would be interested to see how an editor for this would look like.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: adam</title>
		<link>http://t-machine.org/index.php/2009/10/26/entity-systems-are-the-future-of-mmos-part-5/comment-page-1/#comment-3334</link>
		<dc:creator>adam</dc:creator>
		<pubDate>Sun, 15 Nov 2009 00:59:27 +0000</pubDate>
		<guid isPermaLink="false">http://t-machine.org/?p=700#comment-3334</guid>
		<description>@Edward

The facetious answer would be &quot;use structs&quot;.

My preferred approach is passing around big streams of byte data, and using a single instance of a (pertinent) struct to view that data one record-at-a-time from the OOP code. This allows for query-system-friendly &quot;ask for everything you need at once, then slam it down the pipe in a single batch of bytes&quot; ... while also providing sane access semantics.

I tried googling for a link to a technique for a more comprehensive answer, and then found that the terminology I&#039;ve been using for ten years apparently doesn&#039;t exist. I&#039;ll get back to you on that one :(.</description>
		<content:encoded><![CDATA[<p>@Edward</p>
<p>The facetious answer would be &#8220;use structs&#8221;.</p>
<p>My preferred approach is passing around big streams of byte data, and using a single instance of a (pertinent) struct to view that data one record-at-a-time from the OOP code. This allows for query-system-friendly &#8220;ask for everything you need at once, then slam it down the pipe in a single batch of bytes&#8221; &#8230; while also providing sane access semantics.</p>
<p>I tried googling for a link to a technique for a more comprehensive answer, and then found that the terminology I&#8217;ve been using for ten years apparently doesn&#8217;t exist. I&#8217;ll get back to you on that one :(.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Edward</title>
		<link>http://t-machine.org/index.php/2009/10/26/entity-systems-are-the-future-of-mmos-part-5/comment-page-1/#comment-3333</link>
		<dc:creator>Edward</dc:creator>
		<pubDate>Sat, 14 Nov 2009 23:42:42 +0000</pubDate>
		<guid isPermaLink="false">http://t-machine.org/?p=700#comment-3333</guid>
		<description>In the database, the ComponentData tables would, I assume, contain columns of numerical, datetime, string and binary data.  These columns would be named appropriately and everything would look perfectly normal (no pun intended).

When we cross over to our application code, typically in an OO language, the component data is the point at which your entity model loses its generic one-size-fits-all structure.  Whilst the core entities and components remain 100% dynamic, is there a point at which we transition to a more static data model, in particular for ComponentData?

I would expect code within a GunComponent to be able to call...

if (data.GunRate &gt; 1000) { 

... or ... 

data.GunName = &quot;Colt&quot;

... accessing the data via strongly typed accessors rather than a bag of string data.  Perpetual casting and parsing of string data would otherwise cause a hefty performance hit.

This is a general question, but inspired by the following line from your most excellent (dude) article:

float[] gunData = getComponentDataForEntity( GUN_COMPONENT, new_id );

^ So does getComponentDataForEntity always return a float array?</description>
		<content:encoded><![CDATA[<p>In the database, the ComponentData tables would, I assume, contain columns of numerical, datetime, string and binary data.  These columns would be named appropriately and everything would look perfectly normal (no pun intended).</p>
<p>When we cross over to our application code, typically in an OO language, the component data is the point at which your entity model loses its generic one-size-fits-all structure.  Whilst the core entities and components remain 100% dynamic, is there a point at which we transition to a more static data model, in particular for ComponentData?</p>
<p>I would expect code within a GunComponent to be able to call&#8230;</p>
<p>if (data.GunRate &gt; 1000) { </p>
<p>&#8230; or &#8230; </p>
<p>data.GunName = &#8220;Colt&#8221;</p>
<p>&#8230; accessing the data via strongly typed accessors rather than a bag of string data.  Perpetual casting and parsing of string data would otherwise cause a hefty performance hit.</p>
<p>This is a general question, but inspired by the following line from your most excellent (dude) article:</p>
<p>float[] gunData = getComponentDataForEntity( GUN_COMPONENT, new_id );</p>
<p>^ So does getComponentDataForEntity always return a float array?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: adam</title>
		<link>http://t-machine.org/index.php/2009/10/26/entity-systems-are-the-future-of-mmos-part-5/comment-page-1/#comment-3305</link>
		<dc:creator>adam</dc:creator>
		<pubDate>Tue, 10 Nov 2009 08:54:26 +0000</pubDate>
		<guid isPermaLink="false">http://t-machine.org/?p=700#comment-3305</guid>
		<description>@Valentin

Ideally, as many systems as possible. That makes each system as small as possible, and as easy to edit + maintain + improve as possible.

...but use discretion, obviously.

In the end, *depending upon hardware/OS*, additional systems carry little overhead. At some point, adding X additional systems adds signficant overhead as the cost of iterating over &quot;all entities&quot; N+X times rather than N times becomes significant.

Generally, though, it&#039;s not something to worry about: just have lots of systems now, and merge them later as/when necessary.

NB: one system certainly *can* act on multiple components, in fact most systems *must* act on components from other systems, although often only in a &quot;read only&quot; capacity.

(e.g. the rendering system needs to read the world-co-ords for each object, and add that to the local-co-ords for each polygon, in order to render everything in the right place on screen :). The world-co-ords are being maintained by another system, one to do with movement, but the polygon co-ords are being maintained by the rendering system. Or the animatin system, if that&#039;s a separate system (which it probably is))</description>
		<content:encoded><![CDATA[<p>@Valentin</p>
<p>Ideally, as many systems as possible. That makes each system as small as possible, and as easy to edit + maintain + improve as possible.</p>
<p>&#8230;but use discretion, obviously.</p>
<p>In the end, *depending upon hardware/OS*, additional systems carry little overhead. At some point, adding X additional systems adds signficant overhead as the cost of iterating over &#8220;all entities&#8221; N+X times rather than N times becomes significant.</p>
<p>Generally, though, it&#8217;s not something to worry about: just have lots of systems now, and merge them later as/when necessary.</p>
<p>NB: one system certainly *can* act on multiple components, in fact most systems *must* act on components from other systems, although often only in a &#8220;read only&#8221; capacity.</p>
<p>(e.g. the rendering system needs to read the world-co-ords for each object, and add that to the local-co-ords for each polygon, in order to render everything in the right place on screen :). The world-co-ords are being maintained by another system, one to do with movement, but the polygon co-ords are being maintained by the rendering system. Or the animatin system, if that&#8217;s a separate system (which it probably is))</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Valentin</title>
		<link>http://t-machine.org/index.php/2009/10/26/entity-systems-are-the-future-of-mmos-part-5/comment-page-1/#comment-3296</link>
		<dc:creator>Valentin</dc:creator>
		<pubDate>Sat, 07 Nov 2009 16:07:26 +0000</pubDate>
		<guid isPermaLink="false">http://t-machine.org/?p=700#comment-3296</guid>
		<description>Thanks for the articles, ES is really interesting topic and it has its points. But I fail to understand how &quot;big&quot; are system. I mean can one system operate on many components? If they can, how many? If I have a tank for example and two systems: shoot system and damage system, the first one needs access to data of the later one obviously. How should I handle that?</description>
		<content:encoded><![CDATA[<p>Thanks for the articles, ES is really interesting topic and it has its points. But I fail to understand how &#8220;big&#8221; are system. I mean can one system operate on many components? If they can, how many? If I have a tank for example and two systems: shoot system and damage system, the first one needs access to data of the later one obviously. How should I handle that?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: adam</title>
		<link>http://t-machine.org/index.php/2009/10/26/entity-systems-are-the-future-of-mmos-part-5/comment-page-1/#comment-3273</link>
		<dc:creator>adam</dc:creator>
		<pubDate>Sat, 31 Oct 2009 18:16:27 +0000</pubDate>
		<guid isPermaLink="false">http://t-machine.org/?p=700#comment-3273</guid>
		<description>@Cameron

Beneath all the other reasons for using an ES, the core reason is simply &quot;to do things in an OOP environment that we cannot otherwise do&quot; - so Java and AS3 in no way undermine usage of an ES.

Well ... except that without access to C/C++ structs, it&#039;s hard to do the &quot;streaming&quot; part fast. Various people have reproduced structs in Java (it&#039;s only mildly tricky), and it works fine now that java has direct (low-level) access to RAM. I have no idea what equivalents are available in AS3 today. You could still use an ES without that, it&#039;s just that *some* of the performance improvements would no longer work.

re: mobile...

I&#039;ve been concentrating on &quot;big&quot; platforms because ... well, actually ... I&#039;ve been concentrating on &quot;multiprocessor&quot; platforms, where (generally speaking) you want to do as much data-driven programming as you can, and where some of the side-effects of ES&#039;s have no negative side-effect on performance (because they&#039;re &quot;multiprocessor friendly&quot;).

Again, there&#039;s no particular reason to focus on those platforms: I got started with ES&#039;s purely for the improvements they bring to the implementation of game-logic. That&#039;s universal.

But I always intended to veer these blog posts towards &quot;not ONLY are ES&#039;s a better way to code, BUT ALSO they give you higher performance (in certain types of game)&quot; - hence the title ;). A lot of techniques in game development make development easier/faster, but slow down the runtime game a lot. It&#039;s nice to occasionally find some that are easier AND improve performance.

(NB: that&#039;s not the only reason for the title)</description>
		<content:encoded><![CDATA[<p>@Cameron</p>
<p>Beneath all the other reasons for using an ES, the core reason is simply &#8220;to do things in an OOP environment that we cannot otherwise do&#8221; &#8211; so Java and AS3 in no way undermine usage of an ES.</p>
<p>Well &#8230; except that without access to C/C++ structs, it&#8217;s hard to do the &#8220;streaming&#8221; part fast. Various people have reproduced structs in Java (it&#8217;s only mildly tricky), and it works fine now that java has direct (low-level) access to RAM. I have no idea what equivalents are available in AS3 today. You could still use an ES without that, it&#8217;s just that *some* of the performance improvements would no longer work.</p>
<p>re: mobile&#8230;</p>
<p>I&#8217;ve been concentrating on &#8220;big&#8221; platforms because &#8230; well, actually &#8230; I&#8217;ve been concentrating on &#8220;multiprocessor&#8221; platforms, where (generally speaking) you want to do as much data-driven programming as you can, and where some of the side-effects of ES&#8217;s have no negative side-effect on performance (because they&#8217;re &#8220;multiprocessor friendly&#8221;).</p>
<p>Again, there&#8217;s no particular reason to focus on those platforms: I got started with ES&#8217;s purely for the improvements they bring to the implementation of game-logic. That&#8217;s universal.</p>
<p>But I always intended to veer these blog posts towards &#8220;not ONLY are ES&#8217;s a better way to code, BUT ALSO they give you higher performance (in certain types of game)&#8221; &#8211; hence the title ;). A lot of techniques in game development make development easier/faster, but slow down the runtime game a lot. It&#8217;s nice to occasionally find some that are easier AND improve performance.</p>
<p>(NB: that&#8217;s not the only reason for the title)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Cameron</title>
		<link>http://t-machine.org/index.php/2009/10/26/entity-systems-are-the-future-of-mmos-part-5/comment-page-1/#comment-3271</link>
		<dc:creator>Cameron</dc:creator>
		<pubDate>Sat, 31 Oct 2009 02:19:08 +0000</pubDate>
		<guid isPermaLink="false">http://t-machine.org/?p=700#comment-3271</guid>
		<description>Hey Adam,

I&#039;ve read and enjoyed all of the previous posts on Entity Systems (including yours), and they all seem to be targeted towards end-users / clients that run ON fast hardware, e.g. PS3, or gaming PCs running games coded in C/C++.

I know very little about the Cell Architecture, except that it is much faster than a PC, and probably an order of magnitude faster than a mobile device (like the iPhone). So my question is, what do you suggest for slower devices/platforms; mobile, flash, java?

For instance, flash isn&#039;t multithreaded...would you simulate threads for the Systems? Also, forgive my naivete, but don&#039;t languages like Java and AS3 *force* OOP?</description>
		<content:encoded><![CDATA[<p>Hey Adam,</p>
<p>I&#8217;ve read and enjoyed all of the previous posts on Entity Systems (including yours), and they all seem to be targeted towards end-users / clients that run ON fast hardware, e.g. PS3, or gaming PCs running games coded in C/C++.</p>
<p>I know very little about the Cell Architecture, except that it is much faster than a PC, and probably an order of magnitude faster than a mobile device (like the iPhone). So my question is, what do you suggest for slower devices/platforms; mobile, flash, java?</p>
<p>For instance, flash isn&#8217;t multithreaded&#8230;would you simulate threads for the Systems? Also, forgive my naivete, but don&#8217;t languages like Java and AS3 *force* OOP?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Olivier</title>
		<link>http://t-machine.org/index.php/2009/10/26/entity-systems-are-the-future-of-mmos-part-5/comment-page-1/#comment-3262</link>
		<dc:creator>Olivier</dc:creator>
		<pubDate>Thu, 29 Oct 2009 19:27:00 +0000</pubDate>
		<guid isPermaLink="false">http://t-machine.org/?p=700#comment-3262</guid>
		<description>@adam

Sure... But... That means closing the door on a lot of nice/essential things....</description>
		<content:encoded><![CDATA[<p>@adam</p>
<p>Sure&#8230; But&#8230; That means closing the door on a lot of nice/essential things&#8230;.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: adam</title>
		<link>http://t-machine.org/index.php/2009/10/26/entity-systems-are-the-future-of-mmos-part-5/comment-page-1/#comment-3261</link>
		<dc:creator>adam</dc:creator>
		<pubDate>Thu, 29 Oct 2009 19:25:07 +0000</pubDate>
		<guid isPermaLink="false">http://t-machine.org/?p=700#comment-3261</guid>
		<description>@Olivier

Side-effect free
Trivially (and automatically!) parallelizable
Trivially (and automatically!) cacheable
No more dupe bugs

What&#039;s not to love? ;)</description>
		<content:encoded><![CDATA[<p>@Olivier</p>
<p>Side-effect free<br />
Trivially (and automatically!) parallelizable<br />
Trivially (and automatically!) cacheable<br />
No more dupe bugs</p>
<p>What&#8217;s not to love? ;)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: adam</title>
		<link>http://t-machine.org/index.php/2009/10/26/entity-systems-are-the-future-of-mmos-part-5/comment-page-1/#comment-3260</link>
		<dc:creator>adam</dc:creator>
		<pubDate>Thu, 29 Oct 2009 19:23:32 +0000</pubDate>
		<guid isPermaLink="false">http://t-machine.org/?p=700#comment-3260</guid>
		<description>@Matthew

&quot;data analysis on the entity system through tools, that&#039;s precisely the same analysis model as e.g. binary blobs. Except that binary blobs are ridiculously fast to store and load compared to an entity system, require much less database hardware, and so on.&quot;

You&#039;ve lost me here. Maybe I&#039;m thinking of a slightly different concept when you say &quot;binary blobs&quot;, because the blobs I&#039;m used to do not exhibit the features you describe.

Firstly, access:

A. ES&#039;s provide direct access - and direct cross-entity joins - to all data.

B. Blobs literally *prevent* direct access - and all cross-entity joins.

The data analysis you can do offline on ES&#039;s can also be done online - and it requires zero setup. To do the same analysis on blobs requires vast amounts of pre-processing (counted in hours or days to convert from the blobs into a usable format)

The inability to join across entities/game-objects is the main reason I would avoid blobs here - IMHO it&#039;s like cutting both your DBMS&#039;s arms off, blinding it, and then asking it to carry a cup of water without spilling a drop.

Secondly, speed:

If you have a crap DBMS, with poor locking (e.g. MySQL about 10 years ago), then yes - blobs significantly increase write speed by circumventing lock-management / consistency maintenance (at the expense that you&#039;re not allowed any strong references between objects; ouch - that causes more performance problems elsewhere). But if you&#039;ve got a good DBMS, circa 2009, that shouldn&#039;t be the case.

You get some minor speed increases because you don&#039;t have to do any CPU work. But you also get some minor speed decreases because you have to send vastly more data than you actually wanted / needed - and you cannot start processing on the received data until you&#039;ve received the lot (unless you want to write some clever code to change your entire semantics of accessing data in RAM).

So ... where am I going wrong here? Have there been some big changes in blobs in recent years that passed me by? (oops)</description>
		<content:encoded><![CDATA[<p>@Matthew</p>
<p>&#8220;data analysis on the entity system through tools, that&#8217;s precisely the same analysis model as e.g. binary blobs. Except that binary blobs are ridiculously fast to store and load compared to an entity system, require much less database hardware, and so on.&#8221;</p>
<p>You&#8217;ve lost me here. Maybe I&#8217;m thinking of a slightly different concept when you say &#8220;binary blobs&#8221;, because the blobs I&#8217;m used to do not exhibit the features you describe.</p>
<p>Firstly, access:</p>
<p>A. ES&#8217;s provide direct access &#8211; and direct cross-entity joins &#8211; to all data.</p>
<p>B. Blobs literally *prevent* direct access &#8211; and all cross-entity joins.</p>
<p>The data analysis you can do offline on ES&#8217;s can also be done online &#8211; and it requires zero setup. To do the same analysis on blobs requires vast amounts of pre-processing (counted in hours or days to convert from the blobs into a usable format)</p>
<p>The inability to join across entities/game-objects is the main reason I would avoid blobs here &#8211; IMHO it&#8217;s like cutting both your DBMS&#8217;s arms off, blinding it, and then asking it to carry a cup of water without spilling a drop.</p>
<p>Secondly, speed:</p>
<p>If you have a crap DBMS, with poor locking (e.g. MySQL about 10 years ago), then yes &#8211; blobs significantly increase write speed by circumventing lock-management / consistency maintenance (at the expense that you&#8217;re not allowed any strong references between objects; ouch &#8211; that causes more performance problems elsewhere). But if you&#8217;ve got a good DBMS, circa 2009, that shouldn&#8217;t be the case.</p>
<p>You get some minor speed increases because you don&#8217;t have to do any CPU work. But you also get some minor speed decreases because you have to send vastly more data than you actually wanted / needed &#8211; and you cannot start processing on the received data until you&#8217;ve received the lot (unless you want to write some clever code to change your entire semantics of accessing data in RAM).</p>
<p>So &#8230; where am I going wrong here? Have there been some big changes in blobs in recent years that passed me by? (oops)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Olivier</title>
		<link>http://t-machine.org/index.php/2009/10/26/entity-systems-are-the-future-of-mmos-part-5/comment-page-1/#comment-3259</link>
		<dc:creator>Olivier</dc:creator>
		<pubDate>Thu, 29 Oct 2009 19:14:15 +0000</pubDate>
		<guid isPermaLink="false">http://t-machine.org/?p=700#comment-3259</guid>
		<description>@adam

&quot;I also believe that if you really know what you’re doing, and you can find a robust enough language, and you coudl find qualified programmers, you’d write everything on the server in a functional language.&quot;

Would be nice if you could elaborate on that... One of these days when you get the time.
I think one of the main challenges of that is the use of external libraries and frameworks; F# should be faring better than erlang in that matter for instance... But most of the great frameworks one could use for an MMO backend I could think of are either exclusive or available on the java platform... Is there a solid functional language running on the Java platform?</description>
		<content:encoded><![CDATA[<p>@adam</p>
<p>&#8220;I also believe that if you really know what you’re doing, and you can find a robust enough language, and you coudl find qualified programmers, you’d write everything on the server in a functional language.&#8221;</p>
<p>Would be nice if you could elaborate on that&#8230; One of these days when you get the time.<br />
I think one of the main challenges of that is the use of external libraries and frameworks; F# should be faring better than erlang in that matter for instance&#8230; But most of the great frameworks one could use for an MMO backend I could think of are either exclusive or available on the java platform&#8230; Is there a solid functional language running on the Java platform?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: adam</title>
		<link>http://t-machine.org/index.php/2009/10/26/entity-systems-are-the-future-of-mmos-part-5/comment-page-1/#comment-3258</link>
		<dc:creator>adam</dc:creator>
		<pubDate>Thu, 29 Oct 2009 18:58:01 +0000</pubDate>
		<guid isPermaLink="false">http://t-machine.org/?p=700#comment-3258</guid>
		<description>(Incidentally: 27 comments and still going ... this is a big part of why writing anything declarative about ES design takes a lot of time and effort: so many details and edge cases to think about, that it&#039;s worth thinking about, before you open your mouth and say something that implies stuff you didn&#039;t intend :))

@Jason

I have no problem with a single process having everything - but it never needs it all at once. It only needs it sequentially - bringing me back to: when would you ever need all that data at once? (other than for data-dumps to go to a foreign system - offsite backup, etc)

[actuallly, I do have a problem with monolithic processes - unless it&#039;s got a decent built-in scheduler and built-in threading system, and is micro-managing a load of mini-processes, which would be fine by me. But at that point I&#039;d still like to know what was so wrong with the various OSS and commercial scheduling systems that you felt &quot;I can do better; writing a multi-threaded OS ain&#039;t so hard&quot;; are the alternatives unusable?)</description>
		<content:encoded><![CDATA[<p>(Incidentally: 27 comments and still going &#8230; this is a big part of why writing anything declarative about ES design takes a lot of time and effort: so many details and edge cases to think about, that it&#8217;s worth thinking about, before you open your mouth and say something that implies stuff you didn&#8217;t intend :))</p>
<p>@Jason</p>
<p>I have no problem with a single process having everything &#8211; but it never needs it all at once. It only needs it sequentially &#8211; bringing me back to: when would you ever need all that data at once? (other than for data-dumps to go to a foreign system &#8211; offsite backup, etc)</p>
<p>[actuallly, I do have a problem with monolithic processes &#8211; unless it&#8217;s got a decent built-in scheduler and built-in threading system, and is micro-managing a load of mini-processes, which would be fine by me. But at that point I&#8217;d still like to know what was so wrong with the various OSS and commercial scheduling systems that you felt &#8220;I can do better; writing a multi-threaded OS ain&#8217;t so hard&#8221;; are the alternatives unusable?)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: adam</title>
		<link>http://t-machine.org/index.php/2009/10/26/entity-systems-are-the-future-of-mmos-part-5/comment-page-1/#comment-3257</link>
		<dc:creator>adam</dc:creator>
		<pubDate>Thu, 29 Oct 2009 18:48:41 +0000</pubDate>
		<guid isPermaLink="false">http://t-machine.org/?p=700#comment-3257</guid>
		<description>@Olivier

Yes - sorry about that - I meant:

- EITHER: you&#039;re already using it, or have used it, and at least know how to use it (most people)
- OR: you&#039;re not using it - but that&#039;s because you&#039;re not using ANYTHING yet, you haven&#039;t got that far (you probably WILL end up using it, and if you&#039;re this new to MMO&#039;s, you really SHOULD use it)

For the record: Alternative persistence backends are a lovely idea and I&#039;m all for them.

OTOH ... at AGDC, on our panel, Marty was claiming that only map/reduce was worth using, because &quot;every other DB backend is too slow at writes&quot; ... and my response was twofold:

1. Use more functional code
2. Use Entity Systems

I believe you can make a lot of better-known techs (like OOP and SQL) work &quot;well enough&quot; if you modify them by using an ES. I also believe that if you really know what you&#039;re doing, and you can find a robust enough language, and you coudl find qualified programmers, you&#039;d write everything on the server in a functional language. But I also consider that totally unrealistic for 99% of us.

(if anyone tries it, let me know - I&#039;ll be cheering for you, but don&#039;t ask me to *bet* on you ;))</description>
		<content:encoded><![CDATA[<p>@Olivier</p>
<p>Yes &#8211; sorry about that &#8211; I meant:</p>
<p>- EITHER: you&#8217;re already using it, or have used it, and at least know how to use it (most people)<br />
- OR: you&#8217;re not using it &#8211; but that&#8217;s because you&#8217;re not using ANYTHING yet, you haven&#8217;t got that far (you probably WILL end up using it, and if you&#8217;re this new to MMO&#8217;s, you really SHOULD use it)</p>
<p>For the record: Alternative persistence backends are a lovely idea and I&#8217;m all for them.</p>
<p>OTOH &#8230; at AGDC, on our panel, Marty was claiming that only map/reduce was worth using, because &#8220;every other DB backend is too slow at writes&#8221; &#8230; and my response was twofold:</p>
<p>1. Use more functional code<br />
2. Use Entity Systems</p>
<p>I believe you can make a lot of better-known techs (like OOP and SQL) work &#8220;well enough&#8221; if you modify them by using an ES. I also believe that if you really know what you&#8217;re doing, and you can find a robust enough language, and you coudl find qualified programmers, you&#8217;d write everything on the server in a functional language. But I also consider that totally unrealistic for 99% of us.</p>
<p>(if anyone tries it, let me know &#8211; I&#8217;ll be cheering for you, but don&#8217;t ask me to *bet* on you ;))</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Olivier</title>
		<link>http://t-machine.org/index.php/2009/10/26/entity-systems-are-the-future-of-mmos-part-5/comment-page-1/#comment-3255</link>
		<dc:creator>Olivier</dc:creator>
		<pubDate>Thu, 29 Oct 2009 18:06:47 +0000</pubDate>
		<guid isPermaLink="false">http://t-machine.org/?p=700#comment-3255</guid>
		<description>... Or maybe do you mean &quot;you should&quot; in the sense that &quot;most of you are&quot;?</description>
		<content:encoded><![CDATA[<p>&#8230; Or maybe do you mean &#8220;you should&#8221; in the sense that &#8220;most of you are&#8221;?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Olivier</title>
		<link>http://t-machine.org/index.php/2009/10/26/entity-systems-are-the-future-of-mmos-part-5/comment-page-1/#comment-3253</link>
		<dc:creator>Olivier</dc:creator>
		<pubDate>Thu, 29 Oct 2009 18:00:11 +0000</pubDate>
		<guid isPermaLink="false">http://t-machine.org/?p=700#comment-3253</guid>
		<description>&quot;If you’re working on MMO’s, you should be using SQL for your persistence / back-end&quot;

Should we? Don&#039;t you think it depends on how one wants to store and navigate one&#039;s data? SQL/relational isn&#039;t the golden hammer. I wouldn&#039;t dismiss other storage/databases solutions (object, map/reduce inspired systems), especially for a game object entity system before thinking about a game&#039;s specificity.</description>
		<content:encoded><![CDATA[<p>&#8220;If you’re working on MMO’s, you should be using SQL for your persistence / back-end&#8221;</p>
<p>Should we? Don&#8217;t you think it depends on how one wants to store and navigate one&#8217;s data? SQL/relational isn&#8217;t the golden hammer. I wouldn&#8217;t dismiss other storage/databases solutions (object, map/reduce inspired systems), especially for a game object entity system before thinking about a game&#8217;s specificity.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jason Beardsley</title>
		<link>http://t-machine.org/index.php/2009/10/26/entity-systems-are-the-future-of-mmos-part-5/comment-page-1/#comment-3252</link>
		<dc:creator>Jason Beardsley</dc:creator>
		<pubDate>Thu, 29 Oct 2009 16:41:38 +0000</pubDate>
		<guid isPermaLink="false">http://t-machine.org/?p=700#comment-3252</guid>
		<description>@adam

Just because there is a world simulation process doesn&#039;t mean that the individual game systems within that process aren&#039;t largely independent, and only work with a subset of entity components.  For example, the movement system should (ideally) only need to know about an entity&#039;s physics model - collision geometry, position/orientation, velocity, etc.  But, if you have decided to distribute the server load based on geography (e.g. one server handles all processing for a portion of the world), you still end up with a process that needs the whole entity.

And, as Matt pointed out, those crazy game designers have ways of creating systems that do require access to numerous components.  Combat systems, in particular, tend to grow in that direction.  (For this reason, I&#039;d argue, using geographical distribution is still the &quot;best&quot; way to spread the load on the server...but that is a whole other discussion.)</description>
		<content:encoded><![CDATA[<p>@adam</p>
<p>Just because there is a world simulation process doesn&#8217;t mean that the individual game systems within that process aren&#8217;t largely independent, and only work with a subset of entity components.  For example, the movement system should (ideally) only need to know about an entity&#8217;s physics model &#8211; collision geometry, position/orientation, velocity, etc.  But, if you have decided to distribute the server load based on geography (e.g. one server handles all processing for a portion of the world), you still end up with a process that needs the whole entity.</p>
<p>And, as Matt pointed out, those crazy game designers have ways of creating systems that do require access to numerous components.  Combat systems, in particular, tend to grow in that direction.  (For this reason, I&#8217;d argue, using geographical distribution is still the &#8220;best&#8221; way to spread the load on the server&#8230;but that is a whole other discussion.)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Matthew Weigel</title>
		<link>http://t-machine.org/index.php/2009/10/26/entity-systems-are-the-future-of-mmos-part-5/comment-page-1/#comment-3251</link>
		<dc:creator>Matthew Weigel</dc:creator>
		<pubDate>Wed, 28 Oct 2009 23:48:39 +0000</pubDate>
		<guid isPermaLink="false">http://t-machine.org/?p=700#comment-3251</guid>
		<description>@adam: re: what Jason is talking about, yeah. The problem - and this is where e.g. Darkstar falls down too - is that pretty much every piece of data has a good chance of affecting any particular step in the simulation. Are you at least level 35? Do you have a frobitz in your inventory that gives you a bonus to [whatever is happening]? Does your guild have a special power that gives you a bonus? &quot;Relevant stats&quot; at every step of the simulation easily balloons over time until any hard and fast demarcation you make... fails.

It is, in my opinion, a matter of designing the architecture of the game to fit the designers&#039; and players&#039; vision as much as possible, rather than restricting the vision to what architecture you have. The latter certainly comes into play quite a bit, but I think our job as programmers is to fight against it as much as possible... which is the challenging part that makes being a game programmer so fun and fulfilling, personally.

Now, re: data analysis on the entity system through tools, that&#039;s precisely the same analysis model as e.g. binary blobs. Except that binary blobs are ridiculously fast to store and load compared to an entity system, require much less database hardware, and so on.</description>
		<content:encoded><![CDATA[<p>@adam: re: what Jason is talking about, yeah. The problem &#8211; and this is where e.g. Darkstar falls down too &#8211; is that pretty much every piece of data has a good chance of affecting any particular step in the simulation. Are you at least level 35? Do you have a frobitz in your inventory that gives you a bonus to [whatever is happening]? Does your guild have a special power that gives you a bonus? &#8220;Relevant stats&#8221; at every step of the simulation easily balloons over time until any hard and fast demarcation you make&#8230; fails.</p>
<p>It is, in my opinion, a matter of designing the architecture of the game to fit the designers&#8217; and players&#8217; vision as much as possible, rather than restricting the vision to what architecture you have. The latter certainly comes into play quite a bit, but I think our job as programmers is to fight against it as much as possible&#8230; which is the challenging part that makes being a game programmer so fun and fulfilling, personally.</p>
<p>Now, re: data analysis on the entity system through tools, that&#8217;s precisely the same analysis model as e.g. binary blobs. Except that binary blobs are ridiculously fast to store and load compared to an entity system, require much less database hardware, and so on.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: adam</title>
		<link>http://t-machine.org/index.php/2009/10/26/entity-systems-are-the-future-of-mmos-part-5/comment-page-1/#comment-3250</link>
		<dc:creator>adam</dc:creator>
		<pubDate>Wed, 28 Oct 2009 21:53:55 +0000</pubDate>
		<guid isPermaLink="false">http://t-machine.org/?p=700#comment-3250</guid>
		<description>@Jason

&quot;the typical MMO architecture has a &quot;world simulation&quot; process that needs access to most, if not all, components of an entity&quot;

If it&#039;s working correctly, I don&#039;t see how that would happen?

If you&#039;re accessing most/all components of the entity, then you&#039;ve failed to build ES Systems - instead, you&#039;ve built a monolithic &quot;doEverthingPlease()&quot; method.

Why would you do such a thing? What in your simulation algorithm reqires doing everything in a single process in a single place?</description>
		<content:encoded><![CDATA[<p>@Jason</p>
<p>&#8220;the typical MMO architecture has a &#8220;world simulation&#8221; process that needs access to most, if not all, components of an entity&#8221;</p>
<p>If it&#8217;s working correctly, I don&#8217;t see how that would happen?</p>
<p>If you&#8217;re accessing most/all components of the entity, then you&#8217;ve failed to build ES Systems &#8211; instead, you&#8217;ve built a monolithic &#8220;doEverthingPlease()&#8221; method.</p>
<p>Why would you do such a thing? What in your simulation algorithm reqires doing everything in a single process in a single place?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jason Beardsley</title>
		<link>http://t-machine.org/index.php/2009/10/26/entity-systems-are-the-future-of-mmos-part-5/comment-page-1/#comment-3249</link>
		<dc:creator>Jason Beardsley</dc:creator>
		<pubDate>Wed, 28 Oct 2009 18:16:26 +0000</pubDate>
		<guid isPermaLink="false">http://t-machine.org/?p=700#comment-3249</guid>
		<description>@Adam 

As usual (since it&#039;s all I do), I&#039;m considering how these systems work in an MMO, and in particular on the server side.  Loading all (dynamic) entities, even into a caching server, is probably not feasible.  (Though for entity templates, this is exactly what you&#039;d want to do.)  And the typical MMO architecture has a &quot;world simulation&quot; process that needs access to most, if not all, components of an entity, so partial entity loading isn&#039;t applicable.  So, it&#039;s vital to be able to load an entire entity from the database in an efficient manner.  Making multiple queries, one per component, does not strike me as satisfying that goal.

In a previous project of mine, we faced this issue.  It turned out, after much experimentation, that the fastest way to load an entity from the database (MS SQL Server, fwiw) was to do a join across all of the component-specific instance data tables.  If an entity didn&#039;t have a row in one of those tables, then the result would have NULLs in those column positions, which had to be handled appropriately at the application level.  Not pretty, and definitely not the easiest thing to maintain, but sometimes that&#039;s how it goes.

It&#039;s worth noting is that we only had about 5 components that had any instance data; add a few more, maybe a different approach would be better.  If I were starting with a new technical design, I&#039;d probably stick with a simpler method (i.e. query each component table individually), until it became necessary to improve performance.</description>
		<content:encoded><![CDATA[<p>@Adam </p>
<p>As usual (since it&#8217;s all I do), I&#8217;m considering how these systems work in an MMO, and in particular on the server side.  Loading all (dynamic) entities, even into a caching server, is probably not feasible.  (Though for entity templates, this is exactly what you&#8217;d want to do.)  And the typical MMO architecture has a &#8220;world simulation&#8221; process that needs access to most, if not all, components of an entity, so partial entity loading isn&#8217;t applicable.  So, it&#8217;s vital to be able to load an entire entity from the database in an efficient manner.  Making multiple queries, one per component, does not strike me as satisfying that goal.</p>
<p>In a previous project of mine, we faced this issue.  It turned out, after much experimentation, that the fastest way to load an entity from the database (MS SQL Server, fwiw) was to do a join across all of the component-specific instance data tables.  If an entity didn&#8217;t have a row in one of those tables, then the result would have NULLs in those column positions, which had to be handled appropriately at the application level.  Not pretty, and definitely not the easiest thing to maintain, but sometimes that&#8217;s how it goes.</p>
<p>It&#8217;s worth noting is that we only had about 5 components that had any instance data; add a few more, maybe a different approach would be better.  If I were starting with a new technical design, I&#8217;d probably stick with a simpler method (i.e. query each component table individually), until it became necessary to improve performance.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: adam</title>
		<link>http://t-machine.org/index.php/2009/10/26/entity-systems-are-the-future-of-mmos-part-5/comment-page-1/#comment-3247</link>
		<dc:creator>adam</dc:creator>
		<pubDate>Wed, 28 Oct 2009 12:18:28 +0000</pubDate>
		<guid isPermaLink="false">http://t-machine.org/?p=700#comment-3247</guid>
		<description>@Matthew

I might have misunderstood what kind of data you&#039;re talking about, but...

&quot;entity systems are really awful at data analysis&quot; - I&#039;d argue the opposite :), although I agree that what you say is true &quot;by default&quot;.

The difference for me is that any real world ES is going to fall flat on its face as a data-maintenance nightmare if *all* you implement is the runtime system. Practically, you *must* build toolchain features / plugins that support the ES directly in your game-editors.

As soon as you do that, all the data model is once again back - only this time it&#039;s even more explicit (and easier to read and write) than in the alternatives (such as OOP): it&#039;s purer, because the *only* thing affecting the structures you have is the metadata you added to track those structures. In, say, traditional OOP, you&#039;ll &quot;additionally&quot; have occurences of subclassing and non-subclassing that had to be done for reasons other than the core data structure.

FYI - in my earlist conversations with Scott Bilas about ES&#039;s for Dungeon Siege etc, IIRC ... he picked on the editor-support as the biggest single win/lose criteria for an ES being deemed a  success at the project / final game level. For offline games like DS, the ES being implemented well or badly alters the output of the progrmming team, and the final runtime performance and bugginess. BUt the editor support alters the volume and quality of game-content - which for an RPG (obviously!) is the biggest single factor.

So ... yeah ... very important topic. One I haven&#039;t gone into in any detail (yet), because with modern games (larger scale and/or multi-threaded and/or online), the ES implementation itself becomes a lot more critical. And it&#039;s easier to screw up, IMHO :). But one I certainly want to cover in detail at some point - although I have less knowledge on how to do that part &quot;right&quot; - I have ideas and wishes on how to do it &quot;better than I did before&quot;, but haven&#039;t tried them out yet.</description>
		<content:encoded><![CDATA[<p>@Matthew</p>
<p>I might have misunderstood what kind of data you&#8217;re talking about, but&#8230;</p>
<p>&#8220;entity systems are really awful at data analysis&#8221; &#8211; I&#8217;d argue the opposite :), although I agree that what you say is true &#8220;by default&#8221;.</p>
<p>The difference for me is that any real world ES is going to fall flat on its face as a data-maintenance nightmare if *all* you implement is the runtime system. Practically, you *must* build toolchain features / plugins that support the ES directly in your game-editors.</p>
<p>As soon as you do that, all the data model is once again back &#8211; only this time it&#8217;s even more explicit (and easier to read and write) than in the alternatives (such as OOP): it&#8217;s purer, because the *only* thing affecting the structures you have is the metadata you added to track those structures. In, say, traditional OOP, you&#8217;ll &#8220;additionally&#8221; have occurences of subclassing and non-subclassing that had to be done for reasons other than the core data structure.</p>
<p>FYI &#8211; in my earlist conversations with Scott Bilas about ES&#8217;s for Dungeon Siege etc, IIRC &#8230; he picked on the editor-support as the biggest single win/lose criteria for an ES being deemed a  success at the project / final game level. For offline games like DS, the ES being implemented well or badly alters the output of the progrmming team, and the final runtime performance and bugginess. BUt the editor support alters the volume and quality of game-content &#8211; which for an RPG (obviously!) is the biggest single factor.</p>
<p>So &#8230; yeah &#8230; very important topic. One I haven&#8217;t gone into in any detail (yet), because with modern games (larger scale and/or multi-threaded and/or online), the ES implementation itself becomes a lot more critical. And it&#8217;s easier to screw up, IMHO :). But one I certainly want to cover in detail at some point &#8211; although I have less knowledge on how to do that part &#8220;right&#8221; &#8211; I have ideas and wishes on how to do it &#8220;better than I did before&#8221;, but haven&#8217;t tried them out yet.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: adam</title>
		<link>http://t-machine.org/index.php/2009/10/26/entity-systems-are-the-future-of-mmos-part-5/comment-page-1/#comment-3246</link>
		<dc:creator>adam</dc:creator>
		<pubDate>Wed, 28 Oct 2009 12:08:59 +0000</pubDate>
		<guid isPermaLink="false">http://t-machine.org/?p=700#comment-3246</guid>
		<description>@Jason

re: 1 - good point. As you say, assuming only one instance of a given component is needed per entity ... I think that&#039;s a better way of handling it.

re: “N + c database queries for an entity with N components” problem.

...each system is typically only going to need access to a handful of components. If you need all the data for an entity, it&#039;s either for offline / human-readable purposes (load it on screen to show to a player), so that latency isn&#039;t an issue any more, or it&#039;s as part of a mass serialization, in which case you&#039;re probably going to sidestep it and just start dumping tables en masse.

Ideally: rather than fetch entities on-deman, you pre-select all the data needed by a particular system for ALL entities (should be &lt; 10% of the total data of all entities - as per above, you only pick up the components that this system actually uses), and pass it that as input parameter on each tick of the game-loop. There are obvious optimizations here, e.g. splitting that pre-select into batches, but the use-cases for how much you want to pass to the system are going to depend a lot on where / how you&#039;re using the ES (is this a PS3 client? a multi-server cluster? etc).</description>
		<content:encoded><![CDATA[<p>@Jason</p>
<p>re: 1 &#8211; good point. As you say, assuming only one instance of a given component is needed per entity &#8230; I think that&#8217;s a better way of handling it.</p>
<p>re: “N + c database queries for an entity with N components” problem.</p>
<p>&#8230;each system is typically only going to need access to a handful of components. If you need all the data for an entity, it&#8217;s either for offline / human-readable purposes (load it on screen to show to a player), so that latency isn&#8217;t an issue any more, or it&#8217;s as part of a mass serialization, in which case you&#8217;re probably going to sidestep it and just start dumping tables en masse.</p>
<p>Ideally: rather than fetch entities on-deman, you pre-select all the data needed by a particular system for ALL entities (should be &lt; 10% of the total data of all entities &#8211; as per above, you only pick up the components that this system actually uses), and pass it that as input parameter on each tick of the game-loop. There are obvious optimizations here, e.g. splitting that pre-select into batches, but the use-cases for how much you want to pass to the system are going to depend a lot on where / how you&#039;re using the ES (is this a PS3 client? a multi-server cluster? etc).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Matthew Weigel</title>
		<link>http://t-machine.org/index.php/2009/10/26/entity-systems-are-the-future-of-mmos-part-5/comment-page-1/#comment-3244</link>
		<dc:creator>Matthew Weigel</dc:creator>
		<pubDate>Wed, 28 Oct 2009 02:12:13 +0000</pubDate>
		<guid isPermaLink="false">http://t-machine.org/?p=700#comment-3244</guid>
		<description>@adam: entity systems are really awful at data analysis, because so little of the data model is encoded in it (arguably the data model is just very loose, but the point is that at launch time the game has a data model implied by the data that is more concrete and useful than the entity system&#039;s). They are also not very impressive from a performance standpoint, with lots of iterated queries just to build one assembly.

@Jason: Transact-SQL has ExecuteSQL(), which is about as bad as you imagine. I saw a case where it was useful - an automated database update script had some lines of SQL that referred to non-existent tables and columns if that portion of the script didn&#039;t need to be run. The script was smart enough to check for that condition, but if you left the ALTER TABLE commands as bare SQL they&#039;d be parsed and SQL Server would error on them before anything was actually run. Wrapping them in ExecuteSQL() let us check for whether they were going to be valid, and THEN get the database to parse/execute them.

But yeah, it&#039;s the database equivalent of self-modifying code, with equivalent big angry warning signs flashing around it. :-)</description>
		<content:encoded><![CDATA[<p>@adam: entity systems are really awful at data analysis, because so little of the data model is encoded in it (arguably the data model is just very loose, but the point is that at launch time the game has a data model implied by the data that is more concrete and useful than the entity system&#8217;s). They are also not very impressive from a performance standpoint, with lots of iterated queries just to build one assembly.</p>
<p>@Jason: Transact-SQL has ExecuteSQL(), which is about as bad as you imagine. I saw a case where it was useful &#8211; an automated database update script had some lines of SQL that referred to non-existent tables and columns if that portion of the script didn&#8217;t need to be run. The script was smart enough to check for that condition, but if you left the ALTER TABLE commands as bare SQL they&#8217;d be parsed and SQL Server would error on them before anything was actually run. Wrapping them in ExecuteSQL() let us check for whether they were going to be valid, and THEN get the database to parse/execute them.</p>
<p>But yeah, it&#8217;s the database equivalent of self-modifying code, with equivalent big angry warning signs flashing around it. :-)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jason Beardsley</title>
		<link>http://t-machine.org/index.php/2009/10/26/entity-systems-are-the-future-of-mmos-part-5/comment-page-1/#comment-3242</link>
		<dc:creator>Jason Beardsley</dc:creator>
		<pubDate>Tue, 27 Oct 2009 22:05:13 +0000</pubDate>
		<guid isPermaLink="false">http://t-machine.org/?p=700#comment-3242</guid>
		<description>Good stuff.  A couple of random comments:

1)  If you&#039;re willing to live with the limitation that a given entity can only have a single instance of any specific component (which may not be a limitation at all, depends on design), then the component_data_id columns are unnecessary, and the component data tables would use entity_id as their primary key.

Even if you really needed multiple components of the same type attached to an entity, I don&#039;t know if I&#039;d necessarily use a separate id space to store them.  An &quot;instance_id&quot; column (unique only to a given entity_id) would also work, and component data tables would have be keyed on entity_id + instance_id.

Why do this?  Well, I think it&#039;s clearer to have component data indexed on entity_id anyway, but it also means that component data tables will be sorted based on entity_id, which is a good thing for performance.

2)  I generally prefer to not store table names in other tables, e.g. the components.table_name column, and would opt for an algorithmic method.  My knowledge of SQL is far from complete, but as far as I know, you can&#039;t get a column value and then use that value in a later &quot;static&quot; query as the table name.  Instead you have to build the query strings dynamically, which reduces performance (or at least, forces the database to re-analyze/optimize such queries).

Hard to describe exactly what I mean, but let&#039;s assume that SQL included a unix-like backtick operator.  The following is what I&#039;d theoretically like to write, but (to my knowledge) cannot:

SELECT * FROM `SELECT table_name FROM components WHERE component_id = $2` WHERE entity_id = $1;

The above query is meant to return (arbitrary) component data, given an entity id and a component id.  Then again, I&#039;m not sure how the db optimizer could do much with the above, even if I could legally write it.

I guess my main issue is that I prefer using stored procedures - exclusively - from the application, for a number of reasons.  I don&#039;t know that I could do that with the &quot;dynamic&quot; table names utilized in your approach - it would depend on what the database procedural language supported.

And yes, using &quot;known&quot; table names does mean that entity loading queries would hard-code those tables (perhaps in a huge join, even), but in the interests of performance that is something you may ultimately find necessary.  I look forward to the next article in this series, and how you might avoid the &quot;N + c database queries for an entity with N components&quot; problem.</description>
		<content:encoded><![CDATA[<p>Good stuff.  A couple of random comments:</p>
<p>1)  If you&#8217;re willing to live with the limitation that a given entity can only have a single instance of any specific component (which may not be a limitation at all, depends on design), then the component_data_id columns are unnecessary, and the component data tables would use entity_id as their primary key.</p>
<p>Even if you really needed multiple components of the same type attached to an entity, I don&#8217;t know if I&#8217;d necessarily use a separate id space to store them.  An &#8220;instance_id&#8221; column (unique only to a given entity_id) would also work, and component data tables would have be keyed on entity_id + instance_id.</p>
<p>Why do this?  Well, I think it&#8217;s clearer to have component data indexed on entity_id anyway, but it also means that component data tables will be sorted based on entity_id, which is a good thing for performance.</p>
<p>2)  I generally prefer to not store table names in other tables, e.g. the components.table_name column, and would opt for an algorithmic method.  My knowledge of SQL is far from complete, but as far as I know, you can&#8217;t get a column value and then use that value in a later &#8220;static&#8221; query as the table name.  Instead you have to build the query strings dynamically, which reduces performance (or at least, forces the database to re-analyze/optimize such queries).</p>
<p>Hard to describe exactly what I mean, but let&#8217;s assume that SQL included a unix-like backtick operator.  The following is what I&#8217;d theoretically like to write, but (to my knowledge) cannot:</p>
<p>SELECT * FROM `SELECT table_name FROM components WHERE component_id = $2` WHERE entity_id = $1;</p>
<p>The above query is meant to return (arbitrary) component data, given an entity id and a component id.  Then again, I&#8217;m not sure how the db optimizer could do much with the above, even if I could legally write it.</p>
<p>I guess my main issue is that I prefer using stored procedures &#8211; exclusively &#8211; from the application, for a number of reasons.  I don&#8217;t know that I could do that with the &#8220;dynamic&#8221; table names utilized in your approach &#8211; it would depend on what the database procedural language supported.</p>
<p>And yes, using &#8220;known&#8221; table names does mean that entity loading queries would hard-code those tables (perhaps in a huge join, even), but in the interests of performance that is something you may ultimately find necessary.  I look forward to the next article in this series, and how you might avoid the &#8220;N + c database queries for an entity with N components&#8221; problem.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Arni Arent</title>
		<link>http://t-machine.org/index.php/2009/10/26/entity-systems-are-the-future-of-mmos-part-5/comment-page-1/#comment-3241</link>
		<dc:creator>Arni Arent</dc:creator>
		<pubDate>Tue, 27 Oct 2009 20:56:30 +0000</pubDate>
		<guid isPermaLink="false">http://t-machine.org/?p=700#comment-3241</guid>
		<description>Good article!

Maybe you can readdress this issue that has been nagging me:
How do systems interact with each other?
Are the systems oblivious of each other?

Let&#039;s imagine two systems:
&quot;ShootSystem&quot;
&quot;RegenerateHealthSystem&quot;
- But the condition of some game unit (tank) is that it cannot shoot while regenerating.

1. Can I not make the ShootSystem somehow query the RegenerateHealthSystem if that entity is regenerating?

2. Should these two Systems actually be one System? Something like &quot;RegenerateHealthAndShootingSystem&quot; ? That doesn&#039;t make sense to me, I thought you said this was supposed to be modular!? :)

3. If these systems can communicate, then what is the significance of this when you have each of those systems running on it&#039;s own server?</description>
		<content:encoded><![CDATA[<p>Good article!</p>
<p>Maybe you can readdress this issue that has been nagging me:<br />
How do systems interact with each other?<br />
Are the systems oblivious of each other?</p>
<p>Let&#8217;s imagine two systems:<br />
&#8220;ShootSystem&#8221;<br />
&#8220;RegenerateHealthSystem&#8221;<br />
- But the condition of some game unit (tank) is that it cannot shoot while regenerating.</p>
<p>1. Can I not make the ShootSystem somehow query the RegenerateHealthSystem if that entity is regenerating?</p>
<p>2. Should these two Systems actually be one System? Something like &#8220;RegenerateHealthAndShootingSystem&#8221; ? That doesn&#8217;t make sense to me, I thought you said this was supposed to be modular!? :)</p>
<p>3. If these systems can communicate, then what is the significance of this when you have each of those systems running on it&#8217;s own server?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Aengus</title>
		<link>http://t-machine.org/index.php/2009/10/26/entity-systems-are-the-future-of-mmos-part-5/comment-page-1/#comment-3240</link>
		<dc:creator>Aengus</dc:creator>
		<pubDate>Tue, 27 Oct 2009 17:27:54 +0000</pubDate>
		<guid isPermaLink="false">http://t-machine.org/?p=700#comment-3240</guid>
		<description>@Andrew

This is just a thought but one way this might be done is if all of the different Components are stored on a separate Database Server and all of the System Servers are connected by a message system then the animation process could work like this: 
First, the Animation System Server activates it&#039;s Animation and updates the Animation Component on the database.
Then it sends a message to the Render System Server that a animation has been activated (this message would probably hold things like the Entity-id).
And finally the Render System Server will use the information in the Animation Message to fetch the animation data from the Database and use that during render time.
Hope this helps.</description>
		<content:encoded><![CDATA[<p>@Andrew</p>
<p>This is just a thought but one way this might be done is if all of the different Components are stored on a separate Database Server and all of the System Servers are connected by a message system then the animation process could work like this:<br />
First, the Animation System Server activates it&#8217;s Animation and updates the Animation Component on the database.<br />
Then it sends a message to the Render System Server that a animation has been activated (this message would probably hold things like the Entity-id).<br />
And finally the Render System Server will use the information in the Animation Message to fetch the animation data from the Database and use that during render time.<br />
Hope this helps.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andrew Hanson</title>
		<link>http://t-machine.org/index.php/2009/10/26/entity-systems-are-the-future-of-mmos-part-5/comment-page-1/#comment-3239</link>
		<dc:creator>Andrew Hanson</dc:creator>
		<pubDate>Tue, 27 Oct 2009 13:28:10 +0000</pubDate>
		<guid isPermaLink="false">http://t-machine.org/?p=700#comment-3239</guid>
		<description>@adam

So taking the example where the Animation system just modifies the polygons in the Render component. How is this best handled when the two systems are running on different servers? (I know its not likely that a desktop game with an Animation and Rendering system would be large enough to take two servers, but the problem still holds for larger Systems that need to interact)</description>
		<content:encoded><![CDATA[<p>@adam</p>
<p>So taking the example where the Animation system just modifies the polygons in the Render component. How is this best handled when the two systems are running on different servers? (I know its not likely that a desktop game with an Animation and Rendering system would be large enough to take two servers, but the problem still holds for larger Systems that need to interact)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: adam</title>
		<link>http://t-machine.org/index.php/2009/10/26/entity-systems-are-the-future-of-mmos-part-5/comment-page-1/#comment-3238</link>
		<dc:creator>adam</dc:creator>
		<pubDate>Tue, 27 Oct 2009 11:31:51 +0000</pubDate>
		<guid isPermaLink="false">http://t-machine.org/?p=700#comment-3238</guid>
		<description>@andrew

it depends a bit uponhow your rendering layer works, obviously...

Beyond that, it depends how you choose to implement the ES internals of your systems.

I&#039;ll think about this properly, and try to include a better response later, but off the top of my head (nb: I reserve the right to later declare some or all of this stupid and wrong ;))...

For instance: if your renderer requires polygon arrays, then your renderable component may include  a list of polygons to render. Your animation system might mutate those polygons directly - either by modifying them in-situ, or by Reading eg a bones list from it&#039;s own component - the animation component - moving the bones, regenerating the entire polygon list, and overwriting it.

The rendering system would pick up the polygons each frame, and probably pick up the world-co-ords too, and translate the polys into position.</description>
		<content:encoded><![CDATA[<p>@andrew</p>
<p>it depends a bit uponhow your rendering layer works, obviously&#8230;</p>
<p>Beyond that, it depends how you choose to implement the ES internals of your systems.</p>
<p>I&#8217;ll think about this properly, and try to include a better response later, but off the top of my head (nb: I reserve the right to later declare some or all of this stupid and wrong ;))&#8230;</p>
<p>For instance: if your renderer requires polygon arrays, then your renderable component may include  a list of polygons to render. Your animation system might mutate those polygons directly &#8211; either by modifying them in-situ, or by Reading eg a bones list from it&#8217;s own component &#8211; the animation component &#8211; moving the bones, regenerating the entire polygon list, and overwriting it.</p>
<p>The rendering system would pick up the polygons each frame, and probably pick up the world-co-ords too, and translate the polys into position.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: adam</title>
		<link>http://t-machine.org/index.php/2009/10/26/entity-systems-are-the-future-of-mmos-part-5/comment-page-1/#comment-3237</link>
		<dc:creator>adam</dc:creator>
		<pubDate>Tue, 27 Oct 2009 09:29:28 +0000</pubDate>
		<guid isPermaLink="false">http://t-machine.org/?p=700#comment-3237</guid>
		<description>Where do you find ES to be less appropriate than the other approaches?</description>
		<content:encoded><![CDATA[<p>Where do you find ES to be less appropriate than the other approaches?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Matthew Weigel</title>
		<link>http://t-machine.org/index.php/2009/10/26/entity-systems-are-the-future-of-mmos-part-5/comment-page-1/#comment-3236</link>
		<dc:creator>Matthew Weigel</dc:creator>
		<pubDate>Tue, 27 Oct 2009 08:11:14 +0000</pubDate>
		<guid isPermaLink="false">http://t-machine.org/?p=700#comment-3236</guid>
		<description>@adam - the usual suspects, really; binary blobs, entity systems like you describe (and/or simpler ones), and a stronger / more manual approach directly mapping game entities to tables.

I haven&#039;t settled on one because for the last year our team has been focused on prototyping gameplay for something other than your standard Diku/EQ/WoW clone. I was just starting on some aspects of world persistence the last couple of weeks, and now I don&#039;t have to worry about that. A big part of my interest in exploring approaches is balancing production performance and data analysis, and none of the standard approaches do very well at one or the other.</description>
		<content:encoded><![CDATA[<p>@adam &#8211; the usual suspects, really; binary blobs, entity systems like you describe (and/or simpler ones), and a stronger / more manual approach directly mapping game entities to tables.</p>
<p>I haven&#8217;t settled on one because for the last year our team has been focused on prototyping gameplay for something other than your standard Diku/EQ/WoW clone. I was just starting on some aspects of world persistence the last couple of weeks, and now I don&#8217;t have to worry about that. A big part of my interest in exploring approaches is balancing production performance and data analysis, and none of the standard approaches do very well at one or the other.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
