v0.2.0-rc.2
Pre-releasePinging via ICMP
This release switches the implementation of GetRegionalPings
to use Hathora Cloud's new regional ICMP pinging support; the SDK no longer supports pinging with WebSockets. Using ICMP is more reliable and accurate than WebSockets, and the Unreal SDK abstracts the nuances away.
Breaking Changes
- To better structure the SDK for upcoming changes, we dropped the
UHathoraPing
class in favor of a commonUHathoraSDK
class. Instead of creating an instance ofUHathoraPing
and then callingGetRegionalPings
, you can call the static methodUHathoraSDK::GetRegionalPings(...)
. - To support Blueprint usage, we changed the OnComplete delegate passed to
GetRegionalPings
to be a Dynamic Delegate, which means you can no longer callUHathoraSDK::GetRegionalPings
from a non-UObject
(e.g. Slate components). If you are using a Slate component, you can either wrap it with aUWidget
and have the call occur in the childUWidget
class or convert the Slate component to a fullUUserWidget
. For the purposes of the provided sample project in this repo, we opted to changeSDemoMenuWidget : SCompoundWidget
toUDemoMenuWidget : UUserWidget
.
You can find an example on how to call UHathoraSDK::GetRegionalPings
at https://github.com/hathora/hathora-unreal-sdk/blob/main/SDKDemo/Source/SDKDemo/DemoMenuWidget.cpp#L93-L95
Features
- ICMP pinging support
- Ping each region multiple times (defaults to 3)
- Blueprint support
ICMP pinging support
The main interface of how the pings are handled is abstracted for you with UHathoraSDK::GetRegionalPings
, but it should be noted that each ICMP echo has a default timeout of 1 second
. You can change this in the new Edit > Project Settings... > Plugins submenu > Hathora SDK
menu (or just search for ping timeout
):
If you want to save the change for your entire project/team, make sure to click the Set as Default button at the top; this will save the setting in Config/DefaultGame.ini
which you can add to your version control. If you don't do this, the setting will only apply to your instance of the Unreal project.
Ping each region multiple times
The GetRegionalPings
function now takes an optional second argument int32 NumPingsPerRegion
which defaults to 3
. The SDK will execute the following when calling this function:
- Call the
GetPingServiceEndpoints
API call - Send an ICMP echo for each region once in parallel
- After receiving a result for each region, step 2 is repeated
NumPingsPerRegion - 1
times. The SDK waits until a result is returned from each region before sending another set of pings to prevent some of the ICMP echos from being ignored/dropped due to subsequent/overlap requests. - After running step 2 a total of
NumPingsPerRegion
times, the minimum is returned for each region. If a particular region timed out or was unreachable otherwise for each ping, it is omitted from the callback delegate.
Blueprint support
We've added Blueprint support for the SDK!
For this release, the Get Regional Pings
node shown in the above image is all you need to get started:
The Create Hathora SDK
node will be useful in a future release.