Here is my UE5 C++ Multi-threading tutorial!
I hope you enjoy the video!
I give you the >>> entire UE5 project <<< that you see in the video, as well as the C++ code, in the link below!
In the guide the example you give is a Throttled Thread.
If I wanted the length of the tick in my thread to match the length of the tick in the GameThread what changes would I make to do so? Is there an easy change I could make to achieve this?
You could update the thread dynamically to match game thread, but if you are doing something where thread-synchronization is that sensitive you should probably reconsider your design architecture!
A very fast tick rate is 0.001, SUPER fast is 0.0001.
Keep in mind that 200 FPS
is 1/200 = 0.005 seconds
// Thread Tick Rate
//!!! MAKING THIS ENTIRE PROCESS GO SLOWLY OR QUICKLY
//!!! ATTENTION: COMPUTER RESOURCE MANAGEMENT DEPT OF YOUR GAME LOGICS
//!!! <3 RAMA
FTimespan ThreadWaitTime = FTimespan::FromSeconds(0.01); //! Use 0.1 or higher if don't need calcs to occur quickly!
Hi Rama! First, thank you a lot for everything you’ve done to the community. There are lots of people like me that grew on your tutorials!
Secondly, in my testing, this variable that you are changing doesn’t have an effect on the tick rate. I tested it like so:
- Donwloaded your repository
FTimespan ThreadWaitTime 10 times lower and 10 times higher. It didn’t make any difference.
- Moreover judging by the code, your ThrottledThreadTime is only being used in one section of the code: FRamaCodePrimeCalcThread::JoyTick(), however this thing is never called during the generation of prime numbers, hence it doesn’t have any effect on the logic rather than initial delay.