Skip to content

Red koopa shell: fix circling, add terrain step-up, clean homing algorithm#106

Draft
Copilot wants to merge 4 commits into
devfrom
copilot/refactor-koopa-shell-algorithms
Draft

Red koopa shell: fix circling, add terrain step-up, clean homing algorithm#106
Copilot wants to merge 4 commits into
devfrom
copilot/refactor-koopa-shell-algorithms

Conversation

Copilot AI commented Mar 1, 2026

Copy link
Copy Markdown

Red koopa shells circled targets rather than hitting them, and were useless on any non-flat terrain.

Changes

Fix circling near targets

The P-controller gain was too low (0.1), causing the shell to take ~10 ticks to align — enough to orbit close targets indefinitely. Raised to 0.25 via a named constant HOMING_TURN_RATE.

// before: hard-coded, too slow to turn
double pGain = 0.1;

// after: fast enough to converge before overshooting
private static final double HOMING_TURN_RATE = 0.25;

Terrain step-up

Overrides maxUpStep() returning 1.0f so the shell uses Minecraft's built-in step-up physics to climb single blocks in its path — consistent with how players and mobs navigate terrain.

Homing algorithm cleanup

  • Extracted currentVelocity.multiply(1, 0, 1) into currentHorizontal (was duplicated)
  • length()lengthSqr() (avoids unnecessary sqrt)
  • Replaced == 0 float equality with < 1e-10 epsilon guard

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: Hugman76 <36963654+Hugman76@users.noreply.github.com>
Copilot AI changed the title [WIP] Revisit and improve algorithms for koopa shell behavior Fix koopa shell bugs and improve homing/speed algorithms Mar 1, 2026
Co-authored-by: Hugman76 <36963654+Hugman76@users.noreply.github.com>
Copilot AI changed the title Fix koopa shell bugs and improve homing/speed algorithms Fix koopa shell algorithms and bugs Mar 1, 2026
…gorithm

Co-authored-by: Hugman76 <36963654+Hugman76@users.noreply.github.com>
Copilot AI changed the title Fix koopa shell algorithms and bugs Red koopa shell: fix circling, add terrain step-up, clean homing algorithm Mar 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants