Skip to main content

Blog Archive

How ROBLOX Is Improving Its Network Physics

March 19, 2012

by Kevin He


ROBLOX VehicleIf you drive a real-life car into a brick wall, the car doesn’t simply bounce back. With enough speed, it causes the brick wall to come crashing down in a destructive display of physics. (Just trust us on this.)

To make sure these kinds of things happen in ROBLOX, as in the real world, ROBLOX Senior Game Engine Developer Kevin He has made some improvements to ROBLOX’s distributed physics engine. Today, he’ll show us the improvements with a number of video demos.

Simulating Physics

Simulating physics – like a car colliding with a wall or a player character getting hit by a car – in a ROBLOX game with multiple players poses unique challenges. ROBLOX uses a distributed physics (DPhysics) engine, which divides the processing load among in-game players and the server hosting the game. The DPhysics engine scales well and keeps every player in sync with the action.

Each player has a “buffer zone” that determines the physics their computer processes. While this helps spread the processing load, we have recognized the room for improvement: for example, if a player “owns” some piece of a level within their buffer zone – let’s say they’re standing on a simple block – you might, in some cases, not be able to knock it over with a vehicle. The same holds true for a vehicle colliding with a player character. Instead of entering a “ragdoll” state, there are cases where the character remains standing.

Buffer Zones

Buffering Zones Before Fixes

The red balls indicate where players' simulation zones overlap.

This image shows an area we’re improving. There are four players clustered in the center of the level. Only the red balls are shared between the blue player and the other three players, and they’re far away. That means the other players can’t affect the objects in the blue player’s immediate vicinity.

This video shows the inconsistency in action. The vehicle can’t knock down the block “owned” by the other player or knock down the player. This is the result of an overly thin buffer zone between the players.

The Fixes

Buffering Zones After Fixes

Note the much larger shared buffer zones after the tweaks.

Our fixes tweak the buffer zones to create a softer edge; an overlap in who-controls-what. In other words, they make physics happen the way you’d expect.

This image shows the tweaked buffer zones for the purple player at the bottom. The number of red balls has dramatically increased, meaning much of the territory – most importantly, the common territory in the middle – is shared between all four players.

See It In Action

Watch this video to see how vehicles and characters respond under the tweaked DPhysics engine.

[do action=”youtube-iframe” videoid=”nISvYnB9NbE”/]

As this video shows, we’re also working on a new “ragdoll” state for the player character in ROBLOX. The ragdoll state simulates realistic body physics during an event like a car collision. It also works for projectiles, as previewed in this video:

The above is still work in progress. We’re interested in your feedback on the DPhysics and ragdoll changes we’re making to ROBLOX.