Pong Policy ONNX v1

A compact feed-forward policy for the Pong game in Table Protocol. It predicts a return lane, paddle targets, and three game abilities from a normalized 32-value match observation.

Intended use

  • Playing the matching Table Protocol Pong environment.
  • Experiments with small ONNX policies, browser inference, and model distillation.

This model is not a general-purpose game-playing agent and is not compatible with other games without a new observation/action adapter and suitable training data.

Training and evaluation

The model is a 3-layer MLP (32 β†’ 128 β†’ 128 β†’ 64 β†’ 25), trained by supervised imitation of the project's hand-built rapidPongDecision policy. It was trained on 20,000 generated state/action examples with seed 417 and a shuffled 90/10 train/validation split. It was not trained with reinforcement learning or human gameplay, and it has not been shown to improve match win rate over its teacher.

Validation results from the included training-metrics.json:

Metric Result
Lane accuracy 52.8%
Mean absolute error for the two movement outputs 0.085 (normalized units)
Ability accuracy 94.2%
Validation examples 2,000

These metrics measure agreement with the scripted teacher on a random held-out split. They do not measure match win rate, performance against humans, or generalization to other games.

Model files

  • pong-policy-v1.onnx β€” inference model.
  • training-metrics.json β€” architecture, training seed, and validation metrics.
  • inference-example.js β€” minimal ONNX Runtime Web inference example.

Input contract

Input tensor: features, float32[1, 32]. The values use this exact order:

Index Value Normalization
0 Player side (L=0, R=1) categorical scalar
1–2 Ball X, Y arena width, height
3–4 Ball velocity X, Y 1200 px/s
5 Ball currently boosted 0 or 1
6 Ball speed before boost 1200 px/s
7 Own horizontal paddle depth 0 to 1
8 Own paddle Y arena height
9 Own paddle speed 700 px/s
10 Paddle height arena height
11 Current normalized Y target 0 to 1
12 Opponent horizontal depth 0 to 1
13 Opponent Y arena height
14–15 Opponent velocity X, Y 700 px/s
16 Opponent paddle speed 700 px/s
17 Round seconds remaining 45 s
18–20 Boost, slow, block cooldowns 10 s, 5 s, 30 s
21 Block active time remaining 3 s
22–26 Wave active, Y, speed, thickness, ball-effect flag 0/1, height, 700 px/s, height, 0/1
27–28 Player Left and Player Right score 7 points
29 Incoming ball flag 0 or 1
30 Next contact Y arena height
31 Time until next contact 3 s

The game clamps normalized values and supplies zero-padded wave fields. Preserve this feature order and scaling when using the model.

Output contract

Output tensor: action, float32[1, 25].

  • Indices 0–19: logits for lane_01 through lane_20; select the largest logit.
  • Index 20: horizontal depth; clamp to [0, 1].
  • Index 21: vertical target; clamp to [0, 1].
  • Indices 22–24: slow, boost, and block logits; a value greater than zero means request the ability.

The output is a raw policy proposal. The game must still enforce reachable movement, legal boundaries, ability cooldowns, and its own collision rules.

Run in a browser

Install onnxruntime-web and use the included inference-example.js. The model uses the WebAssembly CPU execution provider. The example loads the model file directly from this repository; for production, pin a revision instead of using the mutable main branch.

Limitations

  • It imitates a deterministic, hand-coded Pong teacher; it does not independently reason or plan like a language model.
  • Lane accuracy and ability accuracy are teacher-agreement metrics, not gameplay success metrics.
  • No human-play dataset, self-play reinforcement learning, or cross-game training was used.
  • Ability behavior, game physics, feature scaling, and lane ordering must match the source game.
  • A separate policy and training/evaluation process is needed for substantially different games.
Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support