auto-fire-targeting is a skill from the Summer skill library: a guide your AI agent reads when the task matches, so it builds the good version on the first try. Fix auto-fire targeting (survivors, ARPG, tower defense) with pending damage to stop overkill.
When your agent uses it
- Designing or fixing the targeting system for an auto-fire weapon (survivors-genre, top-down ARPG, tower-defense)
- Bullet flight time longer than fire rate causes wasted bullets or overkill
Install
summer setup installs every skill for your agent. To add only this one:
claude-code for your agent, such as codex or cursor. See Skills for every option.
The skill
A survivors-genre auto-fire weapon picks a target each fire frame. Naive nearest-enemy targeting wastes bullets when fire rate exceeds bullet flight time. This skill encodes the pending-damage pattern that fixes it.The problem
Auto-fire weapon. Bullet speed 22 m/s. Target 10m away. Bullet takes ~0.45s to arrive. With high attack speed the player fires several bullets per second. By the time the first bullet arrives and kills the target, several more bullets are already in flight toward where the target was. They miss into empty space. The player sees bullets “fan out in a cone past the dead enemy” while other enemies stand around untouched. This is not a re-targeting bug. The weapon’s_fire() correctly re-runs find_nearest_enemy() each shot. The issue is that the target is alive at fire-time and dead at arrival-time. All shots fired in that window aim at it because none of them know about the kill in flight.
The fix — pending damage commitment
Each enemy carries a counter of damage that is in flight toward it. Targeting de-prefers (but does not exclude) enemies whose pending damage already exceeds their current HP.1. Add the counter to the enemy base class
2. Update the targeting helper
The selector keeps the saturated set as a fallback. If every enemy is saturated, the player must still be able to fire on someone — fall through to a normal nearest pick across saturated enemies. Otherwise prefer non-saturated.3. Commit at fire time
4. Release at bullet death (catch-all)
The bullet must release the commitment exactly once when it leaves the tree, regardless of how. Hit, pierce-out, range-expire, or any other free path. Usetree_exiting so the release is guaranteed without each free-site having to remember.
Bonus — spread fan across multiple enemies
When the weapon fires N projectiles per shot (extra-projectiles upgrade, multishot), pick a fresh target per projectile instead of fanning all N at the primary target. Combined with the saturation filter this drains follow-on shots toward fresh enemies.Bonus — bump projectile speed
The over-commit window isattack_speed * bullet_travel_time. Faster bullets shrink it for free. 22 m/s up to 35 m/s halves the window without affecting balance much. Cheap fix to bundle with the pattern.
What this does NOT solve
- Pierce > 1 weapons. The committed amount is reserved on the first target only. Subsequent pierces are bonus damage to whoever happens to be in line. That is fine — pierce already feels random by design.
- AOE / nova / orbital weapons. They hit everyone in radius regardless of “target,” so single-target pending-damage doesn’t apply. Skip them.
- Slow-but-massive weapons. A single shot that one-shots multiple enemies in sequence (rocket launcher, railgun) doesn’t benefit much. The window where the over-commit happens is too short to matter.
Why this beats alternatives
Pending-damage is local to the targeting query, requires no per-bullet ticking, and keeps each weapon archetype’s identity intact.
Verification
Test scenario: spawn a single weak enemy directly in front of the player at point-blank range. Equip the auto-fire weapon and the highest-attack-speed item. Watch the bullet fan when the enemy dies. Before: 5-15 bullets continue past the corpse over the next ~0.5s. After: 1-2 bullets continue (the ones that were already past the half-flight point), the rest of the fire pool redirects to whatever target Targeting picks next, or stops if there’s none in range. Usesummer_get_diagnostics to confirm no new errors.
summer_inspect_node will not show you pending_damage mid-fight. It reads
the edited scene in the editor — the response even tags itself
provenance: editor_scene — so it reports the saved node, not the live
instance. Runtime values need a runtime read: with the game running, read
the enemy with summer_inspect_runtime_node or summer_game_probe (engine
builds with the runtime-control ops; see the agent-playtesting skill).
On any build, the RunVerification op, sent through summer_batch, also works. It spins up a hidden, disposable game instance that runs a
GDScript probe and exits; it never touches the editor:
report(), save_frame(), press(), key(), finish(). Returns
{ok, results, frames, out_dir}.
Do not reach for SimulateInput here. It is only reachable from the
in-editor chat bridge; an MCP or CLI caller gets
{ok: false, failure_reason: "unsupported_transport"} back. Drive input from
inside the probe with press() / key() instead.
From a shell
No Summer MCP tools in this session? Run each one as a command; whensummer --version is missing or below 4.0, use npx -y summer-engine@latest in place of summer. Fields are flags in kebab-case (--scene-path res://main.tscn) or one --input '<json>', and summer ops describe <op> prints the exact input. The summer-cli skill has the rest.
Source:
library/skills/auto-fire-targeting/SKILL.md, rendered from summer-engine@4.3.0 on npm.
