93 lines
2.4 KiB
Rust
93 lines
2.4 KiB
Rust
use std::collections::HashMap;
|
|
|
|
// todo: activity of objects and players, including any tile map updates that may happen
|
|
|
|
const CHUNK_SIZE: usize = 64;
|
|
|
|
|
|
/// A tileset is a set of unique tile graphics (indexed by integers).
|
|
pub struct Tileset {
|
|
pub tile_width: u16,
|
|
pub tile_height: u16,
|
|
}
|
|
|
|
|
|
pub struct CollisionTileset {
|
|
// todo: ???
|
|
}
|
|
|
|
|
|
pub struct GameObject {
|
|
|
|
}
|
|
|
|
|
|
pub struct Script {
|
|
|
|
}
|
|
|
|
|
|
/// Regions represent the largest kind of area. Regions are made up of zones, with hard loading
|
|
/// screen transitions between regions. Eventually, regions will also be able to specify custom
|
|
/// system requirements so that retro/low-spec systems will be able to connect to simpler regions.
|
|
pub struct RegionData {
|
|
pub tilesets: HashMap<String, Tileset>,
|
|
pub zones: Vec<ZoneData>,
|
|
/// A list of scripts that exist at the region level. These are loaded and unloaded whenever
|
|
/// a player moves between regions, but are otherwise persistent within a region.
|
|
pub region_scripts: Vec<Script>,
|
|
}
|
|
|
|
|
|
/// Zones are the pieces that make up regions, and are themselves made up of chunks.
|
|
/// Zones have screen-scroll transitions or warps between them.
|
|
pub struct ZoneData {
|
|
/// The chunks that make up this zone, aligned to a 64x64 tile (chunk-sized) grid.
|
|
pub chunks: HashMap<(i32, i32), ChunkData>,
|
|
/// A map of game objects, which can, but don't need to be, aligned to the tile grid.
|
|
pub objects: HashMap<(f32, f32), GameObject>,
|
|
/// A list of scripts that exist at the zone level. These are loaded and unloaded whenever
|
|
/// a player enters or leaves a zone.
|
|
pub zone_scripts: Vec<Script>,
|
|
}
|
|
|
|
|
|
/// Chunks are the smallest area division, made up of 64x64 tiles. Multiple chunks within the same
|
|
/// zone have free scrolling between them, so they can make up arbitrarily-large "screens".
|
|
/// Chunks within a zone are themselves aligned to a grid with each cell 64x64 tiles large.
|
|
pub struct ChunkData {
|
|
pub graphic_layers: Vec<TileLayer>,
|
|
pub collision_layer: CollisionLayer,
|
|
pub metadata_layer: MetadataLayer,
|
|
}
|
|
|
|
|
|
pub struct TileLayer {
|
|
pub tiles: [[TileData; CHUNK_SIZE]; CHUNK_SIZE],
|
|
}
|
|
|
|
|
|
pub struct CollisionLayer {
|
|
pub tiles: [[TileCollision; CHUNK_SIZE]; CHUNK_SIZE],
|
|
}
|
|
|
|
|
|
pub struct MetadataLayer {
|
|
pub tiles: [[TileMetadata; CHUNK_SIZE]; CHUNK_SIZE],
|
|
}
|
|
|
|
|
|
pub struct TileData {
|
|
|
|
}
|
|
|
|
|
|
pub struct TileCollision {
|
|
|
|
}
|
|
|
|
|
|
pub struct TileMetadata {
|
|
|
|
}
|