x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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!

Product Version: Not Selected
Tags:
more ▼

asked Aug 01 '14 at 12:59 PM in C++ Programming

avatar image

Nanoxin
306 35 39 44

(comments are locked)
10|2000 characters needed characters left

1 answer: sort voted first

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.

more ▼

answered Aug 01 '14 at 08:24 PM

avatar image

Crzyhomer STAFF
1.2k 34 26 103

avatar image Nanoxin Aug 01 '14 at 08:36 PM

Great answer, thank you!

avatar image Ironsoul Apr 26 '15 at 06:15 AM

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 ?

avatar image nan2cc Jun 19 '15 at 05:28 PM

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

avatar image Azarus Dec 12 '16 at 06:03 PM

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

avatar image Arty-McLabin Mar 05 '18 at 10:43 PM

i truly don't understand why should we always validate.. it hurts the performance after all :/

avatar image RotemS Dec 10 '18 at 11:17 AM

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).

(comments are locked)
10|2000 characters needed characters left
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question