Jump to content

  • Log In with Google      Sign In   
  • Create Account


#Actualphil_t

Posted 14 May 2013 - 12:14 AM

You really havn't come across such a situation?

 

No, but I've only shipped one game that uses an entity-component-system framework, and it wasn't that large. It certainly doesn't seem unreasonable to broadcast it to multiple systems though. The other game I shipped (which didn't use an ECS), would probably need this functionality.

 

 

First of all the spawn systems needs to be informed about this, to decrement the counter of active units.

 

Again, I have a thing against duplication/caching of state. So instead of having an active unit counter that is added to when a unit is created and subtracted from (via UnitDied message) when a unit dies, I might instead have logic in the spawn system to calculate the current number of active units each frame (or possibly this could be done in another system that is already enumerating through all active entities anyway). That way if I ever added new places in the code where units could be added/killed I wouldn't need to worry/think about updating this number (also coming back to the (irrelevant) save game thing here, I wouldn't need to write any special code to set the "active unit counter" on loading a saved game).


#2phil_t

Posted 13 May 2013 - 05:41 PM

You really havn't come across such a situation?

 

No, but I've only shipped one game that uses an entity-component-system framework, and it wasn't that large. It certainly doesn't seem unreasonable to broadcast it to multiple systems though. The other game I shipped (which didn't use an ECS), would probably need this functionality.

 

 

First of all the spawn systems needs to be informed about this, to decrement the counter of active units.

 

Again, I have a thing against duplication/caching of state. So instead of having an active unit counter that is added to when a unit is created and subtracted from (via UnitDied message) when a unit dies, I might instead have logic in the spawn system to calculate the current number of active units each frame (or possibly this could be done in another system that is already enumerating through all active entities anyway). That way if I ever added new places in the code where units could be added/killed I would need to worry/think about updating this number (also coming back to the (irrelevant) save game thing here, I wouldn't need to write any special code to set the "active unit counter" on loading a saved game).


#1phil_t

Posted 13 May 2013 - 05:40 PM

You really havn't come across such a situation?

 

No, but I've only shipped one game that uses an entity-component-system framework, and it wasn't that large. It certainly doesn't seem unreasonable to broadcast it to multiple systems though.

 

First of all the spawn systems needs to be informed about this, to decrement the counter of active units.

 

Again, I have a thing against duplication/caching of state. So instead of having an active unit counter that is added to when a unit is created and subtracted from (via UnitDied message) when a unit dies, I might instead have logic in the spawn system to calculate the current number of active units each frame (or possibly this could be done in another system that is already enumerating through all active entities anyway). That way if I ever added new places in the code where units could be added/killed I would need to worry/think about updating this number (also coming back to the (irrelevant) save game thing here, I wouldn't need to write any special code to set the "active unit counter" on loading a saved game).


PARTNERS