Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!


1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


#Actualskwee

Posted 01 November 2013 - 01:03 PM

Thanks for the replies!

 

haegarr

Thanks for mentioning the Prototype pattern! I learned something new today!

 

jms bc

Thanks, I heard about Artemis, and as far as I remember it is written in Java. Ill take a look into it.

 

simber

Thanks a lot! I've already though about clone method and CRTP.

 

However I'm still missing a link. Assuming my code is similar to what simber wrote (with the exception that I do not have Entity per se, its just a typedef to uint). 

In that case, assuming the code looks like this

Entity e = entitySpawner().spawn();
for(auto &comp: prototype) {
    entitySpawner.attach(e, comp->clone());
}

And assuming EntitySpawner knows about all the Component Systems, how do I register a component within a specific system?

In component based entity system, there are systems (or processes) that updates the components, I'm still not sure how I can introduce the needed components to the correct system in an elegant way.

 

Any solutions?


#2skwee

Posted 01 November 2013 - 10:36 AM

Thanks for the replies!

 

haegarr

Thanks for mentioning the Prototype pattern! I learned something new today!

 

jms bc

Thanks, I heard about Artemis, and as far as I remember it is written in Java. Ill take a look into it.

 

simber

Thanks a lot! I've already though about clone method and CRTP.

 

However I'm still missing a link. Assuming my code is similar to what simber wrote (with the exception that I do not have Entity per se, its just a typedef to uint). 

In that case, assuming the code looks like this

Entity e = entitySpawner().spawn();
for(auto &comp: prototype) {
    entitySpawner.attach(e, comp->clone());
}

And assuming EntitySpawner knows about all the Component Systems, how do I register a component within a specific system?

In component based entity system, there are systems (or processes) that updates the components, I'm still not sure how I can introduce the needed components to the correct system in an elegant way.

 

My question probably demonstrates bad knowledge of c++ and templates, but as far as I understand, clone() method will give me the exact object I'm working with (i.e. if e is instance of PositionComponent, then e->clone() will give me new instance of PositionComponent).

In that case I need to have EntitySpawner::attach(Entity, ..) for every possible component I have. It dosent looks elegant to me.

Any solutions?


#1skwee

Posted 01 November 2013 - 10:35 AM

Thanks for the replies!

 

haegarr

Thanks for mentioning the Prototype pattern! I learned something new today!

 

jms bc

Thanks, I heard about Artemis, and as far as I remember it is written in Java. Ill take a look into it.

 

simber

Thanks a lot! I've already though about clone method and CRTP.

 

However I'm still missing a link. Assuming my code is similar to what simber wrote (with the exception that I do not have Entity per se, its just a typedef to uint). 

In that case, assuming the code looks like this

Entity e = entitySpawner().spawn();
for(auto &comp: prototype) {
    entitySpawner.attach(e, comp->clone());
}

And assuming EntitySpawner knows about all the Component Systems, how do I register a component within a system specific system?

In component based entity system, there are systems (or processed) that updates the components, I'm still not sure how I can introduce the needed components to the correct system in an elegant way.

 

My question probably demonstrates bad knowledge of c++ and templates, but as far as I understand, clone() method will give me the exact object I'm working with (i.e. if e is instance of PositionComponent, then e->clone() will give me new instance of PositionComponent).

In that case I need to have EntitySpawner::attach(Entity, ..) for every possible component I have. It dosent looks elegant to me.

Any solutions?


PARTNERS