Download

Multithreading: When to use Task Graphs and when to use FRunnables

I’m trying to get your opinions on when the Task Graph system is appropriate and when FRunnables are appropriate. I understand that Task Graph is good for “small” tasks, and FRunnable is for “big” ones, but what does that even mean in a game’s context? Couldn’t any task/operation be broken down into small chunks handled by the Task Graph system? And couldn’t small tasks be iterated in a for loop run in an FRunnable?

Anyway, take the following example cases:

  • Simulating the traffic in a game like SimCity

  • NPC AI in RPGs or the Sims

  • N-Body physics in a game like Universe Simulator

  • AI in a real-time strategy game

Some of those examples are pretty close, but you get the general idea. Where would you use task graph or runnables, and why?