Skip to content

Core/Spells: Launch cast time trajectory spells with the client's final aim - #32039

Open
ayoub-khemissi wants to merge 1 commit into
TrinityCore:3.3.5from
ayoub-khemissi:fix/cast-time-trajectory-final-aim
Open

ayoub-khemissi wants to merge 1 commit into
TrinityCore:3.3.5from
ayoub-khemissi:fix/cast-time-trajectory-final-aim

Conversation

@ayoub-khemissi

Copy link
Copy Markdown

Changes proposed:

For a trajectory spell with a cast time, the client sends its final aim (CMSG_UPDATE_MISSILE_TRAJECTORY: fire position, impact point, pitch, speed, moveStop) when its own cast bar ends, and expects the missile only then. Spell::update() launched the spell as soon as the server timer reached 0, a few milliseconds (the latency) before that packet arrived. As a result:

  • The missile kept the aim of the cast start. Turning the vehicle or changing the pitch during the cast had no effect. When the late packet arrived, the spell was no longer the current spell, so HandleUpdateMissileTrajectory dropped it.
  • The caster's client received SMSG_SPELL_GO for a missile it had not aimed yet, and drew it towards (0, 0, 0). In Wintergrasp that is always south-east and downward, through the ground. Other players see it correctly.

The case where this shows is the Plague Barrel (57606) of the Wintergrasp Catapult, the only Wintergrasp siege weapon with a cast time (1.5 s). The demolisher's boulder and the cannons are instant and were already fine.

With this change, such a spell (cast by a client, with a cast time and a trajectory) waits up to 1 second after its cast time for CMSG_UPDATE_MISSILE_TRAJECTORY, then launches as soon as the packet arrives. The added delay is only the client-to-server latency.

Issues addressed:

No TrinityCore issue that I could find. AzerothCore has the same code and reports for the same bug:

Tests performed:

Tested in game on a server based on TrinityCore 3.3.5 (same Spell::update and HandleUpdateMissileTrajectory code), with a Wintergrasp Catapult:

  • Before the change, no CMSG_UPDATE_MISSILE_TRAJECTORY was ever processed. The barrel visual flew towards (0, 0, 0) for the driver, and the impact stayed on the aim of the cast start.
  • After the change, one CMSG_UPDATE_MISSILE_TRAJECTORY (moveStop 1) arrives at the end of every cast. The barrel flies to the reticle and lands there, including when the vehicle turns or changes pitch during the cast.
  • The demolisher and cannons, which are instant, are unchanged.

This exact patch was not compiled on the current 3.3.5 HEAD. The same change builds and runs on our fork.

These packet changes were tried first and did not fix the visual:

  • the client's cast count as the destination's cast index;
  • CAST_FLAG_ADJUST_MISSILE added to SMSG_SPELL_START or removed from SMSG_SPELL_GO;
  • the source location sent relative to the vehicle;
  • an SMSG_SET_PROJECTILE_POSITION sent with the impact point.

Known issues and TODO list:

  • Spell::SelectImplicitTrajTargets() still uses the caster's orientation for the trajectory direction, both for srcPos and for the shortened impact point when a unit is hit first. The direction from the source to the destination the client sent may be more accurate. That is left out of this PR.

🤖 Generated with Claude Code

https://claude.ai/code/session_01GCPYbmr5ZSurtKRpog1xuZ

…al aim

The client sends CMSG_UPDATE_MISSILE_TRAJECTORY with its final aim (impact point, pitch, speed) when its own cast bar ends
and expects the missile only then. The spell launched on the server timer, before that packet arrived, so the missile
kept the aim of the cast start and the caster's client drew it towards (0, 0, 0) (Plague Barrel of Wintergrasp Catapult).
Such spells now wait up to 1 second for that packet after their cast time, then launch as soon as it arrives.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GCPYbmr5ZSurtKRpog1xuZ
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant