How to Build a Command Grab: Fighting Game State Machine Tutorial
Anatomy of a Command Grab
Command grabs are one of the most satisfying tools in a grappler's kit — and one of the trickiest to implement correctly in a fighting game engine. In this tutorial, we walk through how to build a command grab using the Tarunk state machine system, the same engine that powers our web-native fighting game platform.
The Core Loop
A command grab consists of three states:
- Startup — The character winds up
- Active — The hitbox is live
- Recovery — Whiff recovery
The key parameter is p2getp1state = 1, which forces the opponent into the grabbed state the moment the grab connects. That's what turns a normal hitbox into a throw: instead of dealing damage, the opponent's state is overridden by the grab sequence you define.
Why State Machines Matter
Every move in a fighting game — from this command grab to a full combo — is a sequence of states with triggers and transitions. Tarunk Studio makes those state machines tangible: you can see every transition, every hitbox frame, and every trigger condition without digging through raw text files.
Build Your Own Grappler
Want to try it yourself? Start with the TARUNK Bot template character — it ships with a complete state machine (58 states) and AI command hints you can extend. Or load the template directly in /play and study how its command grab states are wired.
State machines also got faster in the v0.6.0 WASM engine update — grab whiffs and reactions now resolve 3x faster.
Share this post
Related posts
Comments
Sign in to leave a comment.
