Systems Module
The systems module contains game systems like fog of war, trading, combat, and respawning.
Fog of War
- class simulation_framework.src.systems.fog_of_war.FogOfWar(world_width: int, world_height: int)[source]
Bases:
object
Manages what each agent can see and remember
- can_see_entity(agent_id: int, entity: Entity) bool [source]
Check if an agent can currently see a specific entity
- can_see_tile(agent_id: int, position: Tuple[int, int]) bool [source]
Check if an agent can currently see a specific tile
- clear_agent_data(agent_id: int) None [source]
Clear all fog of war data for an agent (when they die, etc.)
- forget_old_memories(agent_id: int, current_tick: int) None [source]
Remove old memories that are beyond the memory duration
- get_exploration_targets(agent_id: int, agent_position: Tuple[int, int], max_distance: int = 15) list[Tuple[int, int]] [source]
Get potential exploration targets (unknown or old tiles) near the agent
- get_known_tiles(agent_id: int) Set[Tuple[int, int]] [source]
Get all tiles that an agent has seen at some point
- get_pathfinding_grid(agent_id: int, world: World) list [source]
Get a pathfinding grid based on what the agent knows
- get_remembered_tile_info(agent_id: int, position: Tuple[int, int]) Dict | None [source]
Get what an agent remembers about a tile
Trading System
- class simulation_framework.src.systems.trading.Market[source]
Bases:
object
Central market system for tracking supply, demand, and prices
- class simulation_framework.src.systems.trading.TradeOffer(id: int, initiator_id: int, target_id: int, offered_items: List[Tuple[str, int]], requested_items: List[Tuple[str, int]], offered_gold: int = 0, requested_gold: int = 0, status: TradeStatus = TradeStatus.PENDING, created_tick: int = 0, expires_tick: int = 0)[source]
Bases:
object
Represents a trade offer between two entities
- status: TradeStatus = 'pending'
- class simulation_framework.src.systems.trading.TradeStatus(value)[source]
Bases:
Enum
An enumeration.
- ACCEPTED = 'accepted'
- CANCELLED = 'cancelled'
- COMPLETED = 'completed'
- PENDING = 'pending'
- REJECTED = 'rejected'
- class simulation_framework.src.systems.trading.TradingSystem[source]
Bases:
object
Manages trading between entities
- accept_trade_offer(accepter: Entity, offer_id: int) bool [source]
Accept a trade offer and execute the trade
- create_trade_offer(initiator: Entity, target: Entity, offered_items: List[Tuple[str, int]] = None, requested_items: List[Tuple[str, int]] = None, offered_gold: int = 0, requested_gold: int = 0, duration: int = 100) TradeOffer | None [source]
Create a new trade offer
- evaluate_trade_offer(target: Entity, offer_id: int) Tuple[bool, float] [source]
Evaluate a trade offer and return (should_accept, utility_score)
- get_pending_offers_for_entity(entity_id: int) List[TradeOffer] [source]
Get all pending trade offers for an entity
Combat Resolver
- class simulation_framework.src.systems.combat_resolver.CombatResolver[source]
Bases:
object
- calculate_damage(attacker: Entity, defender: Entity, base_damage: int, damage_type: str = 'physical', critical_chance: float = 0.0, critical_multiplier: float = 2.0) Tuple[int, bool, Dict] [source]
Respawn Manager
- class simulation_framework.src.systems.respawn.RespawnEntry(entity_id: int, entity_type: RespawnType, respawn_tick: int, original_position: Tuple[int, int], respawn_data: Dict, death_tick: int, respawn_attempts: int = 0, max_respawn_attempts: int = 3)[source]
Bases:
object
Represents an entity scheduled for respawn
- entity_type: RespawnType
- class simulation_framework.src.systems.respawn.RespawnManager(world_width: int, world_height: int)[source]
Bases:
object
Manages entity respawning and resource regeneration
- add_restricted_zone(center_x: int, center_y: int, radius: int) None [source]
Add a restricted zone where entities shouldn’t respawn
- add_safe_zone(center_x: int, center_y: int, radius: int) None [source]
Add a safe zone for respawning
- get_entity_respawn_info(entity_id: int) Dict | None [source]
Get respawn information for a specific entity
Pathfinding
- class simulation_framework.src.systems.pathfinding.Pathfinder(diagonal_movement: bool = True)[source]
Bases:
object
- can_reach(start: Tuple[int, int], goal: Tuple[int, int], world: World, known_tiles: Set[Tuple[int, int]] | None = None) bool [source]
- find_path(start: Tuple[int, int], goal: Tuple[int, int], world: World, known_tiles: Set[Tuple[int, int]] | None = None) List[Tuple[int, int]] [source]