building a versions of the greatest old retro video games of all time
Prompt
You are a senior web game developer. Build a faithful, text-only, single-file browser recreation of “The Oregon Trail (1971-style)” that runs entirely in the browser with no servers, bundlers, or external libraries. Target environment - Deliver a single self-contained index.html with inline CSS and JavaScript (no external files). - Must run by simply opening in Chrome/Firefox/Safari/Edge, or on CodePen/JSFiddle/GitHub Pages. - No frameworks, no npm, no imports. ES6+ only. Aesthetic and UX - Text-only UI that evokes a teletype/terminal: monospace font, uppercase headings, minimal styling, high contrast. - Layout: a scrollable “LOG/SCREEN” area for game text, a compact STATUS panel, and an INPUT area for choices. - Fully keyboard playable: - Number keys or letter hotkeys for menus. - Enter to confirm. - Optional mouse buttons mirroring the same actions. - Accessibility: semantic HTML, focus management, ARIA roles where appropriate. Support small screens (mobile-friendly). Core game (1971-style, original text—do not copy from any commercial version) - Start in March, 1847 at INDEPENDENCE, MISSOURI with $700 (tunable). Goal: reach OREGON (~2040 miles) before December. - Teletype vibe: concise, punchy uppercase messages, but keep strings original (do not reuse copyrighted text). - Single traveler (party size as a tweakable constant). Systems and features 1) Store and setup - Items/prices (tunable constants): - Oxen (yokes of 2): $40 per yoke (recommend 3–5). - Food: $0.20 per lb. - Ammunition: $2.00 per box of 20 bullets. - Clothing: $10 per set. - Spare parts: wheel $10, axle $10, tongue $10 (buy individually). - Input validation, clear receipts, prevent departure without minimum essentials (≥2 yokes, some food). 2) Travel loop and calendar - TOTAL_MILES ≈ 2040. Track MILES TRAVELED and MILES TO GO. - Calendar advances by days; loss if December arrives (winter blizzard). - Weather states (GOOD/FAIR/POOR/BAD) modify mileage and risk. - Daily menu options: - Continue traveling - Rest - Hunt (speed-typing mini-game) - Check status/supplies - Change pace - Change rations - Pace affects health and mileage: - Slow (10–15 mi/day) - Normal (15–25 mi/day) - Grueling (25–35 mi/day) - Rations affect food use and health: - Bare-bones, Meager, Normal, Generous (scaling multipliers). - Consume food daily based on rations and party size. 3) Health model - Overall health state: GOOD/FAIR/POOR/VERY POOR derived from hunger, pace, weather, events. - Starvation or extreme health decline can cause death. 4) Random events (probabilities tunable; cap events per day for fairness) - Illnesses: dysentery, cholera, typhoid, measles, exhaustion. - Injuries: broken arm/leg, snakebite. - Thief at night (steals food or bullets). - Oxen death. - Bad water/contaminated water. - Wagon part breaks (requires part or you’re stranded). - Severe weather (storms, heat, cold). - Getting lost, poor trail. - Hostile riders/bandits. - Clear feedback messages; some events may force rest or be fatal. 5) Rivers and landmarks - Minimal set of checkpoints to pace the trip: KANSAS RIVER, FORT KEARNY, CHIMNEY ROCK, FORT LARAMIE, SOUTH PASS, SNAKE RIVER, THE DALLES. - River crossings: FORD, CAULK AND FLOAT, or FERRY with different risks based on depth/weather; failure can cost supplies or cause drowning. 6) Hunting mini-game (1971 hallmark) - Require bullets to hunt. - Speed-typing: prompt the player to type “BANG” (uppercase). Measure elapsed time using performance.now() from prompt display to submission. - Hit if under difficulty threshold (e.g., EASY ≤3.0s, NORMAL ≤1.8s, HARD ≤1.2s). - Random animal table with yields (subtract bullets per attempt): - Rabbit 10 lbs (common) - Deer 60 lbs (uncommon) - Bear 100 lbs (rare) - Bison 200 lbs (rare) - On hit, add meat up to a PER-HUNT CARRY CAP (e.g., 100 lbs). Misses still consume bullets. 7) Win/loss and scoring - Win by reaching OREGON before winter with non-fatal health. - Loss: death (disease, injury, starvation), winter blizzard, river catastrophe, stranded (no oxen/parts). - Score factors: remaining food, cash, bullets, clothing, spare parts, health, and arrival date. Show a final summary. Technical requirements (web) - Single file index.html containing: - <style> for monospace, high-contrast theme, responsive layout. - <div id="log"> scrolling text area, <div id="status"> info panel, and an INPUT section with a text box or option buttons. - <script> with all logic. - Clean architecture: - Config/constants grouped in a CONFIG object at top. - Game state object; pure functions for calculations; rendering functions for log/status; controller handling input. - Simple seeded RNG (no libraries). Implement a small PRNG (e.g., mulberry32 or xorshift) with a URL param ?seed=... for reproducibility. - Input handling: - Menu rendering that supports 1–9 keys and click. - Robust validation; re-prompt on invalid input. - Performance: - Use requestAnimationFrame or simple append-to-log without jank. - Avoid blocking alerts/prompts; use custom input UI. - Persistence (optional but recommended): - Save/Load to localStorage (e.g., key “oregon1971_save”). - Include RESET and optional “COPY SAVE”/“PASTE SAVE” controls. Balancing defaults (make easy to tweak) - TOTAL_MILES = 2040 - START_MONTH = March; DEADLINE_MONTH = December - START_CASH = 700 - PRICES: OXEN_YOKE=40; FOOD_PER_LB=0.20; AMMO_BOX_20=2; CLOTHING_SET=10; WHEEL=10; AXLE=10; TONGUE=10 - DAILY_MILES_BY_PACE: SLOW 10–15; NORMAL 15–25; GRUELING 25–35 - RATION_MULTIPLIERS: BARE 0.5; MEAGER 0.75; NORMAL 1.0; GENEROUS 1.25 - HUNT_TIME_THRESHOLDS (seconds): EASY 3.0; NORMAL 1.8; HARD 1.2 - HUNT_ANIMALS: RABBIT 10, DEER 60, BEAR 100, BISON 200 - PER-HUNT CARRY CAP: 100 lbs Polish and presentation - Uppercase headings, concise log lines, consistent formatting. - STATUS panel shows: DATE, WEATHER, HEALTH, FOOD (LBS), BULLETS, CLOTHING, SPARE PARTS, CASH, OXEN, PACE, RATIONS, MILES TRAVELED/TO GO. - Prevent unfair streaks (at most one major negative event per day). - Original strings only; no copied phrasing or code. Deliverables - Output a single complete index.html in one code block. No omissions. - At the top, include an HTML comment with: - How to run (open in browser; works on CodePen/JSFiddle/GitHub Pages). - How to change difficulty and constants (CONFIG object). - How to set a random seed (?seed=123). - Include a short, skimmable example transcript in the log on first load (seeded demo) showing: - A travel day with a random event, - A hunting attempt (one hit, one miss), - A river crossing. Quality bar - Clear structure, commented code, careful input validation. - Works offline, keyboard-first, mobile-friendly. - No external assets, no network calls, no libraries.
A system prompt was added to support web rendering