Jump to content
Sign in to follow this  
joltan

Adaptive viewdistance script for mp

Recommended Posts

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.

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.4) and benchmark of weakest machine is 3800. Viewdistance will be set to 1520m.

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:

viewdistancescript1.jpg

Share this post


Link to post
Share on other sites

Very nice! Thanks for sharing...

/Christer (a.k.a KeyCat)

Share this post


Link to post
Share on other sites
Guest

Fantastic. My slackarse housemate keeps on saying he is going to make a script exactly like this.....and you've beaten him to it. Well done smile.giftounge.gif

Share this post


Link to post
Share on other sites

Wow Great Job,

Now maybe i can change my Nogova Bridge Mission so that you can actually see across the Damned Bridge and attack the tanks on the other side. smile.gif

Share this post


Link to post
Share on other sites

That's a really great script and should be in every mp mission.

One thing i found out though (as i always had crappy viewdistances computed for my computer), the scripting command benchmark does not benchmark your computer at all, it relies on the value of 3D_Performance in your Flashpoint.cfg. Mine was never set correctly, i could run flashpointpreferences a hundred times and never changed the value in the config. I had to delete my flashpoint.cfg (and no, it was NOT write-protected) and run flashpointpreferences again. Then i had the correct value put in it (about 3 times what was in there before).

BTW: I had these values in my flashpoint.cfg before i deleted it, now they are gone:

Cloudlets=1;

Reflections=1;

Shadows=1;

Sky=1;

VehShadows=1;

Does ofp still use those or were they taken out with some patch somewhere along the way?

Share this post


Link to post
Share on other sites

Updated to V1.5 & link in first post fixed. Nothing dramatic, just a few small changes. If no parameter is given to the script it starts in 'low automatic' mode, some default values & messages changed.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×