56 · Procedural · 2D and 3D

Chunk streaming

Load the world around the player, unload the rest.

A big or endless world does not fit in memory, and generating it all at once takes forever. Splitting it into chunks and only keeping those within a radius of the player loaded lets the world be any size. Load in the background a little ahead, and unload with some slack so walking on a border does not thrash.

←→↑↓ moveH hysteresis on/offDrag to move the player

Try this: Walk back and forth across a chunk border with hysteresis off: chunks load and unload constantly. Turn it on (H).

Loaded 0Loads + unloads 0

Move around.

Prompt bit

Works for 2D or 3D in any engine (Unity, Unreal, Godot, web). Paste the short one for a quick fix, or the detailed one when you want it done properly.

Stream the world in chunks: keep chunks within a load radius of the player, load them off the main thread within about 0.1 s, unload only beyond the radius plus one chunk so pacing a border never thrashes, and save edited chunks before unloading.

44 words · one sentence to paste as is

Where it's used

Common mistakes

Loading on the main thread so the game hitches, unloading at the same radius so the border thrashes, losing player edits when chunks unload, loading in random order instead of nearest first, and entities falling through unloaded ground.

Writing this with an AI assistant? See our best AI coding assistants for game developers.

Missing a concept? Request one.

Related concepts

New concepts, in your inbox.

One short email when we add new concepts, plus our weekly roundup of AI tools for game devs. Unsubscribe any time.