Mods / Performant Crafting Grid
- Tags:
- Author:
- Emmett_chef
- Side:
- Both
- Created:
- 5 days ago
- Last modified:
- 4 days ago
- Downloads:
- 982
- Follow Unfollow 51
-
Recommended download (for Vintage Story 1.22.3):
performancecraftinggrid_0.1.1.zip 1-click install
O(1) crafting-grid recipe matching for Vintage Story. Pure performance — no gameplay change.
The problem
Every time an item enters or leaves the crafting grid, Vintage Story scans every distinct recipe ingredient in the game to figure out what you might be making — on both the client and the server, on every single change.
On the base game that's quick enough. On a heavy modpack with tens of thousands of recipes and a six-figure item registry, that linear scan balloons to milliseconds per keystroke, and dragging items around the grid starts to feel sticky.
What it does
It builds a recipe index once, when your world loads, that maps each item code straight to the recipes it can contribute to — wildcards and tags included. After that, matching the grid is a constant-time hash lookup per slot.
- O(1) per-slot match, regardless of recipe count
- 35–70× faster than the vanilla scan at base-game scale
- ~1 µs to match a grid once the index is warm
- 0 changes to recipes, items, or world data
The numbers
The win scales with your recipe count: the engine's cost grows with the number of recipes, while this stays flat. Measured in an isolated benchmark against the real engine matching logic.
| Scenario | Vanilla-style scan | This mod | Speedup |
|---|---|---|---|
| ~2,500 recipes | ~57 µs | ~1 µs | ~57× |
| ~2,650 recipes | ~73 µs | ~1 µs | ~72× |
| 100,000 recipes | ~22 ms | ~4 µs | ~5,800× |
Per single grid-match check. The "vanilla" column is a faithful transcription of the engine's own gather; both use the real recipe-matching predicate. In-game on a ~120k-item modpack, crafting goes from noticeably sticky to instant.
Costs are modest and one-time. The index build runs in the background at world load — about 0.2 s on the base game, up to ~4.5 s on a 120k-item modpack — and the index itself takes roughly 1 MB in vanilla, up to ~15 MB on a very large pack.
How it works
- Pre-expanded index. Wildcard and tag ingredients are resolved against the item registry once, so even they become direct code → recipe lookups instead of pattern scans.
- Built off the main thread. The one-time build runs on a background thread, prewarmed as your world loads — crafting never freezes waiting on it.
- Vanilla until ready. If you somehow craft before the index finishes, the game's own matcher handles it. There's never a wrong or missing result.
- Engine stays the authority. The mod only narrows down the candidate recipes faster; the engine's own recipe-match check still makes the final call, so outputs are identical to vanilla — bit for bit.
- Per-world, client and server. Each world builds its own index exactly once. Both sides benefit.
⚠️ This is a deep-engine Harmony patch
This mod doesn't add content — it replaces a core engine method (InventoryCraftingGrid.FindMatchingRecipe) at runtime using Harmony. It's built to be a transparent drop-in, but because it reaches into engine internals you should know:
- It targets a specific Vintage Story version's internals, and may break between VS patches.
- It can conflict with other mods that patch the same crafting-matching code (uncommon, but possible).
- It changes no world data, recipes, or items — it's safe to add or remove from an existing save at any time. If it ever misbehaves, removing it returns you to exactly stock behavior.
- It falls back to the unmodified engine matcher whenever its index isn't ready, so it never produces a wrong craft.
| Mod Version | Mod Identifier | For Game version | Downloads | Released | Changelog | Download | 1-click mod install* |
|---|---|---|---|---|---|---|---|
| 0.1.1 | performancecraftinggrid | 857 | 4 days ago | performancecraftinggrid_0.1.1.zip | 1-click install | ||
|
Packaging fix: removed two stray build-tool DLLs ( | |||||||
| 0.1.0 | performancecraftinggrid | 125 | 5 days ago | performancecraftinggrid_0.1.0.zip | 1-click install | ||
|
For VS 1.22.3 | |||||||
O(1) impressive
i'm curious if this mod is 'vibe-coded', mostly because of the AI image, though i really hope its not; cause i've been having a weird issue i think this could fix... potentially.
The logo is AI, the entire description is AI, I've had a dev confirm the code most definitely had an AI touch it. But the question is does it actually work, we're testing.
Update: Mod does as it says it does, and did fix the issue.
i suspected, thanks.
don't really need to know more, cause i don't care how good of an idea, or well executed a modder's ai idea is, if they can't describe their own code, and talk about it, i won't use it.
The testing numbers are obviously made up but the mod is just 3 c# scripts that look to do what they say (its open source) and vanilla's main issues are entirely in the UI/inventories so its definitely targeting a plausible place. Just do your own testing
Just wanted to say thank you! Now my loading time is back to normal. :)
Getting duplication bug when interacting with crates, can pull out infinite items also can't insert items back in, i removed this mod and that no longer happened.
Sick! How does this handle changes/patches to already indexed recipes?
Edit: nvm... just saw you mention it runs at world load. So I take it the index only exists in memory then?
What happens if I add mods that introduce new recipes after the world has already been created?
The mod rebuilds the index each time you load your world. You can add and remove recipes at any time before world load.
How does this affect the issue that some folks have been having with some recipes flickering/not working until the client is restarted due to server-client disconnect?
That issue is a vanilla bug.
I know it is, but will this make it worse due to messing with one of the ways it shows up?
just run my mod to fix this desync issue