Guest User

ArmA3 "Dynamic ObjectViewDistance"

a guest
Mar 16th, 2013
166
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Dynamic ObjectViewDistance
  2.  
  3. // constants
  4. _targetFPS = 50;
  5. _lowerSpread = 1;
  6. _upperSpread = 5;
  7. _minObjectViewDistance = 500;
  8. _maxObjectViewDistance = 3000;
  9.  
  10. // variables
  11. _objectViewDistance = 730;
  12.  
  13. while {true} do
  14. {
  15. _time = diag_tickTime;
  16. _frame = diag_frameno;
  17. sleep 0.5;
  18. _timePassed = diag_tickTime - _time;
  19. _framesPassed = diag_frameno - _frame;
  20.  
  21. _fps = _framesPassed / _timePassed;
  22. _deviation = _fps - _targetFPS;
  23.  
  24. if (_deviation < -_lowerSpread) then
  25. {
  26. _objectViewDistance = _objectViewDistance + 100 * (_deviation + _lowerSpread);
  27. };
  28. if (_deviation > _upperSpread) then
  29. {
  30. _objectViewDistance = _objectViewDistance + 100 * (_deviation - _upperSpread);
  31. };
  32.  
  33. _objectViewDistance = _minObjectViewDistance max _objectViewDistance;
  34. _objectViewDistance = _objectViewDistance min _maxObjectViewDistance;
  35.  
  36. hint str(_objectViewDistance);
  37.  
  38. setObjectViewDistance _objectViewDistance;
  39. }
RAW Paste Data