Skip to content

Instantly share code, notes, and snippets.

@starbaser
Last active January 1, 2026 21:59
Show Gist options
  • Select an option

  • Save starbaser/b8c7fa3902a27913c5d05663a1133a0a to your computer and use it in GitHub Desktop.

Select an option

Save starbaser/b8c7fa3902a27913c5d05663a1133a0a to your computer and use it in GitHub Desktop.

What Are Effect Tokens Actually?

Every state-modifying operation in STS flows through the same system:

 [Card/Potion/Relic/Event]
             │
             ▼
       use() or onX()
             │
             ▼

addToBot(AbstractGameAction)
             │
             ▼
┌─────────────────────────┐
│    GameActionManager    │
│   actions: ArrayList<>  │
│ → processes queue       │
│ → calls action.update() │
│ → mutates game state    │
└─────────────────────────┘
  • addToBot: Add to bottom of action queue
  • addToTop is for things that need to interrupt/execute before already-queued actions.
Layer Game Entity Count Role
Effect producers Cards, Potions, Relics, Events ~1100 What we embed as "effect tokens"
Primitive actions AbstractGameAction subclasses ~280 The actual state mutations
Queue system GameActionManager 1 Unified execution path

Thus An effect token is the abstraction of game systems into token representations. They can be consumed in order to express it's effect on the observation, applied according to the game's logic.

Notice that a particular action, say playing a card, choosing an event, or ending turn, are all composed of one or many effect tokens with ordered application, with their observed effect being context-dependent state transitions.

Some notes:

  state + effect_token → state_predictor → predicted_state'
                                ↓
                      (compare to actual state')
                                ↓
                      train embedding model

  1. Collect trajectories: (s₀, a₀, s₁, a₁, s₂, ...)

  2. Compute state deltas: Δᵢ = sᵢ₊₁ - sᵢ (dimensioned observation diff)

  3. Learn effect tokens:

  • Encoder: Δ → effect_token (learned embedding)
  • Each action type gets an effect representation
  1. State predictor training:
  • Input: (state, effect_token)
  • Output: predicted_next_state
  • Loss: ||predicted - actual||²
  1. Result: effect_token captures "what this card/power/potion/relic/event_choice does"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment