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"

Client to server replication in blueprints.

Hello everyone,

I've been banging my head against this problem for a few hours--trying to get the client to affect change on the server in multiplayer. My biggest issue stems from being unable to call RPC functions on an actor (client telling server to run a function) because the client does not own the actor. I've seen this problem discussed a lot on this site, but have not found a single solution to the issue.

In short, does anyone know how I can have a client call an RPC function for the server on an actor it doesn't own?

Thanks.

Product Version: Not Selected
Tags:
more ▼

asked Feb 28 '15 at 02:33 AM in Blueprint Scripting

avatar image

Rockhopper
6 2 3 3

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

2 answers: sort voted first

Client can only call RPCs on actors it owns. It is a security measure, preventing clients from commanding other clients' actors. Initially, client only owns its PlayerController. You can then establish (on server) ownership chains like:

A pawn owns its weapon, PlayerController owns pawn. Thus, PlayerController will own a weapon and will be able to call Weapon::Fire().

more ▼

answered Feb 28 '15 at 05:55 AM

avatar image

Slonopotamus
195 7 12 15

avatar image Rockhopper Feb 28 '15 at 06:28 AM

Ah! Thanks for the clarification. Maybe you can help me figure out a better solution to my current case then. I have a server and a client which both display a game board. When either player clicks on a tile on the board, I want it to change color for both players. It's been easy to make it so that the server's clicks change the color on the client, but it's almost impossible for me to think of a way the client can make changes which reflect on the server's colors as well, since the server "owns" the actor tiles.

Suggestions would be greatly appreciated!

avatar image Rockhopper Feb 28 '15 at 07:24 PM

I think I've found the proper way to do this: funnel all RPC requests through the client's PlayerController, which they do own.

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

Workaround is easy: create Run On Server function in a Player Controller and then from within that function call the function on object that you "don't own". alt text

rpc.png (156.5 kB)
more ▼

answered May 25 '15 at 01:03 PM

avatar image

Neochrome
26 2 3 4

(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