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

#Actualsmr

Posted 13 March 2012 - 09:54 AM

No, iterating over the entire list every update is not the most efficient way to solve the problem when not every entity needs to be updated every frame, but it will probably not cause you any performance issues in a simple game. This especially applies if you add a flag to each entity and any that do not need to be updated constantly could be ignored based on the status of the flag.

However, if it bothers you, you can keep a list of all entities, and then a separate list of entities that are currently relevant and update only those. If you look at each entity as a task in a system, then your game simulation becomes a kernel and you could manage tasks similarly. I'm not going to get into that here because task scheduling is huge and there's no one right way to do it.

#1smr

Posted 13 March 2012 - 09:54 AM

No, iterating over the entire list every update is not the most efficient way to solve the problem when not every entity needs to be updated every frame, but it will probably not cause you any performance issues in a simple game. This especially applies if you add a flag to each entity and any that do not need to be updated constantly could be ignored based on the status of the flag.

However, if it bothers you, you can keep a list of all entities, and then a separate list of entities that are currently relevant and update only those. If you look at each entity as a task in a system, then your game simulation becomes a kernel and you could manage tasks similarly. I'm not going to get into that here because scheduling is huge and there's no one right way to do it.

PARTNERS