State vector design #4

Closed
opened 2026-08-15 22:05:18 +02:00 by SirStone · 1 comment
Owner

Question

What exactly goes into the observation vector fed to the actor-critic network?

Known inputs: own bot state (x, y, direction, speed, energy, gunDirection, gunHeat) + tracked enemy state (x, y, direction, speed, energy, age-of-last-scan). Normalize to [-1,1]?

Open sub-questions:

  • Include wall distances (4 directions)? Arena-relative position?
  • Include relative bearing/distance to enemy vs absolute positions?
  • Include own velocity components (vx, vy) vs scalar speed + heading?
  • Include bullet states (own in-flight bullets)?
  • Fixed vector size — what dimensions?
## Question What exactly goes into the observation vector fed to the actor-critic network? Known inputs: own bot state (x, y, direction, speed, energy, gunDirection, gunHeat) + tracked enemy state (x, y, direction, speed, energy, age-of-last-scan). Normalize to [-1,1]? Open sub-questions: - Include wall distances (4 directions)? Arena-relative position? - Include relative bearing/distance to enemy vs absolute positions? - Include own velocity components (vx, vy) vs scalar speed + heading? - Include bullet states (own in-flight bullets)? - Fixed vector size — what dimensions?
SirStone added the wayfinder:grilling label 2026-08-15 22:05:18 +02:00
Author
Owner

Resolution

State vector: 42 floats, all normalized to ~[-1, 1]

Current tick (14 floats):

# Feature Normalization
1-2 own x, y / arenaWidth, / arenaHeight
3 own direction / 360
4 own speed / 8
5 own energy / 100
6 own gunDirection / 360
7 own gunHeat / ~1.8
8-9 enemy x, y / arenaWidth, / arenaHeight
10 enemy direction / 360
11 enemy speed / 8
12 enemy energy / 100
13 hasFired 0 or 1
14 lastFirePower / 3

Derived (8 floats):

# Feature Normalization
15 enemy acceleration / 2
16 enemy turn rate / 10
17 relative bearing to enemy / 180 (signed)
18 distance to enemy / ~1700 (arena diagonal)
19-22 distance to 4 walls / max(arenaW, arenaH)

Enemy window — last 5 ticks (20 floats):

# Feature Normalization
23-42 enemy x, y, direction, speed (t-1 through t-5) same as current tick

Design decisions

  • No own bot history — agent chose its own actions, current state captures momentum via speed.
  • Window size = 5 ticks — enough for "instinct" about enemy trajectory patterns.
  • RNN/GRU is the upgrade path if MLP+window hits a ceiling on pattern recognition.
  • Hand-crafted derived features (acceleration, turn rate, wall distances) complement the window — no need for the network to learn basic physics.
## Resolution ### State vector: 42 floats, all normalized to ~[-1, 1] **Current tick (14 floats):** | # | Feature | Normalization | |---|---------|--------------| | 1-2 | own x, y | / arenaWidth, / arenaHeight | | 3 | own direction | / 360 | | 4 | own speed | / 8 | | 5 | own energy | / 100 | | 6 | own gunDirection | / 360 | | 7 | own gunHeat | / ~1.8 | | 8-9 | enemy x, y | / arenaWidth, / arenaHeight | | 10 | enemy direction | / 360 | | 11 | enemy speed | / 8 | | 12 | enemy energy | / 100 | | 13 | hasFired | 0 or 1 | | 14 | lastFirePower | / 3 | **Derived (8 floats):** | # | Feature | Normalization | |---|---------|--------------| | 15 | enemy acceleration | / 2 | | 16 | enemy turn rate | / 10 | | 17 | relative bearing to enemy | / 180 (signed) | | 18 | distance to enemy | / ~1700 (arena diagonal) | | 19-22 | distance to 4 walls | / max(arenaW, arenaH) | **Enemy window — last 5 ticks (20 floats):** | # | Feature | Normalization | |---|---------|--------------| | 23-42 | enemy x, y, direction, speed (t-1 through t-5) | same as current tick | ### Design decisions - **No own bot history** — agent chose its own actions, current state captures momentum via speed. - **Window size = 5 ticks** — enough for "instinct" about enemy trajectory patterns. - **RNN/GRU is the upgrade path** if MLP+window hits a ceiling on pattern recognition. - **Hand-crafted derived features** (acceleration, turn rate, wall distances) complement the window — no need for the network to learn basic physics.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: SirStone/SirRoboGarage#4