Announcement

Collapse
No announcement yet.

Pull Request - World Origin Shifting in MP

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

  • [PLUGIN] Pull Request - World Origin Shifting in MP

    Merged.

    Hello everyone.

    Probably everyone knows about floating point precision issues with big worlds in UE4. Sometimes some jitter (anims, camera) starts to appear only 2-4 km from origin (especially noticeable in first person games).
    Since UE4 uses single point precision - only possible way to fix it is using world origin shifting. But it not works in multiplayer at the moment.

    So, I am working on PR to Epic with support for origin shifting in multiplayer. Goal is to make it able to transparently use independent origins in each client/server.

    Basic idea is simple as a stone: lets include sender's origin value each time client/server going to replicate coordinates over network. In such a case receiver is able to resolve received location/origin on local origin value and work as usual.
    But sending origin with every coordinate could cause some additional bandwidth usage. In order to avoid it - sender tries to resolve location/origin to zero origin before transmitting (if origin value is not too high - to avoid precision issues). With such trick it is possible send zero origin value as single bit flag (OriginIsZero).

    Yes, in case of really big differences in client/sender origins it still could cause some some issues for server-driven physics. But in most of cases (animations, IK, client physics, tracing, camera location, particles) it works like a charm.

    It was required to find every place where engine replicates coordinates and apply such logic there. You could get branch here - https://github.com/michail-nikolaev/...p_origin_shift . I hope you able to access if you have access to Epics UE4 repo.

    Currently everything is ready for about 90%.
    Supported things: actor spawn, physics, character movement, pawn movement, remote proxy movement, root motion, object-based movement, blueprints functions, network relevancy, etc. Need to finish matinee data replication (what hell is it? )

    This is example how it works so far. Red sphere - is location of origin on each client/server. Number on top of the character - distance to world origin.


    You could get test project here.
    Keys: P - put origin to player location, Q, E, Z - spawn different types of object, T - teleport to distanced location, R - play root motion.

    Most of the things work out of the box, but one thing you need to keep in mind: if you manually sending coordinates over network (as Vector) - engine have no idea about its semantic. So, you need to use some functions provided but it is pretty simple.
    It is looks like this (converter for Vector and OriginBasedPosition):

    OriginBasedPosition structure uses OriginIsZero flag optimisation out of the box.

    So, I will happy if you could to try this branch (based on 4.11) on your project to test how it works (don't forget about manual coordinate sending!). Especially interested in world composition tests.

    Thanks a lot.

    UPD: Official feature request ID: UE-13079
    UPD2: Looks like everything is now supported, going to prepare pull request.
    UPD3: Branch ready https://github.com/EpicGames/UnrealE...p_origin_shift
    UPD4: Pull Request is submitted: https://github.com/EpicGames/UnrealEngine/pull/2359
    UPD5: Pull Request is updated according to EPIC review: https://github.com/EpicGames/UnrealEngine/pull/2359
    UPD6: MERGED!
    Last edited by nkey; 10-06-2016, 11:40 AM.
    Pull Request - UE-13079: World Origin Shifting for Multiplayer. Make Arma Not War - TFAR.

  • #2
    Kudos!

    We cant have features like this soon enough....

    Comment


    • #3
      Judging by the UE4 Roadmap, Epic may already have something in the works:
      https://trello.com/c/M4LgGSUW/118-la...rdinate-system

      Not sure the status of this system, just that it may exist and conflict with yours.
      May need Epic to chime in here.
      Rule#21: Be polite, be professional, but have a plan to kill everyone you meet.

      Comment


      • #4
        Originally posted by Kris View Post
        Judging by the UE4 Roadmap, Epic may already have something in the works:
        https://trello.com/c/M4LgGSUW/118-la...rdinate-system

        Not sure the status of this system, just that it may exist and conflict with yours.
        May need Epic to chime in here.
        Yep, but card in Wishlist/Backlog for 2 years...
        Pull Request - UE-13079: World Origin Shifting for Multiplayer. Make Arma Not War - TFAR.

        Comment


        • #5
          When you do a Pull request - I will give you my support

          Comment


          • #6
            This is interesting, nice work!
            This are the kind of things we need.
            Hevedy - Image Tools: https://hevedy.itch.io/imagetools

            Comment


            • #7
              Did some tests, works fine with level streaming + world origin rebasing in MP (but dedicated server required to load all levels)

              Pull Request - UE-13079: World Origin Shifting for Multiplayer. Make Arma Not War - TFAR.

              Comment


              • #8
                Looks great! Will test out later

                Regards,
                Benjamin D. Smith

                Founder & CEO | Binary Sword Pty Ltd
                Currently working on: ODIN Tracker (UE4 Plugin)

                Comment


                • #9
                  Keep it up nkey. Great work!

                  Comment


                  • #10
                    Awesome work [MENTION=27059]nkey[/MENTION].

                    When you say the server has to load all maps - does it need to load *all* the maps, or just all the maps that clients have loaded? The latter would probably be a decent optimization.

                    And if you want to get really deep into this, if you could make it so that separate servers can host the individual levels, that would be insanely good/useful!
                    Storyteller - An immersive VR audiobook player

                    Dungeon Survival - WIP First person dungeon crawler with a focus on survival and environmental gameplay ala roguelikes

                    Comment


                    • #11
                      This is awesome. I had been wishing this from Epic some months ago. I really hope this will get integrated into the main line.

                      Comment


                      • #12
                        Originally posted by n00854180t View Post
                        Awesome work [MENTION=27059]nkey[/MENTION].

                        When you say the server has to load all maps - does it need to load *all* the maps, or just all the maps that clients have loaded? The latter would probably be a decent optimization.

                        And if you want to get really deep into this, if you could make it so that separate servers can host the individual levels, that would be insanely good/useful!
                        Currently dedicates server loads all maps (even client is not on it) - it is logic in current main line.
                        Regarding separate servers - currently it is out of scope.
                        Pull Request - UE-13079: World Origin Shifting for Multiplayer. Make Arma Not War - TFAR.

                        Comment


                        • #13
                          Click image for larger version

Name:	eab.jpg
Views:	1
Size:	38.0 KB
ID:	1105899
                          (of course)

                          Comment


                          • #14
                            Branch seems to be ready now: https://github.com/EpicGames/UnrealE...p_origin_shift
                            Pull Request - UE-13079: World Origin Shifting for Multiplayer. Make Arma Not War - TFAR.

                            Comment


                            • #15
                              [MENTION=27059]nkey[/MENTION] - Let me know when you make the pull request

                              Comment

                              Working...
                              X