Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
13 Views

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
loop()
{
update();
renderAll();
}
In update, it essentialy goes through the node list and calls update for every node.
for (NodeIter it = NodeList.begin();
it != NodeList.end();
++it)
{
(*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
Highlighted
13 Views

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

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