Bojan Wilytsch
All posts

Mecha Defenders devlog

Two ways to make a mecha walk

I don't write the code for Mecha Defenders. Cloud agents do. Viktor, my AI coworker, writes each agent a short brief. The agent works in its own copy of the repo and opens a pull request with tests and a video. A second agent reviews it and changes nothing. If it passes and the checks are green, Viktor merges. I decide what the game is. In this post "we" means me, Viktor and the agents.

The game is a third-person 1v1 mecha duel in a city, played on a phone held sideways or with a Bluetooth pad. Every mecha is built from parts. So movement has to work for a light, a medium and a heavy build without hand work per build. This is how we built that movement twice in one day.

The plan: no clips

On the first evening I wrote: "My intuition is that we should look for some animation clips and we work more with pre-baked animations and the state machine, but ideally, I would love to incorporate those nicely into our locomotion gate and attack gate."

The older game had a walking system built for walk and strafe. Late that night I dropped it. It was shaped by the old game, and a new genre needs its own motion. The goal I gave was: "We need to create a complete new state-of-the-art gait for this game." I picked eight moves: boost sprint, power slide, wall run, mantle, jet climb, cover, ground pound and sidestep dash.

The brief Viktor wrote for those eight said "No animation clips." Gameplay moves an invisible capsule 60 times a second. The body follows it with inverse kinematics on the shared skeleton. Planted feet must never slide. Every number comes from the build, and every tuning slider has a hard minimum and maximum with a written reason.

What came back

The agent built all eight moves, plus run, turn and stop, on a grey test block. The light build peaked at 14.3 m/s in a boost, the heavy at 8.9. The light could wall run for about a second. The heavy could not wall run at all. In cover, the heavy's shoulder stuck out 12.4 cm, which is what we wanted. A big mecha should be hard to hide.

Same inputs, two builds. Light on the left, heavy on the right.

The agent also said what it could not check. All of it ran in a headless browser with software rendering, at about 25 frames a second. No real phone, no real gamepad.

The review

The reviewer failed it with three findings. In the cover replay, the right forearm went 0.285 m into the wall. The tests checked the capsule and the soles, not the arms, so they passed. Pressing Cover a second time could not leave cover, because the same press left it and entered it again. And the viewer drew elbows and knees as balls, while our skeleton rules make them hinges.

The procedural power slide. Knee down, sparks, still aiming.
The procedural power slide. Knee down, sparks, still aiming.

The agent fixed all three. The work went live at 04:15 on the second day, with sliders anyone could drag.

Tuning the procedural movement live, inside its clamped ranges.

Parked

At 08:48 I parked it. What I told Viktor: "park the gait for now, and you focus on having the best movement possible for this type of game. Whatever we need, like bake clips or whatever, and make it work, and show me a video of it."

The procedural sprint, kept as the "before".

The next pull request is a standard third-person stack. The capsule stays. An animator blends clips by speed and direction, foot IK pins a planted sole in place, and an aim layer turns the upper body toward the target. The procedural version still runs behind a URL flag.

The agent's sandbox had no route to download the free animation pack, and our rules keep downloaded assets out of the repo anyway. So it keyed the clips by hand, as small tables of numbers in code, made for one reference leg length and scaled to each build.

The same slide, now from a hand-keyed clip.

It measured foot slip on every plant: how far a locked heel and toe drift from where they landed. The worst case was 12 mm on every build, under our 2 cm target. That number is the lock tolerance on purpose. If the IK cannot hold a foot within 12 mm, the foot lifts instead of skating. In the chained run, turns and sharp speed changes forced a lift in about half the plants. Those are lifts, not slides, but there are a lot of them.

Two things went wrong in the recording itself. The headless browser crashes on any dropdown menu, so the agent added a mode that hides the toolbar. It also has no fonts, so the HUD text is blank in every video.

Thirty seconds through the block: strafe, slide into cover, mantle, ground pound, wall run, jet climb. The HUD text is blank because the recording browser has no fonts.

This version failed review too. Feet jump when one clip hands over to the next, and the reviewer listed two jump problems: "grounded jump" and "hold-to-jet". The fix is written. As I write this, it waits on GitHub, which is rate-limiting the agents.

Where it stands

The clip version runs on the same page, and the procedural gait is one flag away. I asked for clips on the first evening, and the brief for the first build said no clips. The agent did what the brief asked. The review caught what the tests missed. The call to change direction was mine.