How to override dedicated server version checking connecting clients?

Hello,

I have a dedicated server project using UE 5.1 built from source. I set my project version to 1.0 and I build my dedicated server, then I build a client and everything works fine. However I also have an automated build process set up that increments my project version with every build, so for example I can have a client build versioned 1.0.32 but when I run that version I can’t connect to my server because the versions don’t match. (Server was built on 1.0 and client is 1.0.32)

I want to implement my own version checking logic, I want to only make sure that the major and minor versions match, but that anything after that is allowed to be different. so as long as it starts with “1.0” then it would allow the connection.

I’ve found some information on the FNetworkVersion class, specifically the IsNetworkCompatible function but I haven’t figured out how to override it. I would like to avoid modifying the engine code if that is possible because this project has to be buildable on more than one machine and I don’t want to have to apply the same unreal engine changes to every machine that wants to build this project.

There is something I have already tried but didn’t work. I have a class that inherits from GameMode class which handles my networking logic. In the init event of that class I execute a console command that does this networkversionoverride 12345 and on the client side I have the same logic in the GameInstance class init event, so in theory they should both have the same version right? Doing this still wasn’t working though.

Any help would be greatly appreciated, thank you.

Extra information:

Server log when a client tries to connect but doesn’t have the same project version (1.0 in this case)

LogNetVersion: DedicatedServerGame 1.0, NetCL: 1, EngineNetVer: 30, GameNetVer: 0 (Checksum: 3521483013)

LogHandshake: CheckVersion: Incompatible version. bValidHandshakeVersion: 1, bValidNetVersion: 0, GHandshakeEnforceNetworkCLVersion: 0, RemoteMinVersion: 3, RemoteCurVersion: 3, MinSupportedHandshakeVersion: 3, CurrentHandshakeVersion: 3, RemoteNetworkVersion: 284828098, LocalNetworkVersion: -773484283

And this is the client log when it can’t connect:

LogNet: UPendingNetGame::SendInitialJoin: Sending hello. [UNetConnection] RemoteAddr: 127.0.0.1:7777, Name: IpConnection_0, Driver: PendingNetDriver IpNetDriver_1, IsServer: NO, PC: NULL, Owner: NULL, UniqueId: INVALID

LogNet: Error: Server is incompatible with the local version of the game: RemoteNetworkVersion=3521483013, RemoteNetworkFeatures=LegacyReplication vs LocalNetworkVersion=284828098, LocalNetworkFeatures=LegacyReplication

LogNet: Error: UEngine::BroadcastNetworkFailure: FailureType = OutdatedClient, ErrorString = The match you are trying to join is running an incompatible version of the game.  Please try upgrading your game version., Driver = PendingNetDriver IpNetDriver_1

LogNet: Warning: Network Failure: PendingNetDriver[OutdatedClient]: The match you are trying to join is running an incompatible version of the game.  Please try upgrading your game version.

LogNet: NetworkFailure: OutdatedClient, Error: 'The match you are trying to join is running an incompatible version of the game.  Please try upgrading your game version.'

LogNet: NMT_CloseReason: (Server Disconnect Reasons) 127.0.0.1:7777

I have figured out how to override the version checking with the FNetworkVersion class. I was very close heh, I was just missing the part where I can implement my override in my game module, and now I can implement my own version checking logic!

My game module implements my custom network version overrides like so:

	virtual void StartupModule() override {
		FNetworkVersion::IsNetworkCompatibleOverride.BindStatic(&UMyNetVersion::IsNetworkCompatibleOverride);
		FNetworkVersion::GetLocalNetworkVersionOverride.BindStatic(&UMyNetVersion::GetLocalNetworkVersionOverride);
	}

	virtual void ShutdownModule() override {
		FNetworkVersion::IsNetworkCompatibleOverride.Unbind();
		FNetworkVersion::GetLocalNetworkVersionOverride.Unbind();
	}
1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.