topaz-next / topaz

💎 A server emulator for Final Fantasy XI.
GNU General Public License v3.0
55 stars 80 forks source link

char doesn't move in relation to speed #2661

Open Arghann opened 3 years ago

Arghann commented 3 years ago

Additional Information (Steps to reproduce/Expected behavior) : appear on a fresh install and all new char @TeoTwawki

TeoTwawki commented 3 years ago

I need more than this. as I explained on discord the animation speed value isn't supposed to change in relation to it, and in my tests everything animation properly at a wide range of speeds from 20 to 250.

So I need more than "doesn't move in relation" - are they animating too fast, too slow, what, exactly, is wrong?

edit: I even can even provide VIDEO of me running around at 20/40/50/60./80/80/120/140/150/160/180/200/220/240/250 and it all animating correctly, so something more is going on if thats not the case for you without that line in baseentity.

Arghann commented 3 years ago

So after build I changed speed_mod,mount_speed_mod,mob_speed_mod to 40 then run the server and noticed that the new player I just created moves faster than it should. I check with the !speed cmd the range suppose to be 0-255 but from 220 and over to 255 the char walk.

TeoTwawki commented 3 years ago

so above 220 it animates wrong for you. Can this be reproduced on a stock build of the topaz release branch (no source alterations, just confs/settings) ? If so, please note what nameflags value the test character has: this may possibly be relevant.

ref<uint16>(0x2E) |= PChar->speedsub << 1;

we do this in the packet because speedSub (thats your animation speed) is actually NOT a 16 bit value, but it doesn't alight to 8 bit in either of the 2 bytes contained in that 16 bit area...And nameflags happens to have a byte of its data at 0x2B overlapping the same space.. https://github.com/topaz-next/topaz/blob/6dca15148ed206d12620e7298fe7bae2990ebb41/src/map/packets/char_update.cpp#L47

(also several other bytes of same packet with other things between them - wtf SE?!)

Arghann commented 3 years ago

No it animates just wrong. the !speed cmd was only to check and I noticed what I told you before. Has I said there is no src alterations : all fresh new release build - only setting and conf. (i modify the src to test long after the first run - like 3 days).

nnameflags: '67108864'

TeoTwawki commented 3 years ago

nnameflags or nameflags? both exist

SirGouki commented 3 years ago

@TeoTwawki What I think is meant (and I'd noticed this too) is Say you change the config to change the default speed for characters. When you use the !speed command for the first time, it still lists the speed as old value: 50. Mines set to 70. My player account also seems to be at 50 by default no matter what my config is set to.

TeoTwawki commented 3 years ago

the only 2 errors I have found:

  1. we fail to properly clamp so people can use invalid conf values (50+220 = 270, which is beyond max speed and wraps around past to zero again)
  2. getSpeed() is not returning expected values due to it getting the member value whiel the function does an add and return instead of updating that.

Both of these are about to change.