0
\$\begingroup\$

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.

\$\endgroup\$
3
  • \$\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 '20 at 18:55
  • \$\begingroup\$ @DMGregory No I havent done it yet and this question was to decide whether or not I should. \$\endgroup\$ – Tyler H May 11 '20 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 '20 at 15:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.