World Activity System

v0.3

Core Concepts

Understand the fundamental architecture and components of the World Activity System.

Overview

World Activity System is built around four core concepts that work together to create dynamic world content:

Spatial Activities

Fixed-location content discovered through proximity

Temporal Activities

Time-based events that trigger automatically or conditionally

Activity Manager

Central singleton managing all activities and state

Event Scheduler

Automated scheduling with smart caching and performance optimization

Spatial Activities (Encounters)

Spatial Activities represent discoverable content at fixed locations in your world. They use a hybrid ScriptableObject + MonoBehaviour architecture.

Key Concept: Activity data is stored in a ScriptableObject asset (reusable), while placement is handled by an Anchor component in the scene (visual positioning).

Use Cases

Shrines

Ancient Shrine, Prayer Altar, Meditation Spot

Dungeons

Cave Entrance, Underground Temple, Ruins

Landmarks

Viewpoints, Historical Sites, Fast Travel Points

Bosses

Elite Boss Arena, World Boss Location

Secrets

Hidden Treasure, Secret Path, Easter Egg

NPCs

Quest Giver, Merchant, Trainer

Key Properties

PropertyPurpose
Requires DiscoveryMust be discovered before interacting
Is RepeatableCan be completed multiple times
CategoryType classification (Shrine, Dungeon, etc.)
Trigger ObjectScene anchor with collider
PrerequisitesGC2 conditions required to discover

Discovery Mechanics

Spatial activities use a dual discovery system for reliability:

  1. OnTriggerEnter: Immediate when player enters collider
  2. Proximity Checking: Periodic bounds check (10x/second)

This ensures discovery even if OnTriggerEnter is missed due to physics timing.

Temporal Activities (Events)

Temporal Activities represent time-based or condition-based events that trigger automatically through the Event Scheduler or manually via Game Creator instructions.

Event Lifecycle

Inactive
   ↓
Scheduler Check → Prerequisites Met?
   ↓                      ↓ No
Queue (Priority)     Inactive (retry later)
   ↓
Active (Duration)
   ↓
On Event End (Callbacks)
   ↓
Cooldown (Optional)
   ↓
Chained Event? → Yes → Trigger Chain
   ↓ No
Inactive

Trigger Types

⏱️ Interval Events

Trigger at fixed time intervals (e.g., every 10 minutes)

Configuration:
  • Interval: Time between triggers (seconds)
  • Start Delay: Initial delay before first trigger
  • Max Occurrences: Limit total triggers (0 = infinite)
Use Cases: Merchant spawns, resource respawns, weather changes

🌅 Time-of-Day Events

Trigger at specific times (Dawn, Noon, Dusk, Midnight)

Configuration:
  • Time of Day: Dawn, Noon, Dusk, or Midnight
  • Days Between: Trigger every N days (1 = daily)
  • Max Occurrences: Limit total triggers
Use Cases: Daily quests, dawn rituals, nighttime events

? Conditional Events

Trigger when custom GC2 conditions are met

Configuration:
  • Prerequisites: Your GC2 Conditions
  • Conditional Behavior: OneShot or Temporal
  • Check Interval: How often to check (default: 1s)
Use Cases: Quest triggers, achievements, story progression

✋ Manual Events

Trigger only via Game Creator instructions

Use Cases: Boss fights triggered by player action, cutscene events, story moments

Conditional Behavior Types

OneShot

Triggers once when conditions met, then disables. Use for: Achievements, quest unlocks, discoveries.

Temporal

Can trigger multiple times. Re-enables after cooldown. Use for: Repeating events, periodic checks.

World Activity Manager

The WorldActivityManager is a singleton component that serves as the central hub for all activity management.

Architecture

Singleton Pattern

Only one instance exists per scene. Access via WorldActivityManager.Instance

// Access from any script
var manager = WorldActivityManager.Instance;
bool isDiscovered = manager.IsActivityDiscovered(myActivity);

Responsibilities

  • State Management: Tracks discovered/completed activities
  • Discovery System: Handles proximity checks and OnTriggerEnter
  • Event Coordination: Manages active events, cooldowns, incompatibilities
  • Persistence: Saves/loads activity state via Remember system
  • Time Provider: Manages time source (GameTime, RealTime, Cozy Weather)

Key Settings

SettingDefaultPurpose
Time Provider TypeGameTimeTime measurement source
Player Tag"Player"Tag for player identification
Proximity Checks/Sec10Discovery check frequency
Max Check Distance200Optimization cutoff

Event Scheduler

The EventScheduler automates temporal event triggering with intelligent scheduling, performance optimization, and comprehensive monitoring.

Key Features

Automated Scheduling

Events trigger automatically based on intervals, time-of-day, or conditions. No manual GC2 instructions needed.

Smart Caching

Prerequisite results cached with automatic invalidation. Typical hit rate: 80-95% for optimal performance.

Priority Queue

Events queued by priority (0.0-1.0). Higher priority events execute first. Ties broken by trigger time.

Performance Monitoring

Real-time cache statistics, hit rates, and performance metrics available via Event Scheduler Debug Window.

Scheduler Configuration

The EventScheduler component is automatically added to WorldActivityManager. Configure these settings:

  • Scheduler Enabled: Master toggle for automated scheduling
  • Enable Event History: Log all event activity for debugging
  • Check Interval: How often to check conditional events (default: 1.0s)
  • Time-of-Day Settings: Configure dawn, noon, dusk, midnight times

System Architecture

┌─────────────────────────────────────────────────────┐
│            WorldActivityManager (Singleton)         │
│  ┌─────────────────────────────────────────────┐   │
│  │         State Management                    │   │
│  │  • Discovered activities                    │   │
│  │  • Completed activities                     │   │
│  │  • Activity progress                        │   │
│  │  • Active events                            │   │
│  └─────────────────────────────────────────────┘   │
│                                                     │
│  ┌─────────────────────────────────────────────┐   │
│  │      Discovery System                       │   │
│  │  • OnTriggerEnter (immediate)               │   │
│  │  • Proximity checks (periodic)              │   │
│  └─────────────────────────────────────────────┘   │
│                                                     │
│  ┌─────────────────────────────────────────────┐   │
│  │      EventScheduler                         │   │
│  │  • Interval scheduling                      │   │
│  │  • Time-of-day scheduling                   │   │
│  │  • Conditional monitoring                   │   │
│  │  • Priority queue                           │   │
│  │  • Prerequisite caching                     │   │
│  └─────────────────────────────────────────────┘   │
└─────────────────────────────────────────────────────┘
              ↓                    ↓
    ┌──────────────┐      ┌──────────────┐
    │   Spatial    │      │  Temporal    │
    │  Activities  │      │  Activities  │
    │ (Encounters) │      │   (Events)   │
    └──────────────┘      └──────────────┘
              ↓                    ↓
    ┌──────────────┐      ┌──────────────┐
    │   Anchors    │      │  Scheduler   │
    │  (Scene)     │      │  (Auto)      │
    └──────────────┘      └──────────────┘