Advertisement
Nerexis

Untitled

Nov 27th, 2023
200
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQF 2.08 KB | None | 0 0
  1. // Map Benchmark by Nerexis (nmilsim.wordpress.com )
  2. // Discord: https://discordapp.com/invite/s7BMSjp
  3. // Steam: https://steamcommunity.com/profiles/76561198010051679/
  4. // version 27.11.2023
  5.  
  6. [] spawn {
  7.     private _totalFPS = 0;
  8.     private _count = 0;
  9.     private _mapSize = worldSize;
  10.     private _startTime = diag_tickTime;
  11.  
  12.     private _scores = [];
  13.  
  14.     player allowDamage false;
  15.     private _ehId = player addEventHandler["HandleDamage", {0;}];
  16.  
  17.     setViewDistance 4000;
  18.     setObjectViewDistance 4000;
  19.     setDate [2022,2,24,12,0];
  20.  
  21.     0 setOvercast 0.3;
  22.     0 setRain 0;
  23.     0 setFog 0;
  24.     forceWeatherChange;
  25.     uisleep 1;
  26.  
  27.     systemChat "Starting FPS test, please close debug console...";
  28.     uisleep 1;
  29.  
  30.     diag_log "Starting FPS test...";
  31.     systemChat "3";
  32.     uisleep 1;
  33.     systemChat "2";
  34.     uisleep 1;
  35.     systemChat "1";
  36.     uisleep 1;
  37.     systemChat "START";
  38.    
  39.     for "_x" from 0 to _mapSize step 1000 do {
  40.         for "_y" from 0 to _mapSize step 1000 do {            
  41.             private _center = [_x + 500, _y + 500, 0];            
  42.             if (surfaceIsWater _center) then {
  43.                 continue;
  44.             };
  45.            
  46.             private _pos = [_center select 0, _center select 1, 0];
  47.             cameraOn setPos _pos;
  48.             cameraOn setDir ([_pos, [worldSize/2,worldSize/2,0]] call BIS_fnc_dirTo);
  49.             cameraOn camCommit 0;
  50.            
  51.             uiSleep 1;
  52.            
  53.             private _fps = diag_fps;                
  54.             _totalFPS = _totalFPS + _fps;
  55.             _count = _count + 1;
  56.  
  57.             _scores pushBack [_fps, _pos];         
  58.         };
  59.     };
  60.    
  61.     private _endTime = diag_tickTime;
  62.     private _elapsedTime = _endTime - _startTime;
  63.     private _averageFPS = _totalFPS / _count;
  64.    
  65.     private _msg = format ["Map %1: Average FPS: %2, Samples: %3, Took: %4 seconds", worldName, _averageFPS, _count, _elapsedTime];
  66.     systemChat _msg;
  67.     diag_log _msg;
  68.    
  69.     player allowDamage true;
  70.     player removeEventHandler["HandleDamage",_ehId];
  71.  
  72.     _scores sort true;
  73.  
  74.     diag_log format["------ MAP BENCHMARK RESULTS EXPORT START T%1 ------",diag_tickTime];
  75.     {
  76.         diag_log format["%1. FPS %2, POS %3",_foreachindex,_x # 0, _x # 1];
  77.     } foreach _scores;
  78.     diag_log format["------ MAP BENCHMARK RESULTS EXPORT END T%2 ------",diag_tickTime];
  79. };
  80.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement