x

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 to parallelize some actions in UE4?

Hi !

I am currently building a game in VR and some of the actions I have to perform require a bit of intensive computation. The problem is, predictably, when I click on the button launching computation, the engine becomes too busy, and Steam Chaperone takes over while the computation finishes too avoid freezes. (typically, I might have to display 3000 objects and on a clic of a button, a script computes the ideal position of each of them based on some criteria, script that is well optimized, but still computation intensive for high object number)

Is there a way to run the computation in parallel to the game, giving priority to the basic interactions, and display the results gradually as they are available ? (or all at once at the end if that doesn't make the framerate drop). What I am looking for is some kind of a parallel processing maybe.

Thanks a lot !

PS: I use HTC Vive with Steam VR PPS: c++ or blueprints are both fine for me

Product Version: UE 4.21
Tags:
more ▼

asked Nov 21 '18 at 09:05 AM in VR

avatar image

DevinaVR
3 2 1 5

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

2 answers: sort voted first

The MultiThreqding and sync link ressembles more what I need since it allows thread safe data manipulation and return to the main thread. https://wiki.unrealengine.com/MultiThreading_and_synchronization_Guide

Thx @Weibye for that ;)

It is still a bit unclear to me how to notify the main thread once the FRunnable is done computing but I have open a new post for this question here :

https://answers.unrealengine.com/questions/853110/how-to-notify-the-main-game-thread-when-the-frunna.html

more ▼

answered Nov 29 '18 at 03:45 PM

avatar image

DevinaVR
3 2 1 5

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

Creating new threads that isn't connected to the main game thread is what you are looking for. I have no personal experience with it yet and not sure if it is going to solve all your problems, but I can link some resources on the topic:

more ▼

answered Nov 21 '18 at 10:53 AM

avatar image

Weibye
280 1 8 5

avatar image DevinaVR Nov 21 '18 at 12:09 PM

Thanks ! That looks like exactly what I needed. Going to give it a try !

avatar image DevinaVR Nov 21 '18 at 03:55 PM

Ok so I went ahead and implemented a few test functions. Most of it works.

However, I already have some quite complex blueprints in my project and it would be a pain to recreate all of them inside a c++ class. Any idea if there are some kind of a macro out there that would perform any action multi-threaded from blueprints ? (I found some Vega plugin but it is not supported anymore. ) Also, I have read something about adding a simple delay of 0ms making the current execution asynchronous. This in turn suggests that it might then run on a separate thread. Do you know how this works ?

avatar image Weibye Nov 21 '18 at 04:14 PM

I currently don't have much knowledge on the topic. Multi-threading is something I know I have to learn down the line to solve some of our problems, but I haven't had the time to dive into the deep end just yet.

I think (limited knowledge disclaimer) adding a delay in front of the function will make it asynchronous, but it will not be processed in a separate thread.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
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