factoriax.playground.play.main#
Interactive play script for Factoriax using pygame.
Uses GameUI for all menu rendering
and input dispatch. This module handles the pygame window, environment
stepping, trajectory recording, and play-specific screens (welcome,
victory).
- factoriax.playground.play.main.main(screen: Surface | None = None) None#
Run free play: a procedurally generated world, no fixed level.
When screen is supplied the caller owns the window and pygame outlives this call. That is how the launcher re-enters its menu on exit. Standalone, a window is created and torn down here.
- Controls:
WASD: Move player (world), navigate menus (context-dependent) Space: Mine ore at current tile E: Place/pick up (world), transfer (machine), craft (crafting) F: Inspect machine in front of player I: Toggle inventory/crafting menu A/D: Select inventory slot, edge-wrap to crafting panel W/S: Navigate rows (inventory), recipes (crafting), panels (machine) P: Toggle achievement menu 1-8: Quick-select inventory slot 1-8 Shift+1-2: Quick-select inventory slot 9-10 Ctrl+1-9: Select player (if that many players exist) Escape: Close menus / Open pause menu (with Reset option)
- factoriax.playground.play.main.play_level(level: Level, num_players: int = 1, screen: Surface | None = None, seed: int | None = None) None#
Play a level with the full game UI.
Provides the complete play experience including inventory, crafting, machine inspection, achievements, and pause menus. When called from the editor the existing screen surface is reused and the function returns on quit instead of terminating pygame.
- Parameters:
level – Level to play.
num_players – Number of players to spawn.
screen – Existing pygame display surface. If
Nonea new window is created and destroyed on exit.seed – Seed for the new world.
Nonetakes the seed of the player storedPlayerConfig.seedis loaded from disk.