# How the seed filter works

Every seed you play in Tascade has been hand-picked by a program, the seed filter. It sifts through huge numbers of random seeds and keeps only the ones that give you a real shot at a good run: a useful structure near spawn, a way to make a portal, and a Nether with a bastion and a fortress you can actually get to.

Here's how it decides what makes the cut.

## Two seeds per run

Every Tascade run actually uses **two** seeds: one for the Overworld and one for the Nether. In vanilla, the Nether is generated from the same seed as the Overworld. Tascade gives the Nether its own seed instead.

Why? Finding a seed where both the Overworld and the Nether are great is really rare. Finding a great Overworld and a great Nether separately is much easier. So the filter searches for the two independently, and then pairs them up into a single run. Both players in a match always get the same pair.

## Two stages: fast, then exact

The filter works in two steps.

**Stage 1, the finder.** A fast program built on [cubiomes](https://github.com/Cubitect/cubiomes) (a library that recreates Minecraft's world generation math) checks around 1,500 seeds a second. It looks at structure positions, biomes, the spawn area and Nether fortress layouts, and throws out anything that clearly won't work.

**Stage 2, the verifier.** Seeds that pass go to a Minecraft 1.16.1 server mod that runs the game's real world generation code: exact structure layouts, terrain, caves and ravines, and ruined portal pieces. It's much slower (about a quarter of a second per seed), but it has the final say. If the verifier says a chest is reachable or a portal can be finished, it really can.

To make sure the verifier isn't fooling itself, its predictions are regularly checked against fully generated vanilla worlds, block by block. Villages, temples, portal frames, lava, bastions and blaze spawners have all matched exactly.

## The Overworld

There are five kinds of Overworld seeds, and the pool has roughly the same number of each. The loading screen shows a picture of the seed type you got.

### Rules for every seed

- The main structure is within 320 blocks of 0,0.
- **The filter picks your spawn**, and Tascade puts you exactly there. It's 16 to 64 blocks from the structure, on flat, dry land with no water right next to it, on a landmass of at least 1,024 blocks, and never inside the structure itself.
- Trees, rivers and water are checked at Minecraft's biome scale, and a forest only counts if its chunks actually grow trees. (Sometimes a small forest gets decorated as beach or ocean and ends up with grass and no trees!)

### Village

- Not an abandoned village.
- At least one blacksmith chest with iron in it (weaponsmith, toolsmith or armorer).
- A river within 96 blocks and trees within 64.
- Tascade adds 3 small lava pools 48 to 96 blocks away, spread at least 48 blocks apart, so you can make a portal.

### Desert temple

- Not buried in sand: the entrance is clear and the ground around it is no more than 2 blocks above the floor.
- A river within 96 blocks and trees within 64.
- The same 3 lava pools as villages.

### Buried treasure

- You spawn on a beach, with wood within 64 blocks, at the spot closest to the treasure.
- A dense forest near spawn.
- A **magma ravine** within 96 blocks: a connected underwater canyon with at least 15 magma blocks, each with a lava source under it and open water above (so you can see the bubble columns). That's your lava for a portal.
- Tascade clears out every other chest and spawner structure within 128 blocks so the F3 pie chart leads you straight to the treasure.

### Shipwreck

- All the same beach, forest and magma ravine rules as buried treasure.
- A complete wreck with all three chests, and the treasure and supply chests can be reached without digging.
- The same 128 block clean area for an honest pie chart.

### Ruined portal

- The portal sits on the land surface or is partly buried, never underwater or deep underground.
- The chest can be reached without digging.
- Trees and water within 64 blocks.
- **The frame can always be finished**, one of two ways:
  - **Obsidian**: the chest has enough obsidian to fill the missing frame blocks.
  - **Lava**: there's at least as much lava next to the portal as there are missing frame blocks, so you can finish it with a bucket.
- Ruined portal seeds are split evenly between the two kinds.

The filter knows exactly what's in the chest before you ever open it, because Minecraft decides a chest's loot from the world seed when the chunk is generated. The verifier rolls the real loot table the same way the game does. Tascade only ever tops the chest up with flint and steel and iron, never obsidian, so an "obsidian" seed really has that obsidian in the chest.

The verifier also simulates the patch of netherrack that spreads under ruined portals, since it can eat into lava, frame blocks and even the chest itself. Seeds where it swallows the chest are thrown out.

## The Nether

The Nether seed is all about getting you to a bastion and a fortress without wasting time.

- **A bastion** whose center is within 160 blocks of 0,0, and at least 35% of it is open air, so it's exposed and easy to find. It can be any of the four bastion types.
- **No other treasure bastion** within 256 blocks of it.
- **Stables bastions** need at least one of their two side walls to be the gold variant (with 12 gold blocks) instead of the one with a single low chest.
- **A blaze spawner** within 192 blocks of the bastion. Its fortress piece is at least 30% open air and the nearby fortress is at least 25% open, so you can actually see it.
- **A fixed entry point**, which is where you arrive on your first trip to the Nether:
  - within 64 blocks of 0,0, and 48 to 96 blocks from the bastion
  - a clear pocket with solid ground to stand on
  - no lava within 4 blocks and no structures within 8
  - at least 400 spots you can walk to within 24 blocks, so you never start stuck in a wall pocket or on a tiny island
  - the portal faces toward the bastion
- **Clear paths.** You can get from the entry to the bastion, and from the bastion to the blaze spawner, without digging. Walking, jumping, dropping down, pillaring up and bridging over gaps or lava are all fine. The path can't be more than 3 times longer than the straight line distance.

## What the filter doesn't decide

The filter focuses on the early game. Strongholds, the End and anything far from spawn are just whatever vanilla generates for that seed. Things the filter can't see ahead of time, like exactly where trees and ponds end up, are handled by the mod in game: lava pools step around ponds and trees, and your spawn moves off a tree trunk if one grew in the way.

Loot, barters and drops aren't the filter's job either. The mod takes care of those so everyone on a seed gets the same luck. You can read all about that in [What's different from vanilla](vanilla-differences.md).
