Home   Help Search Login Register  

Author Topic: Adaptive viewdistance in MP  (Read 1191 times)

0 Members and 1 Guest are viewing this topic.

joltan

  • Guest
Adaptive viewdistance in MP
« on: 10 Apr 2003, 16:17:37 »
I submitted this a few days ago as a snippet. Now that I've updated the demo mission and fixed the last bug, I thought I'd post it here, while it's still pending:

The script uses a challenge-response mechanism to negotiate a common viewdistance based on the performance of the weakest system in a mp game. This prevents a mission offering high viewdistances from being unplayable for some players and slow servers.

You need to have a gamelogic called 'server' on your map for the script to work properly. Only the script 'negoview.sqs' is needed from the demo mission. See the script header and the briefing/notes of the demo mission for instructions on how to implement this into your missions.


Download the demo mission (5.4 kb).


Notes: When choosing a fixed viewdistance the script determines if all computers are able to support this value - if not the viewdistance will be adapted to a value that the weakest machine can still cope with (determined by a factor of its benchmark set in the script's header, default 0.65). To avoid the viewdistance being reduced below an acceptable minimum a lower limit is defined in the script (default 1000m). The viewdistance will never be lower than this minimum.

Example 1: benchmark of the weakest machine is 1700, selected viewdistance = 1500m. 1700x0.65=1105 -> Viewdistance set to 1105 for all machines.

Example 2: benchmark of the weakest machine is 2500, selected viewdistance = 1500m. 2500x0.65=1625 -> Viewdistance set to 1500 for all machines.

Example 3: benchmark of weakest machine is 1200, selected viewdistance = 1500. 1200x0.65=780 -> Viewdistance set to 1000m, as that's the minimum distance defined in the script.

Example 4: Viewdistance set to automatic mode (high, default factor 0.65) and benchmark of weakest machine is 3800. 3800x0.65=2470 -> Viewdistance will be set to 2470m.

Example 5: Viewdistance set to automatic mode (low, default factor 0.35) and benchmark of weakest machine is 3800. Viewdistance will be set to 1330m.

Minimum/maximum viewdistance and the factors for high/low automatic modes can be set in the script header and should be adapted to the needs of your mission. There's also an option to have the script adapt the viewdistance iteratively during negotiation (default on) or to leave it to the mission designer to set the negotiated viewdistance at a later point (distance is available as a global variable called DDL_GLOBALSERVERDISTANCE).

Screenshot from one of my missions using the script:

« Last Edit: 10 Apr 2003, 16:19:05 by joltan »