How to make a game like Agar.io
An eat-and-grow arena runs on three curves: how size follows mass, how speed falls with size, and how fast big players shrink. Tune those and the game balances itself.

Key takeaways
- Track mass, derive radius from its square root, and make speed fall as radius grows. Those three lines are the whole balance.
- Eating needs a size margin, so equal players cannot eat each other and a near-equal chase stays tense.
- Big players must shrink slowly over time, or one player dominates the room forever.
Agar.io is the template for the eat-and-grow arena: every player is a round blob on a huge flat map, swallowing small pellets to gain mass and swallowing smaller players outright, while larger players hunt them. Bigger means slower, so small players can escape and big ones must plan. Splitting into pieces lets you lunge at prey at the risk of being eaten in parts. Building your own needs four things: a mass-to-size-to-speed formula, an eating rule with a size margin, splitting and merging, and a room server that handles dozens of players. Agar.io’s name and its specific design belong to its owner; the eat-and-grow genre is open, and it is a wonderful first multiplayer project.
Why eat-and-grow works
- One rule anyone gets in a second: bigger eats smaller.
- Built-in rubber banding. Big is powerful but slow and a juicy target. Small is weak but fast. Neither feels hopeless.
- Emergent stories. Alliances, betrayals, a giant cornered by three tiny players. None of it is scripted.
- A screen that tells you how you are doing. Your size relative to others is the score, visible at every moment.
The three formulas
Store mass for each blob. Derive everything else from it. These are starting formulas, not anyone’s exact values:
- Radius = k × √mass. Area grows with mass, so a blob ten times heavier is about three times wider. With k around 4 and a starting mass of 10, a new player has a radius of about 13 units.
- Speed = base ÷ radius^0.4 (or similar), clamped to a minimum. Small blobs zip around; big ones cruise. The exponent controls how harsh size is: closer to 0.5 punishes big players more.
- Decay: each second, blobs above a threshold lose a small fraction of their mass (around 0.1% to 0.2% per second is a reasonable place to start). It barely touches small players and steadily pulls giants back toward the pack.
The camera should zoom out as the player grows, so a large blob still sees enough of the map to plan. Tie the zoom to radius, with smoothing, and cap it.
The eating rule
A blob can eat another when two things are true: it is sufficiently bigger (choose a margin, for example 15 to 25% more mass), and the smaller one’s center is inside the bigger one’s circle, or most of the way in. The margin matters: without it, two equal players bump endlessly or one eats the other by a rounding error. The eaten blob’s mass is added to the eater, and the eaten player sees a quick respawn screen.
Pellets are tiny fixed-mass food scattered at a target density. Respawn them at random to keep that density as players eat. Pellets are the slow, safe way to grow; players are the fast, risky one.
Splitting, ejecting and hazards
- Split: a blob above a minimum mass splits into two halves; the front half launches forward at high speed, then slows. It is the lunge attack. Pieces that split cannot merge back for a cooldown (around 15 to 30 seconds as a starting point, longer for bigger pieces), so a split is a commitment.
- Merging: after the cooldown, pieces belonging to the same player that touch merge back together. Until then they push apart slightly so they do not overlap.
- Eject: a blob can shoot out a small chunk of its own mass. It lets players feed allies, bait enemies or push hazards.
- Hazards: fixed obstacles that small blobs can hide behind but that break big blobs into many pieces when touched. They protect small players and punish careless giants.
Movement is pointer-driven: each piece moves toward the cursor (or thumb joystick direction on phones) at its own speed. The top-down movement guide covers joystick dead zones and smoothing for phones.
Rooms, ticks and fairness
The room server owns all blobs and pellets and runs the simulation at about 20 to 30 ticks per second. Clients send a target direction and button presses; the server answers with snapshots of what is near each player, and clients interpolate for smooth motion. Use a spatial grid for both eating checks and pellet lookups. Keep rooms to a size the map can hold (30 to 60 players on a large map), spin up another room when one fills, and fill quiet rooms with simple bots that wander, eat pellets and flee anything bigger.
Previews on Startbase run a room server on every plan, and publishing it with the game is on paid plans (Multiplayer, pricing). The realtime features guide explains the difference between room servers and simple realtime updates, and the .io game guide covers the genre more broadly.
Three twists that make it yours
- 01Color matters. Each player picks one of three colors in a rock-paper-scissors loop. You can eat a blob of the color you beat even if it is a little bigger, and you are vulnerable to the color that beats you. Size is still king, but the margin bends.
- 02Territory. Wherever a blob moves, it tints the floor its color. Mass slowly regenerates on your own color and decays on others’. Players now defend areas instead of drifting.
- 03Rounds with an ending. Ten-minute rounds, the map shrinks in the last two, and the biggest blob at the end wins the round. It gives every session a climax and a winner to share.
A brief for an original eat-and-grow arena
An online eat-and-grow arena game called Inkpond, browser and phones. Each player is a drop of colored ink spreading in a large circular pond seen from above. The drop moves toward the pointer or thumb joystick. Mass sets the radius (radius = 4 × square root of mass) and speed falls as the drop grows. Absorb tiny floating seeds to grow slowly. Absorb another player’s drop when you have at least 20% more mass and their center is inside your circle. Press split to launch half of your drop forward as a lunge; pieces rejoin after 20 seconds. Lily pads drift slowly across the pond: drops smaller than a pad can slip under it and hide, while bigger drops are pushed aside by it. Drops above 500 mass lose 0.15% per second. Twist: each player chooses red, blue or yellow ink; red can absorb blue at equal size, blue beats yellow, yellow beats red. The room server simulates at 25 ticks per second with a spatial grid, sends only nearby drops, and fills rooms to 25 with bots. Live top 10, camera zooms out as you grow, and a quick respawn card showing your best size.
Pitfalls
- No decay. Without it, the first player to get big stays big all day and new players quit.
- Speed too similar across sizes. If big blobs are almost as fast as small ones, escape is impossible and the game becomes a slaughter.
- Sending the whole map. Bandwidth and phone performance collapse. Send only what is near each player.
- Empty rooms. Bots, or merge low-population rooms, so a new player never lands alone.
Frequently asked questions
How does size and speed work in eat-and-grow games?
Mass is stored, radius is proportional to the square root of mass, and speed decreases as radius grows. Tuning the speed exponent decides how much being big slows you down.
How much bigger does a player need to be to eat another?
Pick a margin, commonly somewhere between 15% and 25% more mass, so equal players cannot eat each other. Combine it with requiring the smaller center to be inside the bigger circle.
Do I need a server for an eat-and-grow game?
Yes. A room server must own positions and decide who eats whom, or players could cheat by reporting their own size.
Can I use the same name or style?
No. The original’s name and specific design belong to its owner. Make your own theme, art, name and at least one rule twist.

