Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

How do I set up Multi-threading?


I was looking for a way to multi-thread so my world generation could continue during runtime, but I cant find a single thing on multi-threading in UE4 anywhere. Can someone point me where to look or give me some tips on how to do it?

Thanks! ~Adam

Product Version: Not Selected
more ▼

asked Apr 20 '14 at 09:33 PM in C++ Programming

avatar image

118 6 10 14

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

0 answers: sort voted first

You probably want to check out FRunnable and FRunnableThread. FRunnable encapsulates a worker that does the actual work. You inherit from this class, then implement the Run() method (and possibly others, such as Init(), Stop() and Exit()). You can then create a thread that uses this worker with FRunnableThread::Create(). You should be able to find many examples in the code base.

We have some other multi-threading mechanisms in the Engine, but your use case may not be a good fit. If your units of work are very small, you can take a look at the Task Graph system, which provides a nice way of performing task based multi-threading, and which is particularly useful if your tasks have dependencies to each other. You can find some usage examples by searching for CreateTask() in the code base.

Please note that the UObject sub-system is currently not thread-safe, so depending on what you're trying to do for world generation, you have to be extremely careful and know what you're doing :)

more ▼

answered Apr 21 '14 at 05:51 PM

avatar image Rama Apr 22 '14 at 04:30 AM

Thank you GmPreussner

Inspired by your answer I have tested and composed a Wiki Tutorial on using the Task Graph system!

My Wiki Tutorial on Multi-Threading

I am including my entire source code! (Legal: I wrote all of it)



I am computing the first 50,000 prime numbers in the background while I continue to play around in the main game thread!




(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Be the first one to answer this question
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question