Tips in using Threads

1 reply [Last post]
Offline
Joined: 11/18/2012

i just want to know the limitation of using threads in this game engine since the project that i am currently

making is big and i want to use thread for every objects but i always encounter errors like assersion, spatial, current modification

and rootnode error. i want to know the tips and tricks to avoid those kind of error thank you.

 

 

Offline
Joined: 12/13/2010
Basically, anything that

Basically, anything that involves direct rendering must be done in a single thread.  So if you are using EnvNode, you must put everything in one single thread.

If you look at the lesson on Thread, it assumes that you are using EnvObject, which is NOT part of the rendering system, so you can freely put that into a different thread without issues.

Your problems gives me an idea, you could actually combine the two approaches -- use a bunch of threads for object location calculations, and convert them all to EnvNode in the main thread before rendering.  That might be the solution that you are looking for.  However, I am just coming up with this as I type, so more testing need to be done.

For now, my suggestion would be to put everything into one thread first.  If performance is a problem, then we can look at separating them into different threads.