Drop the chunk palette; chunks are plain u16 tile arrays
The 64-entry per-chunk palette was a wire-format artifact and capped a chunk at 64 distinct tiles. A Chunk is now Box<[u16; 1024]> with flags derived from the id on lookup — the same layout a binary on-disk format would use. Map path becomes the first CLI argument; assets/map_large is a generated 256×256 stress map (loads in ~0.5 ms release). The snapshot test takes SNAPSHOT_MAP. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
5a055c048d
commit
1d14076468
+4
-6
@@ -69,16 +69,14 @@ impl Sim {
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use crate::chunk::{Chunk, TileDef, TileFlags};
|
||||
use crate::chunk::Chunk;
|
||||
use crate::player_action;
|
||||
|
||||
/// Open floor (id 1) with a single wall tile at (5, 4) — id 146 is collidable in
|
||||
/// the tile vocabulary.
|
||||
fn open_world() -> World {
|
||||
let mut w = World::new();
|
||||
w.set_chunk(0, 0, Chunk::generate(|lx, ly| {
|
||||
// A single wall tile at (5, 4).
|
||||
let flags = if (lx, ly) == (5, 4) { TileFlags::COLLIDABLE } else { 0 };
|
||||
TileDef { tile_id: 1, flags: TileFlags(flags) }
|
||||
}).unwrap());
|
||||
w.set_chunk(0, 0, Chunk::generate(|lx, ly| if (lx, ly) == (5, 4) { 146 } else { 1 }));
|
||||
w
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user