Drop protocol.md; rewrite the tick-loop note around the game-loop-driven sim and the intent model; rewrite the roadmap (network items removed, sim/game crate layout, save/load and NPC blocking added); fix crate paths in the remaining notes. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
1.6 KiB
Executable File
Asset Loader
Current state
TGA loading is implemented in game/src/assets.rs. Image::from_tga(path) reads the file,
parses the 18-byte header, skips the colormap block, and returns an Image — supporting
type 1 (uncompressed) and type 9 (RLE) via the private decode_rle() function in the same
module. game.rs uses it directly: Image::from_tga("assets/tilesets/overworld.tga").
Image also provides to_tileset() -> Vec<[u8; 64]>, which splits the image into 8×8
tiles row-major. Every tile is emitted; tile ID is the flat row-major index into the Vec,
so tiles are never skipped or reordered. (Transparency is a per-pixel concern handled at
blit time by blit_tile, not by the splitter.)
AssetStore (a named registry) is not yet implemented. Assets are currently loaded
inline in Game::start().
Goal
Add an AssetStore so that game code can ask for an asset by name rather than loading
files directly at the call site.
Design notes
Imagestruct:width: u32,height: u32,pixels: Vec<u8>— done.- A simple
AssetStorecould be aHashMap<&'static str, Image>loaded at startup. - No streaming needed — the whole game is small enough to load everything upfront in
start(). - Palette index 0 is transparent when blitting sprites. This convention is enforced by
blit_tile()inpixelhelper.rs; the loader itself does not need to handle it. - Pixel assets are stored as flat
Vec<u8>of palette indices, row-major, width × height bytes. - Future: consider embedding assets with
include_bytes!to produce a single binary.
Open questions
- Should
AssetStorehold pre-split tilesets too, or just rawImagevalues?