Open toyboot4e opened 3 years ago
I made yet another generational arena: toy_arena. The Arena<T, D, G>
can accept distinct type parameter D
, and it's perfect for duplicating the internal game Model
:
pub struct Game {
system: GameSystem,
view: GameView,
}
/// Model + view game state that is synced to the internal `GameSystem
pub struct GameView {
vm: Model<Self>,
}
/// Model-only game system
pub struct GameSystem {
loop_: TurnBasedGameState,
model: Model<Self>,
}
/// Internal game state
pub struct Model<D> {
entities: Arena<EntityModel, D>,
map: MapModel,
}
No I have to not use the D
parameter, or else I can't apply same Change
to another Model
Three-Worlds Theory: Art or Gameplay? Pick Two. - Box Dragon is my favorite article this year. I'm switching to that strategy.
The idea is duplicating the internal game state; use one for the internal game progress, and sync the other to the progressing world for visualization. So we don't need to be bothered with "stop and resume" state handling; the control is on our hands!