twhl-community/halflife-updated

Increase maximum map bounds to highest working limit

SamVanheer opened this issue · 1 comments

The game hard-codes the map bounds to 4096 units in all directions. Increase this to the highest limit that still works properly. Check the engine's networking code to see what its limits are.

Mappers have reported that 16384 still works.

4096 is the maximum limit that the engine will work properly with. While it is possible to change the settings for coordinates sent as part of entity deltas using delta.lst the same is not true for network messages sending coordinates using WRITE_COORD.

This function writes floating point coordinates by multiplying them with 8 and then sending them as a signed 16 bit integer which has the range [-32768, 32767]. 32768 divided by 8 is 4096. This essentially means that anything in the game that works by sending coordinates is limited to the 4096 unit range.

Many entities never use messages that contain coordinates so allowing them to exist outside the original range will work, but in those cases where they do use coordinates in messages the resulting coordinates will be somewhere else in the map, usually in an area not currently visible causing the results of the message to be invisible or never exist at all.

It is possible to bypass this limitation by re-implementing the affected messages to send an unclamped floating point value but this will double the size of each coordinate value, meaning the message will increase in size by 6 to 12 bytes (for messages that send a start and end position) or more depending on how many coord values are used in a message.

This can cause a knock-on effect resulting in reliable message buffer overflows resulting in clients disconnecting from the server which could render the game unplayable.

For this reason the existing limits should be kept as-is. Modders can change the limit if they want to. If needed a cvar can be added to expand the limit/toggle between 4096 and 16384.