Now it adds the ability for long/medium-range weapons to appear and protections for the…
- User
Now it adds the ability for long/medium-range weapons to appear and protections for the AIs. The AIs need to be able to know the location of items in the environment in order to pick them up, and they also need to know if they have an item or not, and which item they have.
Assistant
I'll significantly upgrade the state representation so agents have rich spatial awareness of pickups (direction, distance, type for up to two pickups), detailed self-inventory (weapon type + ammo level + armor level), and opponent gear knowledge. Let me first review the current state key:
Now I'll rewrite the engine with a much richer state key that gives agents detailed spatial awareness of pickups and full inventory knowledge:
Now I'll replace the entire
stateKeymethod with a rich, informative encoding:Now let me fix the pickup distance filtering so the agent always sees all pickups:
Now let me update the App to display richer inventory info (weapon, ammo, armor) in the agent panels. First I need to pass the fighter state through to the UI:
Now I'll update the App — first the UiStats interface and setStats call, then the AgentPanel to display gear info:
Now update the setStats call to include gear and state key info:
Now update the AgentPanel calls to pass the new gear and state key props:
Now update the AgentPanel component to accept and display the new props:
Now let me replace the AgentPanel with an enhanced version that shows inventory and decoded state:
Let me also update the explainer text to reflect the richer state features:
Build clean. Here's what was added:
Rich State Representation (16 features)
The agents now perceive a much more detailed world. The state key encodes:
# Feature Buckets Meaning 0 Distance to opponent 5 Contact → very-far 1 Opponent direction 2 Left or right 2 Self ready to act 2 Free or busy (attacking/stunned) 3 Opponent threat 3 Safe / winding-up / actively striking or shooting 4 Opponent blocking 2 Blocking or open 5 Self airborne 2 Jumping or grounded 6 Health advantage 3 Losing / even / winning 7 Near wall 2 Edge danger or center safety 8 Self weapon 3 None / shuriken / pistol 9 Self ammo 3 Empty / low / high 10 Self armor 3 None / low / high 11 Opponent weapon 3 None / shuriken / pistol 12 Nearest pickup direction 3 None / behind me / in front of me 13 Nearest pickup type 4 None / pistol / shuriken / armor 14 Nearest pickup distance 4 None / on-top / close / far 15 Second pickup direction 3 None / behind / front Features 8–15 are the new ones — giving each AI complete knowledge of:
- Exactly what they're carrying (weapon type + ammo level as fraction of max + armor tier)
- What the opponent is carrying (so they can fear an armed opponent or play aggressively against an unarmed one)
- Where every pickup is on the map (direction + distance + type for the nearest, direction for a second one)
New UI: Inventory Panel + State Decoder
Each agent panel now shows:
- Inventory box with weapon icon, ammo bar, and armor shield bar — live-updating from the fighter state
- "What the agent perceives" grid that decodes the 16-feature state key into human-readable labels (highlighted in amber for weapon features, sky-blue for pickup features)
This means you can now watch the AI reason: if a shuriken spawns to its right, you'll see
pDir: front→,pType: shuriken,pDist: close— and the next action is oftenforwardto grab it.Files built:
src/game/engine.ts,src/App.tsx
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.