Skip to content

v0.2.0-rc.1

Pre-release
Pre-release
Compare
Choose a tag to compare
@mikeseese mikeseese released this 30 Oct 21:01
· 17 commits to main since this release
28360e8

Pinging 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 common UHathoraSDK class. Instead of creating an instance of UHathoraPing and then calling GetRegionalPings, you can call the static method UHathoraSDK::GetRegionalPings(...).
  • To support Blueprint usage, we changed the OnComplete delegate passed to GetRegionalPings to be a Dynamic Delegate, which means you can no longer call UHathoraSDK::GetRegionalPings from a non-UObject (e.g. Slate components). If you are using a Slate component, you can either wrap it with a UWidget and have the call occur in the child UWidget class or convert the Slate component to a full UUserWidget. For the purposes of the provided sample project in this repo, we opted to change SDemoMenuWidget : SCompoundWidget to UDemoMenuWidget : 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):

image

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:

  1. Call the GetPingServiceEndpoints API call
  2. Send an ICMP echo for each region once in parallel
  3. 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.
  4. 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!

image

For this release, the Get Regional Pings node shown in the above image is all you need to get started:

image

The Create Hathora SDK node will be useful in a future release.