Game Development Community

Container::findObjects in a separate thread

by Daniel Buckmaster · in Torque 3D Professional · 02/29/2012 (2:29 pm) · 1 replies

I'm trying to use Container::findObjects in a separate thread for building navmeshes, but the problem is that it's not multithreaded at all. As soon as it gets used by more than one process the engine breaks. Is there a thread-friendly alternative that I could use? And, if not, would it be feasible to threadify findObjects? I'm thinking of just replacing the assert with a mutex lock.

About the author

Studying mechatronic engineering and computer science at the University of Sydney. Game development is probably my most time-consuming hobby!


#1
03/08/2012 (9:52 pm)
So, the part-solution I came up with was to use an std::set of object ID numbers to keep track of which objects had already been searched, which is the purpose to the 'sequence key' that stops concurrent queries from happening. Using TR1's unordered_set would improve performance but I'm not sure how critical this is. The problem is, the search still uses the bin list structure, which isn't thread-safe.