Announcement

Collapse
No announcement yet.

Online Gaming (Host / Client), Dedicated Server and all the laggs and troubles...

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

    Online Gaming (Host / Client), Dedicated Server and all the laggs and troubles...

    Hey there!

    So me and a friend are working on a multiplayer game, its a fight game where a player can play against another player in 1on1 matches. We plan to make 2on2 matches also.
    The problem is :
    When i create a game and my friend joins the server, its very very laggy. Its not good playable. When i play solo in LAN mode, its lag free and it runs good.
    I have 500MBit Internet with a Download Rate of 63 mb/sec, a Intel i9 core, 32 GB DDR4 Ram and a 1080 Geforce but its still very laggy.

    The whole things runs over Steam. (We need to have Steam running in the background, otherwise the server will not be visible)

    What can we do to make the Game run smooth and lag free?

    Do we really need a Dedicated Server? This makes the whole thing more complicated and today we tried to make it run over SpatialOS but without success. Camera Bugs and other things that didnt want to run over SpatialOS like in the Unreal Editor....

    Also dedicated servers are expensive, the best thing would really be to have it run over steam lag free, but it seams thats not possible?

    Can somebody help?

    Thanks,
    Gazu


    #2
    It could very well be your replication setup. UE4 has bandwidth control to avoid overwhelming the server or clients with information. In my own projects, sending too much data has either led to clients being disconnected, or lag as you describe. Have you looked at optimizing your replication?
    Marketplace Assets

    Advanced Mobile Input: Marketplace Page | Support Thread ――― Easy Input Remapping: Marketplace Page | Support Thread
    Multiplayer Blueprint Chat System: Marketplace Page | Support Thread ――― Closing Credits System: Marketplace Page | Support Thread
    Minesweeper Template: Marketplace Page | Support Thread ――― Maze Creator: Marketplace Page | Support Thread

    Comment


      #3
      That could be one of the problems but then it would also lag when playing over LAN and when testing multiplayer in the editor with multiple editor windows as far as I know. And it runs lag free in both only over the steam net connection it starts to lag. It also seams that the Host runs smoother then the Client.
      Last edited by Gazu; 03-17-2019, 03:14 PM.

      Comment


        #4
        Perhaps, but if Steam is the problem, then bandwidth could still be the cause. I would disable your more network-intensive actors and see if you still have problems with lag when testing over Steam. Since it is a fighting game, it would be very easy to replicate unnecessary variables (Replicating movements that could be simulated on the client instead), and that is the first thing I'd look at. If you haven't already, look at the bandwidth tips in the documentation: http://docs.unrealengine.com/en-US/G...ionPerformance .

        Another thing you should do is test using the network commands that the engine offers, in order to simulate the same environment as you have over Steam: net pktlag ,net pktloss, net pktlagvariance, etc. and see if you are able to reproduce the same lag that you are seeing. https://www.unrealengine.com/en-US/b...based-exploits
        Marketplace Assets

        Advanced Mobile Input: Marketplace Page | Support Thread ――― Easy Input Remapping: Marketplace Page | Support Thread
        Multiplayer Blueprint Chat System: Marketplace Page | Support Thread ――― Closing Credits System: Marketplace Page | Support Thread
        Minesweeper Template: Marketplace Page | Support Thread ――― Maze Creator: Marketplace Page | Support Thread

        Comment


          #5
          What is the framerate on the host? If that's dipping at all, even if the host appears to be fine, it could pose issues. A great example would be something totally unnoticeable to the human eye, like an instantaneous dip in framerate while processing an intense RPC. Odds are, this is not happening (I figure you'd probably have recognized that), but it's worth crossing off the list at the least.

          One thing to take into consideration is that if you are running in a server-authoritative paradigm (which you should be), everything will certainly appear to be laggy. Test in the editor, and as Jamendxman3 mentioned, induce some simulated lag with net pktlag=300 (300 being the round-trip packet time, in milliseconds). In this example, it'll take 150ms for the server to receive the RPC request, x ms to process the RPC, and 150ms for the clients to receive the response and update accordingly. 300ms is an extreme example now days, but still happens. Conducting this test, does it appear to be similar to what you're experiencing? I'd say probably, but only you will know for sure. In a more reasonable example, like 50-100 ms, it's still a very noticeable delay.

          A resolution to this issue is at least a bit daunting. First, you'll need your clients to perform the actions instantly, for themselves only. Then, you'll need to fire the RPC for the server to replicate it. That'll help eliminate the perception of lag, but the lag will still exist. Taking it a step further, you'll need to account for lag when doing hit detection and the like. This is where things get a bit more complicated. In a shooter, for example (giving this example because I've not done anything like this for a fighting game, apologies) this means when you fire off a line trace from a player's firearm, you check where a player was x milliseconds ago, where x is their single-trip latency.

          This may be totally irrelevant to your scenario, and if so I do apologize. I just figured it'd be worth at least crossing off the list. I'm sure you're aware of a lot of this, but like to explain everything in a little more detail due to future searchers, and like to make no assumptions, in order to be as thorough as possible. I hope it doesn't come across as demeaning -- I apologize if so.
          Last edited by One Mode Only; 03-18-2019, 12:28 PM.

          Comment


            #6
            I'm skeptical that it's really a bad server/multicast event setup issue rather than a rpc setup or latency issue.
            could we get a snapshot of one of your events, like say throw a punch event?

            Comment


              #7
              Hey Guys,
              thanks for your help.

              My coder is busy at the moment.
              Will answer you very soon.

              Thanks again!

              Comment


                #8
                Hello people I'm the coder of this project,

                So after looking again at the multiplayer code I was able to optimise it a bit, the way I had some values setted up was a bit to network traffic heavy.
                Now. It works way smoother then before.
                But still there are some lag issues in there.

                For the way the attacking works:

                We get the direction the Gamepad thumbstick is at and then aplly. An index to that position.
                Then when the attack button is pressed we check the index through a gate on event tick.

                Then when the index isn't 0(aka idle position) we fire an event that plays the according animation for that index. Happens through a swicth has athtority that fires either a server event that calls the multicast event or directly firing the multicast when the owner is auhtoritive.

                That's basically it for the attacking, hit detection runs through overlap. Events that basically work the same way authoritve wise.

                A picture will follow shortly

                Hope anyone can help though or has any tips on how to find bottlenecks / lag causers properly and more easily inside the character

                Best regards

                Luis
                ​​
                Last edited by Luis_Schmitz; 03-29-2019, 12:27 PM.

                Comment


                  #9
                  Ok Guys,
                  my Coder said this 3 pictures could be relevant for that.
                  https://imgur.com/a/WEgfHu1

                  What do you think?

                  Thank you Guys!

                  Comment


                    #10
                    If you while running the game type
                    Code:
                    Stat Net
                    in the console and look for saturation it will give you an indication if the problem is bandwidth related.

                    By default the listen server LAN MaxClientRate is set to 15000 while the MaxInternetClientRate is just 10000. You can modify this in DefaultEngine.ini
                    Code:
                    [/Script/OnlineSubsystemUtils.IpNetDriver]
                    MaxClientRate=15000
                    MaxInternetClientRate=10000
                    Some things to keep in mind is that every time you make a RPC reliable you have to be extra careful how much data is being sent. Things that are sent frequently should not be sent reliably as it will easily flood the network with limited ways of recovering. RPC's with many unnecessary parameters should also be avoided. Try only to send the important Parameters when they are changed. This is what replicated variables are good for unlike RPC parameters that are forced to send the variable even if nothing changed.

                    Comment


                      #11
                      Thanks Garner,
                      we will take a look at that.

                      Comment


                        #12
                        You're welcome. I forgot to mention that besides
                        Code:
                        [/Script/OnlineSubsystemUtils.IpNetDriver]
                        MaxClientRate=15000
                        MaxInternetClientRate=10000
                        You also want to tweak
                        Code:
                        [/Script/Engine.Player]
                        ConfiguredInternetSpeed=10000
                        ConfiguredLanSpeed=20000
                        MaxInternetClientRate is the cap set by the server while ConfiguredInternetSpeed is the limit the client set on itself. The lowest value is the one that is being used.

                        Comment


                          #13
                          Thanks garner I tried it using that and I think it improved the Gameplay quite a bit.
                          I also made sure only the relevant variables are replicated. Thanks again.

                          Comment

                          Working...
                          X