Download

connecting to shootergame dedicated server

Hey guys, I have been trying to get a dedicated server running with the default ShooterGame project in 4.22. I have followed all the docs and wikis I could locate. I have got it to build and run successfully, however I can not get it to connect or even see the server. I got the 4.22 release branch from github, compiled and got that running. I created a shootergame project with the epic launcher and pointed it to the installed 4.22 from the launcher. I then changed it to the github version, recompiled everything, all of that works. I can run ShooterGameServer.exe -log, I can run ShooterGame.exe standalone.
I can even host a game from ShooterGame.exe and join that server with another ShooterGame.exe. The problem is that ShooterGame.exe never sees the dedicated server. I try the server browser, I also tried directly connecting via “open 127.0.0.1:7777” and the actual IP of the same computer on the network.
The directions I followed that worked the best were here, https://allarsblog.com/2015/11/05/support-dedicated-servers/
I also followed this one with the same result, https://wiki.unrealengine.com/Dedicated_Server_Guide_(Windows_%26_Linux)

Does anyone know how to get it to connect?
My log file for the server is attached, the only thing I see in it that makes me question is this: “LogOnline: GotoState: NewState: MainMenu”
does the server need to be put into a game state other that MainMenu?
The server is running in dedicated mode so shouldnt it ignore game state?
ShooterGameServerLog.txt (27.5 KB)

Unreal definitely need to update their document about how to set up dedicated server. Since there are a lot changes and details, and that is really hard for someone who new to UE4.

I think the format of command line should be like this, “{MapName} -server -abslog={LogFile} -log -Messaging”.

Thanks for the response, that seems to solve the issue of the gamestate, but I still can not connect.
The log now states that its “playing”
[2019.05.05-19.21.35:297] 0]LogLoad: Took 0.032412 seconds to LoadMap(/Game/Maps/dediExampleMap)
[2019.05.05-19.21.35:297] 0]LogOnline: GotoState: NewState: Playing
However I still can not connect. I hit ~ and enter “open 127.0.0.1:7777” and it sits there for a bit then says it “Lost Connection to Host” but the log window doesnt mention any connections happening [ATTACH]temp_163758_1557084750806_101[/ATTACH] .
This is my shortcut to start it
“D:\Dropbox (CharacterFX)\Projects\lastManStanding\LastMan\Saved\StagedBuilds\WindowsServer\ShooterGameServer.exe” dediExampleMap -server -abslog=“D:\serverLog.txt” -log -Messaging

serverLog.txt (33.7 KB)

Looks like your server is getting ready.

The command line like below may be useful.

“{LocalEditorRoot}/UE4Editor.exe {LocalProjectRoot}/projectname.uproject 127.0.0.1 -game”

I get the same result running it that way. I also tried to run the server this way with -server, but I dont think that then runs it as a dedicated server (I put a log message in that would tell me if it was dedicated and it did not ) Is there a command line option for telling it to be a dedicated server?
Also, I am running builds thru project Launcher so I have fresh dedicated server and game builds.
I also just changed the port on the server thinking maybe the game itself was conflicting the ports, that did fix it either.
I have also set bUsesSteam = false; is all three target.cs files, they were all true at first

So, I ran the client with -log also and I am seeing a bunch of warnings about steam…
[2019.05.06-19.30.17:285][554]LogOnline: Verbose: OSS: Creating online subsystem instance for: Steam
[2019.05.06-19.30.17:327][554]LogOnline: Warning: STEAM: Steamworks: SteamUtils() failed!
[2019.05.06-19.30.17:328][554]LogOnline: Warning: STEAM: Steamworks: SteamUser() failed!
[2019.05.06-19.30.17:329][554]LogOnline: Warning: STEAM: Steamworks: SteamFriends() failed!
[2019.05.06-19.30.17:329][554]LogOnline: Warning: STEAM: Steamworks: SteamRemoteStorage() failed!
[2019.05.06-19.30.17:330][554]LogOnline: Warning: STEAM: Steamworks: SteamUserStats() failed!
[2019.05.06-19.30.17:331][554]LogOnline: Warning: STEAM: Steamworks: SteamMatchmakingServers() failed!
[2019.05.06-19.30.17:331][554]LogOnline: Warning: STEAM: Steamworks: SteamApps() failed!
[2019.05.06-19.30.17:332][554]LogOnline: Warning: STEAM: Steamworks: SteamNetworking() failed!
[2019.05.06-19.30.17:332][554]LogOnline: Warning: STEAM: Steamworks: SteamMatchmaking() failed!
[2019.05.06-19.30.17:333][554]LogOnline: STEAM: [AppId: 0] Client API initialized 0
[2019.05.06-19.30.17:333][554]LogOnline: Display: STEAM: OnlineSubsystemSteam::Shutdown()
[2019.05.06-19.30.17:333][554]LogOnline: Warning: STEAM: Steam API failed to initialize!
[2019.05.06-19.30.17:334][554]LogOnline: Display: STEAM: OnlineSubsystemSteam::Shutdown()
[2019.05.06-19.30.17:334][554]PacketHandlerLog: Loaded PacketHandler component: OnlineSubsystemSteam.SteamAuthComponentModuleInterface ()
[2019.05.06-19.30.17:334][554]PacketHandlerLog: Loaded PacketHandler component: Engine.EngineHandlerComponentFactory (StatelessConnectHandlerComponent)
[2019.05.06-19.30.17:335][554]LogOnline: Warning: STEAM: AUTH HANDLER: Deactivating due to missing requirements

I have tried it with bUsesSteam both set to true and false.
Could this be why it wont connect to the dedicated server?

Are you sure you want to build your game ontop of this?
ShooterGame’s code have a breach where cheating clients can get infinite ammo. I’ve found it and tested myself multiple times many months ago (don’t know if it’s fixed by now tho)

Im not going to be using any of their weapon or character systems. Im using it as a base because it uses the dependency graph networking, and should have been easy to setup a dedicated server, tho the later is proving difficult.

Another update also, I installed the newest steamworks and recompiled everything. I can get the game to see the server now! If I try to run them from the same computer tho, I have to use “-NOSTEAM” on the server or the game crashes (it complains that there are too many running and that is the fix it suggests.)
I can not get them to connect tho, they see each other, and try to connect, but cant, might be something with steam auth.
Here is the output from the log of the server:


[2019.05.07-06.02.33:828][446]LogGameState: Match State Changed from WaitingToStart to InProgress
[2019.05.07-06.03.23:067][916]LogNet: NotifyAcceptingConnection accepted from: 192.168.1.51:62943
[2019.05.07-06.03.23:067][916]LogHandshake: SendConnectChallenge. Timestamp: 64.305305, Cookie: 136172230143243178118005124039152185039095212223096127053062
[2019.05.07-06.03.23:100][917]LogNet: NotifyAcceptingConnection accepted from: 192.168.1.51:62943
[2019.05.07-06.03.23:100][917]LogHandshake: SendChallengeAck. InCookie: 136172230143243178118005124039152185039095212223096127053062
[2019.05.07-06.03.23:103][917]LogNet: Server accepting post-challenge connection from: 192.168.1.51:62943
[2019.05.07-06.03.23:103][917]PacketHandlerLog: Loaded PacketHandler component: OnlineSubsystemSteam.SteamAuthComponentModuleInterface ()
[2019.05.07-06.03.23:104][917]PacketHandlerLog: Loaded PacketHandler component: Engine.EngineHandlerComponentFactory (StatelessConnectHandlerComponent)
[2019.05.07-06.03.23:104][917]LogOnline: Warning: STEAM: AUTH HANDLER: Deactivating due to missing requirements
[2019.05.07-06.03.23:105][917]LogNet: NotifyAcceptedConnection: Name: Sanctuary, TimeStamp: 05/06/19 23:03:23, [UNetConnection] RemoteAddr: 192.168.1.51:62943, Name: IpConnection_0, Driver: GameNetDriver IpNetDriver_0, IsServer: YES, PC: NULL, Owner: NULL, UniqueId: INVALID
[2019.05.07-06.03.23:105][917]LogNet: AddClientConnection: Added client connection: [UNetConnection] RemoteAddr: 192.168.1.51:62943, Name: IpConnection_0, Driver: GameNetDriver IpNetDriver_0, IsServer: YES, PC: NULL, Owner: NULL, UniqueId: INVALID
[2019.05.07-06.03.25:190][979]LogNetSerialization: Error: FBitReader::SetOverflowed() called! (ReadLen: 32, Remaining: 2, Max: 2)
[2019.05.07-06.03.25:191][979]LogSecurity: Warning: 192.168.1.51:62943: Malformed_Packet: Failed to read PacketHeader
[2019.05.07-06.03.25:192][979]LogSecurity: Warning: 192.168.1.51:62943: Closed: Connection closed
[2019.05.07-06.03.25:192][979]LogNet: UNetConnection::Close: [UNetConnection] RemoteAddr: 192.168.1.51:62943, Name: IpConnection_0, Driver: GameNetDriver IpNetDriver_0, IsServer: YES, PC: NULL, Owner: NULL, UniqueId: INVALID, Channels: 1, Time: 2019.05.07-06.03.25
[2019.05.07-06.03.25:223][980]LogNet: UNetConnection::PendingConnectionLost. [UNetConnection] RemoteAddr: 192.168.1.51:62943, Name: IpConnection_0, Driver: GameNetDriver IpNetDriver_0, IsServer: YES, PC: NULL, Owner: NULL, UniqueId: INVALID bPendingDestroy=0
[2019.05.07-06.03.29:205] 99]LogNet: NotifyAcceptingConnection accepted from: 192.168.1.51:62943
[2019.05.07-06.03.29:205] 99]LogHandshake: SendRestartHandshakeRequest.
[2019.05.07-06.03.33:212][219]LogNet: NotifyAcceptingConnection accepted from: 192.168.1.51:62943
[2019.05.07-06.03.33:212][219]LogHandshake: SendRestartHandshakeRequest.
[2019.05.07-06.03.33:246][220]LogNet: NotifyAcceptingConnection accepted from: 192.168.1.51:62943
[2019.05.07-06.03.33:246][220]LogHandshake: SendConnectChallenge. Timestamp: 74.483498, Cookie: 186141198242075247196208089210071050228034166180207131086194
[2019.05.07-06.03.33:278][221]LogNet: NotifyAcceptingConnection accepted from: 192.168.1.51:62943

Here is the log from the game


[2019.05.07-20.04.31:708][838]LogInit: WinSock: I am DESKTOP-FNMQMEH (192.168.1.51:0)
[2019.05.07-20.04.31:708][838]PacketHandlerLog: Loaded PacketHandler component: OnlineSubsystemSteam.SteamAuthComponentModuleInterface ()
[2019.05.07-20.04.31:709][838]PacketHandlerLog: Loaded PacketHandler component: Engine.EngineHandlerComponentFactory (StatelessConnectHandlerComponent)
[2019.05.07-20.04.31:709][838]LogNet: Game client on port 7777, rate 10000
[2019.05.07-20.04.31:731][840]LogHandshake: SendChallengeResponse. Timestamp: 69.322678, Cookie: 085173201139034204066040197161014192216091234170187099072072
[2019.05.07-20.04.31:764][842]LogOnline: Verbose: STEAM: AUTH: Generated steam authticket 14000000130E79154593EFB43AAF4A0001001001E71FD15C180000000100000002000000CC5D534B3301A8C076E8E6035B000000B200000032000000040000003AAF4A0001001001E0010000CC5D534B3301A8C000000000C0FBD05C40ABEC5C010000000000000000001BA9BC55BE0E7B7014E762F194C69090F77428EC637E48AB619016D9322FE07391596DA796FADAA1EBC63FE3698B503E2C0494149C2EF01F25199BC31B978197CDC45BF9B959FED7FA175B67D5FAC1CF4CDB236F9B8D367BCD62D8CA9A69E232E7DD84A46B1785514A6260949E20FEA5F351A39D2C673BCF033D475A797D4659 handle 92
[2019.05.07-20.04.31:764][842]LogOnline: STEAM: AUTH HANDLER: Sending auth key
[2019.05.07-20.04.39:119][299]LogOnline: Verbose: STEAM: FOnlineAsyncEventSteamRichPresenceUpdate got new information about user 76561198011018295
[2019.05.07-20.04.39:232][305]LogHandshake: Ignoring restart handshake request, due to < 10 seconds since last handshake.
[2019.05.07-20.04.43:216][552]LogHandshake: Beginning restart handshake process.

OK, so I got it working.
I could not run the dedicated server and the game on the same machine. I had to put the server on a separate computer, I also had to create a second steam account to run on that computer, I think the -NOSTEAM was causing the AUTH issue and I couldnt run server and game on the same machine since they needed separate steam accounts :wink:
Also, having the server load a map to start is necessary since if its just sitting at the main menu there is no game to join.
this is my shortcut properties
ShooterGameServer.exe Sanctuary -log -abslog=“C:\Users\Desktop\shooter\WindowsServer\log.txt” -Messages

One more update.
Originally it seemed that I couldnt run it cause it wasnt loading a map, solved that and had issues with steam not working, got steam to work.
If everything is running fine you CAN run the server and game on the same machine, I just had to use “-NOSTEAM” on server and game clients at the same time.

I am using ShooterGame as a base as well. It is a good reference for networking function.

From the log you post, I noticed that ReplicationGraph may be missing for your server. Log like this: “LogStats: UReplicationGraph::AddClientConnection - 0.106 ms”, would be shown up as soon as AddClientConnection succeed. Instead of the error of BitReader.

Btw, when I setup dedicated server, I would using “-NOSTEAM” to turn off the steam for both server and client.

Glad to know you pass it while I am posting this…

Thank you for your previous help, it was essential in being able to figure it out!
I will look into the replication graph thing, i scrapped my last version of things and started new on this one, so this is just shootergame working with a dedicated server, didnt change anything else, so it should be working lol