Commit Graph

20 Commits

Author SHA1 Message Date
josh 900d1d5190 Fix compute utilization bug and add subscriber saturation cap
CI / build-and-push (push) Successful in 34s
Three intertwined fixes:

1. Zero-capacity utilization: when inference allocation was 0%, the
   guard clause returned 0% utilization instead of 100%, so the market
   system never penalized satisfaction and subscribers never churned.

2. Stale compute in market: restructured tick order so capacity is
   computed before market runs, giving satisfaction calculations
   current-tick demand/capacity ratio instead of previous tick's.

3. Subscriber growth: replaced pure compound growth (reached billions
   in minutes) with logistic saturation curve. Era-based market caps:
   startup 10K, scaleup 1M, bigtech 20M, agi 100M. Quality and
   reputation expand the effective cap.

Also tuned FLOPS-to-tokens multiplier (10 → 26) for balanced
demand/capacity feel across all eras, and added market saturation
indicator to the Market page.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-24 20:50:26 -04:00
josh a36617f9e3 Fix max update depth crash on Infrastructure page
CI / build-and-push (push) Successful in 34s
ToastContainer's useEffect had `seen` (a Set state) in its dependency
array — each setSeen created a new Set, re-fired the effect, and under
rapid notifications cascaded past React's 50-update limit. Replaced
with a ref since seen doesn't need to trigger re-renders.

Also added useShallow to DataCenterCard's pipeline selector to prevent
.filter() from causing spurious re-renders on unrelated store changes.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-24 20:29:54 -04:00
josh 24278297f0 Add rack decommission pipeline stage
CI / build-and-push (push) Successful in 39s
Racks can now be marked for decommission from the DC view. The rack
leaves production immediately (freeing slot and power), enters the
pipeline as a timed decommission order, and is removed when complete.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-24 20:15:48 -04:00
josh 03ef94c22c Fix rack order race condition allowing slots/power to exceed DC limits
CI / build-and-push (push) Successful in 47s
Rapid clicks on order rack bypassed capacity checks because usedSlots
and usedPowerKW were only updated during the tick. Now both the store
action and UI compute slot/power usage live from racks + pipeline,
so each order immediately reflects in the next check.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-24 20:05:11 -04:00
josh 38097478da Fix price elasticity and inference utilization bugs
CI / build-and-push (push) Successful in 39s
Price elasticity: subscribers ignored price entirely — a $50k/month
subscription still grew. Replaced naive price/100 formula with a fair
price model (based on model quality). Overpriced subscriptions now kill
growth and drive churn at 3x the overprice ratio.

Inference utilization: was always pinned at 100% because organic API
token demand (10M base) and per-subscriber demand (100 tokens/tick)
massively exceeded any realistic compute capacity. Reduced to 500 base
organic tokens and 0.5 per subscriber so scaling compute meaningfully
reduces utilization.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-24 20:00:06 -04:00
josh 95f2f97121 Remove events system entirely
CI / build-and-push (push) Successful in 36s
The random events (GPU shortages, regulatory hearings, PR crises, etc.)
added interruption without enough gameplay value. Removed all event
types, definitions (~1800 lines of event data), the event processor,
EventModal UI, store actions, and tick integration. Updated docs to
reflect the removal. Bundle size drops ~47kB.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-24 19:54:44 -04:00
josh 0005e580a7 Overhaul infrastructure: replace GPU model with rack-centric system
CI / build-and-push (push) Successful in 33s
Replace flat GPU buying with a realistic data center + rack pipeline:
- 4 DC tiers (small/medium/large/mega) with construction time, dual
  capacity constraints (rack slots + power budget kW), and era/research
  gating
- 10 predefined rack SKUs from consumer GPUs through custom ASICs, each
  with unique FLOPS, power draw, cost, and pipeline timings
- 6-stage procurement pipeline (order → mfg → receive → install → test
  → production) with Kanban UI, talent-influenced speed bonuses
- Test failures (5-25% base rate) reduced by cooling, ops talent, and QA
  research; auto-repair with cost and re-test cycle
- Production failures at low per-tick rate, racks sent to repair pipeline
- Cooling and redundancy upgrades per DC (reduce failure rates)
- 4 new tech tree nodes (DC Engineering II/III/IV, Quality Assurance)
- Save version bump (1→2) with migration that resets old saves
- Updated economy system to account for rack repair costs
- Redesigned Infrastructure page with pipeline Kanban, capacity bars,
  rack ordering, and DC upgrade panels

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-24 19:41:55 -04:00
josh 1af9408c87 Fix Finance page: remove Recharts Tooltips, defensive string coercion
CI / build-and-push (push) Successful in 37s
Remove chart Tooltip components and wrap fundingStatus.reason in
String() to eliminate possible object-as-React-child errors.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-24 19:04:44 -04:00
josh 6659941632 Fix Finance page crash from Tooltip formatter returning array
CI / build-and-push (push) Successful in 34s
Recharts Tooltip formatter should return a string, not a
single-element array which React can't render as a child.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-24 18:54:39 -04:00
josh 617b29bd85 Fix crypto.randomUUID crash on non-HTTPS origins
CI / build-and-push (push) Successful in 33s
Replace all crypto.randomUUID() calls with a uuid() utility that
falls back to Math.random-based generation when the Web Crypto API
is unavailable (plain HTTP contexts).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-24 18:50:37 -04:00
josh 68540ebcf9 Add Docker and Gitea Actions CI/CD pipeline
CI / build-and-push (push) Successful in 1m10s
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-24 18:27:07 -04:00
josh 938df33789 Add .claude/ to gitignore
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-24 18:12:52 -04:00
josh 6c7348f924 Add README and documentation
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-24 18:10:43 -04:00
josh 0ff8a32b95 Add Week 4 social features, regulation, and safety tradeoffs
Leaderboard page with category tabs and score submission, shareable
company stats card with clipboard copy, dynamic regulation system
(compliance costs scale with capability and era, regulatory standing
tracks safety research), 6 geopolitical events (export controls, energy
crisis, natural disaster, AI safety summit, immigration policy, data
sovereignty), safety-capability tradeoff (safety score affects benchmark,
low safety triggers incidents with reputation damage), and enhanced
event consequence handling for regulation and talent types.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-24 18:02:30 -04:00
josh 8a8b49d934 Add Week 3 polish and late-game features
VC funding system (seed through IPO with requirements gating), 15
achievements with engine checker, model tuning presets and unlockable
sliders, overload policy controls, open-source mechanic with reputation
boost, enhanced Recharts analytics (subscriber/reputation/revenue vs
expenses charts), M&A acquisition system, sidebar NEW badges on era
transitions, tutorial hints, and wired-up settings toggles.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-24 17:56:40 -04:00
josh 8ea6c771a1 Add Hono backend with PostgreSQL, auth, cloud saves, and leaderboard
Server app (apps/server) with Hono framework and Drizzle ORM:
- PostgreSQL schema: users, saves, leaderboard, achievements tables
- Anonymous auth with UUID tokens, optional email/password linking
- Cloud save API: list, get, upsert, delete with auto-save hook
- Leaderboard API: per-category rankings with score submission
- CORS configured for dev server ports
- Typed middleware with Hono env variables

Frontend cloud save integration:
- API client with auth token management in localStorage
- useCloudSave hook auto-saves every 300 ticks when authenticated
- Vite env type declarations for VITE_API_URL

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-24 17:35:18 -04:00
josh 8c9555bc08 Add Week 2 depth systems: research, events, competitors, talent, data
Tech tree with 21 research nodes across 5 categories (infrastructure,
efficiency, generation, specialization, safety). Research page with
category-grouped cards, progress tracking, prerequisite gating.

Event engine with 34 events across industry/regulatory/PR/internal/market
categories, weighted random firing, cooldowns, expiry, and choice modal
with consequence preview. Events auto-expire with default choice.

Competitor system with 3 rival AI labs (Prometheus AI, Nexus Labs, Titan
Computing), personality-driven milestone progression, and comparison UI.

Talent page with department hiring, headcount management, and key hire
recruitment from a pool of 10 named characters with special abilities.

Data marketplace with 8 purchasable datasets, user data flywheel from
subscribers, and data system processing in tick loop.

Era transition system checks revenue/capability/reputation thresholds.
All new systems integrated into tick processor with notifications.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-24 17:30:24 -04:00
josh d1d3eb4bf2 Polish Week 1: tooltips, save import, game balance tuning
Add reusable Tooltip component and rich tooltips on all TopBar KPIs
(cash breakdown, compute utilization, reputation context). Add save
import button to Settings page. Fix game balance: reduce GPU maintenance
100x, increase organic API demand 200x, accelerate subscription revenue
timescale, boost early subscriber seeding, use sqrt scaling for model
compute factor, simplify deploy to activate all product lines at once.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-24 17:17:58 -04:00
josh 9a48c188ad Add complete game loop: training, revenue, market, offline catch-up
- Model training system: training jobs produce TrainedModels with
  calculated capabilities based on compute, data, and research
- Market system: organic API demand and consumer subscriptions now
  generate real revenue from deployed models
- Talent system: salary costs calculated from department headcount
- Toast notification system for game events (training complete, etc.)
- Offline catch-up: progress bar + summary screen when returning
- Market page: pricing controls for API and subscription products
- Finance page: income statement, cash charts, funding history
- Tick processor now runs all 7 systems in correct dependency order

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-24 17:02:58 -04:00
josh fdc8e544ae Initial scaffold: AI Tycoon monorepo with core game loop
Turborepo monorepo with three packages:
- packages/shared: TypeScript types for all 14 game systems + balance constants + formatting utils
- packages/game-engine: Pure TS simulation engine with tick processor, economy, infrastructure, compute, research, market, and reputation systems
- apps/web: React + Vite + Tailwind + Zustand frontend with sidebar dashboard layout, new game screen, dashboard with charts, infrastructure management, and model training pages

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-24 16:53:46 -04:00