Announcement

Collapse
No announcement yet.

Is UE4 Dedicated Server Networking Authoritative By Default?

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

    Is UE4 Dedicated Server Networking Authoritative By Default?

    Fairly new to UE4 and have a possibly stupid question regarding UE4’s built in networking. I’m making a multiplayer game that would require the server to validate and approve pretty much all client input and I can’t find out if I need to modify the character movement to be server authoritative or if it already is by default. This link https://docs.unrealengine.com/en-us/...working/Server seems to imply that it’s already built in but googling for other topics leads me to a lot of posts about headaches regarding trying to implement proper server authoritative movement.

    Just trying to figure out the best way to proceed. Thanks.

    #2
    Movement is authoritative by default. Any ue4 movement components will communicate with the server. With custom movements you will have to build that communication. Example: Jump function works as is, but if you want to jump then float, the server will force you back to the floor.

    Comment


      #3
      Ahhh, interesting. So any custom character abilities would need to have that networking created for them. Thanks.

      Follow up sort of unrelated question. I currently have an event in the player state BP that saves the player’s position and current map to an external database every 30 seconds for persistence in the event of a crash/disconnect/etc.

      How would I go about making sure this event is triggered by the server and not the client? I tried adding a Switch Has Authority beforehand and connecting the event nodes to the Authority output, but this breaks the code. I don’t want the client accessing / writing to the database, but rather requesting the server to do so on their behalf.

      Thank you again.

      Comment


        #4
        That's something I haven't dived into yet so I'll need to test to be sure.

        I've had issues with switch has authority as well; I made a messy gaggle of nodes to fix it though. Will try to remember to post it tomorrow.

        Comment


          #5
          Originally posted by alexstachelek View Post
          Ahhh, interesting. So any custom character abilities would need to have that networking created for them. Thanks.

          Follow up sort of unrelated question. I currently have an event in the player state BP that saves the player’s position and current map to an external database every 30 seconds for persistence in the event of a crash/disconnect/etc.

          How would I go about making sure this event is triggered by the server and not the client? I tried adding a Switch Has Authority beforehand and connecting the event nodes to the Authority output, but this breaks the code. I don’t want the client accessing / writing to the database, but rather requesting the server to do so on their behalf.

          Thank you again.
          PlayerState is replicated to clients and thus they have authority over it and the code executes. You might want to reconsider to move the logic to somewhere else like GameMode (which only exists in Authoritative Host).

          Comment


            #6
            Hmmm. I’ll have to look into maybe switching that over later tonight when I can test. I did get it working finally last night. The reason Switch Has Authority was breaking the code is because the position update is called through a BaaS (GameSparks) and the client was the one connected, not the server. So on a client (remote) call it worked and on server (authority) it failed due to not having authorization.

            I solved this by passing the login to GameSparks to the server instead of client and then the position database update works, but now I have a new problem. It seems like the server can only be connected to one GameSparks login credential at a time. Everything works perfectly when I launch server plus one client and login with Tester01. However when I launch a second client and log in with Tester02 it seems to override the old GameSparks server login and then only update positions for Tester02 and not Tester01.

            Comment

            Working...
            X