I am attempting to get networked multiplayer working on my game, using the tutorial by eXi as a guide (and using OnlineSubsystemNull). So far, I’ve gotten the client to successfully connect to the server (in a lobby) and all parties make the jump to the playable level when ServerTravel() is called.
However, this ONLY works if the server is launched by right-clicking on the uproject file and selecting “Launch game”.
If the server is launched from the editor, the clients seem to be able to join the session but cannot enter the lobby (which is a level being hosted on the server).
The problem is when I try to enter the lobby from the client:
if (PlayerController && Sessions->GetResolvedConnectString(SessionName, TravelURL))
The TravelURL returned from GetResolvedConnectString has the correct IP address, but the wrong port number (0 rather than 7777).
Is this a bug or have I forgotten something completely obvious?
I’ve stepped through the code on the server-side and it does look like it’s trying to run in port 7777, but the port number seems to be getting lost somewhere in transmission…
(Reminder: This bug only happens when launching the server from the editor).
Thanks in advance~!
Also, I’ve tried doing the next obvious thing: hardcoding the TravelURL with the correct port (i.e. "192.168.1.119:7777). FYI, I’m testing this on two machines on a local network. But when I try to join, the client bombs out with this error message:
PIE:Warning: Warning TravelFailure: LoadMapFailure, Reason for Failure: 'Failed to load package '/Game/Game/Maps/UEDPIE_0_MultiplayerLobby''. Shutting down PIE.
Why is there a “UEDPIE_0_” prefixed to my map name?
Looking at another post here in AnswerHub (UEDPIE Can't find file for asset Error when joining LAN session - Programming & Scripting - Epic Developer Community Forums), is it safe to say that we can’t actually run (and debug) a server through the editor and VC++? I’d be surprised if this is the case…
I had the same problem with Blueprints, and I was able to get around it by launching a standalone version from the editor instead of the play-in-editor. I’m not sure if that feature differs between C++ and Blueprints, but hopefully that helps, at least in part.
Ah, yes. Launching it as standalone from the editor works too - BUT it’s essentially the same as launching it via right-click from Windows Explorer, which means I’m still unable to debug it (i.e. breakpoints won’t trigger in blueprints and in C++ code), and I can’t view what’s happening in the world outliner.
Thanks for chipping in, though. At least I know that this issue isn’t unique to me and I’m not crazy. Yet.
Ok, I should have RTFM.
I’ve been so focused on a problem and really should have taken a step back.
It didn’t occur to me to run the standalone game from Visual Studio (using the “DebugGame” profile). I tried it a while back and it didn’t work, and I never followed up on it (not realizing I had to cook the game content from the editor, which was failing in our project but that’s a whole other story). Everyone here had simply been debugging C++ through the PIE because it works for them. Ok, I’m just making excuses now.
If anyone else new to EU4 is reading this, and you’re trying to debug C++ code in a networked multiplayer game (using stuff like CreateSession, ServerTravel, etc) via PIE (using the “DebugGame Editor” profile in Visual Studio), DON’T - IT DOESN’T WORK. Instead, just do the following:
Open your project in the UE4 editor and click on File → Cook Content for Windows.
Open your project in Visual Studio and switch to the DebugGame configuration and build the project.
Edit the project properties, making sure the selected configuration is “DebugGame_Game” and add the following command line arguments: -game -debug
Run the game.