x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Steam Session Ping 9999

I've pretty much exactly replicated the network session management from the Multiplayer Shootout example. Everything works, I can open a game and other players can find it via Steam online subsystem. The player names are correctly transfered, how many current and max players also works fine.

However, the session always shows a ping of 9999

This is my setup: alt text

Product Version: UE 4.8
Tags:
ping9999.jpg (156.4 kB)
more ▼

asked Jul 31 '15 at 10:41 PM in Bug Reports

avatar image

Blue669
236 29 35 54

avatar image makai Jul 31 '15 at 11:48 PM

why did you open another question? People are answering you here: https://answers.unrealengine.com/questions/265883/session-ping-9999.html

if this would be a bug, the problem would occur on generic shooter and other projects also.

avatar image Blue669 Aug 01 '15 at 12:02 AM

People are not answering, they are confusing the problem. Stuff like "put the session requests in the tick event" aren't helping, they make the question just more difficult to follow.

I've double checked the setup and it is exactly like in Multiplayer Shootout. Did you play that over Steam? Can you confirm the problem does not exist in that project when you play over Steam? Didn't think so.

Also things like "this problem would occur elsewhere" is not helping. If you don't have the experience or knowledge to be of real help, just don't write anything.

I've opened this post again as a bug report, because obviously Epic's staff is looking at bug reports at a higher priority as normal posts and if this can be reproduced, and therefore confirmed as a bug within the engine's session calls, this needs to be addressed asap.

Some people have deadlines to meet.

And before someone asks: yes, we're using multiple computers with multiple steam accounts, every time the session shows ping of 9999. Everything else is showing up correctly.

avatar image makai Aug 01 '15 at 12:49 AM

yes i also have my deadline, you can add me on steam or skype maybe we can look into this together.. I have my problems with blueprint sessions also! Take a look here: https://answers.unrealengine.com/questions/270724/null-cant-start-an-online-game-for-session-with-bl.html https://answers.unrealengine.com/questions/263920/session-found-in-pie-but-not-in-packaged-game.html

as i said: for me the only time i had 9999 ping was when the session was invalid or tried to test server & client on 1 steam account. why didn't you hook in the player controller as i asked you before in the 1st thread? - still unanswered if you have less time you should work with the stuff you definately know it will work, like shooter template..exposing stuff to bp if you need to and mate: im pretty sure people don't want to confuse you, they want to help. So you could be thankful for any try of help! putting this into the bug section only because it is faster is not a nice way, and you didn't even react on questions of other developers in the thread you posted first which is also not very friendly and does not fit if you really want help.

best wishes

avatar image Blue669 Aug 01 '15 at 01:22 AM

Hook in the player controller to what? The widget? The widget doesn't matter! The widget is fine without a controller! Don't you see that you cannot help me? So why do you keep showing up with more comments? I don't care about your problems and I don't want to be your friend, ok?

I have posted a simple question and nothing you have said can answer it. All you do is post useless comments and more questions.

If you cannot answer the question, DON'T COMMENT!

I will not be thankful for useless comments, so just stop it.

avatar image makai Aug 01 '15 at 04:59 AM

don't worry i don't want to be your friend, thats for sure :D but theres no need to be rude.. i understand you, missing knowledge can be frustrating.. i wish you good luck waiting for your answer(s), mate :)

avatar image Blue669 Aug 01 '15 at 09:05 AM

I've looked through your post history. Our problems do not seem related. I can create a session and I can even play with my friend over Steam. So I don't think it is a problem that the whole session or online subsystem setup is invalid (like it might be in your case? I don't know!).

I work with the engine for about a year now and I have barely enough experience and knowledge to make my own game work half-decent. I get a lot of help just reading through the AnswerHub, forums and tutorials.

That is exactly why I am not here trying to help other people. Because "fishing in the dark" is something I expect everyone can do without my "help".

So I appreciate that you are trying to help, but unfortunately I think that we are not in the same boat here and we cannot help each other.

avatar image Ben Halliday STAFF Aug 02 '15 at 08:12 PM

Hi Blue669,

Just to be sure: you're running this in a packaged game, on two different systems, with the Steam client enabled? It may be helpful to take a look at your logs. In the DefaultEngine.ini file (in the Config folder for your project), add the following and save:

 [Core.Log]
 LogNet=verbose
 LogOnline=verbose

Then run through the game again as normal and get us the most recent logs. You can find the logs in your project's Saved\Logs folder. Let us see the logs for both Server and Client, please. Thanks!

avatar image Blue669 Aug 05 '15 at 05:25 PM

Yes, all of these are correct. I get ping 9999 100% of the time, no exceptions, even from different friends' computers.

These logs are not running for a packaged version, so how am I supposed to get them from both machines? My friends don't have the UE4 editor.

The logs dir from my user folder (where packaged games save) is also empty.

avatar image Ben Halliday STAFF Aug 05 '15 at 05:28 PM

Have them run the executable through a shortcut, with " -log" pasted at the end of the Target.

avatar image Ben Halliday STAFF Aug 05 '15 at 05:32 PM

Actually, strike that. Easiest way is for them to go to the folder you gave them and get the logs from the GameName\Saved\Logs folder, which is what I meant to tell you the first time =)

avatar image Blue669 Aug 05 '15 at 06:30 PM

So I told my friend to launch the game on Steam with the launch parameter "-log". I cannot find any logs anywhere. Shouldn't it be under user directory, appdata, local, gamename, saved? I can find my save games there, but logs directory is empty.

avatar image Ben Halliday STAFF Aug 05 '15 at 07:43 PM

Ah, I apologize, I didn't realize you were opening it through the Steam client (I thought you simply had it enabled for testing purposes). Let me look into that and I'll let you know.

Can you test the same packaged project by giving your friends the package folder and run the .exe within while their Steam client is open? Then they should have logs inside the folder I mentioned above. Let me know if the same issue occurs in that scenario.

avatar image Blue669 Aug 07 '15 at 04:02 PM

Package folder? Sorry, I don't understand what you mean.

If I try to start the stand-alone game from anywhere but Steam, the Steam overlay does not show up and the subsystem does not seem to work at all. I have to start the game through the Steam client to have subsystem work.

There seems to be another problem that might be related. After I disconnect from the host and destroy the session on the client, I can reconnect to the same host. However, after about one minute, I get just thrown out of the game. Could this be related? Or is this something else like the garbage collector not unregistering the first connection or something?

avatar image Ben Halliday STAFF Aug 07 '15 at 04:16 PM

I'm checking with the networking devs here about your situation. In the meantime, can you verify that you've set up the Steamworks SDK and included the Unreal Engine Steam module as part of your project, as described here? And are you using the SteamDevAppId of 480, or your own?

avatar image Blue669 Aug 07 '15 at 05:07 PM

Yes, I've gone through the process. I was using a helper-tool found in the forums called something like Steam-setup, but I've double checked the modified files and they seem exactly how they are supposed to look like. I can use every feature, I can see Steam-usernames, I can unlock achievements and see them in my profile and everything.

I'm also using the Steamworks SDK version 1.32, which is what I believe the recommended version to use with UE4?

I'm using my own appid 321270

avatar image Ben Halliday STAFF Aug 10 '15 at 08:36 PM

Hey Blue, I spoke with a networking dev and this is what he had to say:

9999 is a hardcoded value I have in there for "unreachable". Assuming he means a client on a machine is trying to connect to another machine server then it could be a firewall issue, which is the #1 issue people seem to get wrong when trying to develop for Steam. Is he using lobbies or game server APIs? The latter requires ports to be open on his firewall, the former doesn't.

Finding logs for Steam games should still be \saved\logs as always. It might be in the

C:\Games\Steam\steamapps\common\...

or it might be MyDocuments.

The disconnect after a minute issue could be the p2p connection code that a github user posted a fix for. [...] there is a "keep disconnected connection in an array for some time" after people disconnect. If he waits a long time and reconnects does it happen? or no matter how long he waits this happens?

avatar image Omberone Aug 11 '15 at 09:01 AM

Hi, we're having the same issue. The PingInMs variable in FOnlineSessionSearchResult always shows 9999 on listed servers. Every other information seems correct (such as player count, server name etc). We're also using Steam, and are using the lobby API (but just to make sure it wasn't the ports, we've opened 27000 - 27015 and 7777-8000 - udp and tcp).

avatar image Ben Halliday STAFF Aug 12 '15 at 09:43 PM

Hi Omberone,

Please see if you can find the logs from both Server and Client in the locations suggested above, and attach them here. Thanks!

avatar image Ben Halliday STAFF Aug 24 '15 at 05:27 PM

Hi all,

We haven't heard back from you in a while, so I'm going to resolve this post for tracking purposes. If you're able to find the logs as suggested above, or have any further information for us to test this, please feel free to attach them in a response here and we'll continue assisting. Thanks!

avatar image Blue669 Aug 25 '15 at 03:06 PM

This is not resolved. I just do not understand how to get these logs you're talking about. Please be extremely specific how exactly do I produce these logs and where exactly can I find them. I have done everything you say, but logs are nowhere to be found. Keep in mind the game is launched through Steam client, so a lot of debug options are not available.

My game is now commercially available and people are complaining about this issue, so please I really need help!

avatar image Ben Halliday STAFF Aug 25 '15 at 04:28 PM

As asked above:

  1. Are you getting 9999 on a Client on a machine trying to connect to another machine server?

  2. If so, it may be a firewall issue. Are you using lobbies or game server APIs?

  3. In the SteamLibrary directory (wherever the game is saved by Steam), look for the SteamApps\common folder. Take a screenshot of that directory and post it here. My suspicion is the log will be in there somewhere.

Regarding the disconnect after a minute:

  1. If you wait a long time and reconnect, does this still happen?

As an aside: "resolving" a post does not suggest that the issue is fixed or that we're done investigating. It simply means that this particular post is not being tracked currently because either a report was entered into our system for further investigation, or we haven't gotten the information we've requested from you. Simply responding reopens an issue and alerts us to the fact that you have done so.

avatar image Blue669 Aug 25 '15 at 04:36 PM

I'm using a listen server host method, exactly like in Multiplayer Shootout example. Clients can drop in and out at any time. Clients sees 9999 ping on every host when they get a session list (BP posted in first post). Nobody can see a real ping. 100% of all cases do not see a ping other than 9999 of any game session, no matter who creates a game. If this is a firewall issue, every firewall blocks only the ping information, but playing the game is not affected at all it seems.

I'll have to test the disconnect issue further with longer waiting periods and will tell you after the testing.

Here is my Steam folder: alt text

avatar image Blue669 Aug 25 '15 at 04:42 PM

Or do you mean this folder? It has a logs folder but it's emptyalt text

steamfolder2.jpg (49.0 kB)
avatar image Ben Halliday STAFF Aug 25 '15 at 04:50 PM

Okay, it looks like Unloved is the name of your game? In that case, the Saved\Logs folder should be in there. Can you get some logs from both someone playing as Listen Server and someone playing as Client, and attach them here?

I apologize we don't have a good system for testing packaged games in Steam set up yet, but I'm working to set that up with the networking devs here now. Until then, I kinda need to feel around what this looks like through you guys.

avatar image Blue669 Aug 25 '15 at 04:58 PM

No problem, I really hope I don't come across as rude or something, it's just a very annoying problem and I'm not a native English speaker, so I hope my language is adequate :)

The logs directory as posted in my second screenshot above is empty.

Here is another screenshot of the unloved\unloved folder in Steam, but I can go through all sub-directories and there are no logs to be found. That's all directories I can think of to look for the logs alt text

steamfolder3.jpg (64.5 kB)
avatar image Ben Halliday STAFF Sep 03 '15 at 03:45 PM

Okay, sorry for the delay, still trying to figure out why you're not getting logs. Can you find where Steam is installing the game for people who get it through Steam? I'm wondering if there's another location we're missing.

And just to make sure I'm understanding you correctly, other than the ping report, players are able to connect and all other features are working correctly?

avatar image Blue669 Sep 03 '15 at 03:51 PM

The folder I showed earlier is the installation folder where Steam puts the game into (steamapps/common/UNLOVED).

After further investigation, it seems that the current number of players always shows 1, no matter how many players are actually currently in the game.

avatar image Ben Halliday STAFF Sep 28 '15 at 10:00 PM

Heya Blue669,

Sorry for the delay. I've been trying to reproduce this here but haven't made any headway, and I'm still not sure why you don't get logs in the game's folder. I'm still testing a couple of possibilities, but if you wouldn't mind sending me the project to investigate that may prove helpful. You can zip up the project (minus the Saved and Intermediate folders) and upload it someplace secure like Google Drive or Dropbox, then send me a link privately via PMs on the forums:

https://forums.unrealengine.com/private.php

avatar image Blue669 Oct 01 '15 at 05:05 PM

Sorry, it's a commercial game and the project is several gb in file size, can't package that for you.

avatar image Ben Halliday STAFF Oct 03 '15 at 12:07 AM

Well, I haven't been able to reproduce the 9999 ping here when adding a Shipping Win64 build to Steam and opening on two different systems at two different locations. If you have the time, I'd like you to download this small test project:

https://www.dropbox.com/s/rnzdntyeb494ghr/Ping9999Test.zip?dl=0

Run the .exe as you would your game (add it to your Steam library and run on two different systems). Click Host on one system, and once it says "Creation Successful," click Find on the other. Wait a minute or less and the ping should appear on the Client. Let me know if it doesn't.

Without being able to see what's causing the ping miscalculation in your project, and with no logs to look at, there isn't much more I can do. The only other thing I can ask you to try is to build the game as a Development build and try the same thing, then get those logs. I think the reason you're not finding the logs is because it's a shipping build.

I have seen this issue pop up for a few people on AnswerHub, so I'd like to nail it down. If I can figure it out somewhere else, I'll post here and let you know.

avatar image Ben Halliday STAFF Oct 08 '15 at 04:29 PM

Hey Blue669,

I'm going to resolve this issue until you get a chance to test the project I included above and let me know the information I requested. Once you respond, I'll reopen and continue investigating.

avatar image Helghast Oct 09 '15 at 11:45 AM

We have the same problem (ping 9999, and Close Connection) trying to join the MultiplayerShootout (Development build) with Steam client.

Here logs warnings:

  Join request: /Game/Maps/MainMenu?Name=otheruser?SplitscreenCount=1
 Join succeeded: otheruser
 Server connection received: ActorChannelFailure
 Warning: UControlChannel::ReceivedBunch: NetConnection::Close() [GameNetDriver] [MyPlayerController_C_2] [MyPlayerController_C_2] from failed to initialize the PlayerController channel. Closing connection.
 UNetConnection::Close: Name: SteamNetConnection_1, Driver: GameNetDriver SteamNetDriver_0, PC: MyPlayerController_C_2, Owner: MyPlayerController_C_2, Channels: 9, RemoteAddr: 76561198201860191:7777,

alt text

link text

link text

avatar image Ben Halliday STAFF Oct 12 '15 at 06:09 PM

Please download this small test project and follow the repro instructions above, and let me know if the same problem occurs in that project. Thanks!

https://www.dropbox.com/s/rnzdntyeb494ghr/Ping9999Test.zip?dl=0

avatar image 6gg Studios Oct 18 '15 at 12:28 AM

I'm wondering if I'm having the same problem. I have it set up right, tested your pingtest project and it showed just a ping, which I'm guessing is all it should have shown? That its not a firewall issue? My project when I search for server it most of the time will show nothing and sometimes shows the server with 9999 ping and sometimes it shows server with the right ping but 0/0 players and no name and unjoinable..

Why is it that it compiles into a folder that says steamworksv132 when I am using v134?

I originally just had the code from the unreal docs for the subsystem, then I copied the code you had from your pingtester to be sure since yours obviously showed..

It does this same thing.. The rest is all fine though, overlay works, gets id... names my servers after steam id, and shows when someone in another home starts playing it on their steam.

Do you think since sometimes it shows up as the same perfectly buy with a 9999 ping and unjoinable that I have the same issue? or since sometimes it shows as 0/0 with no name and right ping and most of the time doesn't show up that its not the same issue?

avatar image Ben Halliday STAFF Nov 03 '15 at 05:31 PM

After a conversation with The Rift Keeper over forums PM, we were unable to find the source of the problem (the project would not open on my side). For now, I am resolving this post for tracking purposes. If you are able to provide any further information to help us reproduce the ping problem and you've tried both disabling all firewalls and tested the project above, please post here and we will continue investigating. Thank you!

avatar image EniGmaa Jan 25 '16 at 10:22 AM

Has anyone found a solution to this problem we have the same thing in our project. Evety client sees every hosts game ping as 9999. We are all able to connect and play the game fine and there is no lag in game

avatar image Ben Halliday STAFF Jan 25 '16 at 06:44 PM
  1. Have you tried this after disabling all firewalls? Have you tried on two system with no firewall?

  2. Have you downloaded the test project noted above and had the same problem?

  3. Can you reproduce the problem in a new project?

  4. Can you get me a download link so I can test it here?

avatar image EniGmaa Jan 25 '16 at 07:27 PM

1) yes we tried both youre project and our own project on two different systems both signed into steam with all antivirus, and firewalls turned off.

2) yes still same ping

3)yes we just started a brand new multiplayer shootout project, package it up and launch on both the computers always still 999 ping https://docs.unrealengine.com/latest/INT/Resources/Showcases/BlueprintMultiplayer/index.html

4) do u need just our packaged game or the project?

thanks

avatar image Ben Halliday STAFF Jan 25 '16 at 07:39 PM

It would be better to see the project. You can upload the zipped project somewhere like Dropbox or Google Drive and send me a download link via PM on the forums:

https://forums.unrealengine.com/member.php?32-Ben-Halliday

avatar image EniGmaa Jan 25 '16 at 08:48 PM

ok sent check youre pm . thanks

avatar image Ben Halliday STAFF Jan 26 '16 at 10:20 PM

Thanks for the project. As I suspected, both ping and player count showed correctly on my machine, as well as testing on multiple machines. I can guess that there's a port or firewall issue on one or both machines you're testing on. I'll look into possible solutions to test for that tomorrow, but in the meantime I'd recommend testing on machines on a different network than the one you're currently on, where more ports might be open.

Just to verify: you're running the Steam client on all machines while you're testing this, correct? And you're doing a Shipping Windows 64 package?

avatar image EniGmaa Jan 27 '16 at 06:02 PM

Well thanks for checking we appreciate it. yes steam was running on all machines when testing. No I think we were using development build why would this make a difference. Ok ill check my router settings again which ports should be open again ?? Thanks again

avatar image Ben Halliday STAFF Feb 04 '16 at 08:34 PM

Others reporting this have stated it only occurs in Shipping builds. I'd still say this looks like a firewall issue. Testing with all ports open would be the first thing to try, though I think we use port 7777 by default.

avatar image Ben Halliday STAFF Feb 17 '16 at 06:16 PM

Hi all,

We still haven't been able to reproduce this in a new project, and I believe it's primarily a port or firewall issues for most people. I have gotten a project from someone else which reproduced the issue on my end for the first time, but I believe it's a separate issue causing this. We're working on examining that project and what might be causing it, and if it appears related to this I will update this post. Until then, however, I'm going to resolve this post. If you run into this problem and have a reproduceable test case for us, please feel free to comment after testing with the information above. Thanks!

avatar image TheTrueBander Feb 17 '16 at 09:46 PM

We it is also on my game. I produced a normal multiplayer session setup and the ping is 9999 but I can connect normaly to the session.

Btw: You said reproducible test.. Setup a normal find sessions example with a widget that you add to child. You need to test this with a other computer that is not in local network... but even if it has in local network a ping of 9999 without any firewalls or anti virus or something else.

Cheers.

avatar image Ben Halliday STAFF Feb 17 '16 at 09:55 PM

I've tested the project I linked above both in a local network and outside it, and never reproduced the problem. If you download that project, test it on two different systems not on the local network, with Steam enabled on both systems, it shouldn't show you a ping of 9999 unless there is a firewall or port problem preventing that part of the connection.

https://www.dropbox.com/s/rnzdntyeb494ghr/Ping9999Test.zip?dl=0

If you have no problems with that, but do with a separate project, please send a link to your project to me and I can look into it further.

avatar image Ben Halliday STAFF Feb 17 '16 at 10:05 PM

I apologize, it looks like I may have a reproduction after all. I'll update this post when I get somewhere with it and enter a report.

avatar image Tonieh Aug 26 '16 at 02:15 AM

4.12.5 Still the problem with steam, but... When i search a game in LAN the ping shows fine, then if i enter in the host game and i call the ping, it shows me 9999.

avatar image Giuseppe Portelli Aug 26 '16 at 09:30 AM

Hi, as I explained here, it's not an issue of UE. It's just Steam that doesn't offer any ping information when searching for a lobby.

avatar image Andrea92 May 29 '17 at 02:53 PM

Are there any news on this issue?

avatar image invayne Mar 14 '19 at 08:50 AM

2019 and still not fixed? and no reply from devs on this?

(comments are locked)
10|2000 characters needed characters left

12 answers: sort voted first

Everyone interested in this bug can go to the new Unreal Issues tracker and vote for it.

The Issue ID is UE-27444

https://issues.unrealengine.com/

more ▼

answered Jul 26 '16 at 06:49 PM

avatar image

shahrizai
103 9 9 15

avatar image Raz1789 Jun 25 '18 at 06:33 PM

Please reopen this ticket. This is really a major requirement.

(comments are locked)
10|2000 characters needed characters left

Hi folks, I put some efforts into it and came up with a solution. It was such a pain thought I had to share. I based my thinking on Giuseppe Portelli's article but I had to take a slightly different approach to make it work. That's because the initial connection takes up to 2s to establish, giving wrong ping time measurements. So sending a 10 packets burst right away doesn't work, they all come back with 1-2 seconds delay. So what I do is repeatidly send ping packets to the lobby servers during a given period every second. Which gives good results.

First I added an array to the UNetDriver class to hold the responses from the servers: in Engine\Source\Runtime\Engine\Classes\Engine\NetDriver.h : add this struct definition

 // RQ Start
 struct FPingEntry
 {
     uint8 OwnerId[8];
     double Ping;
 };
 // RQ End

Inside the body of class UNetDriver, in the public section, add

 // RQ Start
     TArray<FPingEntry>            PingEntries;
 // RQ End

Now, in Engine\Source\Runtime\Engine\Private\PacketHandlers\StatelessConnectHandlerComponent.cpp, Find StatelessConnectHandlerComponent::IncomingConnectionless(FString Address, FBitReader& Packet) and modify it like this (my modifications are encompassed between RQ Start / RQ End) :

 void StatelessConnectHandlerComponent::IncomingConnectionless(FString Address, FBitReader& Packet)
 {
     bool bHandshakePacket = !!Packet.ReadBit() && !Packet.IsError();
 
 // RQ Start
     bool bIsPingPacket = false;
     bool bIsPongPacket = false;
 // RQ End
 
     LastChallengeSuccessAddress.Empty();
 
     if (bHandshakePacket)
     {
         uint8 SecretId = 0;
         float Timestamp = 1.f;
         uint8 Cookie[20];
 
         bHandshakePacket = ParseHandshakePacket(Packet, SecretId, Timestamp, Cookie);
 
         if (bHandshakePacket)
         {
             if (Handler->Mode == Handler::Mode::Server)
             {
                 bool bInitialConnect = Timestamp == 0.f;
 
                 if (bInitialConnect)
                 {
                     SendConnectChallenge(Address);
                 }
                 // Challenge response
                 else if (Driver != nullptr)
                 {
                     bool bChallengeSuccess = false;
                     float CookieDelta = Driver->Time - Timestamp;
                     float SecretDelta = Timestamp - LastSecretUpdateTimestamp;
                     bool bValidCookieLifetime = CookieDelta > 0.0 && (MAX_COOKIE_LIFETIME - CookieDelta) > 0.f;
                     bool bValidSecretIdTimestamp = (SecretId == ActiveSecret) ? (SecretDelta >= 0.f) : (SecretDelta <= 0.f);
 
                     if (bValidCookieLifetime && bValidSecretIdTimestamp)
                     {
                         // Regenerate the cookie from the packet info, and see if the received cookie matches the regenerated one
                         uint8 RegenCookie[20];
 
                         GenerateCookie(Address, SecretId, Timestamp, RegenCookie);
 
                         bChallengeSuccess = FMemory::Memcmp(Cookie, RegenCookie, 20) == 0;
                     }
 
                     if (bChallengeSuccess)
                     {
                         LastChallengeSuccessAddress = Address;
                     }
                 }
             }
         }
         else
         {
             Packet.SetError();
 
 #if !UE_BUILD_SHIPPING
             UE_LOG(LogHandshake, Log, TEXT("Error reading handshake packet."));
 #endif
         }
     }
 // RQ Start
     else if(!Packet.IsError())
     {
         // check the header to see if it's a ping packet
         uint8 Header;
         Packet.SerializeBits(&Header, 7);
         if((Header<<1) == 74)
             bIsPingPacket = true;
         else if((Header<<1) == 54)
             bIsPongPacket = true;
     }
 
     if(bIsPingPacket)
     {
         // receiving a ping packet 
         if(Driver != NULL && Driver->IsNetResourceValid())
         {
             uint8 * InPacketDataPtr = Packet.GetData();
 
             // build an output packet with original data but PongHeader (must be even)
             FArrayWriter Writer;
             Writer.Add(54);
 
             // copy incoming data to the out packet
             for(int32 i = 1; i < Packet.GetNumBytes(); i++)
                 Writer.Add(InPacketDataPtr[i]);
 
             // pong this back to the client
             Handler->SetRawSend(true);
             Driver->LowLevelSend(Address, Writer.GetData(), Writer.Num()*8);
             Handler->SetRawSend(false);
         }
     }
     else if(bIsPongPacket)
     {
         // receiving a pong packet 
         if(Driver != NULL)
         {
             // get the OwnerId bytes out of the packet
             uint8 OwnerId[8];
             Packet.Serialize(OwnerId, 8);
 
             // get the time stamp out of the packet
             double PacketTime;
             Packet.Serialize(&PacketTime, sizeof(double));
 
             // look for this OwnerId in the Ping entries
             int32 EntryIdx = -1;
             int32 i;
             for(i = 0; i < Driver->PingEntries.Num(); i++)
             {
                 int32 j = 0;
                 while(j < 8 && OwnerId[j] == Driver->PingEntries[i].OwnerId[j])
                     j++;
 
                 if(j == 8)
                     break;
             }
 
             if(i < Driver->PingEntries.Num())
             {
                 // found, use this entry
                 EntryIdx = i;
             }
             else
             {
                 // not found, add a new entry
                 if(Driver->PingEntries.Num() < 200)      // put a limit 
                 {
                     EntryIdx = Driver->PingEntries.Num();
                     FPingEntry NewEntry;
                     for(int32 j = 0; j < 8; j++)
                         NewEntry.OwnerId[j] = OwnerId[j];
                     Driver->PingEntries.Add(NewEntry);
                 }
             }
 
             // update the ping entry value 
             if(EntryIdx >= 0)
                 Driver->PingEntries[EntryIdx].Ping = FPlatformTime::Seconds() - PacketTime;
         }
     }
 // RQ End
 #if !UE_BUILD_SHIPPING
     else if (Packet.IsError())
     {
         UE_LOG(LogHandshake, Log, TEXT("Error reading handshake bit from packet."));
     }
 #endif
 }
 

It's not over yet. Now in my game, I made a few functions to handle this:

 #include "Networking.h"
 #include "Sockets.h"
 #include "SocketSubsystem.h"
 
 ...
 
 
 // -----------------------------------------------------------------
 void UServersPageWidget::PingServer(const FOnlineSessionSearchResult & Result)
 {
     ISocketSubsystem* SocketSubsystem = ISocketSubsystem::Get();
     FString ConnectInfo;
     IOnlineSubsystem* OnlineSub = IOnlineSubsystem::Get();
     IOnlineSessionPtr Sessions = OnlineSub->GetSessionInterface();
     Sessions->GetResolvedConnectString(Result, GamePort, ConnectInfo);
     TSharedRef<FInternetAddr> Addr = SocketSubsystem->CreateInternetAddr();
     bool bIsValid;
     Addr->SetIp(*ConnectInfo, bIsValid);
 
     if (bIsValid)
     {
         // Creating client socket
         FSocket* Socket = SocketSubsystem->CreateSocket(FName("SteamClientSocket"), FString("PingSocket"), true);
 
         FArrayWriter Writer;
                             
         // add a header to the packet so we can recognize it on the other side
         // could any value but LSB must be 0, 1 would mean "handshake packet"
         Writer.Add(74); 
 
         // write the OwnerId data to the packet
         const uint8 * OwnerIdPtr = Result.Session.OwningUserId->GetBytes();
         int32 OwningIdSize = Result.Session.OwningUserId->GetSize();
         for(int32 i = 0; i < OwningIdSize; i++)
             Writer.Add(OwnerIdPtr[i]);
 
         // write the time stamp data to the packet
         double TimeStamp = FPlatformTime::Seconds();
         uint8 * TimeStampPtr = (uint8*)&TimeStamp;
         for(int32 i = 0; i < sizeof(double); i++)
             Writer.Add(TimeStampPtr[i]);
 
         // add a trailing byte to ensure a non zero ending packet which would be considered an error when received
         Writer.Add(255);
 
         // Sending 10 ping packets
         int32 BytesSent;
         Socket->SendTo(Writer.GetData(), Writer.Num(), BytesSent, Addr.Get());
 
         SocketSubsystem->DestroySocket(Socket);
     }
 }
 
 // -----------------------------------------------------------------
 double UServersPageWidget::GetPingByOwner(TSharedPtr<const FUniqueNetId> OwningUserId)
 {
     UNetDriver * NetDriver = GetWorld()->GetNetDriver();
     if(OwningUserId.IsValid() && NetDriver != NULL)
     {
         const uint8 * OwnerIdPtr = OwningUserId->GetBytes();
         int32 OwningIdSize = OwningUserId->GetSize();
         for(int32 k = 0; k < NetDriver->PingEntries.Num(); k++)
         {
             int32 j = 0;
             while(j < OwningIdSize && j < 8 && OwnerIdPtr[j] == NetDriver->PingEntries[k].OwnerId[j])
                 j++;
             
             if(j == 8)
                 return NetDriver->PingEntries[k].Ping;
         }
     }
 
     return -1.0;
 }
 
 // -----------------------------------------------------------------
 void UServersPageWidget::ClearPingArray()
 {
     UNetDriver * NetDriver = GetWorld()->GetNetDriver();
     if(NetDriver != NULL)
         NetDriver->PingEntries.Empty();
 }

PingServer(const FOnlineSessionSearchResult & Result) builds & sends a ping packet to the server. You have to call that on all your search results on a regular time basis. I do it every second for at least 10 secs.

To get the Ping values, call GetPingByOwner(TSharedPtr OwningUserId). The result is in seconds, so you have to multilply it by 1000 to get a ms ping measurement.

When initiating a new search, I clear the PingEntries in the array by calling ClearPingArray().

Important notes :

  • Your game must be listening in order to receive the Pong packets back from the servers. So be sure to add ?Listen to your arguments or call UWorld::InitListen() (or something like that)

  • Your game might be reported as a potential threat by some AntiVirus software to the user. Annoying.

I commented my code, so you might be able to get how it works. I assumed that Steam NetIds are 8 bytes long.

Some optimizations are possible.

Good luck

more ▼

answered Jul 07 '17 at 06:15 PM

avatar image

elliotek
61 2 4 10

avatar image ANonSmartMan Aug 18 '18 at 01:56 AM

Hi Elliotek, I'm trying to implement your fix and when I call ClearPingArray() it doesn't find the NetDriver. It's weird because my game finds search results, I can join them, etc. Seems like these functions are just not finding the net driver or something. I just can't get ClearPingArray to work for some reason.

Here's my function.

 void UMyGame_UserWidget::ClearPingArray()
 {
     UNetDriver * NetDriver = GetWorld()->GetNetDriver();
     if (NetDriver != NULL) 
     {
         NetDriver->PingEntries.Empty();
     }
     else
     {
         UE_LOG(LogTemp, Warning, TEXT("Net Driver not found"));
     }
 }





avatar image ANonSmartMan Aug 18 '18 at 07:57 PM

Ok, I saw your comment above about setting the client to listen. I wrote another function for that. Am I on the right track here?

 bool UMGH_UserWidget::StartListening(FURL &InURL) 
 {
     FURL InURL = InURL;
     UWorld World;
     World.Listen(InURL);
 };
(comments are locked)
10|2000 characters needed characters left

I don't understand how Epic can consider this as such a low priority so they don't even have a timeline to fix this. For developers like me who rely heavily on Blueprints, this is a show stopper for many customers if they want to play online and there is no way of telling if a ping of a host is acceptable for them or not.

I am selling a multiplayer game that because of this issue does not show the ping to the players before they join a game. And because of that I got a lot of angry customers and even some refunds based on players criticising the netcode for being poorly optimized, when in reality they were just unlucky and joined games with a ping that's too high for them.

more ▼

answered Jul 03 '16 at 11:33 AM

avatar image

Blue669
236 29 35 54

(comments are locked)
10|2000 characters needed characters left

Hi guys!

I have stumbled upon this issue with 9999 ping values while implementing the Steam version of my upcoming game. I couldn't find any clue searching online, so I decided to dig into the code starting from the Steam SDK and then analyzing how the Unreal Engine Steam Online Subsystem is mapped into the Steam APIs. I've just written an article on my blog where I explain what I have found. I hope you can find it useful.

Ping 9999 Issue on Unreal Engine Steam Session Results

more ▼

answered Aug 15 '16 at 02:58 PM

avatar image

Giuseppe Portelli
81 1 5 18

avatar image matfer Aug 30 '16 at 03:02 PM

In the code of MyGameSession in your blog you use a variable SS, which should be the socket subsystem. How do you get it?

avatar image Giuseppe Portelli Aug 31 '16 at 11:31 AM

Just updated the blog post. The code to get The Socket subsystem is:

 ISocketSubsystem* SS = ISocketSubsystem::Get();
avatar image matfer Aug 31 '16 at 12:45 PM

Thank you. I was doing some experiments and your code is of great help. Do you know how the net driver could be accessed?

avatar image Giuseppe Portelli Aug 31 '16 at 01:07 PM

GetWorld()->GetNetDriver();

Bear in mind that if you want to modify the UE Steam net driver, or create your own based on it, you must have a deep understanding of the UE modules architecture.

I've written this post as a reminder. At the moment I'm simply relying on the Steam matchmaking result ordering. Maybe in the future I will make some experiments and try to implement a custom ping handshaking for lobby searches.

Surely I'll write some detailed post in the future about UE modules/plugins and on UE multiplayer in general.

avatar image matfer Aug 31 '16 at 01:45 PM

Thank you again, but I already tried that and it returns null.

I think a very quick and dirty way to ping the host could be to send some message and then do a busy wait until something is received (checking with RecvFrom) or a timeout is hit.

I was thinking about sending a regular handshake packet (hence I was trying to access the net driver), so that the host responds without having to modify the engine. However, this could not be a good idea since the handshake could then continue if the response comes after the timeout, which is not desirable. So it could be worth to create a custom ping protocol.

avatar image Giuseppe Portelli Aug 31 '16 at 08:55 PM

The net driver is null if you don't have any client or server socket active in your map. If you load a map by passing the ?listen param inside the map URL, you will get a server listening socket active on your map. In this case the net driver will be loaded and not null.

When you perform a session search, typically you are searching for sessions corresponding to game instances running a map in listening (server) mode, so that you can connect and join them. The net driver is available first on the server. On clients only after a connection to a server (session join and map travel).

In the tests I did, I was able to send packets to a listening server and receive them on server without the need to load the net driver on the client side. Just creating a socket on the client did the job.

If you want to make some experiments with the net driver, do them on a server by opening a map in listening mode.

(comments are locked)
10|2000 characters needed characters left

Hi all,

I apologize for the delay, but I was finally able to reproduce this when attempting a connection between systems not on the same network. I've created a bug report for the issue (UE-27444), and we'll update this post with any details as we get them. Thank you all for your patience and efforts to help us reproduce the issue thus far!1

more ▼

answered Feb 25 '16 at 03:33 PM

avatar image Blue669 Apr 08 '16 at 09:37 PM

Is this fixed in 4.11? Or do we have to wait for 4.12 for an update?

avatar image Sean L ♦♦ STAFF Apr 11 '16 at 03:51 PM

This issue is still being investigated by our developers, and there is currently no timeline for a fix. I will provide updates on this issue as they become available.

Have a great day

avatar image Dealman May 16 '16 at 04:04 PM

Hey, I'm not sure if this information is useful but I'll put it here either way just in case.

So I have a multiplayer game running via Steam, using the advanced sessions plugin(4.11.2).

Whenever I play the game online using a virtual machine, the ping will always work and provide an accurate result.

However, if I'm playing with someone that is not on my network, it will always return 9999 with 100% probability.

We've tried using TeamViewer VPN but the problem persists, as does it with firewall turned off and both clients running in DMZ mode.

I also read in a thread where someone stated that it works as intended when using C++ and only breaks when using the BP node.

I've never used the BP to C++ converter, but I could try that on my project and see if that works.

avatar image Dealman Jun 13 '16 at 04:52 PM

Again just an update that it's still happening with 4.12.2. Hopefully it'll be hotfixed before 4.13 :(

avatar image Ashengar Jun 20 '16 at 05:29 PM

I'm running 4.12.3 and I'm also get a ping rate of 9999, is there any update on this issue? (PS, It's kinda not resolved.)

avatar image Sean L ♦♦ STAFF Jun 20 '16 at 05:39 PM

Hey Ashengar,

This issue is currently still in our system, but there is no timeline for when a fix will be released as of yet.

avatar image Ashengar Jun 28 '16 at 05:19 PM

Has this issue now been fixed with the release of 4.12.4 ?

avatar image Sean L ♦♦ STAFF Jun 28 '16 at 05:40 PM

This issue is currently in our system, but the developers are focusing their attention on high-priority crash and showstopper bugs. As a result, there is not a timeline for when a fix will be released.

Have a great day

avatar image Ashengar Jun 28 '16 at 06:15 PM

Okay thanks for the update:) (Although not being able to test multiplayer over steam I thought would be pretty high)

avatar image Nonlin Jul 03 '16 at 04:18 AM

So is this an Engine issue or is this an issue with a certain example project because I notice the same problem in the Generic Shooter Example Project.

(comments are locked)
10|2000 characters needed characters left

Hi Nonlin, It seems to be an engine problem as I've tested it on the example project and my own project with the same results, and although it works perfectly locally once you add another PC on a different network both connected to steam you'll get a ping return of 9999 which stops you testing your multiplayer game. (I'm sure your aware that just because it works locally it doesn't mean it works online properly until tested, which means we're kinda buggered until they fix the problem which could be tomorrow or in a years time with the answers we're getting.)

more ▼

answered Jul 03 '16 at 11:19 AM

avatar image

Ashengar
6 1

(comments are locked)
10|2000 characters needed characters left

Any updates with this issue? I'm having the same problem, all clients see is 9999 ping and only 1 player for every session.

more ▼

answered Aug 30 '16 at 01:35 PM

avatar image

Howie
16 1 9

avatar image TheTrueBander Sep 06 '16 at 02:43 PM

So I recently found something maybe useful to get the ping right: http://www.aclockworkberry.com/ping-9999-issue-on-unreal-engine-steam-session-results/

avatar image Giuseppe Portelli Sep 07 '16 at 05:49 PM

Hi, I've already posted that link above in this thread, where you can find a little discussion about it.

avatar image TheTrueBander Sep 07 '16 at 06:16 PM

Oh sorry didn't saw that... Will this actually work?

avatar image Giuseppe Portelli Sep 07 '16 at 06:54 PM

It should work, but it is not easy to implement well. Didn't have time to implement it yet. That blog post is a remainder for future tests.

(comments are locked)
10|2000 characters needed characters left

Someone have news? I have created a multiplayer online by blueprints and i will not launch the game for this ping 9999.

more ▼

answered Sep 22 '17 at 07:33 AM

avatar image

streusu
6 1 3 5

(comments are locked)
10|2000 characters needed characters left

it is now 2018 and this is still happening how many updates does it take before we can get a correct ping ?

more ▼

answered Jan 26 '18 at 12:24 PM

avatar image

invayne
37 8 14 18

(comments are locked)
10|2000 characters needed characters left

February 2018, any updates?

more ▼

answered Feb 24 '18 at 11:34 PM

avatar image

Curs0
279 3 11 26

(comments are locked)
10|2000 characters needed characters left

Still an issue in 2018... Guess since Epic's games (especially Fornite: BR) aren't on Steam they won't make it a priority for their 95%+ client base that will be relying on Steam.

/shrug

more ▼

answered Mar 30 '18 at 07:35 PM

avatar image

VictorBurgos
2.4k 60 27 111

(comments are locked)
10|2000 characters needed characters left

This is still a problem in 4.20, even though Steam Authentication has been added since and in theory this could have been fixed at the same time.

All you need to do is publish ShooterGame to Steam with a proper AppID and you can see the problem.

more ▼

answered Jul 23 '18 at 07:17 AM

avatar image

TheJamsh
810 56 91 139

(comments are locked)
10|2000 characters needed characters left
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question