Intel® oneAPI Threading Building Blocks
Ask questions and share information about adding parallelism to your applications when using this threading library.
2464 Discussions

Looking for some guidance on my game engine task manager.

warvstar
Beginner
223 Views
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
Tux__the_Linux_Pengu
223 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
Reply