mtasa-blue icon indicating copy to clipboard operation
mtasa-blue copied to clipboard

Map size limits

Open jordskjelvv opened this issue 2 years ago • 1 comments

Is your feature request related to a problem? Please describe.

map is limited to 16 000x 16 000 meters. Boat stops going for passanger glued on vehicle at 7 000 meters while it goes forward for driver

Describe the solution you'd like

We are developing Stars And Stripes, and hope to make it running in MTA. map is 12 times bigger than original map. Liberty city is located at 48 000 coordinates there

Describe alternatives you've considered

No response

Additional context

GTA-SS

Security Policy

  • [X] I have read and understood the Security Policy and this issue is not about a cheat or security vulnerability.

jordskjelvv avatar Mar 20 '24 10:03 jordskjelvv

For reference:

This issue exists because (player, among other) positions are sent in sync packets in a structure where every floating point number is encoded to 3 bytes, 14 bits for the integer part, and 10 for the fraction. This 14 bits integer part results in a limit of -8192 to 8191.

Interestingly MTA only does this "optimisation" for the X and Y coordinate in a vector, the Z coordinate is frequently sent as a full float (32 bits, 4 bytes).

Fixing this would require changing this among any place where we use this structure, potential fixes would include:

  • Changing the ratio of bits, for example 15 integer, 9 fractional (to keep the same amount of bandwidth / memory), this would reduce accuracy
  • Adding an additional bit (or more) to the integer part, causing it to not be byte aligned (Something tells me this could cause an issue because it seems to be intentionally be something that is byte aligned)
  • Adding 8 additional bits, causing it to be 32 bits, and this point we might as well just write them as normal floats.

Changing this would most likely mean new bitstream version, meaning players need to update.
It might be worth making this configurable, so a server can choose for a lower limit but more accuracy, or just less bandwidth usage.

Some details on the limitations can be found here

NanoBob avatar Mar 22 '24 11:03 NanoBob