Downloads · 30 days
0
awtrisk/pvz-rl-agent
pvz-rl-agent is a reinforcement learning model from awtrisk. Use it for the reinforcement learning task on the model card, and read the license before you ship it in a product. The card lists the license as gpl-3.0.
The best-playing policy from pvz-rl-env, a Gymnasium environment built on a pybind11 bridge into the real Plants vs. Zombies engine.
Downloads · 30 days
0
Access
Public
Updated Sep 21, 2026
Repo size
30.8 MB
Likes
0
Public
Click a slice to open those files.
.pt30.8 MB · 100%
From the Hugging Face model README
The best-playing policy from pvz-rl-env, a Gymnasium environment built on a pybind11 bridge into the real Plants vs. Zombies engine.
Discrete(496) action space. Trained with PPO (sparse reward, KL-anchored) from a
behavior-cloning initialization of a hand-written heuristic teacher.(5, 9, 36) spatial + 24 globals.[1, 41, 39, 44, 42, 5, 30, 36, 17, 20].| config | mean abs wave | median |
|---|---|---|
| endless, 3000 sun, training deck | 49.7 | 50.5 |
| endless, 3000 sun, coffee deck (slot 7 -> Coffee Bean) | 72.1 | 61.5 |
| stage-1 completion suites (3000 sun) | 21.0, 100% completions | 21 |
Coffee-deck note: this policy was never trained on Coffee Bean. Its slot-7 actions get funneled by the env's legality mask into legal Coffee Bean plays on sleeping mushrooms, and it wakes them usefully — a free skill from masking, not from training.
git clone https://github.com/awtrisk/pvz-rl-env
cd pvz-rl-env
# build the engine and drop in your own main.pak + properties/ (see README)
import torch
from network import PvZActorCritic
agent = PvZActorCritic()
agent.load_state_dict(torch.load("pvz_endless_champion.pt", weights_only=True)["agent_state"])
agent.eval()
To watch it play: python scripts/record.py --checkpoint pvz_endless_champion.pt --start-sun 3000
(recordings end at the stage-1 boundary; the endless chain flag is env-side).
Weights are one file, a single {"agent_state": state_dict} payload — load with
weights_only=True.