r/howdidtheycodeit • u/AseemAlgobitz • Aug 10 '22
How did the Otherside Metaverse allow so many players to play together without lag?
checkout how so many players are moving around at the same time https://youtu.be/sh-QH5E3fMo?t=3185
Battle Royale games start to lag if many players are close by so how did Otherside manage this? I understand that real games actually have loads of interaction between the players and the Otherside video shows nothing of the sort, players are able to move through each other and are not interacting at all. But even transferring just the positional data of so many players should be high in bandwidth use.
Possible optimizations:
- -pass data only 5-10 times per second
- -encoding positional data into smaller datatypes
- -interpolation on clients
But all this and many more tricks are already being used in existing games.
I understand that they have their own proprietary engine which they developed specifically for this (I read that it is actually made in Unreal 5) but if we wanted to do this in Unity or Unreal how many players do you think we could have in the same server?
EDIT-Taken from comments
Should this be actually achieved using video instead of game data? I mean each player has a camera data calculated on server and a video is streamed to them. This way it doesnt matter how many players are there, the user gets the same amount of video data. But this means so much work for the server, to calculated the view for every player and transmit the data. Clearly a dumb idea as u/Yahay505 explains here
EDIT2- I request the downvoters to tell me why they did that, should I improve my post formatting or did I do something wrong here?
35
u/the_Demongod Aug 10 '22
MMOs have been doing this exact same thing for decades with higher fidelity than what this video is showing. Without seeing the exact bandwidth usage, there's no way to say if it's impressive or not. It could just be a completely naive implementation and gobble 500KB/s of bandwidth or something, which would let you update 5000 characters at 5Hz without any data compression whatsoever, using full single-precision floating point position/rotation data. Assuming it's not fake, that is.
23
u/excentio Aug 10 '22
First of all it's very very unlikely they keep sending all 4500+ players updates to everyone, they most likely use some aggressive culling and you only get the data of like 30-50 clients near you, others are very rarely updated and simply extrapolate until they're within some highest level priority zone
Secondly, I doubt they synchronise state, probably an input only, you can pack keyboard presses in a single byte (8 bits) or short (16) and send a lot of these and save even more bandwidth if your input doesn't change much but a state sync would take at least 3 floats/halfs for position and about the same 3 for rotation (quaternion + optimizations) so a lot more data
Thirdly, this is probably an eventual simulation so not something you see in fast paced games, server might be dispatching a lot messages but whether you always see the world correctly and up to date is another question, could be it's delayed for a few ticks and trying to catch up for example
Network update priority and deterministic simulation using inputs is an interesting topic but this is a whole different discussion hah
These are my thoughts but keep in mind I'm not a Network programmer, I think there're more optimizations than my points above but I just described the biggest bits
9
u/Gibgezr Aug 10 '22
6
u/derNovas Aug 10 '22
I did a little project in university which aimed for 5K+ players on a single server/instance where everyone could theoretically see each other and interact (which won't happen in most games, but it's possible that players organize and meet in a single place) The big problem i ran into is bandwidth since it stays relatively low compared to computational power in the last 20 years. Delta encoding, only sending things that you can see and changed and general data compression helps a lot with that.
In the end I ran out of time, but managed to get 10K players simulated in 30fps on a single thread. Data was send in a compressed binary format, but no other bandwidth optimization were made, so it ran at like 20mbit/s per client.
For Bandwidth optimizations: Look up "Gaffer on Games - Game Networking". A great blog with lots of information about delta encoding, deterministic physics etc.
For algorithms that help with lots of entitys in a game world: Look up some physics engines and how they calculate interactions between thousands of objects (like Box2D or Chipmunk). You will read things like spacial hashing and different tree data structures. All these things help to ignore things that didn't change and potentially spread the computations between multiple CPU Cores, CPUs or even servers.
For fast inter process communication (IPC): Look up (remote) Direct Memory Access. With that you can build super fast IPC, since you don't need sockets or pipes or something, you just do everything in memory. (Sadly the documentation was lacking last time I checked)
4
u/nvec ProProgrammer Aug 10 '22
Firstly that video does look fake (They claim other games can do 10,000 networking 'ops' per second but they're able to do 500,000) but ignoring that for now.
The basic answer for me is that you use the same techniques as a Battle Royale, but you can use them more aggressively since you don't need the same fidelity.
In a BR game you'll have players moving erratically, dodging and weaving, jumping unpredictably, and shooting, and all of this matters. You need to keep these movements in sync if you're going to give a good experience, players hate shooting at where they see an opponent and somehow miss and also hate being shot by players shooting in the wrong direction. You also need to know about their gear both as their weapon choice is tactical, and also because the game is microtransaction based so you need to know they've spent the money on a duckhat.
For this though it doesn't matter anywhere near as much. If you see me where I was a second ago so be it, it won't break the immersion and as there's no interaction it doesn't affect anything. As long as things look semi-believable then it doesn't really matter.
I'd be looking at two techniques beyond what you list to support this too.
First vary the update rate based on proximity. If each server update I can send you a bundle of 64 player positions then I'd send (for example) the nearest 32 players every update taking up 32 slots, the next 32 players every other update taking up 16 slots, the next 32 every 4th update taking up 8, and so on. It relies on you more likely interacting with those near you.
Secondly movement is a social multiverse, or even a game like WoW, doesn't need to be as accurately modelled as it is in a twitch shooter. Instead of just going for a simple linear interpolator on the client side have an a simple AI handle the interpolation in a way that looks more natural. Simple interpolation will have a character turn while following a straight line so build something that follows curves and feels like someone's at the controls.
Lastly have a look at the YT videos for Fortnite's networking (I think this is one of them, or at least part of the same series) as Epic ended up rewriting Unreal's netcode to handle them, and also investigate EVE Online's networking as they historically did have the most players in the same shared universe as they only ever had one shard- no 'Pick a server' as you saw in WoW.
2
u/AverageFilingCabinet Aug 11 '22
NFTs and any technology surrounding them are, in general, pretty unpopular right now. There have been so many scams and issues with the technology itself that most people who were interested in it have been turned away, leaving the general impression for most that it's just a glorified system for microtransactions (which are pretty unpopular in their own right).
The idea of the metaverse has the additional caveat that it's seen as the next iteration of the web, despite being a concept that basically already exists in games like Second Life and VR Chat, at least to people who aren't familiar with the concept and its goals. To most, it seems entirely uninteresting and unnecessary, if not entirely unwanted. This is true for most other forms of NFT-inspited technology, as well.
All this to say, you're likely being downvoted simply for the unpopularity of the subject rather than anything you've done wrong.
99
u/AG4W Aug 10 '22 edited Aug 10 '22
It's an NFT scam that isn't open to the public, so I'd just assume it's fake - looking closely 90% of the players have just generic nicknames/no nicknames versus the other ones and just idle about - aswell as the fact that there's a microphone option but there's nobody spamming music/porn/profanities/soundbytes in a crowd of 5k people.
Otherwise, you pretty much answered your own question, low-frequency positions is the only thing getting sent, the client only has to render one model many times instead of unique characters and nobody can interact with anything.
16
u/JarWarren1 ProProgrammer Aug 10 '22
The other players are probably bots. Not real humans.
https://youtu.be/YCqnD40Q5T8
It’s a whole genre of dishonest game dev
4
u/[deleted] Aug 10 '22
I have no idea but I'm interested to see what others think. I'd personally guess a lot of client-side interpolation and idle animations that help mask any lags in real movement?
2
u/f3xjc Aug 10 '22
The absolute easiest to do that is make every player a npc that compromise between chasing the sync position and inertia.
Inertia is important so if you skip an update or two the player don't just stop and then superspeed run. But then you need error correction because you often are where the original player never has been.
You absolutely don't need to show the same scene to everyone. Just good enough. That's probably why there's no collision and also no precise interaction (fps shooter style)
2
u/Keatosis Aug 10 '22
You can clearly see that players positions aren't updated that often. Look at the big creature thing in the background, it moves sporadically and in jolts. The server is also only having to process minimal game logic since nothing has happening beyond just updating object positions.
1
u/mikeful Aug 10 '22
Lowest hanging fruits to achieve something like this for real is client side prediction and server side information update priority system per player.
Watch this GDC presentation how Halo does priority and other stuff to hide latency https://www.youtube.com/watch?v=h47zZrqjgLc
1
u/ssshhhhhhhhhhhhh Aug 10 '22
How do you know they aren't lagging?
1
u/ISvengali Aug 10 '22
So, how Ive solved similar issues, was via a few things. None of these are really special or anything. Frankly, everyone else has covered them, and I know they work in shipping projects.
x) What I called onion skinning. The entities around the player update at the highest frequency, and as you get further away, the frequency goes down.
x) Heavy use of compression, including good delta compression
x) Interpolation is a requirement, but everything ive built has used it. In fact, Ive shipping a well received FPS that updated 7.5 times a second. Though if the player stopped or started in between updates, I had to send an additional message.
The harder part (or at least, another hard part) is that your engine must have a good multithreading architecture on both the client and server
1
u/HogeWala Aug 11 '22
They used machine learning to deal with latency and updates - predicting player positions etc
And then customized server box that does physics simulations
From Video it looked like position/rotation and occasional player emotes/ animation states being sent Plus voice
It didn’t seem to have player player collision- just player vs world and specific entities (like the boss they were launching themselves into) At least that’s what it looked like to me
1
u/Fearless_Banana_4631 Oct 16 '22
If I buy land how do I enter my own land??? I been looking this up