Hi, I am a student at DigiPen.edu and I want to use multi-threading in a game I am making. Typically the game loop will run 30-60 times a second, and I want to be able to have different parts of the code (AI/Physics/Assets) run on threads and then synch up each loop.
Should I use OpenCL?
Can anyone suggest advice on how to do this? Useful tutorials or docs to read?
Also I am wondering does TBB work with AMD processors?
I don't have any experience with OpenCL. I was the original architect for TBB (Alexey Kukanov is the current architect), so I'm a bit biased towards TBB. Yes, TBB works with AMD processors.
I have written a game that uses TBB and does about 30-75 frames/sec depending on the hardware. The sources can be downloaded from http://seismic-duck.svn.sourceforge.net/viewvc/seismic-duck/. Download the tarball to get the whole set of sources.The sources include both TBB and Cilk Plus implementations undef #ifdefs. TBB is the default implementation unless you compile it with the Intel >=12.0 compiler. The game has two physics engines that run concurrently with a seismogram renderer. Furthermore one of the physics engines (wavefield modeler and renderer) is parallelized too. There are some old blogs, starting with http://software.intel.com/en-us/blogs/2010/04/21/parallelism-patterns-in-seismic-duck-part-1-backgro... on how the wavefield calculations were parallelized, which is perhaps idiosyncratic to wavefield modelers, but might serve as general inspiration.