I’ve done some work and I want to try my game outside of the editor. But I’m not sure how this works. I’ve seen this wiki page; A new, community-hosted Unreal Engine Wiki - Announcements - Epic Developer Community Forums and I’ve tried running the command after I launch the game, but nothing happens.
Like I package out in development mode, open the game and type in " ?listen -game" is that the wrong way to do so?
Where and when should I run it and is the formatting I’ve given wrong?
eXi
(Cedric Neukirchen)
2
Normaly you would create a button or something that calls “open YOURLEVELNAME?listen” in the console.
But if you want to create a server when starting the game, you would need to add “YOURMAPNAME?listen -game” to your .exe command.
If you do this over the CMD, you would search for your .exe game file and
do something like “MyGame.exe MyMap?listen -game” and hit enter.
Or you add “MyMap?listen -game” in the settings of the exe (rightclick etc).
I have never done this, but i assume this is the way to do it.
Just a modern update from This Reddit Comment -
C++ solution:
- You can set the overridePort param in GameInstance::EnableListenServer and then load the level with bAbsolute set to false.
For example to start listen server on port 7779:
World->GetGameInstance()->EnableListenServer(true, 7779);
World->ServerTravel(MapName, false, false);
If you need more complete code instead of this small snippet, let me know and I can try to help.
Edit: new solution that works in blueprints too:
Instead of ?port option (THAT IS SUGGESTED IN EVERY GUIDE???) which does NOT work, put the port at the start like this ”open :7779/MyLevel?listen”
So use console command blueprint node and put that open command.