Jump to content
  • Advertisement
Sign in to follow this  
fireshadow4126

Collective Object "Updaters" Instead of Individual Objects?

This topic is 2582 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello,

I've been thinking of how I would like to architect my engine. I don't want to iterate over individual components, like this:

foreach (GameObject obj in Objects)
{
obj.Update();
obj.Draw();
}

Note: sorry I didn't indent the code, the editor's indent button didn't work for some reason. Shouldn't matter anyway.


Instead, I would like to have a set of Collective "Updaters" which contain hash tables that map an integer id (remains constant for the same object across different Updaters) to whatever piece of data the Updater needs to handle, for instance, a matrix (stack) for the Transformer updater, a mesh for the Renderer class, etc.

My question is, would this provide acceptable performance for a game engine?

Thanks in advance!

Share this post


Link to post
Share on other sites
Advertisement
Yes, grouping like operations together (e.g. running all matrix updates in one go) and grouping like allocations together (e.g. allocating all matrices in one big array) will greatly improve performance.


What you're describing is one common design for component/entity systems. In these designs, the "updaters" are often called "subsystems".

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!