I am currently trying to create some sort of a “lobby” logic for a future game. As Unreal can’t do it “naturally”, I have decided to use the FSocket system coupled with an external server.
But here I am having a threading issue ; the game is freezing when I am doing things on the socket. I achieved to create a dedicated thread using the FRunnable and Thread systems. The only way I found to actually retrieve data from the thread is to set a timer which every second looks if a new packet has been received, and processes it. It’s currently working, but I would like to have this timer constantly active (in a static way), because I need to be able to send and recieve packets during the whole game… and I didn’t find how to do this.
Could you help me ? The ideal would be having one big class which contains static functions, each one corresponding to one packet (like OnPacketXX), and one static function to send data to the server, everything thread safe obviously. I know how to do this in Java but here, whenever I try to execute code (for example to change an element of the UI) from the socket thread I have an error saying that the thread is not safe to render Slate widgets…
Thanks ! And sorry for my english, it’s not my native language