I am making a game in SFML, and whilst I was making an AI moving system I was wondering which would be better, If I was to instance update all my entities at once, or individually update them via a function in each of the entity class instances.

I know that instance rendering is much faster but was wondering if this would even be needed for updating the logic of the game, afterall I'm not making a giant physics simulation.

So, I am wondering what would the effect be if I updated the game logic for each entity individually or did it via instancing. And if there is an impact is it really worth it for a game like mine where there isn't too much complexity.

  • \$\begingroup\$ What does your profiler say about the tests you ran on this? Have you observed a specific updating bottleneck that you need to solve? \$\endgroup\$
    – DMGregory
    May 10, 2020 at 18:55
  • \$\begingroup\$ @DMGregory No I havent done it yet and this question was to decide whether or not I should. \$\endgroup\$
    – tygzy
    May 11, 2020 at 15:35
  • \$\begingroup\$ Then that likely falls into the category of premature optimization. If you have reason to doubt "is it really worth it for a game like mine where there isn't too much complexity" then that doubt is quite possibly justified. Try doing it the simplest way you can, so it's clear and easy to write, maintain, debug, expand. Then test to see if that way is good enough for your game. Come ask a question here only when your tests show you have a problem that needs solving. \$\endgroup\$
    – DMGregory
    May 11, 2020 at 15:39


You must log in to answer this question.

Browse other questions tagged .