Networking C++ "WithValidation"

Hey guys,

I’m trying to get multiplayer working and it’s pretty okay-ish so far, but I’m confused about the “WithValidation”:

UFUNCTION(reliable, server, WithValidation) ←
void foo();

What exactly does it do? So far all of my foo_validate() functions just return true, is that correct?

I’d appreciate any help, thanks in advance!

This function is new to UE4 and designed to provide security and validation of remote procedure calls sent from the client to the server. The goal is that you’ll provide some conservative error checking on the RPC before we allow the actual RPC to come through.

Often, return true is fine, but if you can validate the input that would be better.

The game will disconnect the client if the data is invalid.

1 Like

Great answer, thank you!

Hi, can we get this information added to the list on the documentation here: https://docs.unrealengine.com/latest/INT/Programming/UnrealArchitecture/Reference/Functions/Specifiers/index.html ?

Hi joshmarkiewicz,

Thanks for your answer, but please, can you provide a “for example” of some case when we need to implement this “conservative error checking”. I have seen some multiplayer samples, but in all, this methods return true. So i need a real sample when we need to return false, can you help me with these, please.

Best regards

IT would be nice if someteimes we could just really skip this :confused:

i truly don’t understand why should we always validate… it hurts the performance after all :confused:

I agree, it’s really a pain that this can’t be disabled. We code exclusively for situations in which the clients are trusted (e.g., VR arcade).

I really wish this was a thing in Blueprints >_<