--- Hello readers, I’m no longer posting new content on gafferongames.com Please check out my new blog at mas-bandwidth.com! --- Introduction Hi, I’m Glenn Fiedler and welcome to Networking for Game Programmers. Lately I’ve been doing some research into networking game physics simulations via deterministic lockstep methods. The basic idea is that instead of synchronizing the state of physics objects directly by sending the positions, orientations, velocities etc. over the network, one c...| Posts on Gaffer On Games
Hello readers, I’m no longer posting new content on gafferongames.com Please check out my new blog at mas-bandwidth.com! Introduction Hi, I’m Glenn Fiedler and welcome to Game Physics. In the previous article we discussed how to integrate our physics simulation forward at fixed delta time increments, regardless of display framerate. In this article we are going to simulate motion in three dimensions. Rigid Bodies We will concentrate on a type of object called a rigid body.| Gaffer On Games
Hello readers, I’m no longer posting new content on gafferongames.com Please check out my new blog at mas-bandwidth.com! Introduction Hi, I’m Glenn Fiedler and welcome to Game Physics. In the previous article we discussed how to integrate the equations of motion using a numerical integrator. Integration sounds complicated, but it’s just a way to advance the your physics simulation forward by some small amount of time called “delta time” (or dt for short).| Gaffer On Games
What we're doing at my new startup [Network Next](https://networknext.com) :rocket:| Gaffer On Games
Introduction About a year ago, Oculus approached me and offered to sponsor my research. They asked me, effectively: “Hey Glenn, there’s a lot of interest in networked physics in VR. You did a cool talk at GDC. Do you think could come up with a networked physics sample in VR that we could share with devs? Maybe you could use the touch controllers?” I replied “F*** yes!" cough “Sure. This could be a lot of fun!| Gaffer On Games
Premise In 2017 the most popular web games like agar.io are networked via WebSockets over TCP. If a UDP equivalent of WebSockets could be incorporated into browsers, it would greatly improve the networking of these games. Background Web browsers are built on top of HTTP, which is a stateless request/response protocol initially designed for serving static web pages. HTTP is built on top of TCP, a low-level protocol which guarantees data sent over the internet arrives reliably, and in the same ...| Gaffer On Games
Introduction Hi, I’m Glenn Fiedler and welcome to Building a Game Network Protocol. So far in this article series we’ve discussed how games read and write packets, how to unify packet read and write into a single function, how to fragment and re-assemble packets, and how to send large blocks of data over UDP. Now in this article we’re going to bring everything together and build a client/server connection on top of UDP.| Gaffer On Games
Introduction Hi, I’m Glenn Fiedler and welcome to Building a Game Network Protocol. Many people will tell you that implementing your own reliable message system on top of UDP is foolish. After all, why reimplement TCP? But why limit ourselves to how TCP works? But there are so many different ways to implement reliable-messages and most of them work nothing like TCP! So let’s get creative and work out how we can implement a reliable message system that’s better and more flexible than ...| Gaffer On Games
Introduction Hi, I’m Glenn Fiedler and welcome to Building a Game Network Protocol. In the previous article we implemented packet fragmentation and reassembly so we can send packets larger than MTU. This approach works great when the data block you’re sending is time critical and can be dropped, but in other cases you need to send large blocks of quickly and reliably over packet loss, and you need the data to get through.| Gaffer On Games
Introduction Hi, I’m Glenn Fiedler and welcome to Building a Game Network Protocol. In the previous article we discussed how to unify packet read and write into a single serialize function and added a bunch of safety features to packet read. Now we are ready to start putting interesting things in our packets and sending them over the network, but immediately we run into an interesting question: how big should our packets be?| Gaffer On Games
Introduction Hi, I’m Glenn Fiedler and welcome to Building a Game Network Protocol. In the previous article, we created a bitpacker but it required manual checking to make sure reading a packet from the network is safe. This is a real problem because the stakes are particularly high - a single missed check creates a vulnerability that an attacker can use to crash your server. In this article, we’re going to transform the bitpacker into a system where this checking is automatic.| Gaffer On Games
Introduction Hi, I’m Glenn Fiedler and welcome to Building a Game Network Protocol. In this article we’re going to explore how AAA multiplayer games like first person shooters read and write packets. We’ll start with text based formats then move into binary hand-coded binary formats and bitpacking. At the end of this article and the next, you should understand exactly how to implement your own packet read and write the same way the pros do it.| Gaffer On Games
Hello readers, I’m no longer posting new content on gafferongames.com Please check out my new blog at mas-bandwidth.com! Introduction Hi, I’m Glenn Fiedler and welcome to Networked Physics. In the previous article we discussed techniques for compressing snapshots. In this article we round out our discussion of networked physics strategies with state synchronization, the third and final strategy in this article series. State Synchronization What is state synchronization? The basic idea is ...| Gaffer On Games
Introduction Hi, I’m Glenn Fiedler and welcome to Networked Physics. In the previous article we sent snapshots of the entire simulation 10 times per-second over the network and interpolated between them to reconstruct a view of the simulation on the other side. The problem with a low snapshot rate like 10HZ is that interpolation between snapshots adds interpolation delay on top of network latency. At 10 snapshots per-second, the minimum interpolation delay is 100ms, and a more practical min...| Gaffer On Games
Hello readers, I’m no longer posting new content on gafferongames.com Please check out my new blog at mas-bandwidth.com! Introduction Hi, I’m Glenn Fiedler and welcome to Networked Physics. In the previous article we networked a physics simulation using deterministic lockstep. Now, in this article we’re going to network the same simulation with a completely different technique: snapshot interpolation. Background While deterministic lockstep is very efficient in terms of bandwidth, it’...| Gaffer On Games
Hello readers, I’m no longer posting new content on gafferongames.com Please check out my new blog at mas-bandwidth.com! Introduction Hi, I’m Glenn Fiedler and welcome to Networked Physics. In the previous article we explored the physics simulation we’re going to network in this article series. In this article specifically, we’re going to network this physics simulation using deterministic lockstep. Deterministic lockstep is a method of networking a system from one computer to another...| Gaffer On Games
Introduction Hi, I’m Glenn Fiedler and welcome to the first article in Networked Physics. In this article series we’re going to network a physics simulation three different ways: deterministic lockstep, snapshot interpolation and state synchronization. But before we get to this, let’s spend some time exploring the physics simulation we’re going to network in this article series: Your browser does not support the video tag. Here I’ve setup a simple simulation of a cube in the open so...| Gaffer On Games
Introduction Hi, I’m Glenn Fiedler. Welcome to Virtual Go, my project to create a physically accurate computer simulation of a Go board and stones. So far in this series, we have mathematically defined the go stone, rendered it, determined how it moves and rotates, and discussed how its shape affects how it responds to collisions. Now in this article we reach our first milestone: A go stone bouncing and coming to rest on the go board.| Gaffer On Games
Introduction Hi, I’m Glenn Fiedler. Welcome to Virtual Go, my project to create a physically accurate computer simulation of a Go board and stones. In the previous article we detected collision between the go stone and the go board. Now we’re working up to calculating collision response so the stone bounces and wobbles before coming to rest on the board. But in order to reach this goal we first need to lay some groundwork.| Gaffer On Games
Introduction Hi, I’m Glenn Fiedler. Welcome to Virtual Go, my project to create a physically accurate computer simulation of a Go board and stones. In this series so far we’ve defined the shape of a go stone, rendered it using 3D graphics hardware and simulated how it moves in three dimensions. Our next goal is for the go stone to bounce and come to rest on the go board. Understandably, this is quite complicated, so in this article we’ll focus on the first step: detecting collisions bet...| Gaffer On Games
Introduction Hi, I’m Glenn Fiedler. Welcome to Virtual Go, my project to create a physically accurate computer simulation of a Go board and stones. In previous articles we mathematically defined the shape of a go stone and tessellated its shape so it can be drawn with 3D graphics hardware. Now we want to make the go stone move, obeying Newton’s laws of motion so the simulation is physically accurate. The stone should be accelerated by gravity and fall downwards.| Gaffer On Games
Introduction Hi, I’m Glenn Fiedler. Welcome to Virtual Go, my project to create a physically accurate computer simulation of a Go board and stones. In this article we want to draw the go stone using OpenGL. Unfortunately we can’t just tell the graphics card, “Hey! Please draw the intersection of two spheres with radius r and d apart with a bevel torus r1 and r2!”, because modern 3D graphics cards work by drawing triangles.| Gaffer On Games
Introduction Hi, I’m Glenn Fiedler. Welcome to Virtual Go, my project to create a physically accurate computer simulation of a Go board and stones. If you play Go, you know that a biconvex go stone has an interesting wobble when it’s placed on the board. This wobble is a direct consequence of its unique shape. I’d like to reproduce this wobble in Virtual Go, so let’s to spend some time studying go stone’s shape, so we can capture this wobble and simulate it on a computer :)| Gaffer On Games
Introduction Hi, I’m Glenn Fiedler. Welcome to Virtual Go, my project to create a physically accurate computer simulation of a Go board and stones. I’m a professional game programmer with 15 years experience in the game industry. Over the years I’ve worked for Irrational Games, Team Bondi, Pandemic Studios, Sony Santa Monica and most recently Respawn Entertainment. During my career I’m extremely proud to have worked on such games as ‘Freedom Force’, ‘L.| Gaffer On Games
Introduction Hi, I’m Glenn Fiedler and welcome to Networking for Game Programmers. Have you ever wondered how multiplayer games work? From the outside it seems magical: two or more players sharing a consistent experience across the network like they actually exist together in the same virtual world. But as programmers we know the truth of what is actually going on underneath is quite different from what you see. It turns out it’s all an illusion.| Gaffer On Games
Introduction Hi, I’m Glenn Fiedler and welcome to Networking for Game Programmers. In the previous article, we added our own concept of virtual connection on top of UDP. In this article we’re going to add reliability, ordering and congestion avoidance to our virtual UDP connection. The Problem with TCP Those of you familiar with TCP know that it already has its own concept of connection, reliability-ordering and congestion avoidance, so why are we rewriting our own mini version of TCP on ...| Gaffer On Games
Introduction Hi, I’m Glenn Fiedler and welcome to Networking for Game Programmers. In the previous article we sent and received packets over UDP. Since UDP is connectionless, one UDP socket can be used to exchange packets with any number of different computers. In multiplayer games however, we usually only want to exchange packets between a small set of connected computers. As the first step towards a general connection system, we’ll start with the simplest case possible: creating a virtu...| Gaffer On Games
Introduction Hi, I’m Glenn Fiedler and welcome to Networking for Game Programmers. In the previous article we discussed options for sending data between computers and decided to use UDP instead of TCP for time critical data. In this article I am going to show you how to send and receive UDP packets. BSD sockets For most modern platforms you have some sort of basic socket layer available based on BSD sockets.| Gaffer On Games
Introduction Hi, I’m Glenn Fiedler and welcome to Networking for Game Programmers. In this article we start with the most basic aspect of network programming: sending and receiving data over the network. This is perhaps the simplest and most basic part of what network programmers do, but still it is quite intricate and non-obvious as to what the best course of action is. You have most likely heard of sockets, and are probably aware that there are two main types: TCP and UDP.| Gaffer On Games
Introduction Hi, I’m Glenn Fiedler and welcome to Game Physics. In the previous article we discussed how to use spring-like forces to model basic collision response, joints and motors. In this article we’re going to discuss how to network a physics simulation. First Person Shooters First person shooter physics are usually very simple. The world is static and players are limited to running around and jumping and shooting. Because of cheating, first person shooters typically operate on a cl...| Gaffer On Games
Hello readers, I’m no longer posting new content on gafferongames.com Please check out my new blog at mas-bandwidth.com! Introduction Hi, I’m Glenn Fiedler and welcome to Game Physics. In the previous article we discussed how to simulate the motion of rigid bodies in 3D. Now we’re going to discuss how to implement spring physics. The physics behind springs is simple but extremely versatile and useful. You can use springs to link points together to model rope and string, cloth, and even ...| Gaffer On Games
Introduction Hi, I’m Glenn Fiedler and welcome to Game Physics. If you have ever wondered how the physics simulation in a computer game works then this series of articles will explain it for you. I assume you are proficient with C++ and have a basic grasp of physics and mathematics. Nothing else will be required if you pay attention and study the example source code. A physics simulation works by making many small predictions based on the laws of physics.| Gaffer On Games