# Pull Request - World Origin Shifting in MP

**URL:** <https://forums.unrealengine.com/t/pull-request-world-origin-shifting-in-mp/62649>\
**Category:** Game Development\
**Tags:** unreal-engine\
**Created:** [May 1, 2016, 3:29pm UTC](https://forums.unrealengine.com/t/pull-request-world-origin-shifting-in-mp/62649 "2016-05-01T15:29:56Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![nkey](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@nkey](https://forums.unrealengine.com/u/nkey)\
**Post date:** [May 1, 2016, 3:29pm UTC](https://forums.unrealengine.com/t/pull-request-world-origin-shifting-in-mp/62649/1 "2016-05-01T15:29:56Z")

</div>

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/UnrealEngine/tree/mp\_origin\_shift](https://github.com/michail-nikolaev/UnrealEngine/tree/mp_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.

[https://www.youtube.com/watch?v=YCx-8Gioii0](https://www.youtube.com/watch?v=YCx-8Gioii0)

You could get test project [here](https://drive.google.com/file/d/0B08jTAtYhBTyb2VDcnBDdEdEb0k/view?usp=sharing).  
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):

 ![](https://d3kjluh73b9h9o.cloudfront.net/original/4X/a/e/c/aec2660366dc04e8eb489843df6980958e02fcc5.png)

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](https://forums.unrealengine.com/showthread.php?64536-Feature-Request-Big-world-support-for-Multiplayer-Games)  
**UPD2** : Looks like everything is now supported, going to prepare pull request.  
**UPD3** : Branch ready [https://github.com/EpicGames/UnrealEngine/compare/release...michail-nikolaev:mp\_origin\_shift](https://github.com/EpicGames/UnrealEngine/compare/release...michail-nikolaev:mp_origin_shift)  
**UPD4** : Pull Request is submitted: [https://github.com/EpicGames/UnrealEngine/pull/2359](https://github.com/EpicGames/UnrealEngine/pull/2359)  
**UPD5** : Pull Request is updated according to EPIC review: [https://github.com/EpicGames/UnrealEngine/pull/2359](https://github.com/EpicGames/UnrealEngine/pull/2359)  
**UPD6** : MERGED!

---

<div class="post-metadata">

**Author:** ![Kris](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/kris/32/758129_2.png) [@Kris](https://forums.unrealengine.com/u/Kris)\
**Post date:** [May 1, 2016, 11:08pm UTC](https://forums.unrealengine.com/t/pull-request-world-origin-shifting-in-mp/62649/3 "2016-05-01T23:08:51Z")

</div>

Judging by the UE4 Roadmap, Epic may already have something in the works:  
https://trello.com/c/M4LgGSUW.html

Not sure the status of this system, just that it may exist and conflict with yours.  
May need Epic to chime in here.

---

<div class="post-metadata">

**Author:** ![nkey](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@nkey](https://forums.unrealengine.com/u/nkey)\
**Post date:** [May 2, 2016, 12:09am UTC](https://forums.unrealengine.com/t/pull-request-world-origin-shifting-in-mp/62649/4 "2016-05-02T00:09:38Z")

</div>

> [@Kris;522896](#):
>
> Judging by the UE4 Roadmap, Epic may already have something in the works:  
> [Trello](https://trello.com/c/M4LgGSUW/118-large-world-coordinate-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…

---

<div class="post-metadata">

**Author:** ![Mr\_SquarePeg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Mr\_SquarePeg](https://forums.unrealengine.com/u/Mr_SquarePeg)\
**Post date:** [May 2, 2016, 10:20am UTC](https://forums.unrealengine.com/t/pull-request-world-origin-shifting-in-mp/62649/5 "2016-05-02T10:20:13Z")

</div>

When you do a Pull request - I will give you my support 🙂

---

<div class="post-metadata">

**Author:** ![Hevedy](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Hevedy](https://forums.unrealengine.com/u/Hevedy)\
**Post date:** [May 2, 2016, 10:29am UTC](https://forums.unrealengine.com/t/pull-request-world-origin-shifting-in-mp/62649/6 "2016-05-02T10:29:33Z")

</div>

This is interesting, nice work!  
This are the kind of things we need.

---

<div class="post-metadata">

**Author:** ![nkey](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@nkey](https://forums.unrealengine.com/u/nkey)\
**Post date:** [May 2, 2016, 7:12pm UTC](https://forums.unrealengine.com/t/pull-request-world-origin-shifting-in-mp/62649/7 "2016-05-02T19:12:58Z")

</div>

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

[![](https://cdn.discordapp.com/attachments/173884795221311497/176772300400623617/unknown.png) ](https://cdn.discordapp.com/attachments/173884795221311497/176772300400623617/unknown.png)

---

<div class="post-metadata">

**Author:** ![BinarySword](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/binarysword/32/472675_2.png) [@BinarySword](https://forums.unrealengine.com/u/BinarySword)\
**Post date:** [May 3, 2016, 9:40am UTC](https://forums.unrealengine.com/t/pull-request-world-origin-shifting-in-mp/62649/8 "2016-05-03T09:40:45Z")

</div>

Looks great! Will test out later

[![](https://wallpapers.com/images/high/derp-yellow-doge-meme-u8u0j56n009i57sm.jpg) ](https://wallpapers.com/images/high/derp-yellow-doge-meme-u8u0j56n009i57sm.jpg)

---

<div class="post-metadata">

**Author:** ![FilipBasara](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/filipbasara/32/947130_2.png) [@FilipBasara](https://forums.unrealengine.com/u/FilipBasara)\
**Post date:** [May 3, 2016, 10:53am UTC](https://forums.unrealengine.com/t/pull-request-world-origin-shifting-in-mp/62649/9 "2016-05-03T10:53:54Z")

</div>

Keep it up nkey. Great work!

---

<div class="post-metadata">

**Author:** ![n00854180t](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@n00854180t](https://forums.unrealengine.com/u/n00854180t)\
**Post date:** [May 3, 2016, 6:02pm UTC](https://forums.unrealengine.com/t/pull-request-world-origin-shifting-in-mp/62649/10 "2016-05-03T18:02:48Z")

</div>

Awesome work @nkey.

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!

---

<div class="post-metadata">

**Author:** ![jonimake](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@jonimake](https://forums.unrealengine.com/u/jonimake)\
**Post date:** [May 3, 2016, 6:43pm UTC](https://forums.unrealengine.com/t/pull-request-world-origin-shifting-in-mp/62649/11 "2016-05-03T18:43:40Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![nkey](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@nkey](https://forums.unrealengine.com/u/nkey)\
**Post date:** [May 3, 2016, 8:28pm UTC](https://forums.unrealengine.com/t/pull-request-world-origin-shifting-in-mp/62649/12 "2016-05-03T20:28:17Z")

</div>

> [@n00854180t;523961](#):
>
> Awesome work @nkey.
> 
> 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.

---

<div class="post-metadata">

**Author:** ![ioFlow\_Studios](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/ioflow_studios/32/1194555_2.png) [@ioFlow\_Studios](https://forums.unrealengine.com/u/ioFlow_Studios)\
**Post date:** [May 3, 2016, 11:51pm UTC](https://forums.unrealengine.com/t/pull-request-world-origin-shifting-in-mp/62649/13 "2016-05-03T23:51:10Z")

</div>

![eab.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/3X/c/0/c09c59c1324123050402820cbaba55a85d764890.jpeg)  
(of course)

---

<div class="post-metadata">

**Author:** ![nkey](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@nkey](https://forums.unrealengine.com/u/nkey)\
**Post date:** [May 4, 2016, 11:47pm UTC](https://forums.unrealengine.com/t/pull-request-world-origin-shifting-in-mp/62649/14 "2016-05-04T23:47:05Z")

</div>

Branch seems to be ready now: [https://github.com/EpicGames/UnrealEngine/compare/release...michail-nikolaev:mp\_origin\_shift](https://github.com/EpicGames/UnrealEngine/compare/release...michail-nikolaev:mp_origin_shift)

---

<div class="post-metadata">

**Author:** ![Mr\_SquarePeg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Mr\_SquarePeg](https://forums.unrealengine.com/u/Mr_SquarePeg)\
**Post date:** [May 5, 2016, 12:58am UTC](https://forums.unrealengine.com/t/pull-request-world-origin-shifting-in-mp/62649/15 "2016-05-05T00:58:33Z")

</div>

@nkey - Let me know when you make the pull request 🙂

---

<div class="post-metadata">

**Author:** ![Kris](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/kris/32/758129_2.png) [@Kris](https://forums.unrealengine.com/u/Kris)\
**Post date:** [May 5, 2016, 10:49am UTC](https://forums.unrealengine.com/t/pull-request-world-origin-shifting-in-mp/62649/16 "2016-05-05T10:49:07Z")

</div>

> [@Kris;522896](#):
>
> Judging by the UE4 Roadmap, Epic may already have something in the works:  
> [Trello](https://trello.com/c/M4LgGSUW/118-large-world-coordinate-system)
> 
> Not sure the status of this system, just that it may exist and conflict with yours.  
> May need Epic to chime in here.

@nkey - True.  
Ditto on mirrored animation support 😛

Ok, sp I have no use for the feature in current project, but I’m more then happy to support the feature, as it is useful to others.  
Please let me know when and what to do when the times comes.  
Cheers.

![](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/e/3/ee32da5a4519fc5debbc707116264b61140940b1.gif)

---

<div class="post-metadata">

**Author:** ![nkey](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@nkey](https://forums.unrealengine.com/u/nkey)\
**Post date:** [May 5, 2016, 10:25pm UTC](https://forums.unrealengine.com/t/pull-request-world-origin-shifting-in-mp/62649/17 "2016-05-05T22:25:02Z")

</div>

@Kris, @HeadClot, [MENTION=887]ioFlow Studios[/MENTION], @jonimake, @n00854180t, @Mitsu, @benjamin.smith, @Hevedy, @franktech

Pull Request is submitted: [https://github.com/EpicGames/UnrealEngine/pull/2359](https://github.com/EpicGames/UnrealEngine/pull/2359)

---

<div class="post-metadata">

**Author:** ![Rhynedahll](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Rhynedahll](https://forums.unrealengine.com/u/Rhynedahll)\
**Post date:** [May 5, 2016, 10:42pm UTC](https://forums.unrealengine.com/t/pull-request-world-origin-shifting-in-mp/62649/19 "2016-05-05T22:42:41Z")

</div>

> [@franktech;525250](#):
>
> 404 Dead link for anyone else?

UnrealEngine on GitHub is private.

You have to be signed in to GitHub to see that page.

---

<div class="post-metadata">

**Author:** ![n00854180t](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@n00854180t](https://forums.unrealengine.com/u/n00854180t)\
**Post date:** [May 5, 2016, 10:48pm UTC](https://forums.unrealengine.com/t/pull-request-world-origin-shifting-in-mp/62649/20 "2016-05-05T22:48:31Z")

</div>

Added my support to the Github comments 🙂

---

<div class="post-metadata">

**Author:** ![Mr\_SquarePeg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Mr\_SquarePeg](https://forums.unrealengine.com/u/Mr_SquarePeg)\
**Post date:** [May 6, 2016, 12:21am UTC](https://forums.unrealengine.com/t/pull-request-world-origin-shifting-in-mp/62649/21 "2016-05-06T00:21:44Z")

</div>

@nkey - I am doing my part 🙂

> <https://twitter.com/HeadClot88/status/728377221891526656>

---

<div class="post-metadata">

**Author:** ![JmDevTx](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@JmDevTx](https://forums.unrealengine.com/u/JmDevTx)\
**Post date:** [May 6, 2016, 12:30am UTC](https://forums.unrealengine.com/t/pull-request-world-origin-shifting-in-mp/62649/22 "2016-05-06T00:30:34Z")

</div>

> [@franktech;525250](#):
>
> 404 Dead link for anyone else?

You must A. Be signed into GitHub, and B. Link your GitHub account with your Epic account (Account settings).

Regarding the PR, I would love to see this in 4.12 😛

[Next page](https://forums.unrealengine.com/t/pull-request-world-origin-shifting-in-mp/62649.md?page=2)
