Hi, I’m trying to have my client connect to my dedicated server from the main menu and exchange messages (for example list of available characters in an MMO). I tried many ways but it seems I cannot find an easy way to do so.
What I understood is that the client first of all needs to be connected to the server, and to do this the open command executes some code like this:
WorldContext.PendingNetGame = NewObject<UPendingNetGame>(); WorldContext.PendingNetGame->Initialize(URL); WorldContext.PendingNetGame->InitNetDriver();
taken from UnrealEngine.cpp:8160
I tried to recreate this into my GameMode, when the player clicks on the “login” button, but seems I cannot find a way to provide a proper worldcontext from there.
I used GEngine->GetWorldContexts() but this is returning a const set of objects, I cannot modify, so I cannot apply to that the code above. Does anyone know the way to have the client connect to the server by code? I would suggest to put this in an example, as I think it’s a pretty common question.
(my next question will be how to send a message)