DGuard

Pre-generating your world: stop chunk generation lag

Generating new chunks is one of the heaviest things a server does. Set a world border, pre-generate everything inside it with Chunky before launch — and players on elytras won't tank your TPS anymore.

The DGuard team6 min read

The order: set a world border with /worldborder set, install the Chunky plugin and run chunky worldborder and chunky start in the console. Then repeat for the Nether and the End. Ideally do it before the server opens, while nobody's online. From then on the server just reads finished chunks from disk instead of building them on the fly.

Why chunk generation causes lag

To create a new chunk the server builds terrain, caves, ores and structures, calculates lighting and writes the result to disk. Loading a chunk that already exists is far cheaper. While players stay in explored areas there's almost no generation. But once someone flies an elytra into unexplored land, the server starts building dozens of new chunks and the tick no longer fits into 50 ms.

It's especially noticeable on anarchy and survival servers with big worlds. Cheaters using ElytraFly and BoatFly fly faster than honest players and load generation hardest of all. To confirm the lag really comes from generation, take a spark profile — see why your server lags.

Step 1. Set a world border

The border limits how much world can exist at all. Without one there's nothing to pre-generate: the world is endless. The command takes a diameter in blocks, not a radius: /worldborder set 10000 means 5,000 blocks in each direction from the center.

A 10,000 × 10,000 border around 0, 0
/worldborder center 0 0
/worldborder set 10000
/worldborder get
  • Since 1.21.9 every dimension has its own border: the command only changes the one where it runs. Set the Nether and End separately, for example /execute in minecraft:the_nether run worldborder set 5000.
  • Remember that one block in the Nether equals eight in the Overworld, so the border there can be smaller.
  • If you want the border to grow gradually, note that since 1.21.11 the time argument is in ticks, with an s suffix for seconds.
  • Mobs don't spawn naturally outside the border. So pre-generate inside the border, not beyond it.
  • There's also a hard cap in server.properties: max-world-size, the distance from the center to the border in blocks (29999984 by default). For pre-generation /worldborder is handier: you change it with a command, without editing a file and restarting.

Step 2. Pre-generate with Chunky

Chunky is a plugin that generates chunks ahead of time. It runs on Paper, Spigot, Folia, Fabric, Forge, NeoForge and Sponge and is licensed GPL-3.0. Tasks can be paused and resumed later, and progress shows right in the console.

  1. 1

    Install it

    Download Chunky from Modrinth, put it in plugins/ and restart. Type chunky in the console — if it replies with a list of commands, it works. How to install plugins in general: installing a plugin.

  2. 2

    Pick the world and area

    chunky world world selects the world, chunky worldborder matches center and radius to the border from step 1. Without a border use chunky center 0 0 and chunky radius 5000: the radius is in blocks.

  3. 3

    Start

    chunky start. Chunky prints progress, rate and time remaining to the console; in game use chunky progress.

  4. 4

    Control the task

    chunky pause pauses and saves progress, chunky continue resumes, chunky cancel stops the task — chunks already generated stay.

Server console (in game, add a slash)
chunky world world
chunky worldborder
chunky start
chunky progress

Step 3. The Nether and the End

Players build portals and fly around the End on elytras — these worlds generate the same way. Repeat the steps for each, changing only the world. On Paper 1.21.x the default worlds are world_nether and world_the_end; Chunky's docs also mention the_nether and the_end. Since 26.1 Paper stores dimensions differently, under world/dimensions/, so if Chunky can't find a world, check its name on your server.

Nether and End on Paper 1.21.x
chunky world world_nether
chunky worldborder
chunky start

chunky world world_the_end
chunky worldborder
chunky start

When to pre-generate: before launch

Chunky's docs advise pre-generating before players join: it's usually faster, and gameplay doesn't suffer. The best time is before the server opens or right after a wipe; next best is a night with minimal online.

Speed depends on hardware: per Chunky's docs, what matters most is a fast single-thread CPU, enough threads, an SSD and at least 4 GB of RAM. How much to give your server: how much RAM you need.

Disk space and backups

Worlds don't grow linearly: area is the square of the radius, so a 10,000 radius takes roughly four times the space of a 5,000 one. Estimate the size in advance — Chunky recommends a world size calculator for that. And remember that backups grow with the world: see server backups.

Pre-generation and your anticheat

TPS drops hit the whole server, and the anticheat is no exception: time-based checks see things during lag that never happened. A pre-generated world removes one of the common sources of those drops. On top of that, DGuard builds up evidence instead of banning on a single flag: a ban needs 400 points across three separate episodes, so one lag spike won't punish an honest player. It checks ElytraFly and BoatFly on every plan.

FAQ

Does /worldborder set take a radius or a diameter?

A diameter. /worldborder set 10000 puts the border 5,000 blocks from the center in each direction; in Chunky that matches a radius of 5000.

What radius should I pre-generate?

Chunky's docs suggest starting smaller, for example 5000, and increasing as needed. Base it on your player count, game mode and free disk space: world size grows with the square of the radius.

Can I pre-generate while players are online?

You can, but generation will be slower and players will lag more. It's better to do it before launch or during your quietest hours.

What happens if the server restarts during pre-generation?

The task won't resume on its own: continue-on-restart is off by default in Chunky. Run chunky continue and it picks up where it stopped.

Do I need to pre-generate the Nether and the End?

Yes, if players go there: those worlds generate the same way and drop TPS just as much. Repeat chunky world and chunky start for each one.

Sources

All sections

Run the best anticheat for modern Minecraft

DGuard catches all 47 kinds of cheats in our comparison — the closest rival, Intave, has 27. Full protection on every plan, free up to 30 players online.