1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
//! # dotzuki-engine
//!
//! Core trait definitions for a JRPG engine framework.
//!
//! This crate defines the foundational abstractions that any JRPG engine
//! implementation must provide. It has **zero dependency** on specific game
//! data — all types are generic associated types or marker traits that
//! the implementing crate supplies.
//!
//! ## Design Philosophy
//!
//! The traits in this crate follow these principles:
//!
//! - **Generic over game data**: No concrete game-specific, item, or move types.
//! All identifiers are associated types bounded by `Copy + Eq + Hash + Debug`.
//! - **Provider pattern**: Data providers (tilesets, maps, palettes, tile
//! metadata, render data) are obtained through a single `GameData` master
//! trait, enabling dependency injection and testing.
//! - **No I/O, no platform**: This crate contains only trait definitions
//! and simple data types. No file loading, no GPU code, no platform calls.
//!
//! ## Modules
//!
//! | Module | Contents |
//! |--------|----------|
//! | [`tileset`] | `TilesetTrait` and `TilesetProvider` — tileset loading and querying |
//! | [`tile_meta`] | `CollisionType`, `TileMetaTrait`, `TileMetadata` — collision and terrain |
//! | [`tilemap`] | `TilemapEntry`, `Tilemap` — 16-bit tilemap with per-tile metadata |
//! | [`map`] | `MapTrait`, `MapProvider`, `MapConnection` — map data and connections |
//! | [`palette`] | `PaletteTrait`, `PaletteProvider` — colour palette lookups |
//! | [`render_data`] | `RenderData` — display-name and metadata lookups for moves, items, species |
//! | [`save`] | `SaveData`, `SaveManager`, `SaveStorage`, `SaveError` — save/load with CRC16 |
//! | [`link`] | `NetworkTransport<M>`, `TransportError`, `ChannelTransport<M>`, `LinkRole`, JSON-line `link::codec` — game-agnostic link-play transport seam (zero-I/O) |
// no_std port (GBA / thumbv4t):
// - On bare-metal targets (`target_os = "none"`) the crate builds without
// std; a nightly-only `prelude_import` re-injects the alloc items
// (`Vec`, `String`, `Box`, `vec!`, `format!`, …) plus the core prelude so
// the existing code needs no per-module import churn.
// - On hosted targets the crate keeps std (stable-toolchain compatible —
// required for the engine-dsl build-dependency path), which is why
// `no_std` itself is cfg-gated rather than unconditional.
// `prelude_import` is internal to the compiler; the lint is expected noise.
extern crate alloc;
use *;
use Debug;
use Hash;
/// Master trait that provides access to all game data subsystems.
///
/// `GameData` is the central dependency-injection point for the engine.
/// Implementations supply concrete types for tilesets, maps, palettes,
/// tile metadata, moves, items, and species, along with provider objects
/// that serve the corresponding data.
///
/// # Type Parameters
///
/// * `Tileset` — A [`TilesetTrait`](tileset::TilesetTrait) implementation
/// (typically an enum of tileset IDs).
/// * `Map` — A [`MapTrait`](map::MapTrait) implementation (typically an
/// enum of map IDs).
/// * `Palette` — A [`PaletteTrait`](palette::PaletteTrait) implementation
/// (typically an enum of palette IDs).
/// * `TileMeta` — A [`TileMetaTrait`](tile_meta::TileMetaTrait) implementation
/// for tile collision lookups.
/// * `Move` — The move/ability ID type (`Copy + Eq + Hash + Debug`).
/// * `Item` — The item ID type (`Copy + Eq + Hash + Debug`).
/// * `Species` — The species/monster ID type (`Copy + Eq + Hash + Debug`).
///
/// # Example
///
/// ```ignore
/// struct MonsterGameData;
///
/// impl GameData for MonsterGameData {
/// type Tileset = TilesetId;
/// type Map = MapId;
/// type Palette = PaletteId;
/// type TileMeta = TileMetaId;
/// type Move = MoveId;
/// type Item = ItemId;
/// type Species = SpeciesId;
///
/// fn tileset_provider(&self) -> &dyn TilesetProvider<Self::Tileset> {
/// &MY_TILESET_PROVIDER
/// }
/// // ... etc
/// }
/// ```