Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Boats] Fix x/y offsets from client to reflect EQ x/y instead of boat heading… #1296

Merged
merged 3 commits into from
Mar 28, 2021

Conversation

noudess
Copy link
Contributor

@noudess noudess commented Mar 15, 2021

At the end of 2019 I pushed a [PR] ( with @Uleat ) which corrected an issue where clients did not properly see other clients that were on a boat. This was because the x/y sent by the client is an offset from the center of the boat they are on, when the client is onboard. We had no code for this, so the moment a client went onto a boat they warped off to close to 0,0 on other client's screens.

I've come to learn, while trying to get cross zone ports from boat to boat working, that the client x,y is also an x,y offset which is based on the boat's heading. So if the boat has a heading of 0, the x,y offsets are correct in EQ map coordinates, but if the boat is at heading of 128 for example, the x,y sent by the client need to be rotated about the boat's origin to get correct x,y offsets in the EQ map world.

To complicate matters, simple rotation around the boat origin math needed to be altered due to the fact that the EQ X axis is negative to the right, while most axis systems are x positive to the right.

I believe this PR will:

  • render clients on the boat in the correct location for other viewing clients
  • will not change the view from the rider's perspective as they don't get these updates
  • will not fix the drift that we all see.. that is a client issue as best I can tell - where on some angles (mostly non integer) the x,y offsets drift due to rounding (or some other math issue)
  • clients actual x and y values will be correct if queried from quests when on a boat (they used to be off by rotation)

The PR also modifies the boat/zomm code slightly to share a variable to clean up that code a little.

@noudess noudess requested a review from Uleat March 15, 2021 12:58
zone/client_packet.cpp Outdated Show resolved Hide resolved
@Akkadius
Copy link
Member

Looks like this one has some comments to be followed up on

Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be able to comment on the code I don't know enough about C++ yet. But I have tested the function extensively and found no problems. Only that I had to change a script on my server a bit, because I had rotated the rotated coordinates myself - if that makes any sense.

@noudess
Copy link
Contributor Author

noudess commented Mar 16, 2021

I have found something related. There are times, where the movement manager code sets heading without actually rotating the mob. This can and will cause errors if the mob is a boat and a client is onboard.

I'm looking to see if fixing these spots impacts this PR.

If not, I'd like to get this PR pushed through (once I update to use the std library as suggested, and attack the movement manager portion in a new PR.

Copy link
Member

@mackal mackal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer we didn't have to convert away from EQ headings, but probably not worth figuring out :P

@Akkadius Akkadius merged commit 7407607 into EQEmu:master Mar 28, 2021
@noudess noudess deleted the boats branch April 26, 2021 13:42
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.

3 participants