How to parallelize some actions in UE4?
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
asked Nov 21 '18 at 09:05 AM in VR
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 :
answered Nov 29 '18 at 03:45 PM
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:
Follow this question
Once you sign in you will be able to subscribe for any updates here