Showing results for 
Search instead for 
Did you mean: 

Looking for some guidance on my game engine task manager.

Hi community,
I'm looking for some solutions for threading my game engine.
Currently this is how I have my system setup.
I have a main loop, like this
In update, it essentialy goes through the node list and calls update for every node.
for (NodeIter it = NodeList.begin();
it != NodeList.end();
(*it)->Update(fTick); // This handles AI and other updates
In renderAll(), it basically checks that objects are in view and renders them.
Now the reason I want to thread this game engine is because I have recently started implementing a heavy AI system and it's starting to slow down my game a bit.
Physics is handled by Havok and already multithreaded.
I can have thousands of objects on the screen, but when I start to do intensive AI it slows down a little.
Anyway, I have looked through Smoke, Nulstein andTaskingGameEngineAnimation material. They all have a different way of doing the threading.
Anyone have any recomondations on how to use TBB for threading.
Sorry this post looks a little messy, I'm in a rush to post it and I'll be back later to update it.
Thanks all!
0 Kudos
1 Reply

I know this is a pretty old thread, but...
For your mode updating, try something like this:

[cpp]#include <...> // Other includes
using namespace ... // Other namespaces using namespace tbb; // ... update()
{ parallel_for(Nodelist.begin(), NodeList.end(), [=](ModeIter it) {(*it)->Update(fTick); }); }