Latency/ping

Hi, is there a way to get the current latency/ping in milliseconds with the blueprints?

But would that return a network ping? I don’t think so. I also don’t know if there is a way with BP, but you could check the ShooterGame. I think they used a ping for the Serverlist. Maybe you can make the function for that BP callable.

Yes. I’ve just figured it out. My mistake. I tought fps.

I found this in SShooterServerList.cpp:

NewServerEntry->Ping = FString::FromInt(Result.PingInMs);

I found this on the Documentation: https://docs.unrealengine.com/latest/INT/API/Runtime/OnlineSubsystem/FOnlineSessionSearchResult/PingInMs/index.html

but it’s a variable of FOnlineSessionSearchResult. I want to get the ping in game.

How about the Ping from APlayerState?

https://docs.unrealengine.com/latest/INT/API/Runtime/Engine/GameFramework/APlayerState/Ping/index.html

Could that help :X I don’t know much about the ping in UE4.

I already tried it, but it gives errors:

Accessed None normaly means that your PlayerState variable is empty. Did you set it?

I did this on MyCharacter:

The Int Ping variable (SET) is linked to Event Tick.

I mean your Player State variable. Did you set it somewhere? In that screenshot you just use it, where did you set it?

If I search Player state, I can find only Get Player State, not Set Player State.

Hm ok, can you make a “IsValid” check on the PlayerState before using it please? Drag the PlayerState wire and search for “IsValid”. Put it in between the tick and the Set Int Ping. To be sure the Variable is valid before using it.

Ok, now it works. But why I’ve got 24ms in LAN?

Could be. I don’t know if how networking works deep in the engine.

If you are connected to the localhost it should be 0, but it could also go over the router to your provider and back. I really don’t know how this works xD

Is the ping at least changing a bit?

I’m glad that you even get something to work xD

I’ve got a problem: sometimes the ping is always 0 even if I connect to a dedicated server (not on my PC).

Outside of the network.

Not on your pc means outside of the network or only a second pc?

I dont know if a dedictaed server handels theis differently.