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"

Help understand RPCs (client to server calls)

I'm trying to have my client's weapon call a server function on overlap, but the server function is never called (in-spite of being the owning client).

According to documentation (https://www.unrealengine.com/blog/crash-course-in-blueprints-replication):

 "Server RPCs can only be called by a client who owns the actor executing the event graph."

Shouldn't the following work? owning actor

Thanks in advance

Product Version: Not Selected
more ▼

asked Jul 05 '14 at 03:38 AM in Using UE4

avatar image

797 49 61 94

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

2 answers: sort voted first

First of, you forget to check if actor actually has authority inside your server RPC :)

And yeah, it should work like that, not sure what's the case..

I've got it up set like that(in example of weapon firing): Weapon::Fire() Weapon::ServerFire()

Weapon::Fire() checks for role, and if it's not ROLE_Authority, then it calls ServerFire, which is reliable server function. If it's authority - it processes firing.

Hope this helps you some way.


Forgot to mention that ServerFire simply calls Fire.

more ▼

answered Jul 05 '14 at 07:13 AM

avatar image

1.6k 54 38 105

avatar image Grogger Jul 06 '14 at 12:45 AM

Thanks for the suggestion BiggestSmile, I do check for authority in the real code (the above is a contrived example of the issue).

I managed to get it to work with what feels like a crummy workaround: I moved the server function to the Character and the weapon calls that one when it does not have authority (which in turn calls the weapon function to apply the changes :\ ).

I doubt this is the proper solution, and I'm far from understanding why this is happening

avatar image James Ordner Jul 06 '14 at 06:13 PM

I'd like to know what the condition of being "owned by the calling client" is. I'm in the same situation as Grogger. I have an actor with the RPC functions set up, but the server functions never are called. I placed the actor in the world through the editor (did not spawn it through code), which explains why it's not owned by the client, but I don't know how to make the client own it in the first place.

avatar image BiggestSmile Jul 07 '14 at 11:45 AM

Executes on owning client is exactly what it sounds like.

It's being executed only on client that requested this call, server will know nothing about it. In case of condition, function will be called only on the proxy that client, which requested the call, owns. If i recall correctly, only the AuthorityProxy will work with such a condition.

Try displaying actor's role and see how different conditions affect results.

displayall class property

displayall MyGameCharacter Role should work just fine.

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

The Client calls RPC, but it runs on server. So anything later than red node TestServer will be executed ONLY on Server. In Epic's tutorials all firing, damage and other changes executed on server. This functions change replicated variables. And clients "feel" the result. So, if you want fire weapon, just call it from any client with RPC. On Server run bullit movement and hit detection. But health, bullit and other parameters are "Replicated". So, changes on Server will be seen on clients.

Server - gameplay calculations, clients - input, HUD, graphics and calling. You can make calculations on clients too, but first need training like I wrote, to make it feel!

more ▼

answered Jul 07 '14 at 02:39 PM

avatar image

66 11 11 16

avatar image Grogger Jul 07 '14 at 04:33 PM

Thank you for the response MoD, though I think you may have misunderstood the issue: The problem is that the red TestServer node is never triggered on the server in my example (although from my understanding, it should be)

avatar image Wobbleyheadedbob Jul 21 '14 at 11:47 PM

I'm in the same boat as you and James Ordner, I've got net-ready drivable vehicles that the player character can posses. Everything kinda works except the RPC calls from the vehicles dropped or spawned dynamically in the level.

At least now I know why, but now I need to understand how to change who the owner of a particular Actor is... can this even be done? I assume only the server can determine ownership.

avatar image dbc211 Sep 11 '14 at 08:23 PM

Did you ever happen to find more information on this? I have a separate question exactly about this, here: https://answers.unrealengine.com/questions/82892/need-clarification-on-networking-controllers-and-n.html

avatar image Wobbleyheadedbob Sep 12 '14 at 08:32 AM

Sort of, though I'm still wrestling with trying to get it to work. I've haven't had much time for development the last 2 weeks but I'm going to be back on it this Sunday and onwards.

You can see the discussion I've been having on this particular topic here: https://answers.unrealengine.com/questions/92176/posses-a-pawn-as-a-client-on-dedicated-server.html

In the absence of an example project from Epic or some other third party I'll probably do a write-up and example in the Wiki once I have it working.

(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