What DO you use threads for in UE4?

I think UE4 already uses several cores by default, for rendering for example, so its not entirely singlecore.

Well, that doesn’t say that you can’t access them at all. You could read from them (do valid-checks, of course) or collect all relevant data in the main thread and send that relevant data over to another thread for calculations.

I haven’t done any multithreading myself in UE4, but as an example what you could do with multithreading:

What about an Ai with complex decision making? Main Thread could want an Ai Controller to choose a target.

  1. Main Thread collects a list of nearby targets, sets AiControllers target to nullptr (which in this case could mean no target, aka it won’t do anything, it is waiting for a decision to be made), activates another thread and passes the list of those nearby targets and some data about the AIs state…
  2. While Main Thread is doing its thing calculating the rest of the world, the new thread does complex stuff like visibility tracing to all targets in the list and is doing decision making algorithms.
  3. When the new thread is done, it activates a mutex lock on the AIController (or any other locking mechanic) to set the new target in the AiController and then releases the mutex lock again.
  4. Main Thread can access AiController again, sees that a new target is set and can make the Ai now attack the target

If you need help with locking in order to allow threads to modify data, here is a nice guide https://wiki.unrealengine.com/MultiT…nization_Guide
I haven’t tried it myself, though, so i can’t promise that it works.