haive.games.among_us.models¶
Comprehensive data models for Among Us social deduction gameplay.
This module provides sophisticated data models for the Among Us game implementation, supporting both cooperative crew tasks and deceptive impostor gameplay. The models enable structured data handling for complex social deduction mechanics, spatial navigation, task management, and strategic decision-making.
The models support: - Role-based gameplay (Crewmate vs Impostor) - Spatial navigation with rooms and vents - Task management with multiple task types - Sabotage systems with critical and non-critical events - Memory and observation tracking for deduction - Strategic analysis and decision-making - Meeting and voting mechanics
Examples
Creating a player with tasks:
player = PlayerState(
id="player1",
role=PlayerRole.CREWMATE,
location="cafeteria",
tasks=[
Task(
id="task1",
type=TaskType.SHORT,
location="electrical",
description="Fix wiring"
)
]
)
Impostor actions:
impostor = PlayerState(
id="impostor1",
role=PlayerRole.IMPOSTOR,
location="medbay"
)
# Check kill ability
if impostor.can_kill(kill_cooldown=0):
decision = AmongUsPlayerDecision(
action_type=AmongUsActionType.KILL,
target_player="player2",
reasoning="Isolated target in medbay"
)
Sabotage management:
sabotage = SabotageEvent(
type="reactor",
location="reactor",
timer=30,
resolution_points=[
SabotageResolutionPoint(
id="reactor_left",
location="reactor",
description="Left panel"
),
SabotageResolutionPoint(
id="reactor_right",
location="reactor",
description="Right panel"
)
]
)
# Check if critical
if sabotage.is_critical():
print("Emergency! Reactor meltdown imminent!")
Note
All models use Pydantic for validation and support both JSON serialization and integration with LLM-based strategic decision systems.
Classes¶
All possible player actions in Among Us. |
|
Comprehensive game state analysis for strategic planning. |
|
Current phase of gameplay. |
|
Strategic decision model for player actions. |
|
Cognitive model for player observations and deductions. |
|
Player roles defining objectives and abilities. |
|
Complete state representation for a player in Among Us. |
|
Physical location on the game map. |
|
Physical connection between adjacent rooms. |
|
Active sabotage affecting gameplay. |
|
Interactive point for resolving sabotages. |
|
Current state of a sabotage event. |
|
Types of sabotage available to impostors. |
|
Individual task assignment for crewmates. |
|
Task completion status for tracking progress. |
|
Types of tasks with different characteristics. |
|
Ventilation system access point for impostor movement. |
|
Connection between two vents for impostor movement. |
Module Contents¶
- class haive.games.among_us.models.AmongUsActionType[source]¶
-
All possible player actions in Among Us.
Actions are phase-dependent and role-restricted: - Movement and tasks: Available to all during task phase - Kill/Sabotage/Vent: Impostor-only actions - Report/Meeting: Emergency actions - Vote/Skip: Meeting phase only
- Values:
MOVE: Travel between connected rooms DO_TASK: Perform assigned task (crewmates) KILL: Eliminate a player (impostors) SABOTAGE: Trigger map disruption (impostors) USE_VENT: Enter/exit ventilation (impostors) REPORT_BODY: Report a discovered body CALL_MEETING: Call emergency meeting VOTE: Vote to eject a player SKIP_VOTE: Vote to skip ejection
Initialize self. See help(type(self)) for accurate signature.
- class haive.games.among_us.models.AmongUsAnalysis(/, **data)[source]¶
Bases:
pydantic.BaseModel
Comprehensive game state analysis for strategic planning.
Provides high-level analysis of the current game situation, including win probability, player suspicions, and strategic recommendations. Used by AI agents for decision-making.
- Parameters:
data (Any)
- game_phase¶
Current game phase.
- Type:
Examples
Early game analysis:
analysis = AmongUsAnalysis( game_phase=AmongUsGamePhase.TASKS, crew_advantage=0.0, task_completion_percentage=15.0, suspected_impostors=[], trusted_players=["Green"], # Did visual task active_sabotages=[], recommended_strategy="Focus on tasks, stay in groups", risk_assessment="Low risk, no suspicious behavior yet", priority_actions=["Complete tasks", "Observe players"] )
Critical situation:
analysis = AmongUsAnalysis( game_phase=AmongUsGamePhase.TASKS, crew_advantage=-0.7, task_completion_percentage=80.0, suspected_impostors=["Red", "Purple"], trusted_players=["Blue", "Green"], active_sabotages=["reactor"], recommended_strategy="Fix reactor immediately!", risk_assessment="Critical: reactor meltdown imminent", priority_actions=["Fix reactor", "Stay together"] )
Meeting phase analysis:
analysis = AmongUsAnalysis( game_phase=AmongUsGamePhase.VOTING, crew_advantage=-0.3, task_completion_percentage=60.0, suspected_impostors=["Red"], trusted_players=["Blue", "Green", "Yellow"], active_sabotages=[], recommended_strategy="Vote Red based on venting evidence", risk_assessment="High stakes vote - wrong choice loses game", priority_actions=["Vote Red", "Share observations"] )
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- classmethod validate_priority_actions(v)[source]¶
Ensure priority actions list is reasonable length.
- Parameters:
v (List[str]) – Priority actions to validate.
- Returns:
Validated actions list.
- Return type:
List[str]
- Raises:
ValueError – If too many priorities listed.
- property game_stage: str¶
Classify game progression stage.
- Returns:
Early, mid, or late game classification.
- Return type:
- property is_emergency: bool¶
Check if situation requires immediate action.
- Returns:
True if critical sabotages active or crew disadvantaged.
- Return type:
- model_config¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class haive.games.among_us.models.AmongUsGamePhase[source]¶
-
Current phase of gameplay.
Game alternates between task/action phases and discussion/voting.
- Values:
TASKS: Normal gameplay with movement and actions MEETING: Discussion phase after body report or emergency VOTING: Active voting to eject a player GAME_OVER: Game concluded with winner determined
Initialize self. See help(type(self)) for accurate signature.
- class haive.games.among_us.models.AmongUsPlayerDecision(/, **data)[source]¶
Bases:
pydantic.BaseModel
Strategic decision model for player actions.
Encapsulates a player’s chosen action with reasoning and confidence. Used by AI agents to make informed decisions based on game state and objectives. Includes justification for social deduction.
- Parameters:
data (Any)
- action_type¶
Chosen action to perform.
- Type:
Examples
Crewmate task decision:
decision = AmongUsPlayerDecision( action_type=AmongUsActionType.DO_TASK, target_task="fix_wiring_1", reasoning="Completing tasks helps crew win", confidence=0.9 )
Impostor kill decision:
decision = AmongUsPlayerDecision( action_type=AmongUsActionType.KILL, target_player="Blue", reasoning="Blue is isolated in electrical", confidence=0.8 )
Strategic movement:
decision = AmongUsPlayerDecision( action_type=AmongUsActionType.MOVE, target_location="medbay", reasoning="Need to establish alibi with visual task", confidence=0.7 )
Voting decision:
decision = AmongUsPlayerDecision( action_type=AmongUsActionType.VOTE, target_player="Red", reasoning="Red was seen venting by Green", confidence=0.95 )
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- classmethod validate_location_for_action(v, info)[source]¶
Ensure target location is provided for movement actions.
- Parameters:
v (Optional[str]) – Target location value.
info – Validation context with other fields.
- Returns:
Validated location.
- Return type:
Optional[str]
- Raises:
ValueError – If location missing for movement.
- class haive.games.among_us.models.PlayerMemory(/, **data)[source]¶
Bases:
pydantic.BaseModel
Cognitive model for player observations and deductions.
Tracks what a player has observed and deduced during gameplay, forming the basis for social deduction. Memory includes direct observations, suspicion levels, alibis, and movement patterns.
- Parameters:
data (Any)
Examples
Tracking suspicious behavior:
memory = PlayerMemory( observations=[ "Saw Red near body in electrical", "Blue was alone in medbay", "Green completed visual task" ], player_suspicions={ "Red": 0.8, "Blue": 0.4, "Green": 0.0 } )
Building alibis:
memory.player_alibis = { "Red": "electrical", "Blue": "medbay", "Green": "cafeteria" }
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- classmethod validate_suspicion_levels(v)[source]¶
Ensure suspicion levels are within valid range.
- Parameters:
- Returns:
Validated suspicion levels.
- Return type:
- Raises:
ValueError – If suspicion level outside 0-1 range.
- class haive.games.among_us.models.PlayerRole[source]¶
-
Player roles defining objectives and abilities.
Determines the player’s win condition and available actions: - Crewmates: Complete tasks and identify impostors - Impostors: Eliminate crew and avoid detection
- Values:
CREWMATE: Innocent crew member focused on tasks IMPOSTOR: Deceptive player who can kill and sabotage
Initialize self. See help(type(self)) for accurate signature.
- class haive.games.among_us.models.PlayerState(/, **data)[source]¶
Bases:
pydantic.BaseModel
Complete state representation for a player in Among Us.
Encapsulates all information about a player including their role, location, tasks, survival status, and cognitive state. Supports both crewmate and impostor gameplay with appropriate abilities.
- Parameters:
data (Any)
- role¶
Crewmate or Impostor designation.
- Type:
- memory¶
Cognitive state and deductions.
- Type:
Examples
Crewmate with tasks:
crewmate = PlayerState( id="Blue", role=PlayerRole.CREWMATE, location="electrical", tasks=[ Task(id="wire1", type=TaskType.COMMON, location="electrical", description="Fix wiring"), Task(id="scan1", type=TaskType.VISUAL, location="medbay", description="Submit to scan") ] )
Impostor in vent:
impostor = PlayerState( id="Red", role=PlayerRole.IMPOSTOR, location="electrical", tasks=[], in_vent=True, current_vent="electrical_vent" )
Dead player:
ghost = PlayerState( id="Green", role=PlayerRole.CREWMATE, location="cafeteria", tasks=[], is_alive=False )
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- can_kill(kill_cooldown=0)[source]¶
Check if the player can perform a kill action.
Kill ability requires: - Impostor role - Being alive - Kill cooldown expired - Not currently in vent
- Parameters:
kill_cooldown (int) – Remaining cooldown seconds.
- Returns:
True if all conditions met for killing.
- Return type:
Examples
>>> impostor = PlayerState(id="Red", role=PlayerRole.IMPOSTOR, ... location="electrical", is_alive=True) >>> impostor.can_kill(kill_cooldown=0) True >>> impostor.can_kill(kill_cooldown=10) False
- can_use_vent()[source]¶
Check if the player can use ventilation systems.
Vent usage requires: - Impostor role - Being alive
- Returns:
True if player can enter/exit vents.
- Return type:
Examples
>>> impostor = PlayerState(id="Red", role=PlayerRole.IMPOSTOR, ... location="electrical", is_alive=True) >>> impostor.can_use_vent() True
- is_crewmate()[source]¶
Check if the player is a crewmate.
- Returns:
True if player has crewmate role.
- Return type:
Examples
>>> crew = PlayerState(id="Blue", role=PlayerRole.CREWMATE, location="cafeteria") >>> crew.is_crewmate() True
- is_impostor()[source]¶
Check if the player is an impostor.
- Returns:
True if player has impostor role.
- Return type:
Examples
>>> impostor = PlayerState(id="Red", role=PlayerRole.IMPOSTOR, location="cafeteria") >>> impostor.is_impostor() True
- property incomplete_tasks: list[Task]¶
Get list of uncompleted tasks.
- Returns:
Tasks that still need completion.
- Return type:
List[Task]
- class haive.games.among_us.models.Room(/, **data)[source]¶
Bases:
pydantic.BaseModel
Physical location on the game map.
Rooms are the primary spaces where gameplay occurs. Players move between rooms, complete tasks in specific rooms, and use room layout for strategic positioning. Some rooms contain vents for impostor movement.
- Parameters:
data (Any)
- connections¶
Adjacent room connections.
- Type:
List[RoomConnection]
Examples
Central hub room:
cafeteria = Room( id="cafeteria", name="Cafeteria", connections=[ RoomConnection(target_room="upper_engine"), RoomConnection(target_room="medbay"), RoomConnection(target_room="admin") ] )
Task room with vent:
electrical = Room( id="electrical", name="Electrical", connections=[ RoomConnection(target_room="storage"), RoomConnection(target_room="lower_engine") ], vents=["electrical_vent"] )
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- get_connection(room_id)[source]¶
Get the connection to another room if it exists.
- Parameters:
room_id (str) – ID of the target room.
- Returns:
Connection object or None.
- Return type:
Optional[RoomConnection]
Examples
>>> conn = cafeteria.get_connection("medbay") >>> conn.distance 1
- is_connected_to(room_id)[source]¶
Check if this room directly connects to another room.
- Parameters:
room_id (str) – ID of the target room.
- Returns:
True if rooms are directly connected.
- Return type:
Examples
>>> cafeteria.is_connected_to("medbay") True >>> cafeteria.is_connected_to("reactor") False
- class haive.games.among_us.models.RoomConnection(/, **data)[source]¶
Bases:
pydantic.BaseModel
Physical connection between adjacent rooms.
Represents hallways and passages between rooms, defining the map topology. Connections can be blocked by door sabotages, forcing players to find alternate routes.
- Parameters:
data (Any)
Examples
Standard hallway:
connection = RoomConnection( target_room="cafeteria", distance=1 )
Long corridor:
connection = RoomConnection( target_room="reactor", distance=3 )
Sabotaged door:
connection = RoomConnection( target_room="electrical", distance=1, is_blocked=True )
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- class haive.games.among_us.models.SabotageEvent(/, **data)[source]¶
Bases:
pydantic.BaseModel
Active sabotage affecting gameplay.
Represents an ongoing sabotage that disrupts normal gameplay. Critical sabotages have timers and can end the game, while non-critical sabotages create tactical advantages.
- Parameters:
data (Any)
- resolution_points¶
Fix locations.
- Type:
List[SabotageResolutionPoint]
Examples
Critical reactor sabotage:
sabotage = SabotageEvent( type="reactor", location="reactor", timer=30, resolution_points=[ SabotageResolutionPoint( id="reactor_left", location="reactor", description="Left panel" ), SabotageResolutionPoint( id="reactor_right", location="reactor", description="Right panel" ) ] )
Non-critical lights sabotage:
sabotage = SabotageEvent( type="lights", location="electrical", timer=0, # No timer for non-critical resolution_points=[ SabotageResolutionPoint( id="light_panel", location="electrical", description="Fix light switches" ) ] )
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- is_critical()[source]¶
Check if this is a game-ending critical sabotage.
Critical sabotages (O2, Reactor) can end the game if not resolved within the time limit.
- Returns:
True if sabotage is critical.
- Return type:
Examples
>>> reactor = SabotageEvent(type="reactor", location="reactor", timer=30) >>> reactor.is_critical() True >>> lights = SabotageEvent(type="lights", location="electrical", timer=0) >>> lights.is_critical() False
- is_resolved()[source]¶
Check if the sabotage is fully resolved.
Sabotage is resolved when either marked resolved or all resolution points are activated.
- Returns:
True if sabotage is fixed.
- Return type:
Examples
>>> sabotage = SabotageEvent(type="reactor", location="reactor", timer=30) >>> sabotage.is_resolved() False >>> sabotage.resolved = True >>> sabotage.is_resolved() True
- class haive.games.among_us.models.SabotageResolutionPoint(/, **data)[source]¶
Bases:
pydantic.BaseModel
Interactive point for resolving sabotages.
Critical sabotages require multiple resolution points to be activated simultaneously (e.g., reactor needs two players). Non-critical sabotages may have single resolution points.
- Parameters:
data (Any)
Examples
Reactor resolution point:
point = SabotageResolutionPoint( id="reactor_left", location="reactor", description="Hold left reactor panel" )
O2 resolution point:
point = SabotageResolutionPoint( id="o2_admin", location="admin", description="Enter O2 code in admin" )
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- class haive.games.among_us.models.SabotageStatus[source]¶
-
Current state of a sabotage event.
- Values:
ACTIVE: Sabotage in effect, needs resolution RESOLVED: Successfully fixed by crewmates FAILED: Timer expired on critical sabotage (impostor win)
Initialize self. See help(type(self)) for accurate signature.
- class haive.games.among_us.models.SabotageType[source]¶
-
Types of sabotage available to impostors.
Sabotages disrupt crewmate activities and create opportunities for kills. Critical sabotages can end the game if not resolved.
- Values:
LIGHTS: Reduces crewmate vision radius COMMS: Hides task list and prevents meetings OXYGEN: Critical - requires two-point fix within time limit REACTOR: Critical - requires two-point fix within time limit DOORS: Locks specific room doors temporarily
Initialize self. See help(type(self)) for accurate signature.
- class haive.games.among_us.models.Task(/, **data)[source]¶
Bases:
pydantic.BaseModel
Individual task assignment for crewmates.
Tasks are the primary objective for crewmates, requiring them to visit specific locations and complete mini-games. Visual tasks can prove innocence by showing animations to nearby players.
- Parameters:
data (Any)
- status¶
Current completion state.
- Type:
Examples
Visual task proving innocence:
task = Task( id="medbay_scan", type=TaskType.VISUAL, location="medbay", description="Submit to medbay scan", visual_indicator=True )
Common electrical task:
task = Task( id="fix_wiring", type=TaskType.COMMON, location="electrical", description="Fix wiring" )
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- class haive.games.among_us.models.TaskStatus[source]¶
-
Task completion status for tracking progress.
- Values:
NOT_STARTED: Task not yet attempted IN_PROGRESS: Task partially completed COMPLETED: Task fully finished
Initialize self. See help(type(self)) for accurate signature.
- class haive.games.among_us.models.TaskType[source]¶
-
Types of tasks with different characteristics.
Task types affect completion time and verification: - Visual tasks provide visible proof of innocence - Common tasks are shared by all crewmates - Short/Long tasks vary in completion time
- Values:
VISUAL: Tasks with visible animations (proves innocence) COMMON: Tasks assigned to all crewmates SHORT: Quick tasks (1-3 seconds) LONG: Extended tasks (5-10 seconds)
Initialize self. See help(type(self)) for accurate signature.
- class haive.games.among_us.models.Vent(/, **data)[source]¶
Bases:
pydantic.BaseModel
Ventilation system access point for impostor movement.
Vents are strategic tools exclusive to impostors, allowing rapid movement between connected locations while avoiding detection. Each vent can connect to multiple other vents forming a network.
- Parameters:
data (Any)
- connections¶
Available vent routes.
- Type:
List[VentConnection]
Examples
Central vent hub:
vent = Vent( id="electrical_vent", location="electrical", connections=[ VentConnection(target_vent_id="medbay_vent"), VentConnection(target_vent_id="security_vent") ] )
Isolated vent:
vent = Vent( id="reactor_vent", location="reactor", connections=[ VentConnection( target_vent_id="upper_engine_vent", travel_time=3 ) ] )
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- class haive.games.among_us.models.VentConnection(/, **data)[source]¶
Bases:
pydantic.BaseModel
Connection between two vents for impostor movement.
Vents provide secret passages for impostors to move quickly and unseen between locations. Travel time simulates crawling through ventilation systems.
- Parameters:
data (Any)
Examples
Fast vent connection:
connection = VentConnection( target_vent_id="medbay_vent", travel_time=1 )
Distant vent connection:
connection = VentConnection( target_vent_id="reactor_vent", travel_time=4 )
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.