Skip to content

feat: Event Override System & pdoom-data integration (#442, #505)#503

Merged
PipFoweraker merged 6 commits intomainfrom
feature/api-event-fetching-442
Dec 25, 2025
Merged

feat: Event Override System & pdoom-data integration (#442, #505)#503
PipFoweraker merged 6 commits intomainfrom
feature/api-event-fetching-442

Conversation

@PipFoweraker
Copy link
Owner

@PipFoweraker PipFoweraker commented Dec 24, 2025

Summary

Implements EventService for fetching/caching historical AI safety events and integrates 1,194 events from pdoom-data repository with a full override system for game balance tuning.

Key Changes

EventService (godot/autoload/event_service.gd):

  • Fetches events from pdoom-data API with local cache fallback
  • Transforms pdoom-data format (impacts[], rarity, reactions) to game events
  • Loads variable mapping, rarity curves, and override configs
  • Applies deep-merge overrides for balance tuning

Event Override System (godot/data/events/):

  • balancing/variable_mapping.json - Maps pdoom-data vars (cash, stress, vibey_doom) to game vars (money, doom)
  • balancing/rarity_curves.json - Trigger probability/timing by rarity (52 turns/year)
  • overrides/ - Balance tuning files (example included)
  • extensions/ - Placeholder for Phase 5 event chains

Trigger Modes by Rarity:

Rarity Count Mode Behavior
Legendary 41 deterministic Always fires at historical date
Rare 1,076 probabilistic_window 6% chance within 26-turn window
Common 77 random_after_eligible 12% chance after min_turn

Key Principle: pdoom-data owns facts and defaults; pdoom1 owns balance tuning via overrides.

Commits

  1. feat: Add EventService for historical event fetching (#442) - Base EventService with caching
  2. docs: Add implementation plan for external repos - Architecture documentation
  3. fix: Prevent repeating events and fix network action lookup - Event cooldowns
  4. feat: Implement Event Override System for pdoom-data integration (#505) - Full 1,194 events + override system
  5. fix: Correct turns-per-year calculation and add rarity trigger modes - 52 turns/year, deterministic legendary

Test plan

  • Game loads without errors with 1,194 bundled events
  • Legendary events fire at expected turns (e.g., ChatGPT ~turn 287)
  • Override files correctly modify event properties
  • Events display with generated options based on category
  • Debug overlay shows event cache status

Closes #442, Closes #505

🤖 Generated with Claude Code

Implements API event fetching system that loads historical AI safety
timeline events and transforms them into game-playable events.

EventService Architecture:
- Fetches events from external API (pdoom-data) with local caching
- Falls back to bundled historical_events.json for offline play
- 24-hour cache expiry with manual refresh option
- HTTPRequest-based async fetching with error handling

Event Transformation:
- Converts raw historical data (date, title, category, significance)
  into game events with costs, effects, and player choices
- Category-aware option generation (organization, research, policy, etc.)
- Significance-scaled effects for balanced gameplay
- Preserves source data for reference

Historical Events Dataset:
- 20 curated AI safety milestone events (2000-2024)
- Organizations: MIRI, FHI, OpenAI, Anthropic, CAIS, Redwood, ARC
- Capabilities: AlphaGo, GPT-3, ChatGPT, GPT-4, Claude
- Policy: Asilomar, Pause Letter, UK Summit, EU AI Act
- Research: Superintelligence book, Concrete Problems paper

Integration:
- Added EventService autoload to project.godot
- GameEvents.check_triggered_events() now includes historical events
- Debug overlay shows historical event cache status
- Events trigger based on game year (12 turns/year from 2017 start)

Data Flow:
  External API -> Fetch -> Transform -> Cache -> GameEvents -> UI

This enables the game to incorporate real AI safety history while
supporting future API-based content updates.

Closes #442

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +218 to +221
var error = http_request.request(url)
if error != OK:
push_error("[EventService] HTTP request failed with error: %d" % error)
_handle_fetch_failure("HTTP request failed")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Reset loading state on failed request start

When HTTPRequest.request() fails immediately (e.g., no network/DNS), _fetch_from_api calls _handle_fetch_failure but never clears is_loading. That leaves EventService.is_ready() permanently false even though bundled or cached data may have been loaded, so GameEvents.check_triggered_events() will never see historical events in offline/error scenarios. Consider setting is_loading = false before calling _handle_fetch_failure (or inside it) so fallback data can be used.

Useful? React with 👍 / 👎.

PipFoweraker and others added 4 commits December 24, 2025 16:55
Comprehensive plan covering:
- pdoom-data repository structure and schemas
- 2018-2019 timeline extraction from Alignment Research Dataset
- Automated blog publishing pipeline

This serves as the reference document for implementing the
pdoom-data ecosystem.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Event System Fixes:
- Fix employee_burnout firing every turn (was threshold, now random with cooldown)
- Add cooldowns to all repeatable events to prevent spam
- Reduce probabilities on high-frequency events
- Add minimum researcher requirements for team-based events

Specific cooldowns added:
- employee_burnout: 25 turns (~5 weeks)
- talent_recruitment: 15 turns (~3 weeks)
- ai_breakthrough: 30 turns (~6 weeks)
- compute_deal: 40 turns (~8 weeks)
- rival_poaching: 35 turns (~7 weeks)
- media_scandal: 40 turns (~8 weeks)
- technical_failure: 50 turns (~10 weeks)
- workplace_conflict: 30 turns (~6 weeks)
- harassment_complaint: 60 turns (~12 weeks)
- mental_health_crisis: 40 turns (~8 weeks)
- office_theft: 60 turns (~12 weeks)
- policy_violation: 45 turns (~9 weeks)
- research_leak: 50 turns (~10 weeks)
- competitor_intel: 60 turns (~12 weeks)
- whistleblower_approach: 80 turns (~16 weeks)
- employee_whistleblower: 50 turns (~10 weeks)
- your_security_audit: 50 turns (~10 weeks)
- researcher_poached: 35 turns (~7 weeks)

Action Lookup Fix:
- Fix "network" action not found error
- Delegate _get_action_by_id() to GameActions.get_action_by_id()
- Removes duplicate incomplete implementations in game_manager.gd and main_ui.gd

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Phase 1-4 implementation integrating 1,194 historical AI safety events
from pdoom-data into the game with full override system.

Directory Structure:
- godot/data/events/balancing/ - variable mapping, rarity curves, difficulty
- godot/data/events/extensions/ - event chains, triggers, scenarios (Phase 5)
- godot/data/events/overrides/ - game balance tuning files

EventService Updates:
- Handle pdoom-data format with impacts[] array, rarity, reactions
- Variable mapping (cash->money, stress->doom, vibey_doom->doom, etc.)
- Override system for deep-merging balance tuning onto base events
- Rarity-based trigger probability and cooldown settings
- Category-specific option generation (funding_catastrophe, organization, etc.)

Key Principle: pdoom-data owns facts and defaults; pdoom1 owns balance
tuning via overrides. Never modify pdoom-data for game balance.

Data:
- Bundled all 1,194 events (1,076 rare, 77 common, 41 legendary)
- 1.2MB historical_events.json from pdoom-data export

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Fixes timing calculation for historical events:
- Changed turns_per_year from 12 to 52 (weekly turns)
- Events now fire at correct historical dates

Added rarity-based trigger modes:
- legendary: deterministic - always fires at exact turn (100% probability)
- rare: probabilistic_window - 6% chance within 26-turn window
- common: random_after_eligible - 12% chance after min_turn

New event fields:
- eligibility_start/eligibility_end: window when event can fire
- trigger_mode: how the event triggers

Example: 2022 events now trigger around turn 287 (not turn 61)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@PipFoweraker PipFoweraker changed the title feat: Add EventService for historical event fetching (#442) feat: Event Override System & pdoom-data integration (#442, #505) Dec 25, 2025
Creates comprehensive documentation for the event system:

docs/EVENT_OVERRIDE_SYSTEM.md:
- Architecture overview and data flow
- pdoom-data format vs game event format
- Trigger modes by rarity (deterministic/probabilistic/random)
- Variable mapping reference
- Override creation guide
- EventService API reference
- Debugging tips

godot/docs/README.md updates:
- Added Historical Events System section (100% complete)
- Updated directory structure with data/events/
- Added EventService to autoloads
- Updated events section with 1,194 historical events
- Added link to EVENT_OVERRIDE_SYSTEM.md
- Updated known issues and features remaining

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@PipFoweraker PipFoweraker merged commit 88a7195 into main Dec 25, 2025
20 of 21 checks passed
@PipFoweraker PipFoweraker deleted the feature/api-event-fetching-442 branch December 25, 2025 03:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement Event Override System (ADR-001 Compliance) Fetch game events from API and add game-specific transformations

1 participant