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"

Server OnLanded to client

I have two players: Server and Client. I want to know from the client side if server has landed or not. So I used Event OnLanded and replicated variable but this method doesn't work for me. Is there a way to have client know when server has done Event OnLanded?

Product Version: UE 4.15
Tags:
more ▼

asked Apr 03 '17 at 04:02 PM in Blueprint Scripting

avatar image

kuboxus
10 1 5 8

avatar image Xelj Apr 03 '17 at 06:42 PM

Try this: alt text

1.jpg (314.5 kB)
avatar image kuboxus Apr 03 '17 at 07:15 PM

I've already tried it and it looked like this: alt text So theoretically when I jumped and landed on server, then switched to client and pressed X I should have seen "Client1: true" but instead there was "false".

landed.png (97.4 kB)
avatar image Jason.J Apr 05 '17 at 07:03 PM

A. Did you do a "break" at the server's "On Landed" event in the Editor to confirm it's actually getting called.

B. Why not Just have the "Landed" variable set to Replicate with Notify? Then, on the client, have the "OnRepl_Landed" event do the Print String.

That may work out a bit better for you, but both approaches will be moot if the "On Landed" event isn't even happening.

avatar image kuboxus Apr 05 '17 at 08:21 PM

Method with RepNotify works for Printing String but I want to make something more complex. This is my double jump (and a part of dash). alt text And what I want to do is to make server jump whenever server or client presses space. I tried to have custom event been called from RepNotify, but it does not work. For now it looks like that: server can double jump and "Used Dash" is being set to 0, and on the client side: You can jump twice (or single double jump), but "Do N" does not reset nor "Used Dash".

jump.png (154.6 kB)
avatar image Jason.J Apr 05 '17 at 10:46 PM

okay.... what you just described differs greatly from the original question. I understand that you don't want to share/show/give away any more IP than absolutely necessary, but you're talking about Landed, Dash, and now Double Jumps.

Give us a hand and go through the concept from A-Z of what you're trying to accomplish, and exactly what part is hindering your progress. Because this started out with just clients being aware of when the (or a) character lands on the server side.

Also... What exactly is the role of the Server? Is this a Dedicated server, or a user hosted game session? There are big differences between the two, and how you go about implementing your logic. For example, it matters greatly in deciding what information should ONLY be handled Server side, and what information is okay to be handled client side.

avatar image kuboxus Apr 06 '17 at 04:55 AM

I'm very sorry for the confussion.

The thing that I want to accomplish is to make server's charcter jump whenever server or client presses space. The problem is that client himself is stuck to the ground so he cannot jump and then land. And if he is not landing "Do N" does not get reset and with that "Used Dash" (which is for another event, it just have to be reseted here).

So, summaring, client has to know when server's character has landed because client's character never lands. When landing happens "Do N" and "Used Dash" need to be reseted.

avatar image Jason.J Apr 06 '17 at 12:34 PM

"whenever server or client presses space"

This is what confuses me the most... On a Dedicated server, no one would ever press "space" because no one is playing on the Server.

The scenario would be different if you're talking about a multiplayer in which one of the players would be hosting their own game session. In this situation, the Hosting player is the server player.

How you would handle Server/Client Logic is a bit different depending on which scenario you're using.

But one (of many options) would be to have your "Do N" and "Used Dash" variables to be Replicated. Switch your "Landed" variable from "RepNotify" to "Replicated" as well. Unless you need the clients to do something on their side when these variables change

When the server event "On Landed" fires, you set the 3 variables as you see fit. Which will replicate their values down to the client.

This now brings you to another problem... Because Replicated variables can only be SET by the SERVER. So how do you do that? Simple.... You make a Custom Event in whatever Blueprint you're working in. Set the replication property for that event to be "Run On Server". Make inputs for the values you need and Set the variables according to the input recieved.

Now, whenever something on the client side needs to set those variables, it calls the appropriate Server event you created above, and passes the desired value.

But I'm still unclear about the Server/Client Relationship you're referring too.. In my mind, we're talking about one player, who has the client player they're working with, and a Server version of their player which is on a dedicated server.

If you're doing a Player Hosted Session, then what you're calling Server/Client players are actually two totally different characters, and you're needing to replicate what each other is doing; which would be a completely different solution than what I proposed above.

avatar image kuboxus Apr 06 '17 at 01:27 PM

Again sorry.

I was thinking about Player Hosted Session (not Dedicated), where the Host's character's jump can be controlled by Host himself or another Player that joined the session.

avatar image Jason.J Apr 06 '17 at 01:31 PM

So you're looking for the possibility of two different players being able to control the same character on screen?

avatar image kuboxus Apr 06 '17 at 01:47 PM

Yes, but not on the same computer, I'm using Steam Online Subsystem.

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

1 answer: sort voted first

I use the "switch has authority" to test before playing my landed effects

You do not need to replicate this message to your client as it executes on both client and server by default

Is your game client/server? because you will still want it to happen for the authority if it is NOT a dedicated server as well

more ▼

answered Apr 12 '17 at 09:00 PM

avatar image

BPANDREW
995 22 27 125

avatar image kuboxus Apr 18 '17 at 01:02 PM

One of the players is hosting the server and others are joining it. All the clients have to know when server's character lands.

avatar image BPANDREW Apr 25 '17 at 01:54 PM

the switch has authority also has a 'remote' path - that path will execute on your clients

avatar image BPANDREW Apr 25 '17 at 01:55 PM

i guess you could also isolate the is authority and have it blast out a multicast with guaranteed delivery as well - which is what I think you are currently doing - this stuff is really hard to isolate especially when you want it to work single, dedicated and peer host - i recommend using print strings, it thankfully tags if it is executing on client/server

(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