Skip to content

Build polished no-build 2D planet resource‑hauler game#3

Open
lblwstc wants to merge 1 commit into
mainfrom
codex/build-a-2d-planet-resource-gathering-game
Open

Build polished no-build 2D planet resource‑hauler game#3
lblwstc wants to merge 1 commit into
mainfrom
codex/build-a-2d-planet-resource-gathering-game

Conversation

@lblwstc
Copy link
Copy Markdown
Owner

@lblwstc lblwstc commented Feb 21, 2026

Motivation

  • Replace the starter demo with a self-contained, no-build web game that runs by opening index.html and performs well on desktop Chrome and iPhone Safari.
  • Provide a playable core loop (mothership, planets, resource extractors, cargo ships with visible animation) and a small tech tree to enable meaningful progression.
  • Keep the code modular and maintainable with a single source of truth state and separate modules for content, simulation, rendering, UI, and storage.

Description

  • Added a full modular game implementation: game.js, style.css, updated index.html, README.md, and modules/{content,state,sim,render,ui,storage}.js with the game architecture and wiring.
  • Implemented a fixed-timestep simulation (TICK_DT = 1/10) with planet production buffers, ship FSM (TRAVEL_TO_PLANET → LOADING → TRAVEL_TO_MOTHERSHIP → UNLOADING), extractor upgrades, planet unlocks, tech definitions (10 techs), and route AI.
  • Implemented a Canvas 2D renderer with world/screen transforms, twinkling stars, distinct planet visuals, curved Bezier routes, animated ships with thruster trails and cargo indicator, mothership glow, and floating +X resource text.
  • Implemented desktop + mobile UI: top resource bar, actions/details/tech panels, mobile bottom tabs, pointer-event pan/zoom (drag/pinch/wheel), safe-area handling, and a localStorage save system with offline progress (capped to 8 hours) and a Reset Save button.

Testing

  • Syntax checks: ran node --check against game.js and all modules/*.js and the checks completed successfully.
  • Runtime smoke: started a simple server with python3 -m http.server 4173 and used an automated Playwright script to load http://127.0.0.1:4173/index.html, which loaded successfully and produced a screenshot.
  • Persistence check: save/load and offline application were exercised by the automated load path (modules/storage.js) during state hydration and succeeded (no runtime errors observed during automated page load).

Codex Task

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant