Open Vaei opened 10 months ago
Hello,
I will have a look. The reason I don't get this error on my side is because I do not use the unreal option "Run Under One Process".
If you uncheck this, Unreal spawn a process for the server and the client. This is more reliable since it is closer to what the players will experience.
I'm aware of the option but for rapid iteration and testing, it takes a lot longer to spin up so not a good option all of the time.
Sure, that's why I'll have a look to fix it.
I've got a fork that supports this now, if that's of interest https://github.com/Moniz/Cog Gamepad support is off for the moment though as I refactored how input is handled quite a bit
I added Cog to the gamestate as per the example project and setup readme.
This means that
BeginPlay
,Tick
,EndPlay
are called for the server and every client. Of course, if I move it to GameMode, then it will only run on server and clients won't get any UI, so that won't help.There seems to be a lack of consideration for the static properties that ImGui uses.
Soon as there is a server and a client (vs. standalone), it will crash on EndPlay because calling
CogWindowManager->Shutdown();
shuts down the Context, causingImGuiIO& IO = ImGui::GetIO();
to return nullptr, but it is not null checked (rather, it has an assert, which it fails, and then promptly crashes).Furthermore, BeginPlay spams warnings because it is repeating logic:
Even if I test if ImGui has already initialized, to ensure it only runs once, then it'll run on the server and not the clients so they don't get windows.
For cog to support multiplayer (literally at all) it needs to respect that ImGui uses statics and separate out of the behaviour between Cog and ImGui so that you can initialize or clean up without making repeated calls to statics (especially when they are getting nulled).
This isn't sufficient on it's own, because we need to know when all clients have finished cleaning up, and then shutdown ImGui.