Stamina - Mulitplaer
Hello, Iv'e been trying to create a stamina bar ( with no dedicated server and 1 player). and the stamina doesn't working when running... and the editor giving me the following errors: and here is the character BP:
here is the widget BP:
and here is a video about what happening when using dedicated server and not using dedicated server:
thanks for help.
asked Jul 07 '17 at 08:43 AM in Blueprint Scripting
Yeah, you need modify walking speed on client and on Server too. Currentky you modify only on client when sprint presses ;) This will modify the max speed on client and client try run faster but on server you have old max speed, so server will restrict that speed to old value. This is why you see flickering ;)
answered Jul 07 '17 at 11:01 AM
Some networking teach here ;)
No matter if you using dedicated server or just play with two player without dedicated server (in this case we talkig hosted/listen server) in every solution always will be one authorative server.
In dedicated mode is the server itself In listen server mode is the first client.
Two main problem you did.
First: Dedicated servers will not have any render data, so when you play in dedicated server mode you need to create your widget only on client (has authority node).
Second: You creating widget in BEGIN PLAY! begin play will be executed in every client and server.
What that means?
If you play with two player (no matter if dedicated or not, multiplayer ;) ), two begin event will be called on server because there is two live character are present.
On Client 1 again two begin play will be executed, because one for owned pawn and one for simulated character (other player) On Client 2 again two begin play will.be executed, because owned and simulated pawn ;)
Basically pawns are exist in every client and after spawn engine will call begin play event, but because simulated pawns (other players) do not have player controller (because only local player have their player controller) engine cant create widget and add to viewport :)
You can simply fix this with IsLocalPlayer node after you fixed server bug what i told you before..
So concept is this. Put HasAuthority node after begin play, on remote branch check IsLocalPlayer and if true add widget ;)
answered Jul 07 '17 at 08:59 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here