 <?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 for Tom Davies</title>
	<atom:link href="http://www.tomseysdavies.com/comments/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.tomseysdavies.com</link>
	<description>Freelance flash and flex developer</description>
	<lastBuildDate>Thu, 12 Jan 2012 17:38:28 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>Comment on Getting started with Ember by Mangan</title>
		<link>http://www.tomseysdavies.com/2011/02/03/getting-started-with-ember/comment-page-1/#comment-271</link>
		<dc:creator>Mangan</dc:creator>
		<pubDate>Thu, 12 Jan 2012 17:38:28 +0000</pubDate>
		<guid isPermaLink="false">http://www.tomseysdavies.com/?p=219#comment-271</guid>
		<description>I&#039;m still new to Entity Systems, but found this page through my researching.
Anyway, in response to the mage transforming into a troll questioning, although a bit late:

Couldn&#039;t the &quot;TrollTransform&quot; System do the following:
1) Create a new &quot;TransformedTroll&quot; Component, which has troll-data as well as an empty list of the blocked Components.
2) Remove all the mage&#039;s Components that should be blocked, moving them to the &quot;TransformedTroll&quot; Component&#039;s list of blocked Components.
3) Apply the &quot;TransformedTroll&quot; Component to the mage.

Then the System that eventually cancels (removes) the &quot;TransformedTroll&quot; Component would reapply the removed Components, which it would have access to through the &quot;TransformedTroll&quot; Component. In essence, the removed Components are just blocked (unseen by the Entity &amp; Systems that would use them), and treated as data as part of the &quot;TransformedTroll&quot; Component.

Only downside that immediately pops out at me is that two Systems rely on one another in this example, unless there was a clean way to do it in a single system... I can think of an easy way off the top of my head, but it seems like a hack:

When the mage is to be turned into a troll, simply apply the &quot;TransformedTroll&quot; component with a boolean data flag marking that it has yet to change. The &quot;TrollTransform&quot; System would depend on this one component, and could handle both stages of the troll: transform into troll and transform back to normal.

Comments/opinions/criticism welcome.</description>
		<content:encoded><![CDATA[<p>I&#8217;m still new to Entity Systems, but found this page through my researching.<br />
Anyway, in response to the mage transforming into a troll questioning, although a bit late:</p>
<p>Couldn&#8217;t the &#8220;TrollTransform&#8221; System do the following:<br />
1) Create a new &#8220;TransformedTroll&#8221; Component, which has troll-data as well as an empty list of the blocked Components.<br />
2) Remove all the mage&#8217;s Components that should be blocked, moving them to the &#8220;TransformedTroll&#8221; Component&#8217;s list of blocked Components.<br />
3) Apply the &#8220;TransformedTroll&#8221; Component to the mage.</p>
<p>Then the System that eventually cancels (removes) the &#8220;TransformedTroll&#8221; Component would reapply the removed Components, which it would have access to through the &#8220;TransformedTroll&#8221; Component. In essence, the removed Components are just blocked (unseen by the Entity &amp; Systems that would use them), and treated as data as part of the &#8220;TransformedTroll&#8221; Component.</p>
<p>Only downside that immediately pops out at me is that two Systems rely on one another in this example, unless there was a clean way to do it in a single system&#8230; I can think of an easy way off the top of my head, but it seems like a hack:</p>
<p>When the mage is to be turned into a troll, simply apply the &#8220;TransformedTroll&#8221; component with a boolean data flag marking that it has yet to change. The &#8220;TrollTransform&#8221; System would depend on this one component, and could handle both stages of the troll: transform into troll and transform back to normal.</p>
<p>Comments/opinions/criticism welcome.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Getting started with Ember by jayden</title>
		<link>http://www.tomseysdavies.com/2011/02/03/getting-started-with-ember/comment-page-1/#comment-234</link>
		<dc:creator>jayden</dc:creator>
		<pubDate>Wed, 19 Oct 2011 07:04:34 +0000</pubDate>
		<guid isPermaLink="false">http://www.tomseysdavies.com/?p=219#comment-234</guid>
		<description>Its not too bad I guess, heres the implementation for anyone interested. The native array sort is fast so its likely the whole game will run slow with or without it if you have too many entities being added/removed or changing layers.

-----in the game class-----

	private var _resortLayers:ResortLayers = new ResortLayers(); //ResortLayers is a signal the same as Render/Update etc..
	
	override protected function startUp():void 
	{
		var renderNodes:IFamily = entityManager.getEntityFamily(RendererNode);
		renderNodes.entityAdded.add(renderableEntityAdded);
		
		injector.mapValue(ResortLayers, _resortLayers);
	}
	
	private function renderableEntityAdded(renderNode:RendererNode):void
	{
		_resortLayers.dispatch();
	}
	
	//! there will also need to be a dispatch sent for when an entity changes its layer depth and when an entity is removed.

-----in the rendering &amp; sorting system-----
	public class RenderSystem implements ISystem
	{
		[Inject]
		public var render:Render;
		
		[Inject]
		public var resortLayers:ResortLayers;

		private var _sort:Array = [];
		
		public function onRegister():void
		{
			render.add(onRender);
			resortLayers.add(onResortLayers);
			resortLayers.dispatch(); //without this the array will stay empty if the system is created after the last entity.
		}
		
		public function onResortLayers():void
		{
			_sort = [];
			for (_renderNodes.start(); _renderNodes.hasNext; _renderNodes.next())
			{
				_sort.push(_renderNodes.currentNode);
			}
			_sort.sortOn(&quot;layer&quot;);
		}
		
		public function onRender():void
		{	
			for (var i:int = 0; i &lt; _sort.length; i++) //maybe this is actually faster than using the _renderNodes access methods anyway?
			{
				node = _sort[i];
				//the usual....
			}	
		}
	}
	
-----change to give renderNode a property to sort on-----

	public class RendererNode extends Node
	{
		public static const componentClasses:Array = [SpacialComponent, GraphicComponent];
		
		public var spacialComponent:SpacialComponent;
		public var graphicComponent:GraphicComponent;
		
		public function get layer():int
		{
			return graphicComponent.layer; //graphics can now have their rendering order changed with an added layer property.
		}
		
		public function RendererNode(entityID:String, components:Dictionary)
		{
			super(entityID, components);
			spacialComponent = components[SpacialComponent];
			graphicComponent = components[GraphicComponent];
		}
	}</description>
		<content:encoded><![CDATA[<p>Its not too bad I guess, heres the implementation for anyone interested. The native array sort is fast so its likely the whole game will run slow with or without it if you have too many entities being added/removed or changing layers.</p>
<p>&#8212;&#8211;in the game class&#8212;&#8211;</p>
<p>	private var _resortLayers:ResortLayers = new ResortLayers(); //ResortLayers is a signal the same as Render/Update etc..</p>
<p>	override protected function startUp():void<br />
	{<br />
		var renderNodes:IFamily = entityManager.getEntityFamily(RendererNode);<br />
		renderNodes.entityAdded.add(renderableEntityAdded);</p>
<p>		injector.mapValue(ResortLayers, _resortLayers);<br />
	}</p>
<p>	private function renderableEntityAdded(renderNode:RendererNode):void<br />
	{<br />
		_resortLayers.dispatch();<br />
	}</p>
<p>	//! there will also need to be a dispatch sent for when an entity changes its layer depth and when an entity is removed.</p>
<p>&#8212;&#8211;in the rendering &amp; sorting system&#8212;&#8211;<br />
	public class RenderSystem implements ISystem<br />
	{<br />
		[Inject]<br />
		public var render:Render;</p>
<p>		[Inject]<br />
		public var resortLayers:ResortLayers;</p>
<p>		private var _sort:Array = [];</p>
<p>		public function onRegister():void<br />
		{<br />
			render.add(onRender);<br />
			resortLayers.add(onResortLayers);<br />
			resortLayers.dispatch(); //without this the array will stay empty if the system is created after the last entity.<br />
		}</p>
<p>		public function onResortLayers():void<br />
		{<br />
			_sort = [];<br />
			for (_renderNodes.start(); _renderNodes.hasNext; _renderNodes.next())<br />
			{<br />
				_sort.push(_renderNodes.currentNode);<br />
			}<br />
			_sort.sortOn(&#8220;layer&#8221;);<br />
		}</p>
<p>		public function onRender():void<br />
		{<br />
			for (var i:int = 0; i &lt; _sort.length; i++) //maybe this is actually faster than using the _renderNodes access methods anyway?<br />
			{<br />
				node = _sort[i];<br />
				//the usual&#8230;.<br />
			}<br />
		}<br />
	}</p>
<p>&#8212;&#8211;change to give renderNode a property to sort on&#8212;&#8211;</p>
<p>	public class RendererNode extends Node<br />
	{<br />
		public static const componentClasses:Array = [SpacialComponent, GraphicComponent];</p>
<p>		public var spacialComponent:SpacialComponent;<br />
		public var graphicComponent:GraphicComponent;</p>
<p>		public function get layer():int<br />
		{<br />
			return graphicComponent.layer; //graphics can now have their rendering order changed with an added layer property.<br />
		}</p>
<p>		public function RendererNode(entityID:String, components:Dictionary)<br />
		{<br />
			super(entityID, components);<br />
			spacialComponent = components[SpacialComponent];<br />
			graphicComponent = components[GraphicComponent];<br />
		}<br />
	}</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Getting started with Ember by admin</title>
		<link>http://www.tomseysdavies.com/2011/02/03/getting-started-with-ember/comment-page-1/#comment-233</link>
		<dc:creator>admin</dc:creator>
		<pubDate>Tue, 18 Oct 2011 16:36:26 +0000</pubDate>
		<guid isPermaLink="false">http://www.tomseysdavies.com/?p=219#comment-233</guid>
		<description>Hi sorry for the dealy in the response. This is not somthing i&#039;ve really thought about so its always good to here these usercase. As this isnt going to be too common I think your solution is pretty good. However it would mean you can&#039;t change the depth of an entity once its been added. I guess in that case you would have to create a sorted list every frame. I suppose in the same vein you could possibly also want to include in this some way to filter nodes. Certainly somthing for me to think about. If only we had generics in AS3 then we could just create a vector of nodes and sort that.</description>
		<content:encoded><![CDATA[<p>Hi sorry for the dealy in the response. This is not somthing i&#8217;ve really thought about so its always good to here these usercase. As this isnt going to be too common I think your solution is pretty good. However it would mean you can&#8217;t change the depth of an entity once its been added. I guess in that case you would have to create a sorted list every frame. I suppose in the same vein you could possibly also want to include in this some way to filter nodes. Certainly somthing for me to think about. If only we had generics in AS3 then we could just create a vector of nodes and sort that.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Getting started with Ember by jayden</title>
		<link>http://www.tomseysdavies.com/2011/02/03/getting-started-with-ember/comment-page-1/#comment-230</link>
		<dc:creator>jayden</dc:creator>
		<pubDate>Sat, 15 Oct 2011 06:40:14 +0000</pubDate>
		<guid isPermaLink="false">http://www.tomseysdavies.com/?p=219#comment-230</guid>
		<description>I have been doing some more playing with the framework, and I&#039;ve hit a brick wall with how to handle graphics layering on the current system.

I came up with some not so optimal solutions, so I was wondering if the next iteration of ember has a solution built in, or whether there is a clean way to sort nodes.

My solution involved having an array in the render system which contained the rendernodes and can be signalled to update/re-sort when a rendernode is added/removed. - its obviously a bit hacky and defeats the purpose of the system.</description>
		<content:encoded><![CDATA[<p>I have been doing some more playing with the framework, and I&#8217;ve hit a brick wall with how to handle graphics layering on the current system.</p>
<p>I came up with some not so optimal solutions, so I was wondering if the next iteration of ember has a solution built in, or whether there is a clean way to sort nodes.</p>
<p>My solution involved having an array in the render system which contained the rendernodes and can be signalled to update/re-sort when a rendernode is added/removed. &#8211; its obviously a bit hacky and defeats the purpose of the system.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Getting started with Ember by jayden</title>
		<link>http://www.tomseysdavies.com/2011/02/03/getting-started-with-ember/comment-page-1/#comment-223</link>
		<dc:creator>jayden</dc:creator>
		<pubDate>Thu, 13 Oct 2011 12:14:35 +0000</pubDate>
		<guid isPermaLink="false">http://www.tomseysdavies.com/?p=219#comment-223</guid>
		<description>Thanks for the response,
before I read your comment I managed to get it working by adding

override protected function mapInjectors():void{
	injector.mapValue(EntityManager, entityManager);
	super.mapInjectors();
}

to SpeedTestGame.as of the bunny demo

Ill probably hold of on too much more blind fiddling in eager anticipation of the updates now. :)

I think its a great system so far. 
thanks.</description>
		<content:encoded><![CDATA[<p>Thanks for the response,<br />
before I read your comment I managed to get it working by adding</p>
<p>override protected function mapInjectors():void{<br />
	injector.mapValue(EntityManager, entityManager);<br />
	super.mapInjectors();<br />
}</p>
<p>to SpeedTestGame.as of the bunny demo</p>
<p>Ill probably hold of on too much more blind fiddling in eager anticipation of the updates now. <img src='http://www.tomseysdavies.com/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>I think its a great system so far.<br />
thanks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Getting started with Ember by admin</title>
		<link>http://www.tomseysdavies.com/2011/02/03/getting-started-with-ember/comment-page-1/#comment-222</link>
		<dc:creator>admin</dc:creator>
		<pubDate>Thu, 13 Oct 2011 11:48:04 +0000</pubDate>
		<guid isPermaLink="false">http://www.tomseysdavies.com/?p=219#comment-222</guid>
		<description>Jayden, Richard Lord correclty suggested the EntityManager should be injected with its interface so that change was made. In the demo change the injection points to IEntityManager and you should be fine. Some more major changes may be due soon which is why nothing is cuttenlty being kept upto date.
 As you correctly point out one of the many advantages of this is being able to swap the rendering system easily. In therory you could acutaly do this at run time!</description>
		<content:encoded><![CDATA[<p>Jayden, Richard Lord correclty suggested the EntityManager should be injected with its interface so that change was made. In the demo change the injection points to IEntityManager and you should be fine. Some more major changes may be due soon which is why nothing is cuttenlty being kept upto date.<br />
 As you correctly point out one of the many advantages of this is being able to swap the rendering system easily. In therory you could acutaly do this at run time!</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Getting started with Ember by jayden</title>
		<link>http://www.tomseysdavies.com/2011/02/03/getting-started-with-ember/comment-page-1/#comment-221</link>
		<dc:creator>jayden</dc:creator>
		<pubDate>Thu, 13 Oct 2011 10:37:13 +0000</pubDate>
		<guid isPermaLink="false">http://www.tomseysdavies.com/?p=219#comment-221</guid>
		<description>I tried to build the bunny demo but I get the following error:

Error: Injector is missing a rule to handle injection into target [object RenderSystem]. Target dependency: com.tomseysdavies.ember.base::EntityManager

ill go through the swiftsuspenders/robotlegs docs since im new to dependency injection, but is there any possibility of getting a complete working demo, or a hint to fix the problem.

After reading up on the entity system approach, im thinking its worthwhile using it for a game engine im working on now, since its rendering code would be interchangable/easier to replace with future gpu enhanced methods etc. in theory anyway, id like to keep that door as open as I can.

-Jayden</description>
		<content:encoded><![CDATA[<p>I tried to build the bunny demo but I get the following error:</p>
<p>Error: Injector is missing a rule to handle injection into target [object RenderSystem]. Target dependency: com.tomseysdavies.ember.base::EntityManager</p>
<p>ill go through the swiftsuspenders/robotlegs docs since im new to dependency injection, but is there any possibility of getting a complete working demo, or a hint to fix the problem.</p>
<p>After reading up on the entity system approach, im thinking its worthwhile using it for a game engine im working on now, since its rendering code would be interchangable/easier to replace with future gpu enhanced methods etc. in theory anyway, id like to keep that door as open as I can.</p>
<p>-Jayden</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Entity Systems by Doubly linked list and object pooling :Aymeric Lamboley</title>
		<link>http://www.tomseysdavies.com/2011/01/23/entity-systems/comment-page-1/#comment-180</link>
		<dc:creator>Doubly linked list and object pooling :Aymeric Lamboley</dc:creator>
		<pubDate>Sat, 10 Sep 2011 14:58:54 +0000</pubDate>
		<guid isPermaLink="false">http://www.tomseysdavies.com/?p=197#comment-180</guid>
		<description>[...] : Gamasutra the Entity Component Model, Entity Systems are the future of MMOG development, Entity Systems. This links are very interesting, but there isn&#8217;t any implementation. You can find [...]</description>
		<content:encoded><![CDATA[<p>[...] : Gamasutra the Entity Component Model, Entity Systems are the future of MMOG development, Entity Systems. This links are very interesting, but there isn&#8217;t any implementation. You can find [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Getting started with Ember by Plamen Andreev</title>
		<link>http://www.tomseysdavies.com/2011/02/03/getting-started-with-ember/comment-page-1/#comment-167</link>
		<dc:creator>Plamen Andreev</dc:creator>
		<pubDate>Tue, 23 Aug 2011 15:00:35 +0000</pubDate>
		<guid isPermaLink="false">http://www.tomseysdavies.com/?p=219#comment-167</guid>
		<description>Hi Tom,

thanks for the info. Nice presentation :). I&#039;ll check your blog at a later time for updates. Good luck with your stuff.

- Plamen</description>
		<content:encoded><![CDATA[<p>Hi Tom,</p>
<p>thanks for the info. Nice presentation <img src='http://www.tomseysdavies.com/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> . I&#8217;ll check your blog at a later time for updates. Good luck with your stuff.</p>
<p>- Plamen</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Getting started with Ember by admin</title>
		<link>http://www.tomseysdavies.com/2011/02/03/getting-started-with-ember/comment-page-1/#comment-166</link>
		<dc:creator>admin</dc:creator>
		<pubDate>Tue, 23 Aug 2011 08:42:52 +0000</pubDate>
		<guid isPermaLink="false">http://www.tomseysdavies.com/?p=219#comment-166</guid>
		<description>Palamen,

    In the bunny demo&#039;s there are examples of  inter-system-communication. In the game context we map a signal class like this

 injector.mapSingleton(Tick);

then we can inject it into a system needed

 [Inject]public var tick:Tick;

Simple as that. Not much progress on the engine at the moment im afraid. Im over busy with other work but hopefully I will get a chance later this year.

Tom</description>
		<content:encoded><![CDATA[<p>Palamen,</p>
<p>    In the bunny demo&#8217;s there are examples of  inter-system-communication. In the game context we map a signal class like this</p>
<p> injector.mapSingleton(Tick);</p>
<p>then we can inject it into a system needed</p>
<p> [Inject]public var tick:Tick;</p>
<p>Simple as that. Not much progress on the engine at the moment im afraid. Im over busy with other work but hopefully I will get a chance later this year.</p>
<p>Tom</p>
]]></content:encoded>
	</item>
</channel>
</rss>

