Source: factory.service/package.farcaster/ObjServiceTacticalRPG.py
Main FARCASTER game service.
| Method | Signature | Description |
|---|---|---|
| route_new_game | route_new_game(player_name: str, difficulty: str = 'normal') |
POST /farcaster/api/game/new |
| route_load_game | route_load_game(campaign_id: str) |
GET /farcaster/api/game/load/:campaign_id |
| route_start_mission | route_start_mission(campaign_id: str, mission_id: str, squad_selection: List[str]) |
POST /farcaster/api/mission/start |
| route_submit_action | route_submit_action(game_state_id: str, action: Dict) |
POST /farcaster/api/mission/action |
| route_get_game_state | route_get_game_state(game_state_id: str) |
GET /farcaster/api/mission/state/:game_state_id |
| route_get_unit_details | route_get_unit_details(campaign_id: str, unit_id: str) |
GET /farcaster/api/roster/:unit_id |
| load_game_data | load_game_data() |
Load all game data from JSON files. |
| create_roster | create_roster(campaign_id: str, player_name: str) -> 'Squad' |
Create starting squad of 4 soldiers. |
| create_unit | create_unit(unit_id: str, class_name: str, name: str) -> 'Unit' |
Create a unit from class definition. |
| initialize_mission | initialize_mission(campaign_id: str, mission_id: str, squad_selection: List[str]) -> 'GameState' |
Initialize mission state. |
| spawn_enemy | spawn_enemy(enemy_type: str) -> 'Unit' |
Create an enemy unit from definition. |
| load_map | load_map(map_name: str) -> 'Grid' |
Load and initialize map grid. |
| validate_action | validate_action(game_state: 'GameState', action: Dict) -> bool |
Validate that action is legal in current state. |
| resolve_action | resolve_action(game_state: 'GameState', action: Dict) -> Dict |
Execute action and return result. |
| pathfind | pathfind(grid: 'Grid', start: Tuple, end: Tuple) -> List[Tuple] |
A* pathfinding. |
| distance | distance(pos1: Tuple, pos2: Tuple) -> float |
Euclidean distance. |
| heuristic | heuristic(pos: Tuple, goal: Tuple) -> float |
Manhattan heuristic for A*. |
| calculate_hit_chance | calculate_hit_chance(attacker: 'Unit', defender: 'Unit', grid: 'Grid') -> float |
Calculate hit probability. |
| calculate_damage | calculate_damage(attacker: 'Unit', defender: 'Unit') -> int |
Calculate damage roll. |
| advance_turn | advance_turn(game_state: 'GameState') |
Advance to next phase (player → enemy → player). |
| run_ai_turn | run_ai_turn(game_state: 'GameState') |
Execute AI for all enemy units. |
| ai_choose_action | ai_choose_action(game_state: 'GameState', unit: 'Unit') |
Simple AI: move toward nearest player, attack if in range. |
| handle_mission_complete | handle_mission_complete(game_state: 'GameState') |
Award XP, update progression, save campaign. |
| save_to_database | save_to_database(campaign_id: str, save_data: Dict) |
Persist campaign to gekkoridge.axion. |
| load_from_database | load_from_database(campaign_id: str) -> Optional[Dict] |
Load campaign from gekkoridge.axion. |
A single game unit (player or enemy).
| Method | Signature | Description |
|---|---|---|
| to_dict | to_dict() |
A player squad (roster of units).
| Method | Signature | Description |
|---|---|---|
| add_unit | add_unit(unit: Unit) |
|
| to_dict | to_dict() |
Current mission state.
| Method | Signature | Description |
|---|---|---|
| place_unit | place_unit(unit_id: str, pos: Tuple, is_enemy: bool = False) |
|
| remove_unit | remove_unit(unit_id: str) |
|
| is_complete | is_complete() -> bool |
Mission is complete if all enemies are dead. |
| to_dict | to_dict() |
Tile-based game grid.
| Method | Signature | Description |
|---|---|---|
| get_walkable_neighbors | get_walkable_neighbors(pos: Tuple) -> List[Tuple] |
4-connected neighbors. |
| get_spawn_point | get_spawn_point(index: int) -> Tuple |
Player spawn point. |
| get_enemy_spawn_point | get_enemy_spawn_point(index: int) -> Tuple |
Enemy spawn point. |
| get_cover_value | get_cover_value(pos: Tuple) -> float |
Get cover percentage at position (0-100). |
| to_dict | to_dict() |
Manages turn order and action points.
| Method | Signature | Description |
|---|---|---|
| advance_phase | advance_phase() |
Alternate between player and enemy phases. |
| refill_ap | refill_ap() |
Restore AP for new round. |