perf: SmallVec inline storage, TOML drop tables, seeded deterministic RNG

- SmallVec<[DropEntry; 2]> replaces Vec in DropTable: zero heap allocation for
  all current tiles (0 or 1 entries), spills to heap only at 3+
- DropEntry fields packed to u8 (chance_pct, min_count, max_count): ~12 bytes ->
  4 bytes; derives Copy so no extra clones
- Replaced SystemTime pseudo-RNG with dig_rng(pos): PCG-style hash of world SEED
  + tile position. Deterministic per world, same dig = same roll every time
- TOML-driven drop tables: assets/drop_tables.toml (grass=5%/1-2, rock=10%/1,
  dirt/air=none). TOML parsed at startup into DropTableRegistry resource
- OnceLock global map for async terrain generation tasks to access drop tables
  without Bevy resource borrowing
- terrain.rs: DropTableRegistry::global_get("tile") replaces hardcoded drop_table_for
This commit is contained in:
2026-03-21 16:06:41 +00:00
parent f03651e0cf
commit 5b563bad67
7 changed files with 124 additions and 59 deletions
Generated
+1
View File
@@ -2444,6 +2444,7 @@ dependencies = [
"rayon",
"rustc-hash 2.1.1",
"serde",
"smallvec",
"toml",
]