////--------------------------------------------------------------------------------------------------------------------------------

////

//// AveYo's DOTA 2 BENCHMARK.CFG v3.1

//// Previous D-OPTIMIZER V2 cfg engine based script got this job done using clever pseudo schedule / wait cmds

//// Now Valve finally added exec_async and a suite of useful commands featured in their perftest.cfg

//// This is a quick mix of the two scripts

////

//// 1: remove .txt extension and copy this file to \Steam\steamapps\common\dota 2 beta\game\dota\cfg\benchmark.cfg

//// 2: change Dota 2 launch options (-dx11 / -dx9 / -vulkan / -nod3d9ex / -nosound )

//// 3: open Dota 2 and go to Watch - Replays - enter 2844309781 in Search for MatchIDs then download it

//// credits for the matchid goes to dev.dota user: jstq

//// 4: to start, enter into console: EXEC_ASYNC BENCHMARK

//// Zip file including replay available at: https://1drv.ms/f/s!AhH0pZaDBUFEgU6MJbUMugaQZuFw

////

//// Demo overlay and spectator menu cannot be closed by script anymore, feel free to do it manually in the Warm up phase

//// Try not to press any keys or move the mouse in the red Running performance tests phase ( takes ~2 minutes )

//// Results are pretty printed to console when finished

//// Can be saved to \dota 2 beta\game\dota\condumpxxx.txt file after entering into console: CONDUMP

////

//// v2 Changes:

//// - initial short warmup now uses normal demo playback

//// - removed demo_goto usage (caused Source2Bench.csv not writing fps number - it was reported fine in console)

//// - timedemo now runs uninterrupted for more reliable results

//// - added particle usage reporting

//// - improved ui feedback

//// v2.1 Changes:

//// - added a better alias filter to facilitate resetting timedemo_start / timedemo_end when done / intrerrupted with FF

//// - added pimpmuckl's demo alternative

//// - added a few more stats to the console report (video memory usage, sound cache usage)

//// v3 Changes:

//// - adapted Valve's perftest.cfg for more specific / grouped stats and extra machine info

//// - single replay load with several warm up stages implemented for more accurate and reproducible results

//// v3.1 Changes:

//// - split into live test (repeated once) and 7x static tests, overall duration reduced

//// - added 'Interpreting the static test results' by gdrewb-valve

////

////--------------------------------------------------------------------------------------------------------------------------------

//// Last updated: 21:40 UTC FEB 28

//// BACKUP CVARS? ( ASSUMING IT SHOULD DO THAT, IT'S ONLY PARTIAL )

push_var_values

//// LOADING REPLAY GUI HINT

hideconsole

activategameui

top_bar_message "[Dota 2 Benchmark] Loading replays/2844309781, please wait a minute.." 0

sleep 5000

gameui_hide

//// LOADING REPLAY OPTIONS

sv_log 0

sv_alternateticks 0

dota_spectator_use_broadcaster_stats_panel 0

dota_spectator_mode 0

dota_spectator_hero_index ""

cl_showdemooverlay 0; // still broken, no other command usable to hide demo overlay

demo_usefastgoto 1

@panorama_show_fps 1

//demo_pauseatservertick 104200

//// REPLAY TARGET DEFAULT: replays\2844309781

alias #replay_target "playdemo replays\2844309781"; // reused by LIVE TEST 3

#replay_target;

//// REPLAY LOAD TIME - DEFAULT 60 SECONDS SHOULD BE ENOUGH ( COULD USE 30 FOR FASTER SYSTEMS OR 90 FOR SLOWER ONES )

sleep 60000

//sleep 30000

//sleep 90000; // sleep can't be aliased..

////--------------------------------------------------------------------------------------------------------------------------------

//// CFG INTERNALS: CONSOLE OUTPUT / CANCEL / D-OPTIMIZER BASED SCHEDULER ENGINE REPLACED BY EXEC_ASYNC SLEEP

////--------------------------------------------------------------------------------------------------------------------------------

//// CONSOLE ECHO ALTERNATIVE WITH ON-THE-FLY COLORS! - FINALLY VALVE (RE)ADDED ECHOLN SO USE THAT INSTEAD

alias #echo_off "log_flags Console General +donotecho | grep %";alias #echo_on "log_flags Console General -donotecho | grep %";

alias #color_none "log_color General C0C0C000 | grep %"; // invisible color - text can still be selected/copied/pasted

alias #color_default "log_color General 00000000 | grep %;alias #color #color_default";//ip "";// using echoln instead of ip for newline

alias #echo "#color_none;echoln;#color";// basically sets invisible color, prints newline (v2: ip = ) then restores previous color

//// COLOR PRESETS! - WORKS THE SAME WITH BUILT-IN ECHOLN

alias #color_cyan "log_color General 00FFFFFF | grep %;alias #color #color_cyan";

alias #color_yellow "log_color General FFFF00FF | grep %;alias #color #color_yellow";

alias #color_green "log_color General 00FF00FF | grep %;alias #color #color_green";

//// FILTER

alias `~` "";

//// DISABLE ALL CONSOLE SPEW SOURCES FOR A CLEAN SCRIPT OUTPUT ( VALVE PLZ GIFF SINGLE CMD FOR IT )

log_flags Console +DoNotEcho | grep %

log_flags General Developer DeveloperConsole Panel Panorama PanoramaScript VScript VScriptDbg VScriptScripts CustomUI CustomGameCache CustomNetTable +DoNotEcho

log_flags AnimationGraph AnimationSystem AnimGraphManager AnimResource Assert "BitBuf Error" BoneSetup Client "Combat Analyzer" CommandLine D3D Decals Demo DeveloperVerbose DotaGuide DOTAHLTVCamera +DoNotEcho

log_flags DOTAHLTVDirector DOTA_CHAT DownloadManager EmitSound EngineInitialization EngineServiceManager "Entity Dump" "Entity Load Unserialize" "Entity System" Filesystem GameEventSystem GCClient GlobalState HangWatchdog "HLTV Server" Host +DoNotEcho

log_flags HostStateManager IME InputService InputSystem InstantReplay LOADING MaterialSystem MeshSystem ModelCombiner modellib NavMesh NetworkClientService Networking "Networking Reliable" NetworkP2PService NetworkServerService +DoNotEcho

log_flags NetworkService Particles ParticlesLib Physics PostProcessing PostProcessPipeline RenderPipelineDota RenderPipelineVr RenderService RenderSystem ResourceSystem SaveRestore SaveRestoreIO Scaleform "Scaleform IME" ScaleformAS +DoNotEcho

log_flags ScaleformParse ScaleformScript SceneSystem SchemaSystem SchemaSystemUtils Server ServerLog SignonState SndEmitterSystem SndOperators SoundOperatorSystem SoundOpGameSystem SoundSystem SoundSystemLowLevel SpawnGroup SplitPacket +DoNotEcho

log_flags SplitScreen Steam SteamDatagramClient SteamDatagramServer SteamUnifiedMessages ToneMapping ToolGameSimulation TypeManager Vfx VguiCallQueue VolumetricFog VProf VR WeekendTourney Workshop WorldRenderer +DoNotEcho

////--------------------------------------------------------------------------------------------------------------------------------

//// BENCHMARK MAIN - SYSTEM INFO, THEN 5 x 30 seconds performance tests

////--------------------------------------------------------------------------------------------------------------------------------

//// PERFORMANCE TESTS GUI HINT

activategameui

top_bar_message "[DOTA 2 BENCHMARK] Running performance tests - ETA: 2 minutes" 1

sleep 5000

gameui_hide

//// CONSOLE LOGO

clear

#color_cyan

#echo_on

echoln ;// DispatchAsyncEvent spew in the General channel is so lame.. killing it would also kill echoln.. question is why is set like that?

#echo_on; echoln " _______ ______ ______ ________ __ ___ ___ __ ________ _______ ______ "; #echo_off

#echo_on; echoln " | __ \ / \ | _ \ | | | | | \/ | | | | / | ____| | _ \ "; #echo_off

#echo_on; echoln " | | | | | ,~~, | | |_) | `~~| |~~` | | | \ / | | | `~~~/ / | |__ | |_) | "; #echo_off

#echo_on; echoln " | | | | AVEYO`S | | | | | ___/ | | | | | |\/| | | | / / | __| | / "; #echo_off

#echo_on; echoln " | `~~` | | `~~` | | | | | | | | | | | | | / /~~~, | |____ | |\ \ "; #echo_off

#echo_on; echoln " |_______/ \______/ |__| |__| |__| |__| |__| |__| /_______| |_______| |__| \__\ "; #echo_off

echoln

#echo_off

#color_default

//// CONSOLE MACHINE INFO

#color_yellow

#echo_on

echoln

echoln -------------------------------------------------------------

echoln [DOTA 2 BENCHMARK] Machine info

echoln -------------------------------------------------------------

echoln

#echo_off

#color_default

log_flags Console -consoleonly | grep %; // allow sys_info to be logged to file

#echo_on

sys_info

#echo_off

log_flags Console +consoleonly | grep %

//// CONSOLE TEST LABEL

#color_yellow

#echo_on

echoln

echoln

echoln -------------------------------------------------------------

echoln [DOTA 2 BENCHMARK] Running performance tests - ETA: 2 minutes

echoln -------------------------------------------------------------

#echo_off

#color_default

//// TEST ACTIVATE ( Valve's proposed method relies on cl_showfps - it should have lower overhead than D-OPTIMIZER V2 based Vprof )

@panorama_show_fps 0

fps_max 999

cl_showfps 2

//// LIVE TEST 1. CURRENT USER SETTINGS [DEF] D-OPTIMIZER PRESETS: Potato Low OPTIMAL Med High Ultra @

////--------------------------------------------------------------------------------------------------------------------------------

//dota_portrait_animate 1; // [1] Animate Portrait 0 0 1 1 1 1 O

//r_deferred_additive_pass 0; //~ [1] Additive Light Pass 0 0 0 1 1 1 M

//r_deferred_simple_light 1; // [1] World Lighting 0 1 1 1 1 1 L

//r_ssao 0; // [0] Ambient Occlusion 0 0 0 0 0 1 U

//r_dota_normal_maps 0; // [0] Normal Maps 0 0 0 1 1 1 M

//r_dota_allow_parallax_mapping 0; // [0] Ground Parallax 0 0 0 0 1 1 H

//dota_ambient_creatures 0; // [0] Ambient Creatures 0 0 0 0 0 1 U

//dota_ambient_cloth 1; // [0] Ambient Cloth Simulation 0 0 1 1 1 1 M

//r_grass_quality 1; // [0] Grass 0 0 1 2 3 4 O

//r_dota_fxaa 0; // [0] Anti-Aliasing 0 0 0 0 1 1 H

//r_deferred_specular 1; // [0] Specular 0 0 1 1 1 1 O

//r_deferred_specular_bloom 0; // [0] Specular and Light Blooms 0 0 0 1 1 1 M

//dota_cheap_water 1; // [1] !High Quality Water 1 1 1 1 0 0 H

//r_deferred_height_fog 1; // [1] Atmospheric Fog 0 0 1 1 1 1 O

//r_dashboard_render_quality 1; // [1] High Quality Dashboard - - - - - - -

//r_dota_allow_wind_on_trees 0; // [0] Tree Wind 0 0 0 0 1 1 H

//r_texture_stream_mip_bias 1; // [1] Texture Quality 2 1 1 1 0 0 L

//cl_particle_fallback_base 4; //~ [2] Effects Quality 4 4 4 2 0 0 M

//cl_globallight_shadow_mode 2; // [2] Shadow Quality 0 1 2 2 2 3 L

//mat_viewportscale 1.0; // [1] Render Quality 0.8 0.9 1.0 1.0 1.0 1.0 L

//fps_max 60.0f; // [120] Maximum frames per second 60 60 60 120 144 240 M

//// Reset live scene

demo_resume

dota_spectator_mode 3

dota_spectator_hero_index 0

demo_goto 102800 pause

sleep 1000

dota_spectator_hero_index 2

stat_dropdown 0

demo_resume

#color_green

#echo_on

echoln LIVE TEST 1. CURRENT USER SETTINGS

#echo_off

#color_default

//// Let new state settle.

sleep 1000

cl_resetfps

sleep 30000

#echo_on

cl_printfps

#echo_off

//// LIVE TEST 2. CURRENT USER SETTINGS

//// Reset live scene

demo_resume

dota_spectator_mode 3

dota_spectator_hero_index 0

demo_goto 102800 pause

sleep 1000

dota_spectator_hero_index 2

stat_dropdown 0

demo_resume

#color_green

#echo_on

echoln LIVE TEST 2. CURRENT USER SETTINGS

#echo_off

#color_default

//// Let new state settle.

sleep 1000

cl_resetfps

sleep 30000

#echo_on

cl_printfps

#echo_off

//// STATIC SCENE SETUP

demo_resume; demo_pauseatservertick 104081; demo_goto 102800

dota_spectator_mode 3

dota_spectator_hero_index 0

sleep 1000

dota_spectator_hero_index 5

stat_dropdown 0

sleep 30000

//// STATIC TEST 1. CURRENT USER SETTINGS

#color_yellow

#echo_on

echoln

echoln STATIC TEST 1. CURRENT USER SETTINGS

#echo_off

#color_default

//// Let new state settle.

sleep 1000

cl_resetfps

sleep 5000

#echo_on

cl_printfps

#echo_off

//// STATIC TEST 2. BASELINE MEASUREMENT

mat_viewportscale 1

cl_globallight_shadow_mode 2

dota_cheap_water 0

r_drawparticles 1

cl_particle_simulate 1

r_drawblankworld 0

r_drawpanorama 1

#color_yellow

#echo_on

echoln STATIC TEST 2. BASELINE MEASUREMENT

#echo_off

#color_default

//// Let new state settle.

sleep 1000

cl_resetfps

sleep 5000

#echo_on

cl_printfps

#echo_off

//// STATIC TEST 3. HALF RESOLUTION

mat_viewportscale 0.5;//1

cl_globallight_shadow_mode 2

dota_cheap_water 0

r_drawparticles 1

cl_particle_simulate 1

r_drawblankworld 0

r_drawpanorama 1

#color_yellow

#echo_on

echoln STATIC TEST 3. HALF RESOLUTION

#echo_off

#color_default

//// Let new state settle.

sleep 1000

cl_resetfps

sleep 5000

#echo_on

cl_printfps

#echo_off

//// STATIC TEST 4. REDUCED DRAWING

mat_viewportscale 1

cl_globallight_shadow_mode 1;//2

dota_cheap_water 1;//0

r_drawparticles 1

cl_particle_simulate 1

r_drawblankworld 0

r_drawpanorama 1

#color_yellow

#echo_on

echoln STATIC TEST 4. REDUCED DRAWING

#echo_off

#color_default

//// Let new state settle.

sleep 1000

cl_resetfps

sleep 5000

#echo_on

cl_printfps

#echo_off

//// STATIC TEST 5. PARTICLES DISABLED

mat_viewportscale 1

cl_globallight_shadow_mode 2

dota_cheap_water 0

r_drawparticles 0;//1

cl_particle_simulate 0;//1

r_drawblankworld 0

r_drawpanorama 1

#color_yellow

#echo_on

echoln STATIC TEST 5. PARTICLES DISABLED

#echo_off

#color_default

//// Let new state settle.

sleep 1000

cl_resetfps

sleep 5000

#echo_on

cl_printfps

#echo_off

//// STATIC TEST 6. UI ONLY

mat_viewportscale 1

cl_globallight_shadow_mode 2

dota_cheap_water 0

r_drawparticles 1

cl_particle_simulate 1

r_drawblankworld 1;//0

r_drawpanorama 1

#color_yellow

#echo_on

echoln STATIC TEST 6. UI ONLY

#echo_off

#color_default

//// Let new state settle.

sleep 1000

cl_resetfps

sleep 5000

#echo_on

cl_printfps

#echo_off

//// STATIC TEST 7. GAME ONLY

mat_viewportscale 1

cl_globallight_shadow_mode 2

dota_cheap_water 0

r_drawparticles 1

cl_particle_simulate 1

r_drawblankworld 0

r_drawpanorama 0;//1

#color_yellow

#echo_on

echoln STATIC TEST 7. GAME ONLY

#echo_off

#color_default

//// Let new state settle.

sleep 1000

cl_resetfps

sleep 5000

#echo_on

cl_printfps

#echo_off

r_drawpanorama 1

//// STATIC TESTS HELP

#color_cyan

#echo_on; echoln; echoln Interpreting the static test results (gdrewb-valve); #echo_off

#echo_on; echoln * If HALF RESOLUTION FPS is significantly higher than BASELINE FPS you should reduce the Game Screen Render Quality; #echo_off

#echo_on; echoln * If REDUCED DRAWING FPS is significantly higher than BASELINE FPS you should turn off High Quality Water and set Shadow Quality to Med/Off; #echo_off

#echo_on; echoln * If PARTICLES DISABLED FPS is higher than BASELINE FPS you should drop Effects Quality; #echo_off

#echo_on; echoln * If GAME ONLY FPS is significantly higher than BASELINE FPS you should turn off High Quality UI; #echo_off

#color_default

//// TEST FINISHED

#color_yellow

#echo_on

echoln

echoln -------------------------------------------------------------

echoln [DOTA 2 BENCHMARK] Finished!

echoln -------------------------------------------------------------

#color_default

grep . To save results into ; #color_cyan; grep . \dota 2 beta\game\dota\condumpxxx.txt ; #color_default;

grep . file, enter ; #color_green; grep . CONDUMP ; #color_default; echoln; // multiple colors on a single line

grep . To run benchmark again, enter short alias: ; #color_green; grep . BM; #color_default;

echoln

#echo_off

alias BM "exec_async benchmark.cfg"

top_bar_message "[DOTA 2 BENCHMARK] Finished!" 0

cl_showfps 0

dota_spectator_mode 0

dota_spectator_hero_index ""

VT0; // Undo Video Tweaks

disconnect

sleep 5000

top_bar_message 0

//// RESTORE CONSOLE SPEW

log_flags Console +DoNotEcho | grep %

log_flags Developer DeveloperConsole Panel Panorama PanoramaScript VScript VScriptDbg VScriptScripts CustomUI CustomGameCache CustomNetTable -DoNotEcho

log_flags AnimationGraph AnimationSystem AnimGraphManager AnimResource Assert "BitBuf Error" BoneSetup Client "Combat Analyzer" CommandLine D3D Decals Demo DeveloperVerbose DotaGuide DOTAHLTVCamera -DoNotEcho

log_flags DOTAHLTVDirector DOTA_CHAT DownloadManager EmitSound EngineInitialization EngineServiceManager "Entity Dump" "Entity Load Unserialize" "Entity System" Filesystem GameEventSystem GCClient GlobalState HangWatchdog "HLTV Server" Host -DoNotEcho

log_flags HostStateManager IME InputService InputSystem InstantReplay LOADING MaterialSystem MeshSystem ModelCombiner modellib NavMesh NetworkClientService Networking "Networking Reliable" NetworkP2PService NetworkServerService -DoNotEcho

log_flags NetworkService Particles ParticlesLib Physics PostProcessing PostProcessPipeline RenderPipelineDota RenderPipelineVr RenderService RenderSystem ResourceSystem SaveRestore SaveRestoreIO Scaleform "Scaleform IME" ScaleformAS -DoNotEcho

log_flags ScaleformParse ScaleformScript SceneSystem SchemaSystem SchemaSystemUtils Server ServerLog SignonState SndEmitterSystem SndOperators SoundOperatorSystem SoundOpGameSystem SoundSystem SoundSystemLowLevel SpawnGroup SplitPacket -DoNotEcho

log_flags SplitScreen Steam SteamDatagramClient SteamDatagramServer SteamUnifiedMessages ToneMapping ToolGameSimulation TypeManager Vfx VguiCallQueue VolumetricFog VProf VR WeekendTourney Workshop WorldRenderer -DoNotEcho

log_flags ServerLog Workshop +DoNotEcho

log_flags Console -DoNotEcho | grep %

//// RESTORE CVARS? ( ASSUMING IT SHOULD DO THAT, IT'S ONLY PARTIAL )

pop_var_values

//// SHOW CONSOLE