ALGOSYNTAX BLOG

Same Seed, Same World: Deterministic Procedural Generation in Unreal Engine

November 23, 2026

Updated November 2026. Written by the Algosyntax team.

Quick answer: a deterministic generator builds the same world every time it gets the same seed and settings. In Unreal Engine that comes down to a few habits:

  • Use a seeded stream: FRandomStream in C++ or the “from Stream” nodes in Blueprints, never the global random functions.
  • Draw in a fixed order: the same calls, in the same order, over data in a fixed order.
  • Give each pass its own stream, so a change in one pass doesn’t re-roll the rest.
  • Keep time out: no frame time, physics or thread timing in the generation.
  • Same build, same content: float differences and code changes can still break it, so version your generator.

What determinism means

A generator is deterministic when its output depends only on its inputs. The inputs are more than the seed. They are the seed, every setting, the content it reads (meshes, data assets, presets) and the generator code itself. Keep all of them the same and you get the same world, down to the last tree. Change any of them and you may not.

Why it matters

  • Sharing worlds: players swap a seed instead of a save file.
  • Reproducing bugs: “seed 48213, medium size” opens the exact world a tester saw.
  • Multiplayer: send the seed, not the world. A few bytes replace thousands of placed objects, and every machine builds the same map.
  • Save files: store the seed and the player’s changes, not every generated object.

Use a seeded stream, not global random

The plain Random Integer and Random Float nodes, like FMath::Rand and FMath::FRand in C++, draw from one global generator. Any other code that draws a number in between shifts your sequence, so your world depends on whatever else ran that frame.

FRandomStream keeps its own seed. Nothing else draws from it unless you pass it along:

// Two independent streams, both derived from the world seed.
FRandomStream StreetStream(WorldSeed);
FRandomStream TreeStream(WorldSeed ^ 0x2C1B3C6D);

for (int32 BlockIndex = 0; BlockIndex < BlockCount; ++BlockIndex)
{
    float BlockWidth = StreetStream.FRandRange(4000.f, 8000.f);

    int32 TreeCount = TreeStream.RandRange(0, 12);

    BuildBlock(BlockIndex, BlockWidth, TreeCount);
}

Epic notes that the stream’s lower bits are poor, so use RandRange rather than the modulus operator for whole numbers.

Blueprints: the “from Stream” nodes

Blueprints have the same tool. Make a Random Stream variable, or use Make Random Stream, then draw with Random Integer In Range From Stream, Random Float in Range from Stream, Random Bool from Stream and their siblings. Epic’s Random Streams page lists them all. Two traps:

  • Each placed instance gets a new Initial Seed. Set the seed yourself with Set Random Stream Seed, or expose the variable and type it in the Details panel.
  • A pure node runs again every time a node that uses it runs. Wire one “from Stream” node into two places and you draw twice. Store the result in a local variable first.

Draw in a fixed order

A stream only repeats if you make the same calls in the same order. Watch for anything whose order you don’t control:

  • Results of Get All Actors Of Class, or a map filled in a varying order. Sort by a stable ID first.
  • Work split across threads that share one stream. Give each task its own stream, seeded from its index.
  • Assets that finish loading in a different order each run.

Why changing one setting re-rolls everything after it

Say one stream drives the whole generator: streets, then parks, then trees. You raise the park chance. More blocks become parks, each park draws a few extra numbers, and every tree after that point gets different numbers. One slider moved a forest on the other side of the map.

The fix is to stop passes sharing a stream, as in the snippet above. For large worlds, go further and seed each chunk from its coordinates, so a change stays inside its chunk. Unreal’s PCG framework works along these lines: the PCG component has a Seed, and every point carries its own seed.

Keep time out of the generation

Anything tied to the frame breaks repeatability: Delta Seconds, timers, “spawn one every 0.1 seconds” in Tick, the clock, or dropping rocks with physics and keeping wherever they land. Spreading work over several frames is fine, as long as the work happens in the same order and time never feeds into a value. Picking a fresh seed from the clock is fine too, as long as you store it.

Floating-point and platform caveats

The same build on the same machine gives the same floats every time. Across compilers, optimisation settings, CPUs or platforms, maths functions such as sine and cosine can differ in the last bit. Usually that is invisible. It matters when a value sits right on a threshold and decides whether a road gets built. From then on, the two worlds differ.

  • Make decisions on integers where you can, and keep floats for final positions.
  • Snap or round values before you compare them or use them as keys.
  • Test the same seed on every platform you ship, and compare a hash of the result.
  • Store a generator version with the seed. Changing your code or updating the engine can change old seeds.

An example: Any City Generator

Our Any City Generator follows these rules. Every draw comes from one FRandomStream seeded with your seed, in a fixed step order, so the same preset, size and seed give the same road layout. It also shows the trade-off above: changing a chance setting can change how many draws a pass makes, which re-rolls the passes after it. The road network isn’t replicated, so in a networked game you run the same generation request on every machine instead of sending the roads.

FAQ

Do I need C++ for deterministic generation?

No. The “from Stream” Blueprint nodes are enough. C++ helps when generation gets large or slow.

Can multiplayer clients generate the world themselves?

Yes, if every machine runs the same build with the same content. The server stays in charge of what players change. A hash of the generated world, checked when a client joins, catches mismatches early.

Should one seed drive everything?

Use one world seed that players can see and share, and derive the rest from it: a stream per pass, per chunk or per system. Never draw gameplay randomness, such as loot rolls, from a world stream, or playing changes what gets generated next.

Related articles

← All blog posts