Skip to main content

Module overworld

Module overworld 

Source
Expand description

Overworld systems, in two tiers — pick the one that matches the game:

  • actor — simple, render- & map-agnostic. OverworldActor + the tiny OverworldCollision trait (is_blocked(i32, i32)): held-direction → tile step → walk animation, and nothing else. For lightweight, non-Game-Boy games whose maps aren’t block/tileset based — e.g. the wuxia game and the minimon example, which plug in their own render backend (GB tiles vs a full-colour sprite sheet). The actor returns frame indices, never pixels.

  • player_movement + collision + map_transitions + sprites — rich, Game-Boy-faithful. try_move/advance_step over MapTrait + TilesetTrait with u8 / 4×4-block coordinates, modelling the full classic JRPG overworld: ledge jumps, warps, map-edge connections, tileset-aware collision, OAM sprites, NPC movement scripts, wild encounters. Used by pokered (the flagship), which drives it directly (pokered-core::overworld just re-exports).

Both tiers share types::Direction. They are intentionally separate: the rich tier is a strict superset of behaviour, so collapsing the flagship onto the simple actor would lose fidelity for no gain. New simple games use actor; JRPG-grade games use the rich tier.

Re-exports§

pub use collision::check_movement_collision;
pub use collision::check_sprite_collision;
pub use collision::check_warp_at_position;
pub use collision::direction_to_pad_input;
pub use collision::direction_to_sprite_facing;
pub use collision::get_block_at;
pub use collision::get_target_coords;
pub use collision::is_facing_map_edge;
pub use collision::CollisionProvider;
pub use collision::CollisionResult;
pub use collision::SpritePosition;
pub use collision::PAD_DOWN;
pub use collision::PAD_LEFT;
pub use collision::PAD_RIGHT;
pub use collision::PAD_UP;
pub use collision::SPRITE_FACING_DOWN;
pub use collision::SPRITE_FACING_LEFT;
pub use collision::SPRITE_FACING_RIGHT;
pub use collision::SPRITE_FACING_UP;
pub use encounter::EncounterEngine;
pub use encounter::EncounterMode;
pub use encounter::EncounterProvider;
pub use encounter::EncounterStep;
pub use npc_interaction::check_line_of_sight;
pub use npc_interaction::check_sign_interaction;
pub use npc_interaction::mark_defeated;
pub use npc_interaction::try_interact;
pub use npc_interaction::InteractionResult;
pub use npc_interaction::LineOfSightResult;
pub use npc_movement::direction_toward;
pub use npc_movement::get_npc_positions;
pub use npc_movement::is_scripted_move_done;
pub use npc_movement::npc_at_position;
pub use npc_movement::npc_at_position_mut;
pub use npc_movement::npc_in_front_of_player;
pub use npc_movement::start_scripted_move;
pub use npc_movement::update_npc_movement;
pub use npc_movement::NpcRuntimeState;
pub use npc_movement::NPC_MAX_DELAY;
pub use npc_movement::NPC_WALK_FRAMES;
pub use player_movement::advance_step;
pub use player_movement::direction_delta;
pub use player_movement::frames_per_step;
pub use player_movement::get_tile_at_position;
pub use player_movement::opposite_direction;
pub use player_movement::process_frame;
pub use player_movement::try_move;
pub use player_movement::InputState;
pub use player_movement::MoveResult;
pub use player_movement::WALK_COUNTER_INIT;
pub use types::Direction;
pub use types::MapConnection;
pub use types::MapConnections;
pub use types::MapData;
pub use types::MovementState;
pub use types::NpcDefinition;
pub use types::NpcMovementType;
pub use types::OverworldInput;
pub use types::OverworldState;
pub use types::PlayerState;
pub use types::Sign;
pub use types::TransportMode;
pub use types::WarpPoint;

Modules§

actor
Render- and map-model-agnostic overworld walking actor.
collision
Generic collision detection for the overworld.
encounter
Game-agnostic wild-encounter + battle-handoff control flow (P0d).
event_flags
map_transitions
npc_interaction
Generic NPC interaction system — talk, line-of-sight, sign interaction.
npc_movement
Generic NPC movement system for the overworld.
player_movement
Generic player movement system for the overworld.
sprites
types
Core overworld type definitions for a JRPG engine.