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"

Multiplayer, server shoots correctly, but the client calls authority not remote?

Hi, I've been trying to get this to work for quite a while and I can't seem to get it to work. When the server fires everything works correctly but when the client fires it seems that the remote is not called and instead authority is called again, when the server fires I can see 1 explosion and hear a sound, but when the client fires I can see two explosions and hear two sounds and this is IF the remote decides to fire. Sometimes on the client i can see in blue client: client firing and sometimes its client: server firing. Also when the server fires the client can see the explosion spawn at the hit location, but when the client fires, the server can't see anything.

Here is what is going on:

Server: alt text

Client: alt text

I think that the second explosion I see from the client when firing is actually coming from the server. Most of the time the blue string is not even there but it says "Client: Server is firing".

Here is my setup for this:

alt text alt text

^This is in the event graph of a weapon blueprint. The "SpawnEmitterAtLocation" is plugged at the end of a LineTraceByChannel's break hit result location.

alt text

Start and Stop Fire are called from the character blueprint.

Product Version: UE 4.16
Tags:
use.png (189.6 kB)
capture0.png (105.0 kB)
capture.png (26.9 kB)
clientfiring.png (34.7 kB)
capturexx.png (162.3 kB)
more ▼

asked Jul 11 '17 at 03:50 AM in Blueprint Scripting

avatar image

Tseno
46 1 5 7

avatar image Tseno Jul 11 '17 at 05:02 PM

Nobody has an idea? :(

avatar image vivalabugz Jul 11 '17 at 11:25 PM

Why are you calling "Server Start Fire" in the "Start fire" function?

avatar image Tseno Jul 12 '17 at 01:30 AM

I think that's what I'm supposed to call there at the remote since the client needs to tell the server that it wants to shoot. If I just call start fire my game crashes with an infinite loop detected and that's when my client actually decides to fire, sometimes it just says client: server firing, and executes authority.

avatar image vivalabugz Jul 12 '17 at 02:17 AM

The first time your "server start fire" is being called is through the client. When it reaches the remote it gets called again, this time through authority which I believe is why it is getting called a second time but through the server

avatar image Tseno Jul 12 '17 at 02:33 AM

You mean in the start fire function? The thing is that sometimes I get this: alt text

and now for some reason its like this, firing from client: alt text

I disconnected it to test it like this: alt text

The blue print string just doesn't go through. I'm also creating a session could that be it? Sigh I just don't get it.

pic1.png (2.4 MB)
pic2.png (116.7 kB)
avatar image vivalabugz Jul 12 '17 at 02:49 AM

Can you upload your project so I can take a look? I've tried to duplicate your issue through the first person shooter template with server and client and its working for me

avatar image Tseno Jul 12 '17 at 02:56 AM

Sure, is there a way I can privately message you? I'd rather not post it here.

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

1 answer: sort voted first

Here is what you can do:

  • copy the blueprints after the print strings in your "start fire" function. Disconnect the nodes (similar to the last image you posted).alt text

  • Create an identical spawnEmitter node except make it run on server. Run the server node to the nodes you previously had in the multicast. alt text

  • Create a new custom event in the event graph that has no replication. You're going to do the line trace in here so paste the code you copied before. Also, probably want to replicate the "wants to fire?" boolean. alt text

  • Now, instead of the multicast spawnEmitters you had, use the server spawnEmitters we just made.You were previously calling the spawns twice. Once locally and once from the server. Now we are doing the line trace locally, sending the information to the server and all connected clients, and spawning the emitters to all clients.alt text

p.s. I also tested with 3 players and it worked as well.

startfire.png (147.6 kB)
newspawnemitt.png (166.0 kB)
linetrace.png (293.8 kB)
spawnemitt.png (156.0 kB)
more ▼

answered Jul 13 '17 at 04:07 PM

avatar image

vivalabugz
729 10 8 13

avatar image Tseno Jul 14 '17 at 06:23 PM

Hey, I came to the same conclusion, you can post this as the answer.

avatar image vivalabugz Jul 18 '17 at 02:29 PM

Hey, don't forget to mark as resolved!

avatar image vivalabugz Jul 14 '17 at 10:13 PM

Glad to help

(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