Rapheal RobinsonSite Reliability Engineer & Game Developer

← Blog & Chat

engineering learning

Frustrations with PvP combat networking in TPS game servers

Projectiles, movement and lag in a game that only updates 10 times a second.

Part of Arcana

Arcana’s server runs at 10 ticks per second: one update every 100 ms. For fighting monsters that’s fine. Enemies move in patterns, and you dodge their bullets on your own screen.

PvP is different. Your target is a person who is also dodging, and at 10 TPS a sprinting player can move almost a whole tile between updates. Shots that clearly hit on your screen missed on the server. Players teleported around. It was hell.

So we’re doing a full PvP rewrite. Here’s where it stands.

Who decides a hit

The shooter’s game says “I hit them”, and the server checks the claim:

If anything fails it’s just a miss. The server never says why, so a modified client can’t use it to learn the limits.

Faster movement, only where it matters

The game stays at 10 TPS, which keeps everything else cheap. On the PvP island, movement runs faster: players send their position about 30 times a second instead of 10, and the server passes hostile players’ positions to each other between ticks, up to every 30 ms, for the 32 nearest players. Everywhere else nothing changes.

Other players glide smoothly between updates, and the glide adapts to how steadily updates arrive. Smooth movement is always on now; it used to be an option.

High ping vs low ping

When you shoot, you’re aiming at where the other player was when your game last heard from them. So the server rewinds the target by your ping plus that display delay.

Keeping it cheap

Rules that keep it fun

You get 15 seconds of protection when you arrive, and you can’t attack during it either. Attacking tags both players for 15 seconds, so nobody can teleport out of a fight. Hits on players do a fraction of their normal damage, so a fight takes more than a couple of shots. And if you die, you drop everything, which is why the island’s loot is boosted.

What’s next

Dozens of automated tests cover the hit rules, the rewind, the relay and the movement limits, and we test against simulated lag, jitter and stalls. What’s left is the real thing: big fights with real players on real connections.

Comments

    Your email is never shown or shared. It's only used to email you when someone replies, after you confirm it, and every email has a link to stop them. To prevent spam, the server keeps your IP address and a random ID saved in this browser.