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"

Does NetMulticast only work from the server?

I've been experimenting with NetMulticast, and if I call a NetMulticast function from a client then it only gets called locally, and does not run on any other client or the server.

If I add a server function that then called the multicast function, then the function gets called locally on the server as well as on all the clients.

Is this correct, that the only way to call a NetMulitcast function is from the server?

In which case, in order to get a function called on every client and server, you need to implement two functions - one to run one the server and the other to be multicast?

Product Version: Not Selected
Tags:
more ▼

asked May 08 '15 at 11:56 PM in C++ Programming

avatar image

AusPaco
195 17 122 34

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

4 answers: sort voted first

Yes that is the intended behavior. In order for a client to interact with another client it must go through the server first. This piece of documentation explains it well.

more ▼

answered May 09 '15 at 01:44 AM

avatar image

Zaucy
681 15 13 127

avatar image Venros May 09 '15 at 03:26 AM

so essentially we are really implementing 4 functions total (implementation, validate, netmult,etc). Am I correct in saying this?

avatar image AusPaco May 09 '15 at 03:32 AM

Yes, that's what I did. In fact, to get a single function multicast from the client I needed 8 functions in total!

avatar image Zaucy May 09 '15 at 03:35 AM

If you are wanting a client to broadcast a message to all other clients then yes. You would need at least 4 functions. The Server Implementation, Validation and the NetMulticast Implementation and Validation.

avatar image eXi Jul 07 '15 at 08:16 AM

You don't need the validation if you are not using it. The Validation function can be used to stop the whole call when it returns false. If you are only putting "return true" in it, you don't need it and you can only work with Implementation and drop the WithValidation parameter from the UFUNCTION macro.

avatar image Constantin Suman May 02 '18 at 04:32 PM

Actually now the validation is forced for Server functions. This was made so developers don't forget to use it. In case you don't need special validation functionality, just return true from the _validate function.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

Ok, so the answer is yes! - Points to Zaucy but I can't select that comment as a correct answer for some reason.

more ▼

answered May 17 '15 at 10:30 AM

avatar image

AusPaco
195 17 122 34

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

Hi, Please wrote those four functions here. I have a function that called from Animation Blueprint and it's just only run on client owner and server and not on other client, I want to know how i can call it on other clients ? I get an error about no owning connection for that function. This is my code:

.h

 UFUNCTION(BlueprintCallable, Category = "Animation")
 void EndAttack();
 
     UFUNCTION(Reliable, Server, WithValidation)
     void ServerEndAttack();
     void ServerEndAttack_Implementation();
     bool ServerEndAttack_Validate();

.cpp

 void AMyClass::EndAttack()
 {
     
     if (Role < ROLE_Authority)
     {
         ServerEndAttack();
     }
 }
 
 void AMyClass::ServerEndAttack_Implementation()
 {
     EndAttack();
 }
 
 bool AMyClass::ServerEndAttack_Validate()
 {
     return true;
 }

more ▼

answered May 12 '16 at 01:22 PM

avatar image

Vahid
156 9 12 13

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

No. Yes and No.

No - because it will work on client, but only for the calling client Yes - because in order for all the rest to get that too, it should be called from the server.

So pretty much it depends on what you intend to do.

This answer is to unconfuse rapid readers who would otherwise think it wont work on the calling client

more ▼

answered Feb 17 '18 at 08:01 PM

avatar image

Arty-McLabin
868 19 41 61

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
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