Skip to main content

Overview

The feedback system delivers stimulation to biological neurons in response to game events (kills, damage, pickups). Each event has configurable base parameters and surprise-based scaling that modulates feedback intensity based on temporal difference (TD) errors.

EventFeedbackConfig

Each event type (enemy kill, took damage, armor pickup, etc.) is configured using the EventFeedbackConfig dataclass.

Base Stimulation Parameters

List[int]
required
List of neural channel indices to stimulate for this event.Channels must be in range 0-63 and not overlap with other event or action channels.
float
required
Base stimulation frequency in Hz before surprise scaling.Typical ranges:
  • Positive events: 20-40 Hz
  • Negative events: 60-120 Hz
float
required
Base stimulation amplitude in microamperes (μA) before surprise scaling.Typical range: 1.8-2.5 μA
int
required
Base number of pulses per feedback burst.Typical ranges:
  • Quick events: 25-35 pulses
  • Important events: 40-50 pulses

Event Metadata

str
required
Key name in the environment’s info dict that tracks this event.Examples: 'event_enemy_kill', 'event_took_damage', 'event_armor_pickup'
str
default:"'positive'"
Expected sign of temporal difference error for this event.
  • 'positive': Event represents reward (kills, pickups)
  • 'negative': Event represents punishment (damage, waste)
  • 'absolute': Use absolute value of TD error

Surprise Scaling Parameters

Feedback intensity scales based on TD error magnitude (“surprise”). Larger unexpected rewards/punishments trigger stronger feedback.
float
default:"0.9"
Gain coefficient for frequency scaling based on surprise.scaled_freq = base_freq * (1 + freq_gain * surprise_factor)
float
default:"2.0"
Maximum scaling multiplier for frequency.Frequency is clipped to [base_freq, base_freq * freq_max_scale]
float
default:"0.35"
Gain coefficient for amplitude scaling based on surprise.scaled_amp = base_amp * (1 + amp_gain * surprise_factor)
float
default:"1.5"
Maximum scaling multiplier for amplitude.Amplitude is clipped to [base_amp, base_amp * amp_max_scale]
float
default:"0.5"
Gain coefficient for pulse count scaling based on surprise.scaled_pulses = base_pulses * (1 + pulse_gain * surprise_factor)
float
default:"2.0"
Maximum scaling multiplier for pulse count.Pulse count is clipped to [base_pulses, base_pulses * pulse_max_scale]

Exponential Moving Average

float
default:"0.99"
Beta parameter for exponential moving average of surprise magnitude.surprise_ema = ema_beta * surprise_ema + (1 - ema_beta) * |td_error|Higher values (closer to 1.0) create slower-moving averages.

Unpredictable Stimulation

Some events (like taking damage) can trigger additional unpredictable background stimulation.
bool
default:"True"
Enable unpredictable background stimulation for this event.
float
default:"5.0"
Frequency in Hz for unpredictable stimulation bursts.
float
default:"1.0"
Duration in seconds for each unpredictable stimulation burst.
float
default:"1.0"
Rest period in seconds between unpredictable bursts.
Optional[List[int]]
default:"None"
Channels to use for unpredictable stimulation. If None, uses same channels as main event.
Optional[float]
default:"None"
Amplitude for unpredictable stimulation. If None, uses base_amplitude.

Default Event Configurations

Enemy Kill (Positive Event)

Armor Pickup (Positive Event)

Took Damage (Negative Event)

Ammo Waste (Negative Event)

Approach Target (Positive Event, ppo_doom.py only)

Retreat from Target (Negative Event, ppo_doom.py only)

Global Feedback Settings

Reward-Based Feedback

bool
default:"True"
Enable continuous feedback based on TD error magnitude.
List[int]
default:"[19, 20, 22]"
Channels for positive TD error feedback.
List[int]
default:"[23, 24, 26]"
Channels for negative TD error feedback.
float
default:"1.0"
TD error threshold for triggering positive feedback.
float
default:"-1.0"
TD error threshold for triggering negative feedback.

Positive Feedback Parameters

float
default:"2.0"
Amplitude in μA for positive reward feedback.
float
default:"20.0"
Frequency in Hz for positive reward feedback.
int
default:"30"
Number of pulses for positive reward feedback.

Negative Feedback Parameters

float
default:"2.0"
Amplitude in μA for negative reward feedback.
float
default:"60.0"
Frequency in Hz for negative reward feedback (higher than positive).
int
default:"90"
Number of pulses for negative reward feedback (longer than positive).

Episode-Level Feedback

bool
default:"True"
Enable episode-end feedback stimulation. Only available in training_server.py.
bool
default:"False"
If True, disable step-level feedback and only provide episode-end feedback.
bool
default:"True"
Scale episode feedback by surprise magnitude. Only available in training_server.py.
int
default:"80"
Pulses for positive episode-end feedback.
float
default:"40.0"
Frequency for positive episode-end feedback.
int
default:"160"
Pulses for negative episode-end feedback.
float
default:"120.0"
Frequency for negative episode-end feedback.

Global Surprise Scaling

float
default:"0.25"
Global gain for surprise-based feedback scaling.
Code comment: “Tune as needed, will depend on neurons”
float
default:"2.0"
Maximum global surprise scaling multiplier.
Optional[float]
default:"0.65"
Frequency-specific surprise gain (overrides feedback_surprise_gain for frequency).
Optional[float]
default:"0.35"
Amplitude-specific surprise gain.
Optional[float]
default:"2.0"
Frequency-specific max scaling.
Optional[float]
default:"1.5"
Amplitude-specific max scaling.

Example: Custom Event Feedback

PPO Hyperparameters

Learning rate and training settings

Encoder/Decoder

Network architecture configuration