I started with the Multi-threading example(using FRunnable) from @Rama’s tutorial. I chose the 3rd person character sample project. I managed to make the multi-threading work with this project(ie. run a task on a non-main thread in background, while I control the character in MainThread). The FRunnable implementation was in a new class inheriting FRunnable as illustrated in the tutorial. This worked. Note that - this project by default has only one module - primary game module.
Now comes the problem. I wanted to have this multithreading support in another module, but in the same project(ie. not in a plugin). So, I created a new project module, with the standard Public, Private, .Build.cs files.
Now, if I implement the module using IMPLEMENT_MODULE(), the thread (FRunnableThread) is not being launched. However, if I implement this module as IMPLEMENT_GAME_MODULE(), it works!
So, what and why does it work with IMPLEMENT_GAME_MODULE() and not with IMPLEMENT_MODULE()? Really appreciate if someone can clear this.
From what I understand, there should be only one primary game module per game project. However, I’m not sure of what modules should be implemented as a game module and what shouldn’t. Also, for a plugin module, can we do IMPLEMENT_GAME_MODULE? How should I decide/think when I’m doing this?
Also, the source code comments use “gameplay code” to indicate whether it should be a gameplay module. What does gameplay code mean?
If you think my code will help to answer/discuss, let me know and I can show it here.