Jump to content

  • Log In with Google      Sign In   
  • Create Account

Awesome job so far everyone! Please give us your feedback on how our article efforts are going. We still need more finished articles for our May contest theme: Remake the Classics

#ActualNet Gnome

Posted 18 July 2012 - 02:31 PM

One of them was that if you let your systems update one entity per time, you'll run into problems with the Collision and the Rendering system, because you'll have to make your own containers in order to check each Entity against each entity (for collisions), and you'll need to sort the entities for depth drawing (rendering).


Systems do not have to update one entity at a time. If you need to process through several at a time, you just extend the base EntitySystem class so that the process calls gives you all registered entities for that system and not just one at a time. Name it something like CascadingEntityProcessingSystem or somesuch.

so where a normal EntityProcessingSystem looks like such:

public abstract class EntityProcessingSystem : EntitySystem
    {
	    public EntityProcessingSystem() : base() { }
	    public override bool shouldSystemProcess()
	    {
		    return true;
	    }
	    protected abstract void process(Entity entity);
	    protected sealed override void processEntities(Bag<Entity> entities)
	    {
		    for (int i = 0; i < entities.Size(); i++)
		    {
			    process(entities.Get(i));
		    }
	    }
    }

the cascade variant would work like so:

public abstract class CascadingEntityProcessingSystem : EntitySystem
    {
	    public EntityProcessingSystem() : base() { }

	    public override bool shouldSystemProcess()
	    {
		    return true;
	    }

	    protected abstract void process(Bag<Entity> entities);

	    protected sealed override void processEntities(Bag<Entity> entities)
	    {
            process(entities);
	    }
    }

It depends on the kind of components we talk about. I started the discussion because you stated that you wanted to implement a system, where the components only represent the data. And it could definitely possible to have two entities with the same data set that behave differently. For example you have two different AI systems, which need the same data but lead to different behavior etc.


In this case, neither entity actually owns that data. it is accessed through a separate entity that they are both referencing. There is no true "ownership" in an ECS framework like there is in an OO or Hierarchical framework, its all about references, relationships and associations. Its very loosely coupled, very similar to a simple database.

#5Net Gnome

Posted 18 July 2012 - 02:29 PM

One of them was that if you let your systems update one entity per time, you'll run into problems with the Collision and the Rendering system, because you'll have to make your own containers in order to check each Entity against each entity (for collisions), and you'll need to sort the entities for depth drawing (rendering).


Systems do not have to update one entity at a time. If you need to process through several at a time, you just extend the base EntitySystem class so that the process calls gives you all registered entities for that system and not just one at a time. Name it something like CascadingEntityProcessingSystem or somesuch.

It depends on the kind of components we talk about. I started the discussion because you stated that you wanted to implement a system, where the components only represent the data. And it could definitely possible to have two entities with the same data set that behave differently. For example you have two different AI systems, which need the same data but lead to different behavior etc.


In this case, neither entity actually owns that data. it is accessed through a separate entity that they are both referencing. There is no true "ownership" in an ECS framework like there is in an OO or Hierarchical framework, its all about references, relationships and associations. Its very loosely coupled, very similar to a simple database.

#4Net Gnome

Posted 18 July 2012 - 02:29 PM

One of them was that if you let your systems update one entity per time, you'll run into problems with the Collision and the Rendering system, because you'll have to make your own containers in order to check each Entity against each entity (for collisions), and you'll need to sort the entities for depth drawing (rendering).


Systems do not have to update one entity at a time. If you need to process through several at a time, you just extend the base EntitySystem class so that the process calls gives you all registered entities for that system and not just one at a time. Name it something like CascadingEntityProcessingSystem or somesuch.

It depends on the kind of components we talk about. I started the discussion because you stated that you wanted to implement a system, where the components only represent the data. And it could definitely possible to have two entities with the same data set that behave differently. For example you have two different AI systems, which need the same data but lead to different behavior etc.


In this case, neither entity actually owns that data. it is accessed through a separate entity that they are both referencing. There is no true "ownership" in an ECS framework like there is in an OO or Hierarchical framework, its all about references, relationships and associations. Its very loosely coupled.

#3Net Gnome

Posted 18 July 2012 - 02:26 PM

One of them was that if you let your systems update one entity per time, you'll run into problems with the Collision and the Rendering system, because you'll have to make your own containers in order to check each Entity against each entity (for collisions), and you'll need to sort the entities for depth drawing (rendering).


Systems do not have to update one entity at a time. If you need to process through several at a time, you just extend the base EntitySystem class so that the process calls gives you all registered entities for that system and not just one at a time. Name it something like CascadingEntityProcessingSystem or somesuch.

It depends on the kind of components we talk about. I started the discussion because you stated that you wanted to implement a system, where the components only represent the data. And it could definitely possible to have two entities with the same data set that behave differently. For example you have two different AI systems, which need the same data but lead to different behavior etc.


In this case, neither entity actually owns that data. it is accessed through a separate entity that they are both referencing. There is no true "ownership" in an ECS framework like there is in an OO framework, its all about references, relationships and associations. Its very loosely coupled.

#2Net Gnome

Posted 18 July 2012 - 02:23 PM

One of them was that if you let your systems update one entity per time, you'll run into problems with the Collision and the Rendering system, because you'll have to make your own containers in order to check each Entity against each entity (for collisions), and you'll need to sort the entities for depth drawing (rendering).


Systems do not have to update one entity at a time. If you need to process through several at a time, you just extend the base EntitySystem class so that the process calls gives you all registered entities for that system and not just one at a time. Name it something like CascadingEntityProcessingSystem or somesuch.

It depends on the kind of components we talk about. I started the discussion because you stated that you wanted to implement a system, where the components only represent the data. And it could definitely possible to have two entities with the same data set that behave differently. For example you have two different AI systems, which need the same data but lead to different behavior etc.


In this case, neither entity actually owns that data. it is owned by a separate entity that they are both referencing. There is no true "ownership" in an ECS framework like there is in an OO framework, its all about references, relationships and associations. Its very loosely coupled.

#1Net Gnome

Posted 18 July 2012 - 02:23 PM

One of them was that if you let your systems update one entity per time, you'll run into problems with the Collision and the Rendering system, because you'll have to make your own containers in order to check each Entity against each entity (for collisions), and you'll need to sort the entities for depth drawing (rendering).


Systems do not have to update one entity at a time. If you need to process through several at a time, you just extend the base EntitySystem class so that the process calls gives you all registered entities for that system and not just one at a time.

It depends on the kind of components we talk about. I started the discussion because you stated that you wanted to implement a system, where the components only represent the data. And it could definitely possible to have two entities with the same data set that behave differently. For example you have two different AI systems, which need the same data but lead to different behavior etc.


In this case, neither entity actually owns that data. it is owned by a separate entity that they are both referencing. There is no true "ownership" in an ECS framework like there is in an OO framework, its all about references, relationships and associations. Its very loosely coupled.

PARTNERS