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>
This commit is contained in:
+8
-18
@@ -24,7 +24,7 @@ ai-tycoon/
|
||||
├── apps/
|
||||
│ ├── web/ # React frontend (Vite)
|
||||
│ │ └── src/
|
||||
│ │ ├── components/ # layout/, common/, charts/, events/, game/
|
||||
│ │ ├── components/ # layout/, common/, charts/, game/
|
||||
│ │ ├── pages/ # One page per game system
|
||||
│ │ ├── store/ # Zustand store with slice pattern
|
||||
│ │ ├── hooks/ # useGameLoop, useOfflineCatchUp, etc.
|
||||
@@ -49,7 +49,7 @@ ai-tycoon/
|
||||
├── engine.ts # GameEngine class (tick scheduling)
|
||||
├── tick.ts # Tick processor (orchestrates systems)
|
||||
├── systems/ # One file per simulation system
|
||||
└── data/ # Event definitions, tech tree, datasets
|
||||
└── data/ # Tech tree, achievements, datasets
|
||||
```
|
||||
|
||||
## Tick System
|
||||
@@ -83,10 +83,9 @@ Each tick runs these systems sequentially, since later systems depend on earlier
|
||||
8. Economy — Revenue, expenses, net cash flow
|
||||
9. Data — Data acquisition, user data flywheel
|
||||
10. Competitors — AI rival decisions and actions
|
||||
11. Events — Random + condition-triggered events
|
||||
12. Era check — Threshold-based era transitions
|
||||
13. Valuation — Dynamic company valuation
|
||||
14. Achievements — Milestone checks (every 10 ticks)
|
||||
11. Era check — Threshold-based era transitions
|
||||
12. Valuation — Dynamic company valuation
|
||||
13. Achievements — Milestone checks (every 10 ticks)
|
||||
```
|
||||
|
||||
### Offline Catch-Up
|
||||
@@ -118,7 +117,6 @@ The store uses a slice pattern with 14 slices, each owning a portion of the game
|
||||
| `talentSlice` | Departments, headcount, morale, hiring |
|
||||
| `dataSlice` | Datasets, quality, user data generation |
|
||||
| `reputationSlice` | Safety record, public perception, regulatory standing |
|
||||
| `eventSlice` | Active events, history, cooldowns |
|
||||
| `achievementSlice` | Unlocked achievements |
|
||||
| `uiSlice` | Active page, notifications, modals (not persisted) |
|
||||
|
||||
@@ -188,20 +186,12 @@ Training a model:
|
||||
Composite score (0-100) from four factors:
|
||||
|
||||
- **Safety record** (30%): Damaged by safety incidents
|
||||
- **Public perception** (30%): Affected by events and incidents
|
||||
- **Public perception** (30%): Affected by incidents and open-sourcing models
|
||||
- **Employee satisfaction** (20%): Driven by department morale averages
|
||||
- **Regulatory standing** (20%): `50 + safetyResearch * 8 - eraIndex * 5`
|
||||
|
||||
Safety incidents trigger when deployed models have safety scores below `LOW_SAFETY_THRESHOLD` (40), checked every 60 ticks with probability `SAFETY_INCIDENT_PROBABILITY_BASE * (threshold - safetyLevel)`.
|
||||
|
||||
### Event System (`eventSystem.ts`)
|
||||
|
||||
- 40+ event definitions across 6 categories
|
||||
- Events have conditions (era, tick count, state thresholds), weights, cooldowns, and max occurrences
|
||||
- Most events present 2-3 choices with consequences affecting money, reputation, compute, or other state
|
||||
- Template system with variable interpolation prevents repetition
|
||||
- Geopolitical events (export controls, energy crises, natural disasters) affect specific regions
|
||||
|
||||
### Competitor System (`competitorSystem.ts`)
|
||||
|
||||
- 3+ AI rival labs with archetypes (safety-first, move-fast, big tech, open-source)
|
||||
@@ -283,7 +273,7 @@ Anonymous-first: players get a UUID token on first visit. Optional email/passwor
|
||||
## Performance Considerations
|
||||
|
||||
- Game engine runs outside React's render cycle; single `setState` per tick
|
||||
- Achievements check every 10 ticks, events every 30 ticks
|
||||
- Achievements check every 10 ticks
|
||||
- History arrays use circular buffers with configurable max sizes
|
||||
- Snapshots sample at intervals (every 60-120 ticks), not every tick
|
||||
- All systems are bounded O(n) where n is small (number of GPUs, models, competitors)
|
||||
@@ -299,4 +289,4 @@ Anonymous-first: players get a UUID token on first visit. Optional email/passwor
|
||||
|
||||
4. **Notifications via `_notifications`**: The tick processor attaches notifications as a side-channel property on the result, keeping the return type clean while enabling the UI to show contextual alerts.
|
||||
|
||||
5. **Cached definitions**: Event and achievement definitions are set once at game start via `setEventDefinitions` / `setAchievementDefinitions`, avoiding repeated imports in the hot tick path.
|
||||
5. **Cached definitions**: Achievement definitions are set once at game start via `setAchievementDefinitions`, avoiding repeated imports in the hot tick path.
|
||||
|
||||
Reference in New Issue
Block a user