Page 1 of 3 123 LastLast
Results 1 to 10 of 21

  Click here to go to the first Developer post in this thread.  

Thread: Simple Dynamic Viewdistance Script

  1. #1
    First Sergeant
    Join Date
    Oct 30 2009
    Location
    Brisbane, Australia
    Posts
    980

    Simple Dynamic Viewdistance Script

    Gday all.

    Here's a simple script I've been working on which does a few useful things:

    What it does:
    1 - It dynamically and smoothly adjusts viewdistance according to your framerate.

    2 - It prevents the framerate from dropping and staying too low in areas of scenic complexity or lots of ai.

    3 - It stabilises framerate so that there are less noticeable fps changes.

    4 - It increases the viewdistance when using scopes/binoculars.

    How it works:
    The script launches a background process to monitor the average fps over a user specified time period (eg 10 seconds). This is then compared to the average from the previous 10 seconds, and if the fps has decreased then the viewdistance is dropped accordingly. Conversely, if the fps increases, the viewdistance is increased. It's set up so that it won't cause large oscillations in viewdistance/framerate.

    The script also checks if you are using a scope or binocs and increases the viewdistance to simulate being able to see further and with more detail than with the naked eye.

    These kind of scripts work on the assumption that in areas of high scenic complexity such as the middle of Zargabad or in a dense forest, you won't really notice that the view distance has been dropped. Similarly, if there are a lot of enemy ai trying to smoke you, you're probably more interested in getting a smooth bead on them than in admiring distant scenery. Another assumption is that increasing viewdistance when looking down a scoped weapon doesn't actually negatively affect fps most of the time.

    You'll notice the viewdistance changing if you look for it, just like you'll notice lod switching or clutter popping in if you look for them too. After a while you simply stop noticing.

    How to use it
    Save the script below as whatever you like, wherever you like, and call it thusly from your init.sqf:

    Code:
    nul = [this,400,1800,25,40,10] execvm "nameofscript.sqf";
    These are the values I use on my middle range system (Dual coreE6750, GTX460)

    400 = minimum view distance (m)
    1800 = maximum view distance (m)
    25 = minimum framerate
    40 = preferred (realistic!) framerate
    10 = time to average framerate over

    Obviously you'll change these values to suit your system. If you can't deal with fps below 30 then set the minimum to 30, and/or lower the minimum viewdistance even further. If your system can comfortably pull 75 fps at 5000m viewdistance then adjust accordingly (alternatively your computer is so powerful it probably doesn't need this script!).

    Comment out the hintsilent line near the bottom of the script to remove debugging messages.

    Script below:
    Spoiler:


    If you can see a way to improve this script or have any suggestions then I'd love to hear them.

    Lastly, if you want a more comprehensive system to adjust framerate then look at VictorFarbau's VF FPS Saver (VFFPSS)
    http://forums.bistudio.com/showthrea...c+viewdistance

  2. #2
    First Lieutenant Kremator's Avatar
    Join Date
    Jun 8 2007
    Location
    Cambridge, UK
    Posts
    5,002
    Will check it out ... cheers mate !

  3. #3
    Wow - this looks really interesting!

  4. #4
    First Sergeant
    Join Date
    Oct 30 2009
    Location
    Brisbane, Australia
    Posts
    980
    Author of the Thread
    Thanks guys, looking forward to your feedback.

  5. #5

  6.   This is the last Developer post in this thread.   #6
    Inside your mission's folder.

    Though, I think it would be pretty awesome to have this as a client-side addon, rather than a mission-dependent script. Good work nonetheless, tpw.

  7. #7
    Yes make it a client-side addon.

  8. #8
    First Sergeant
    Join Date
    Oct 30 2009
    Location
    Brisbane, Australia
    Posts
    980
    Author of the Thread
    Well, other than the fact that I have zero idea how to turn it into and addon, I'd be happy to help. When I was talking about a simple script, I meant simple for me

    Before I go to the bother, can a few people at least tell me if it works properly for someone other than me...

  9. #9
    I'll help out making a pbo version for you if you require - shoot me a PM
    Hackintosh Windows 7/Mountain Lion. Intel i7-920 @3.8 Ghz.
    Gigabyte GA-EX58-UD5 Rev1. Palit GTX 680 4GB.
    6Gb DDR3 RAM. Corsair 650W PSU.

  10. #10
    First Sergeant
    Join Date
    Oct 30 2009
    Location
    Brisbane, Australia
    Posts
    980
    Author of the Thread
    Quote Originally Posted by Das Attorney View Post
    I'll help out making a pbo version for you if you require - shoot me a PM
    Thanks mate, will do.

Page 1 of 3 123 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •