Announcement

Collapse
No announcement yet.

Multiplayer bugs becoming more prevalent - Harden & Improve Network / Multiplayer Support!

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

    #16
    They can't be because it simply doesn't work that way, the Constructor runs the instant the object is created in memory, not necessarily when it's in the world - and it's far too early to consider it for networking at that point. The actor has to be in-play to have a valid net connection / actor channel. Additionally, as soon as you introduce even a few microseconds of latency - you're entire solution will break. The first thing to understand about MP programming is that it really is entirely different to programming a local-only game.

    The correct way to set this up would be to create a struct of all the variables you feel you have to send immediately, and when the client eventually receives them from the server, they can run an update function which sets those vars accordingly and performs any tasks. You need to write your code in such a way that it can handle any networking situation, whether it be latency, packet loss, packet order etc. UE takes care of the latter two for you mostly. Owner also has to be set from the Server, and if the client has no knowledge about that actor yet, it can't set that up.
    I dont understand the logic behind this. Server, the one who spawn actor, server know the expose on spawn variables in construction script. Then server call the client and Client the one who create replicated copy of the actor, but does not have access/ dosnt know expose on spawn data?

    "Correct" way doesn't work with projectile movement component initial speed.

    Comment


      #17
      This reminds me of a feature request I made: https://forums.unrealengine.com/show...-through-nodes

      What do you guys thing about something like that?
      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


        #18
        Originally posted by Jamendxman3 View Post
        This reminds me of a feature request I made: https://forums.unrealengine.com/show...-through-nodes

        What do you guys thing about something like that?
        I commented on your link but I shall here also just incase. What you want is the Switch Has Authority node

        Comment


          #19
          Originally posted by CriErr View Post
          I dont understand the logic behind this. Server, the one who spawn actor, server know the expose on spawn variables in construction script. Then server call the client and Client the one who create replicated copy of the actor, but does not have access/ dosnt know expose on spawn data?

          "Correct" way doesn't work with projectile movement component initial speed.
          You can Spawn objects and set properties on them straight away, but they won't be set in the construction script because the construction script runs before all of that happens. Think of the construction script as a "I want to create one of these" - that's what it is really, almost like "here's a template - go make one". This is more apparent if you're familiar with C++ or something but it is by design. Blueprint kind of hides that sort of thing away from you a bit.

          IDK, I'm not very good at explaining it

          As always it depends on the situation but, in the case of a projectile, the initial speed is always the same right? Even if not it doesn't matter, since if the projectile is spawned on the server and has it's velocity set in that same frame, the client will also have that same velocity as soon as the object is created, so long as you're replicating movement of course.
          Last edited by TheJamsh; 12-03-2015, 02:56 PM.

          Comment


            #20
            nope, init speed is different, i calculate in on spawn to hit the target here the vid
            And i expose the target location on spawn, turns out i missed to turn in replicate movement, so after init spawn server would fix movement, but the idea is, i cannot use expose on spawn variables over network on client.

            also if you know better way to fire projectile, tell me please

            Comment


              #21
              Oh okay, are you using the Suggest Velocity node or something? It's hard to say without seeing it all to be honest (probably good for another thread anyway). Either way, so long as the Server is calculating everything and sets the velocity as soon as the object is spawned, the client object will follow.

              Comment


                #22
                Originally posted by TheJamsh View Post
                You can Spawn objects and set properties on them straight away, but they won't be set in the construction script because the construction script runs before all of that happens. Think of the construction script as a "I want to create one of these" - that's what it is really, almost like "here's a template - go make one". This is more apparent if you're familiar with C++ or something but it is by design. Blueprint kind of hides that sort of thing away from you a bit.

                IDK, I'm not very good at explaining it

                As always it depends on the situation but, in the case of a projectile, the initial speed is always the same right? Even if not it doesn't matter, since if the projectile is spawned on the server and has it's velocity set in that same frame, the client will also have that same velocity as soon as the object is created, so long as you're replicating movement of course.
                I went through this whole thing with 'what runs in what order'.. because OnPostLogin runs at a point you wouldn't expect it would... anyway, my results/findings are here (a bit down in the thread): https://forums.unrealengine.com/show...ing-on-clients
                Acclivity Game Studios. Making a BP FPS, Tutorial Series on Blog : On Unreal Wiki : Twitch

                Comment


                  #23
                  Originally posted by John Alcatraz View Post
                  DateTime variables are not replicated at all
                  To replicate a DateTime you can create a UStruct that wraps it and make your own serialization, that would do the trick ^^
                  Sr. Engine Programmer @ www.playspace.com - moritzwundke.com
                  Remember: be polite and respect other peoples opinions - Join the Unofficial Unreal Discord Channel - Found a bug? Then use the Bug Report Form to get it fixed ^^

                  Comment


                    #24
                    Originally posted by arbopa View Post
                    I went through this whole thing with 'what runs in what order'.. because OnPostLogin runs at a point you wouldn't expect it would... anyway, my results/findings are here (a bit down in the thread): https://forums.unrealengine.com/show...ing-on-clients
                    BeginPlay() is an interesting one because on the Server, it fires when the Gamemode calls 'StartPlay' - but on Clients (since they don't have a GameMode) - it get's called immediately as soon as a player loads into the world. I'm not sure if that's really a bug or not, but it did catch me out a lot in the beginning. I think doing so allows the actor to receive data from the server, which is essential at the very start of the game for things like it's network role and owner etc, and receiving RPC's.

                    The Construction Script thing is more of a general programming thing than something specific to Unreal. Constructor is always the first thing that runs whenever you create a new instance of an object.

                    Comment


                      #25
                      Awesome thread. Very interesting to know about, since i love to build stuff in multiplayer.

                      The Widget vanishing thing:

                      Is this also happening if you simulate death? Like "Unpossess" then "DestroyActor" on the Pawn and then Respawn it and "Possess" again?
                      Because i'm doing this in my Marketplace Project and the clients have no problem in 4.10 with vanishing widgets.

                      Is there something more to it?

                      SetOwner in Blueprints (and C++?):

                      An important thing for replication on my end is the SetOwner to allow a client to call a RunOnServer on an Actor that he is no owner of.
                      I had a simple setup with a door, an overlap collision and Client/Server. As soon as the Client moved into the Overlap, i filter the OnBeginOverlap
                      for the Server and let the Server set the Owner of the Door to the Client. Which, in my mind, should enable a RunOnServer call for the client.
                      That simply did not work. To "workaround" this, i put the RunOnServer event into the Controller and passed it the door actor to let the Server
                      open it that way.

                      Already asked that a few months ago, but now, since someone mentioned the SetOwner thing, i wanted to make sure that i'm not misunderstanding
                      the SetOwner thing. Did i use it wrong or is it broken if that didn't work?

                      All in all...

                      ... i would also really love to see more stuff happening for Networking. The ShooterGame is a good source, but as you said, fairly old.
                      And networking people are pretty rare. Most of the time i feel like one of the only devs who knows about networking and also shares that knowledge.
                      Open for contracted work | C++/BP (incl. Multiplayer) | Tutoring | VR

                      My UE4 Blog/Page with Tutorials and more: Hit me for ALL the things!
                      (Including 100+ Pages Multiplayer Network Compendium to get you started.)

                      Comment


                        #26
                        Originally posted by eXi View Post
                        Is this also happening if you simulate death? Like "Unpossess" then "DestroyActor" on the Pawn and then Respawn it and "Possess" again?
                        Because i'm doing this in my Marketplace Project and the clients have no problem in 4.10 with vanishing widgets.
                        Not in my case, the vehicles are persistent and remain in the level until they are killed off. The pilot however is spawned when the hop-out of the vehicle, so perhaps there is something to it there. if a player hops out of a vehicle, a new character is spawned for them and they take control of it. If they hop into a vehicle, the character is destroyed. (This is a bit inefficient but was the quickest way to to it instead of pooling them / hiding them out-of-world somewhere).

                        I think that there's a possibility that the widget is destroyed and rebuilt locally before the client properly sets up the new pawn it receives from the server. Mind you, it strikes me as a bit weird that you can't change pawn without having to rebuild the widgets anyway.

                        As for the door thing - In that case I would just check for the overlap event on the Server instead of the Client, since they're both in sync anyway right, and have the Server open the door object. (I may be missing something here though).

                        Comment


                          #27
                          Originally posted by TheJamsh View Post
                          As for the door thing - In that case I would just check for the overlap event on the Server instead of the Client, since they're both in sync anyway right, and have the Server open the door object. (I may be missing something here though).
                          Yeah i forgot to mention that the overlap is only enabling Input and then the real opening happens by key press, which needs to be replicated of course.
                          Sorry wasn't really awake when writing this

                          Well, it sounds really awkward that your widgets disappear. I mean, as long as you don't save them on the Character that you destroy, it shouldn't be affected, should it?
                          Where do you create and save the widget, that it is affected by PlayerController possession?

                          I didn't even know it is, until this thread and i never experienced that :O
                          Open for contracted work | C++/BP (incl. Multiplayer) | Tutoring | VR

                          My UE4 Blog/Page with Tutorials and more: Hit me for ALL the things!
                          (Including 100+ Pages Multiplayer Network Compendium to get you started.)

                          Comment


                            #28
                            Hi TheJamsh,

                            Thanks for the thorough thread! There's some very valuable information in here that I would love to get to the Docs team as we let them know what knowledge gaps exist between docs and community. I'll be doing a pass of info to get for them, and I'll pull from this thread. If there's any particular information missing documentation, please point it out and I can pass it along as well.

                            As for the two bug reports you linked to:

                            The first was closed when we didn't hear back from you. Can you follow up with Rudy and get him what he needs to enter a bug report? I understand you were speaking with Nick Darnell about it, but I don't know for certain if he entered anything. Thanks!

                            The second wasn't in the Bug Reports section, so we missed it. We can't always catch a possible bug if it's not in the right area, unfortunately, as we simply don't have the numbers on our staff. I've moved it over, because it does seem like either a bug or missing functionality to me. I'll get some of our guys to look into it, and they may have some follow up questions for you. Then we can get a bug entered.

                            I don't know when/if a networking pass will come for the engine. I know that the networking devs in particular have all been working hard on the Paragon title, and some of that work may get moved over to our main branch at some point, but it has kept them from being able to focus on the reports we've entered thus far. I'm hoping that once they have more time, they'll be able to address some of these issues. But that will only happen if we continue to report them, so please continue letting us know about the particular issues you run into!

                            Comment


                              #29
                              Hey Ben,

                              All great stuff! If any of the Networking folks have any time to spare (unlikely I know) and they could take a look at this thread and post their own thoughts, that too would be great, It would be good to get a discussion started with them. If they're not on Paragon they're probably on UT

                              Comment


                                #30
                                Another request I'd like to ask for:

                                The ability to debug specific clients when using PIE and Visual Studio. Blueprint allows you to select which world you use for debugging / breakpoints etc. Visual Studio currently doesn't seem to have a way of doing this, and the only workaround I can think of is to package the game, start a session and attach to the client process. This is quite convoluted and difficult, whereas blueprint allows you to easily switch which world you're debugging in realtime.

                                This feature is almost essential for tracking down issues!
                                Last edited by TheJamsh; 12-30-2015, 09:38 PM.

                                Comment

                                Working...
                                X