multitheftauto/mtasa-blue

Bandwidth reduction zones aren't accurate when stood on a mapped object.

Opened this issue · 0 comments

Describe the bug

For a long time players have reported de-sync with players on mapped objects, I thought the isPedOnGround de-sync fix would fix it, but after testing 1.7 with someone it did not. So I tested it further using a custom build where I added this to CNetAPI::ReadPlayerPuresync

// Trigger event with received position
{
    CLuaArguments Arguments;
    Arguments.PushNumber(position.data.vecPosition.fX);
    Arguments.PushNumber(position.data.vecPosition.fY);
    Arguments.PushNumber(position.data.vecPosition.fZ);
    pPlayer->CallEvent("onClientPlayerReceivePureSync", Arguments, true);
}

I then outputted these to chatbox, I was hoping to have it draw in the 3D world the updated positions, however when stood on a mapped object (I assume server side only mapped objects) instead of it using your world co-ordinates it uses an offset from the object, so that was of no use.

However the outputChatBox was useful as I noticed it was only coming in about 1 or 2 per second, despite player_sync_interval being set to 50ms. After some trial and error I discovered it was caused by bandwidth_reduction being set to "maximum" however "medium" also has some de-sync but less noticeable.

So it seems that the bandwidth reduction zone remote players are placed in, you can see the zones here: https://github.com/multitheftauto/mtasa-blue/blob/545972afef171cc3bbf993725054a09d67b648bd/Server/mods/deathmatch/logic/CBandwidthSettings.h are sometimes being placed in a higher zone than they should be. I noticed that sometimes it works fine (10 messages per second), you move a little bit and suddenly the player is only sending a few a second.

How it looks stood on a game world roof: https://streamable.com/kyy6e9

How it looks stood on the exact same roof but mapped: https://streamable.com/v4s6dy - Notice how at the end of the video I moved which then suddenly caused the sync packets to come in normal.

Note the difference in frequency of the sync packets.

Steps to reproduce

Have 2 players
srun a = createObject(3624, 2424.612, -2500.337, 13.655)
crun setElementPosition(localPlayer, 2424.612, -2500.337, 20)
srun setServerConfigSetting("bandwidth_reduction", "maximum")
Watch other player move around on the roof

Version

1.6 and 1.7 newest

Additional context

No response

Relevant log output

Security Policy

  • I have read and understood the Security Policy and this issue is not security related.