I’ve taken networking courses in college and can say with certainty that if the instructors presented the topics like you have here, much more of the class would be engaged with the intricate web *pun intended* of subject matter!
I’m happy you liked the topic. I try to make these more entertaining than a slideshow or lecture, happy it comes across that way. Just wish these videos took less than a month or more to make.
@@NickMaltbie I totally understand the grind involved with making videos. My channel is still small, but my videos take forever to make as well. Just have to keep hustling and hope the algorithm gods bless us with their presence. Your videos provide lots of value to many, so know that your efforts are appreciated! ✌️
another thing worth noting is that any way you allow the client to be authoritative, you will open space for hacks more easily, since it is just modifying the game to modify the behavior. i have seen some games (like Rocket League) use prediction on the client for the player's own movement so the server still has full control of the player's position without implying fluidity. this should be more difficult to implement, but is way more secure btw, nice video ;)
@@bren.r normally yes, but I have seen the use of relay servers to avoid this (I think this makes it no longer P2P, but at the end of the day, logically it still is). steam itself does this if I am not mistaken. by the way, another interesting thing about P2P is that in theory you can avoid these hacks too. if an action has happened but no client agrees, you communicate to undo the action. it would be "like" a network of trust. i don't know if anything has already implemented this, but it is certainly possible
I found out Valheim has some client authorization. I installed a mod that allows me to plant more things using the Cultivator. When I joined my friends world, who doesn't have the mod installed, I was still able to plant them
This is such an insanely good high level overview. As someone who codes very very little I felt like I was able to follow everything you were talking about and really love that I now have a better understanding of how this works. Thank you!
Scratch online multiplayer games are usually done using peer to peer connection. Tit is possible to make the host type, but is harder. The hardest obe to make on scratch, is the client server, because you have to have a special case in the project to make it run as a server or a client, and also leave the project running forever, and not have to worry about being disconnected. The best way to do that, would be to use an external server that communicates with scratch's server, which is against their tos, so it is rare to find a project that uses that.
Thanks for the feedback, I try to make the videos approachable to people with any level of experience! I need to work on examples more but looking forward to iterating and improving in the future.
@@NickMaltbie I second this, i have spent the past few months learning development in Unity, relying on the asset store and AI for code, but i haven't touched multiplayer because it scares me. Would love to see a video on it
An important clarification to make: an IP address refers to a device on a network, the address tells the sender whether the receiving device is on the same LAN or not, as well as where to send to. Ports refer to an application on a device, for example, a port number can tell the device whether the signal it receives is meant for a web browser or a game. A socket pair refers to both an IP address and the port number, meaning you can know which program is being talked with on which device.
4:52 It is a bit problematic to say that an IP address points to an entire network and a port points to a particular computer, as this is only true in the context of network address translation (from the perspective of a server or peer). In the general case, an IP address refers to a network interface and a port is associated with a particular application on a computer. Just thought it's worth pointing out.
This is a really beautiful video, it helped a lot understanding things I had never actually understood before. Thank you so much, keep up the amazing content!
4:56 that’s not quite right. A port specifies which program on an operating system (i.e. host) gets to receive an incoming packet. For example port 80 is usually dedicated to an http server while 22 is for ssh. In both cases, the same IP can be used and the port is only so the receiving computer knows which packet to forward to which program.
NAT is used because there aren't enough IPv4 addresses to uniquely identify each device in existence. The router acts like a proxy, doing requests on behalf of the clients. In order for the router to know which incoming packet belong to which client, a unique (random) port is used to later determine the client that requested a particular packet. So, "all computers having the same IP address" is only true when talking about a NAT-like setup like most consumers have. An IP "uniquely" (in theory) identifies a HOST where a PORT identifies the RECEIVING program ON that HOST. Multiple programs can receive IP-Packets on the same host, the port portion tells the OS which program gets to receive which packet. This makes it possible to run multiple, unrelated services on the same host (like SSH and HTTP etc.).
Really interesting! I was slightly disappointed though that this video seems to only explain online multiplayer, while the thumbnail shows a distinctly local multiplayer setting (which is what I was looking for). Maybe change the thumbnail?
You know, no one else has pointed this out yet. Sorry if the thumbnail was misleading. I want to make a video tackling local multiplayer but haven’t had time yet. I’ll be sure to update it if I get the time.
You know, no one else has pointed this out yet. Sorry if the thumbnail was misleading. I want to make a video tackling local multiplayer but haven’t had time yet. I’ll be sure to update it if I get the time.
3 years of my experience of trial and error, sweat and tears, in just 15 minutes video.. Where were you all this time? Well done explaining everything, I wish I saw this 3 years ago
I was just watching this video for entertainment mostly, but actually learned that I should use unreliable messages in the networked game I was working on
Amazing explanation of how multiplayer code works bro. I used to do development in Unity back in 2009-2012, and never even touched netcode for some reason lol
I'm a self-taught junior web developer and a gamer. Once I learnt web sockets, RPC and etc couple days ago, I wondered how multiplayer games work. Your video helped me to understand it, and made me more curious about it so I'll deep dive in it. thank you so much ❤
Yes, I think I provided a bit of an oversimplification. Port actually has a bunch of different contexts and meaning than just the IP and network address translation helps handle talking to devices hidden behind another network layer. Someone else pointed out this in the comments as well, I'll make sure to use more clear language in the future!
@@NickMaltbieyeah that was very misleading, especially the "only one host on a network can use a port" part. That would apply to port forwarding at home with ipv4, for example if you want to host a web server at home, you can have only one that is reachable from the internet on the default port, but it's still possible for all machines on your lan to run a web server an access it from any other machine in that lan.
@@anon_y_mousse I mean thats there's no protection against that at all, like 0.5% of packets are consistently lost, and this number can be as high as 5% on very unstable networks
So you're telling me that rollback has been basically industry standard for decades, but the fgc is just recently making the transition? My guess for why they took so long is that fgs are incredibly dependent on frame data and exactly how many frames it takes for an attack to happen (and block/hit stun duration, recovery frames etc.), so the idea of allowing a slight desync, even if it's quickly corrected, may have been a hard sell. Instead, for years fg netcode has been entirely delay based, adding a frame buffer to your inputs based on the connection quality so you and your opponent are (in theory) always synced. The issue here is that the connection has to be good and if it's not, more delay would be added to compensate. The max most would tolerate is 3-4 frames of delay, much more than that and inputs feel awful. The FGC's version of the standard outlined very well in this video, what we call rollback, still has a frame delay, but it's much lower than in purely delay based netcode and because it uses the prediction method described in the video, it can let your input go through on your client instantly. Basically it moves the buffer behind the scenes like most other competitive games instead of just kinda being how you play the game. I'm sure the FGC's various versions of rollback have their own methods of dealing with a desync and that there are plenty of reasons fgs took so long to use this tech, but what you outlined in the video is essentially how it works. Rollback was sold to the FGC as this revolutionary new way of handling netcode, but it seems they just took what already existed and adapted it to fgs. Still impressive that i can play Guilty Gear with someone on the opposite side of the planet with little to no lag, so I'm not complaining about the implementation. It's just frustrating as someone who loves the genre to know that the tech hailed as the savior of online fg play (and, as of covid, the savior of the FGC, at least during lockdown) has existed for probably my entire life
The thing with rollback is that in its previous iterations is that its possible with simple games, but code that uses floating point numbers ends up non-deterministic. Iirc Valve actually tried doing physics resimulations in csgo, however they realized due to the non-determinism of the physics engine eventually the client would be so far off from the server that it would have to do a rollback on every packet which wasnt acceptable during gameplay. The video describes this sort of middle point because you need to realize that EVERY moving objects position and additional data fields must be sent, which adds up and can congest the bandwidth. The key innovation of rollback is to only take the input from the controller to resimulate the entire game, which scales significantly better with large detailed environments However in the case of fighting games rollback also serves as a low latency low bandwidth solution for fast paced reflexes over the network. It really is the best solution overall IF the engine can implement it; which often time due to time/money/licensing they cannot.
@AndrosYang Oh yeah, not knocking the work that went into adapting it for fighting games and other complex games like, as you mentioned, csgo. GGPO, the main rollback solution used in fighting games today, has existed since '06, but wasn't made open source until 2019. 13 years of knowing it's possible to make it work and none of the big studios could figure it out? Hell, Skullgirls was released in 2011 and used GGPO for its online, so it was still available for use even before going open source. A lot of people were skeptical of rollback's viability as a netcode solution for fighting games, especially after SFV's less than stellar implementation, so it wasn't just the studios being resistant. I'm glad it's standard now and that studios like Arc Sys are willing to go back and retrofit rollback into their older delay based games, just frustrating that it took so long after GGPO showed it was possible and better back in '06.
There are several articles and videos that discuss this phenomena. IIRC yeah although rollback adds a lot of complexity, it's standard practice for western devs, however Japanese studios have been much slower to adapt.
@Peyton - yes, rollback is nice but without a fast computer and strong network connection there needs to be a bit of delay and lag for commands. The oldest implementation I know of is for AoE2 - www.gamedevs.org/uploads/1500-archers-age-of-empires-network-programming.pdf I know that fighting games are often frame locked and want to work on an update rate of 30-60 ticks per second (or higher). Until the last 5-10 years that wouldn’t have been possible for computers. For RTS games, if your inputs have a 50-100ms lag it doesn’t matter too much but for fighting games it can be a big drag on performance. I guess they can just be slow to adopt it if if they didn’t use it in the past. Fighting games have a very specific set of requirements. I’m planning on making a video about rollback and buffering in specific for moving platforms so I’ll talk about this in the future! Thanks for taking the time to write a thoughtful comment.
@@NickMaltbie I'm looking forward to it! I know rollback for fighting games is still delay based, usually 1-3 frames depending on the game. What's important is that rollback gives the game 2 knobs to adjust to maintain synchronization between players, and it usually adjusts the number of rollback frames instead of the delay frames to keep the game responsive. I think most games only adjust rollback frames, with games like Guilty Gear Strive even having an option to display the number of rollback frames throughout the match. Going from solely delay to rollback is night and day, and I can't imagine the technical wizardry that goes into keeping both players synced down to the frame.
I wish videos like these went deeper. For example, often the client/server, host, and peer to peer multiplayer models are presented as if a game dev team chooses one and is done; however, multiplayer games like Destiny and others mix and match multiplayer models depending on how sensitive an operation could be versus how much it would cost to maintain the infrastructure. Another example: what about "multiplayer services" aka APIs (often REST) that facilitate stuff like matchmaking or choosing a server; you can think of these as "the things that don't need a game server instance running a game simulation to accomplish" like a server browser or quick play.
This is the stuff I would love to cover more but it’s just me working on these videos :) I’m getting better about coving them in depth and making them interesting. I’m trying to document my projects better and will try to provide resources and demos linked in description!
This works for absolute beginners but have to say after studying the topic a lot I see some misguiding information. Overwatch for example definitely does not client authoritative model. They do a lot of checks on the server side and will rollback a client that goes out of state - showing it's not client authoritative system. They just like to prefer clients in a lot of their checks on the server side but the authority is saved for the server and the server does a bunch of checks to make sure clients behave. Also you don't need to use client authoritative model to fix the problem where your actions take a lot of time as they are verified by the server. You just need to execute the actions on the client as you send them to server BUT revert them back if prediction does not match reality (that's what Overwatch does too!). Favor the shooter != client authoritative. Authority in networking means basically who has "final say". Clients in Overwatch don't have final say. Also many libraries exist that combine UDP into TCP like system while still being faster than TCP, with still some TCP benefits. Also one thing to note is that it's very common place to use combination of client hosted & dedicated server for a same game. They both use Client-server model.
At around 8:00 you mention UDP connections being optimal for real-time physics, etc. Do you think we'll start seeing HTTP3/QUIC poking its head up, since it's a stream capable HTTP protocol that is based on UDP?
weird this game I play is called Let It Die and it has a weird Offline-Online Model, in terms of exploiting the game there is nothing stopping you but the second you have your health past max and use an npc or action that gets sent to the server, it kicks you off and it's a temporary kick in that moment or a ban after 7 days, there is also data grabbed from everyone's waiting room as a Clash of Clans type base raiding feature exist, where the other people have to be offline or away from their base. there is no true online multiplayer experience, just an off "I'll raid you base and I can die with my weapon out and drop it for you when you get back online"
can someone explain this type of model to me? again this game can be manipulated but at the same time work with no problem naturally, the only networking is for when purchasing an item or using the base raiding feature, going up and down a floor, etc.
Roll back is the future, the problem currently is all modern languages have native floating-point representations for decimals as this has historically been better than fixed-point decimals for scientific computing but platform-specific quirks make floating-point code non-deterministic. Fixed point physics engines in particular. I imagine as new engines are developed from scratch this will be a requirement as it simplifies networking tremendously.
That’s a great point. I might make a video on fixed point precision in the future! Unity is moving towards fixed point precision in the future for its physics calculations as well. Although to get it to sync properly you need to ensure all clients are running the same simulation without data interruption which might be common for multiplayer games. Rollback is nice but you have to use it only when needed otherwise you game will need to re-sync every few minutes for any player who has had their simulation drift.
hey...I'm fullstack developer and i am planning to make multiplayergame using udemy or unreal in which i havent learned yet, and i want to make users create account and create or join a game and log data about the match on db but i'm new to game development and more detailed logic about implementation of online game can you help?
My multiplayer sample code is open source if you want to checkout demos in Unity. Their multiplayer packages are fairly easy to use and understand and have some very nice tutorial if you want to check them out.
pretty sure you messed up some of the networking info. ports are not limited to a single pc, they're limited to one IP, so you cannot have multiple applications listening to the same port on the same ip (mostly, on windows at least), but you can have multiple applications running on different IPs with the same port number :]
This is correct! It’s handled on the OS level so it’s mostly abstracted away for high level languages like C, C# or C++. However it is possible for multiple applications to listen to the same port as long as they are behind the same ip. It’s an important differentiation to make. I believe you can also map one IP to multiple devices via multiplexing so you can load balance applications on the same port between multiple machines masked behind the same IP. However this gets complex quickly. Discussing the TCP/IP stack and OSI model is a bit out of scope for this video though :D
I have experienced that exact thing of getting hooked by roadhog when I was behind a corner and even tho I knew why it happened it's still incredibly frustrating :
Still will need NAT for network obfuscation and security but it will be nice to allow each machine to have its own address and not limited by the arbitrary limitation by an older system. Using NAT for what it’s intended instead of as bad glue to hold the internet together!
@NickMaltbie NAT is not a security mechanism, and really shouldn't be relied on for security. In an ideal world, we'd have native v6 with no NAT, but with host devices behind a basic firewall. Edit: see RFC 2993 section 9 for an explanation of what I mean
Great explanation, however wouldn’t we be using ipv6 instead? If I made a game that had to use IP I’d opt for v6 if I could just to be future proof, and current
Do you know what is the best part you don't have to relay in only one off those methods you by able to combine multiple off those multiplayer method if you want For example just because One game have lan Play for example it doesn't mean the don't able to have online servers as well One other example it's what I tried to achieve in the video game I tried to create the game I want to make I will have split screen and the option to play online or lan game at the same time for example in theory I will able to play up to 8 player's with 2 computers and my game I be host base but I will have some kind off server in the order people to able to connect online
Yes, netcode for game objects has some great abstractions and examples of this. I’ll make a follow up video on this topic at some point in the future! :)
It’s usually a mix. Use tcp for things that need to be ordered and reliable like text communication, authentication, level data. But for quickly updating data where only the most recent info matters like position and velocity it’s much more faster to use UDP to avoid the extra steps in message passing.
Incredibly underrated video. Fantastic production!
Glad you enjoyed it!
exactly its not *overly* energetic and annoying but not silent where i cant hear anything i wish more youtubers were like this
Underrated in what sense?
Hey Sheditz, just wondering, is that photo edited?T Thanks
systems
I’ve taken networking courses in college and can say with certainty that if the instructors presented the topics like you have here, much more of the class would be engaged with the intricate web *pun intended* of subject matter!
I’m happy you liked the topic. I try to make these more entertaining than a slideshow or lecture, happy it comes across that way. Just wish these videos took less than a month or more to make.
@@NickMaltbie I totally understand the grind involved with making videos. My channel is still small, but my videos take forever to make as well. Just have to keep hustling and hope the algorithm gods bless us with their presence. Your videos provide lots of value to many, so know that your efforts are appreciated! ✌️
2:04 I like how he avoided making a demonic sign whenhe was example peer to peer 😂
Peer to peer is where the devil thrives. ;)
another thing worth noting is that any way you allow the client to be authoritative, you will open space for hacks more easily, since it is just modifying the game to modify the behavior. i have seen some games (like Rocket League) use prediction on the client for the player's own movement so the server still has full control of the player's position without implying fluidity. this should be more difficult to implement, but is way more secure
btw, nice video ;)
Not to mention P2P opens the opportunity for script kiddies to do DoS attacks, etc.
Exactly what's been happening to GTA online since 2015
@@bren.r normally yes, but I have seen the use of relay servers to avoid this (I think this makes it no longer P2P, but at the end of the day, logically it still is). steam itself does this if I am not mistaken.
by the way, another interesting thing about P2P is that in theory you can avoid these hacks too. if an action has happened but no client agrees, you communicate to undo the action. it would be "like" a network of trust. i don't know if anything has already implemented this, but it is certainly possible
I found out Valheim has some client authorization. I installed a mod that allows me to plant more things using the Cultivator. When I joined my friends world, who doesn't have the mod installed, I was still able to plant them
This is such an insanely good high level overview. As someone who codes very very little I felt like I was able to follow everything you were talking about and really love that I now have a better understanding of how this works. Thank you!
Explained very clearly. Loved it. Great work 👍
Thanks! :)
Scratch online multiplayer games are usually done using peer to peer connection. Tit is possible to make the host type, but is harder. The hardest obe to make on scratch, is the client server, because you have to have a special case in the project to make it run as a server or a client, and also leave the project running forever, and not have to worry about being disconnected. The best way to do that, would be to use an external server that communicates with scratch's server, which is against their tos, so it is rare to find a project that uses that.
Yeah, and besides that, you can only store 2560 numbers in total and you have to wait 0.1 seconds to send the data
I have no idea how to make a game but for the most part, I was actually able to keep up with the content a little bit.
Thanks for the feedback, I try to make the videos approachable to people with any level of experience! I need to work on examples more but looking forward to iterating and improving in the future.
That's how to present a complex topic in a short precise manner - very well done.
Damn, I am so interested in a Unity multiayer tutorial by you. Explaining and comparing the different methods on how to implement multiplayer.
Might be a future video topic :) I’ll definitely make one on netcode for game objects in the near future as it’s what I use for most of my projects!
@@NickMaltbie I second this, i have spent the past few months learning development in Unity, relying on the asset store and AI for code, but i haven't touched multiplayer because it scares me. Would love to see a video on it
An important clarification to make: an IP address refers to a device on a network, the address tells the sender whether the receiving device is on the same LAN or not, as well as where to send to. Ports refer to an application on a device, for example, a port number can tell the device whether the signal it receives is meant for a web browser or a game. A socket pair refers to both an IP address and the port number, meaning you can know which program is being talked with on which device.
4:52 It is a bit problematic to say that an IP address points to an entire network and a port points to a particular computer, as this is only true in the context of network address translation (from the perspective of a server or peer). In the general case, an IP address refers to a network interface and a port is associated with a particular application on a computer. Just thought it's worth pointing out.
This is a really beautiful video, it helped a lot understanding things I had never actually understood before. Thank you so much, keep up the amazing content!
4:56 that’s not quite right. A port specifies which program on an operating system (i.e. host) gets to receive an incoming packet. For example port 80 is usually dedicated to an http server while 22 is for ssh. In both cases, the same IP can be used and the port is only so the receiving computer knows which packet to forward to which program.
NAT is used because there aren't enough IPv4 addresses to uniquely identify each device in existence. The router acts like a proxy, doing requests on behalf of the clients. In order for the router to know which incoming packet belong to which client, a unique (random) port is used to later determine the client that requested a particular packet. So, "all computers having the same IP address" is only true when talking about a NAT-like setup like most consumers have.
An IP "uniquely" (in theory) identifies a HOST where a PORT identifies the RECEIVING program ON that HOST.
Multiple programs can receive IP-Packets on the same host, the port portion tells the OS which program gets to receive which packet.
This makes it possible to run multiple, unrelated services on the same host (like SSH and HTTP etc.).
Damn this helped me understand more about Computer networks than the entire semester of my college life..........thank you so much :)
Really interesting! I was slightly disappointed though that this video seems to only explain online multiplayer, while the thumbnail shows a distinctly local multiplayer setting (which is what I was looking for). Maybe change the thumbnail?
You know, no one else has pointed this out yet. Sorry if the thumbnail was misleading. I want to make a video tackling local multiplayer but haven’t had time yet. I’ll be sure to update it if I get the time.
You know, no one else has pointed this out yet. Sorry if the thumbnail was misleading. I want to make a video tackling local multiplayer but haven’t had time yet. I’ll be sure to update it if I get the time.
Hey bro i just wanted to say this video was actually extremely interesting. Good shit i’ll be looking out for other uploads from you
3 years of my experience of trial and error, sweat and tears, in just 15 minutes video.. Where were you all this time?
Well done explaining everything, I wish I saw this 3 years ago
I really related to the joy of making multiplayer games!
I definitely want to make one again in the future
They’re very easy to make with the new frameworks, they abstract away a lot of the hard work like sockets and serialization.
Very comprehensive video. Nerds are the MVPS!
Interesting and simple, I love it. Keep up a good work! Subscribed
Wowww! Incredibly underrated, thank you for this useful info :)) 😊
Thanks!
This video is more informative than the wikipedia page on multiplayer technologies for games
Nice video. Very informative :)
TCP stands for Transmission Control Protocol.
Thanks, I'll make sure to correct that next time I bring it up :)
Woow nice production and content
I was just watching this video for entertainment mostly, but actually learned that I should use unreliable messages in the networked game I was working on
Really well put together, great job on the explanation
Amazing explanation of how multiplayer code works bro. I used to do development in Unity back in 2009-2012, and never even touched netcode for some reason lol
Awesome video! I would love a follow on video about state prediction, reckoning and rollback
Thank you for creating and sharing this video!
I'm a self-taught junior web developer and a gamer. Once I learnt web sockets, RPC and etc couple days ago, I wondered how multiplayer games work. Your video helped me to understand it, and made me more curious about it so I'll deep dive in it. thank you so much ❤
Thanks, I’m happy my video served as a nice introduction and inspiration to learn more!
4:50 This is factually incorrect, in the standard TCP/UDP protocol ip is the address of a host, while port is the address of a process on that host.
Yes, I think I provided a bit of an oversimplification. Port actually has a bunch of different contexts and meaning than just the IP and network address translation helps handle talking to devices hidden behind another network layer. Someone else pointed out this in the comments as well, I'll make sure to use more clear language in the future!
@@NickMaltbieyeah that was very misleading, especially the "only one host on a network can use a port" part. That would apply to port forwarding at home with ipv4, for example if you want to host a web server at home, you can have only one that is reachable from the internet on the default port, but it's still possible for all machines on your lan to run a web server an access it from any other machine in that lan.
you forgot how udp packets are not guaranteed to be delivered at all!
(reliability is one of the main points of tcp)
To be fair, there's no guarantee any packets will get delivered no matter the protocol.
@@anon_y_mousse I mean thats there's no protection against that at all, like 0.5% of packets are consistently lost, and this number can be as high as 5% on very unstable networks
Good point to bring up! Extra important reason why buffering and prediction/interpolation are helpful over flaky connections.
Really thank you for making this video.
Thanks, glad it was helpful!
This is a really great and informative video!
Thanks!
So you're telling me that rollback has been basically industry standard for decades, but the fgc is just recently making the transition? My guess for why they took so long is that fgs are incredibly dependent on frame data and exactly how many frames it takes for an attack to happen (and block/hit stun duration, recovery frames etc.), so the idea of allowing a slight desync, even if it's quickly corrected, may have been a hard sell.
Instead, for years fg netcode has been entirely delay based, adding a frame buffer to your inputs based on the connection quality so you and your opponent are (in theory) always synced. The issue here is that the connection has to be good and if it's not, more delay would be added to compensate. The max most would tolerate is 3-4 frames of delay, much more than that and inputs feel awful.
The FGC's version of the standard outlined very well in this video, what we call rollback, still has a frame delay, but it's much lower than in purely delay based netcode and because it uses the prediction method described in the video, it can let your input go through on your client instantly. Basically it moves the buffer behind the scenes like most other competitive games instead of just kinda being how you play the game.
I'm sure the FGC's various versions of rollback have their own methods of dealing with a desync and that there are plenty of reasons fgs took so long to use this tech, but what you outlined in the video is essentially how it works. Rollback was sold to the FGC as this revolutionary new way of handling netcode, but it seems they just took what already existed and adapted it to fgs. Still impressive that i can play Guilty Gear with someone on the opposite side of the planet with little to no lag, so I'm not complaining about the implementation. It's just frustrating as someone who loves the genre to know that the tech hailed as the savior of online fg play (and, as of covid, the savior of the FGC, at least during lockdown) has existed for probably my entire life
The thing with rollback is that in its previous iterations is that its possible with simple games, but code that uses floating point numbers ends up non-deterministic. Iirc Valve actually tried doing physics resimulations in csgo, however they realized due to the non-determinism of the physics engine eventually the client would be so far off from the server that it would have to do a rollback on every packet which wasnt acceptable during gameplay. The video describes this sort of middle point because you need to realize that EVERY moving objects position and additional data fields must be sent, which adds up and can congest the bandwidth. The key innovation of rollback is to only take the input from the controller to resimulate the entire game, which scales significantly better with large detailed environments
However in the case of fighting games rollback also serves as a low latency low bandwidth solution for fast paced reflexes over the network. It really is the best solution overall IF the engine can implement it; which often time due to time/money/licensing they cannot.
@AndrosYang Oh yeah, not knocking the work that went into adapting it for fighting games and other complex games like, as you mentioned, csgo. GGPO, the main rollback solution used in fighting games today, has existed since '06, but wasn't made open source until 2019. 13 years of knowing it's possible to make it work and none of the big studios could figure it out? Hell, Skullgirls was released in 2011 and used GGPO for its online, so it was still available for use even before going open source.
A lot of people were skeptical of rollback's viability as a netcode solution for fighting games, especially after SFV's less than stellar implementation, so it wasn't just the studios being resistant. I'm glad it's standard now and that studios like Arc Sys are willing to go back and retrofit rollback into their older delay based games, just frustrating that it took so long after GGPO showed it was possible and better back in '06.
There are several articles and videos that discuss this phenomena. IIRC yeah although rollback adds a lot of complexity, it's standard practice for western devs, however Japanese studios have been much slower to adapt.
@Peyton - yes, rollback is nice but without a fast computer and strong network connection there needs to be a bit of delay and lag for commands. The oldest implementation I know of is for AoE2 - www.gamedevs.org/uploads/1500-archers-age-of-empires-network-programming.pdf
I know that fighting games are often frame locked and want to work on an update rate of 30-60 ticks per second (or higher). Until the last 5-10 years that wouldn’t have been possible for computers. For RTS games, if your inputs have a 50-100ms lag it doesn’t matter too much but for fighting games it can be a big drag on performance. I guess they can just be slow to adopt it if if they didn’t use it in the past. Fighting games have a very specific set of requirements. I’m planning on making a video about rollback and buffering in specific for moving platforms so I’ll talk about this in the future! Thanks for taking the time to write a thoughtful comment.
@@NickMaltbie I'm looking forward to it! I know rollback for fighting games is still delay based, usually 1-3 frames depending on the game. What's important is that rollback gives the game 2 knobs to adjust to maintain synchronization between players, and it usually adjusts the number of rollback frames instead of the delay frames to keep the game responsive. I think most games only adjust rollback frames, with games like Guilty Gear Strive even having an option to display the number of rollback frames throughout the match. Going from solely delay to rollback is night and day, and I can't imagine the technical wizardry that goes into keeping both players synced down to the frame.
Sad there's only 100k views. It deserves several million
This was an excellent overview. 🤔👍
Amazing video! thank you! I’m trying to make a peer-hosted setup for my game
Superb overview, thanks Nick 👍
Thanks!
wow, this presentation ist amazing
I wish videos like these went deeper. For example, often the client/server, host, and peer to peer multiplayer models are presented as if a game dev team chooses one and is done; however, multiplayer games like Destiny and others mix and match multiplayer models depending on how sensitive an operation could be versus how much it would cost to maintain the infrastructure. Another example: what about "multiplayer services" aka APIs (often REST) that facilitate stuff like matchmaking or choosing a server; you can think of these as "the things that don't need a game server instance running a game simulation to accomplish" like a server browser or quick play.
This is the stuff I would love to cover more but it’s just me working on these videos :) I’m getting better about coving them in depth and making them interesting. I’m trying to document my projects better and will try to provide resources and demos linked in description!
This is an amazing video!
Thanks, I'm happy you liked it!
0:14 that 4K tho
This works for absolute beginners but have to say after studying the topic a lot I see some misguiding information. Overwatch for example definitely does not client authoritative model. They do a lot of checks on the server side and will rollback a client that goes out of state - showing it's not client authoritative system. They just like to prefer clients in a lot of their checks on the server side but the authority is saved for the server and the server does a bunch of checks to make sure clients behave.
Also you don't need to use client authoritative model to fix the problem where your actions take a lot of time as they are verified by the server. You just need to execute the actions on the client as you send them to server BUT revert them back if prediction does not match reality (that's what Overwatch does too!). Favor the shooter != client authoritative. Authority in networking means basically who has "final say". Clients in Overwatch don't have final say.
Also many libraries exist that combine UDP into TCP like system while still being faster than TCP, with still some TCP benefits.
Also one thing to note is that it's very common place to use combination of client hosted & dedicated server for a same game. They both use Client-server model.
Amazing video, thank you for sharing your knowledge
Where was this video during my previous year in school?
excellent explanation
Thank you!
fantastic overview
3:35 TCP is transmission control protocol
10:43 Is this the basic idea behind "rollback netcode" for fighting games?
thank you for this video, it makes me relly want to make my own games.👍
This is my computer science revision
How does valve cs2 sub ticks work?
Very good!
Thanks :)
Have a great day too! :)
Please make tutorials I love the format of this video. The thing with multiplayer that makes it so hard for me is the lack of good resources
small correction TCP stands for transmission control protocol, not transmission communication protocol
Amazing Video thank you!
At around 8:00 you mention UDP connections being optimal for real-time physics, etc. Do you think we'll start seeing HTTP3/QUIC poking its head up, since it's a stream capable HTTP protocol that is based on UDP?
weird this game I play is called Let It Die and it has a weird Offline-Online Model, in terms of exploiting the game there is nothing stopping you but the second you have your health past max and use an npc or action that gets sent to the server, it kicks you off and it's a temporary kick in that moment or a ban after 7 days, there is also data grabbed from everyone's waiting room as a Clash of Clans type base raiding feature exist, where the other people have to be offline or away from their base. there is no true online multiplayer experience, just an off "I'll raid you base and I can die with my weapon out and drop it for you when you get back online"
can someone explain this type of model to me? again this game can be manipulated but at the same time work with no problem naturally, the only networking is for when purchasing an item or using the base raiding feature, going up and down a floor, etc.
3:33 Awesome video but one small mistake. TCP stands for Transmission Control Potocrol. But as I said, still a really good and interesting video :)
Fantastic video!
@11:00 DRG is a great example of a game that doesn't use this right. You lag off cliffs all the time
Well done!
Thanks, glad you liked it!
Great video.
Great Video!
I never knew this one salient point before, but apparently clients are color blind. They'll predict game state in green, but call it red. :P
Roll back is the future, the problem currently is all modern languages have native floating-point representations for decimals as this has historically been better than fixed-point decimals for scientific computing but platform-specific quirks make floating-point code non-deterministic. Fixed point physics engines in particular. I imagine as new engines are developed from scratch this will be a requirement as it simplifies networking tremendously.
That’s a great point. I might make a video on fixed point precision in the future!
Unity is moving towards fixed point precision in the future for its physics calculations as well. Although to get it to sync properly you need to ensure all clients are running the same simulation without data interruption which might be common for multiplayer games. Rollback is nice but you have to use it only when needed otherwise you game will need to re-sync every few minutes for any player who has had their simulation drift.
Thank you!
There is only one problem, fast efficient synchronization. Achieving that is very tricky.
my hopes for making a multiplayer fps have truly been smashed
Does anyone know the name of the game at 14:52?
Late response sorry but thats Overcooked
Do I need to study and master computer networking in order to make multiplayer games?
Nope, but understand the underlying concepts can help with debugging errors or how to lookup the best solution :)
Very well explained, thumbs up for sure.
Does anyone know whether QUIC made its way into any of these? 🤔
Great video however it would be nice to see some code implemented
Good overview of networking but quite a few errors/assumptions
Well-Done
hey...I'm fullstack developer and i am planning to make multiplayergame using udemy or unreal in which i havent learned yet, and i want to make users create account and create or join a game and log data about the match on db but i'm new to game development and more detailed logic about implementation of online game can you help?
10:14 prediction data
Awesome video (Y)
Ok, let's build our own Godot multiplayer game now
I wish I knew how to make an offline multiplayer game for mobile
My multiplayer sample code is open source if you want to checkout demos in Unity. Their multiplayer packages are fairly easy to use and understand and have some very nice tutorial if you want to check them out.
@@NickMaltbie that would be great!!
but so far everything I've learnt works fine on PC but when it comes to mobile it's just not working
pretty sure you messed up some of the networking info. ports are not limited to a single pc, they're limited to one IP, so you cannot have multiple applications listening to the same port on the same ip (mostly, on windows at least), but you can have multiple applications running on different IPs with the same port number :]
(for tcp)
udp can have multiple applications subscribed to the same port
This is correct! It’s handled on the OS level so it’s mostly abstracted away for high level languages like C, C# or C++. However it is possible for multiple applications to listen to the same port as long as they are behind the same ip. It’s an important differentiation to make.
I believe you can also map one IP to multiple devices via multiplexing so you can load balance applications on the same port between multiple machines masked behind the same IP. However this gets complex quickly.
Discussing the TCP/IP stack and OSI model is a bit out of scope for this video though :D
in my years of using unity i've used serialization countless times, but somehow i didn't really understand what it was until i watched this...
Love the content! Please speak a little slower with longer pauses, it'll help people (me) follow along and help with stumbling over or slurring words.
I have experienced that exact thing of getting hooked by roadhog when I was behind a corner and even tho I knew why it happened it's still incredibly frustrating :
I think you missed a very important point about udp. There is no guarantee that packets will arrive at all.
Now we just need better deployment of IPv6 so we can avoid NAT all together.
Still will need NAT for network obfuscation and security but it will be nice to allow each machine to have its own address and not limited by the arbitrary limitation by an older system. Using NAT for what it’s intended instead of as bad glue to hold the internet together!
@NickMaltbie NAT is not a security mechanism, and really shouldn't be relied on for security. In an ideal world, we'd have native v6 with no NAT, but with host devices behind a basic firewall.
Edit: see RFC 2993 section 9 for an explanation of what I mean
@@zmania101 yes, not for security, just organization :)
Great explanation, however wouldn’t we be using ipv6 instead? If I made a game that had to use IP I’d opt for v6 if I could just to be future proof, and current
One doesnt simply "use IPv6".
@@snorman1911 lol, i know but what I am saying is that it would be better if explained using ipv6 because that is what the world is going to
@@realElzie I know but nobody likes IPv6 :)
This helped me understand why sometimes Rocket League behaves weirdly
Do you know what is the best part you don't have to relay in only one off those methods you by able to combine multiple off those multiplayer method if you want
For example just because One game have lan Play for example it doesn't mean the don't able to have online servers as well
One other example it's what I tried to achieve in the video game I tried to create the game I want to make I will have split screen and the option to play online or lan game at the same time for example in theory I will able to play up to 8 player's with 2 computers and my game I be host base but I will have some kind off server in the order people to able to connect online
Yes, netcode for game objects has some great abstractions and examples of this. I’ll make a follow up video on this topic at some point in the future! :)
It seems like peer-to-peer is executed in the LAN parties.
i miss lan games without internet or split screen now even single player game is online
Such a fun time. I’d love to make a video on split screen games as well soon. Time is difficult however.
awesome
It seems like everyone *says* that you have to use UDP for games because it's faster, but literally everyone and every game uses TCP.. so confusing
It’s usually a mix. Use tcp for things that need to be ordered and reliable like text communication, authentication, level data. But for quickly updating data where only the most recent info matters like position and velocity it’s much more faster to use UDP to avoid the extra steps in message passing.
UDP seems scary to me
I miss the days of split-screen multiplayer. Not like it was better or anything, I'm just nostalgic.
Thanks but i am too lazy so i just made my game couchplay only.
Haha, couch play is still its own challenge to setup :)