167 lines
8.3 KiB
PowerShell
167 lines
8.3 KiB
PowerShell
# game-optimize.ps1 — оптимизация Windows 11 под игры (сеть + FPS + input lag)
|
|
# ЗАПУСК: PowerShell от Администратора
|
|
# Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass
|
|
# .\game-optimize.ps1
|
|
#
|
|
# ВНИМАНИЕ: некоторые твики требуют перезагрузки
|
|
|
|
$ErrorActionPreference = "Stop"
|
|
$Host.UI.RawUI.WindowTitle = "Game Optimization — Windows 11"
|
|
|
|
Write-Host "============================================" -ForegroundColor Cyan
|
|
Write-Host " Game Optimization — Windows 11" -ForegroundColor Cyan
|
|
Write-Host "============================================" -ForegroundColor Cyan
|
|
Write-Host ""
|
|
|
|
# Проверка прав администратора
|
|
if (-NOT ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) {
|
|
Write-Host "ОШИБКА: запустите от Администратора" -ForegroundColor Red
|
|
exit 1
|
|
}
|
|
|
|
# ── 1. Сеть (TCP/IP) ─────────────────────────────────────
|
|
|
|
Write-Host "[1/7] Сетевые оптимизации..." -ForegroundColor Yellow
|
|
|
|
# TCP autotuning
|
|
netsh int tcp set global autotuninglevel=normal 2>$null
|
|
Write-Host " TCP autotuning: normal"
|
|
|
|
# RSS
|
|
netsh int tcp set global rss=enabled 2>$null
|
|
Write-Host " RSS: enabled"
|
|
|
|
# Chimney offload
|
|
netsh int tcp set global chimney=enabled 2>$null
|
|
Write-Host " TCP Chimney: enabled"
|
|
|
|
# Initial RTO (вместо 1 сек — 2 сек, меньше ретрансмитов)
|
|
netsh int tcp set global initialRto=2000 2>$null
|
|
Write-Host " Initial RTO: 2000ms"
|
|
|
|
# Отключить автотюнинг окна (Windows иногда агрессивно уменьшает)
|
|
netsh int tcp set heuristics disabled 2>$null
|
|
Write-Host " Heuristics: disabled"
|
|
|
|
# ── 2. Network Throttling ────────────────────────────────
|
|
|
|
Write-Host "[2/7] Network throttling — off..." -ForegroundColor Yellow
|
|
|
|
$path = "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Multimedia\SystemProfile"
|
|
New-Item -Path $path -Force | Out-Null
|
|
Set-ItemProperty -Path $path -Name "NetworkThrottlingIndex" -Value 0xffffffff -Type DWord
|
|
Set-ItemProperty -Path $path -Name "SystemResponsiveness" -Value 0 -Type DWord
|
|
Write-Host " Throttling: OFF (FFFFFFFF)"
|
|
|
|
# ── 3. Power Plan — Ultimate Performance ─────────────────
|
|
|
|
Write-Host "[3/7] Электропитание..." -ForegroundColor Yellow
|
|
|
|
$plan = powercfg /list | Select-String "Ultimate Performance"
|
|
if (-not $plan) {
|
|
powercfg -duplicatescheme e9a42b02-d5df-448d-aa00-03f14749eb61 2>$null
|
|
}
|
|
powercfg /setactive e9a42b02-d5df-448d-aa00-03f14749eb61 2>$null
|
|
|
|
# Отключить USB selective suspend
|
|
powercfg /setacvalueindex scheme_current 2a737441-1930-4402-8d77-b2bebba308a3 48e6b7a6-50f5-4782-a5d4-53bb8f07e226 0
|
|
powercfg /setdcvalueindex scheme_current 2a737441-1930-4402-8d77-b2bebba308a3 48e6b7a6-50f5-4782-a5d4-53bb8f07e226 0
|
|
|
|
# Отключить PCI Express power saving
|
|
powercfg /setacvalueindex scheme_current 501a4d13-42af-4429-9fd1-a8218c268e20 ee12f906-d277-404b-b6da-e5fa1a576df5 0
|
|
powercfg /setdcvalueindex scheme_current 501a4d13-42af-4429-9fd1-a8218c268e20 ee12f906-d277-404b-b6da-e5fa1a576df5 0
|
|
|
|
Write-Host " Ultimate Performance: ACTIVE"
|
|
Write-Host " USB suspend: OFF"
|
|
Write-Host " PCIe savings: OFF"
|
|
|
|
# ── 4. FPS / Input lag ───────────────────────────────────
|
|
|
|
Write-Host "[4/7] FPS + input lag..." -ForegroundColor Yellow
|
|
|
|
# Game Mode — включить
|
|
Set-ItemProperty -Path "HKCU:\Software\Microsoft\GameBar" -Name "AutoGameModeEnabled" -Value 1 -Type DWord -Force
|
|
|
|
# Game DVR — отключить (режет FPS)
|
|
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\PolicyManager\default\ApplicationManagement\AllowGameDVR" -Name "value" -Value 0 -Type DWord -Force
|
|
|
|
# Отключить прозрачность (экономит GPU)
|
|
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize" -Name "EnableTransparency" -Value 0 -Type DWord -Force
|
|
|
|
# Отключить анимации
|
|
Set-ItemProperty -Path "HKCU:\Control Panel\Desktop" -Name "UserPreferencesMask" -Value ([byte[]](0x90,0x12,0x03,0x80,0x10,0x00,0x00,0x00)) -Type Binary -Force
|
|
Set-ItemProperty -Path "HKCU:\Control Panel\Desktop\WindowMetrics" -Name "MinAnimate" -Value 0 -Type String -Force
|
|
|
|
# Priority Control (оптимизация на фоновые службы НЕ для игр — наоборот, программы)
|
|
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\PriorityControl" -Name "Win32PrioritySeparation" -Value 0x26 -Type DWord -Force
|
|
|
|
Write-Host " Game Mode: ON"
|
|
Write-Host " Game DVR: OFF"
|
|
Write-Host " Transparency: OFF"
|
|
Write-Host " Animations: OFF"
|
|
|
|
# ── 5. HPET + таймеры ───────────────────────────────────
|
|
|
|
Write-Host "[5/7] Таймеры (HPET)..." -ForegroundColor Yellow
|
|
|
|
bcdedit /deletevalue useplatformclock 2>$null
|
|
bcdedit /set useplatformclock false 2>$null
|
|
bcdedit /set disabledynamictick yes 2>$null
|
|
|
|
Write-Host " HPET: OFF (снижает input lag)"
|
|
Write-Host " Dynamic tick: OFF"
|
|
|
|
# ── 6. Nagle / TCP ───────────────────────────────────────
|
|
|
|
Write-Host "[6/7] Nagle алгоритм..." -ForegroundColor Yellow
|
|
|
|
# Отключить Nagle = меньше задержка TCP
|
|
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters" -Name "TCPNoDelay" -Value 1 -Type DWord -Force
|
|
|
|
# TCP ACK frequency — отправлять ACK на каждый пакет (не ждать)
|
|
$ifaces = Get-ChildItem "HKLM:\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces" -ErrorAction SilentlyContinue
|
|
foreach ($iface in $ifaces) {
|
|
Set-ItemProperty -Path $iface.PSPath -Name "TcpAckFrequency" -Value 1 -Type DWord -Force -ErrorAction SilentlyContinue
|
|
}
|
|
|
|
Write-Host " Nagle: OFF"
|
|
Write-Host " TCP ACK frequency: 1"
|
|
|
|
# ── 7. Предупреждения ────────────────────────────────────
|
|
|
|
Write-Host "[7/7] Ручные твики (не автоматизированы)..." -ForegroundColor Yellow
|
|
|
|
Write-Host ""
|
|
Write-Host " !!! ОБЯЗАТЕЛЬНО СДЕЛАТЬ ВРУЧНУЮ !!!" -ForegroundColor Red
|
|
Write-Host ""
|
|
Write-Host " 1. VBS / Core Isolation OFF:" -ForegroundColor White
|
|
Write-Host " Settings → Windows Security → Device Security → Core Isolation → OFF" -ForegroundColor Gray
|
|
Write-Host " ИЛИ: bcdedit /set hypervisorlaunchtype off" -ForegroundColor Gray
|
|
Write-Host " (+5-15% FPS, -2ms input lag)" -ForegroundColor DarkGreen
|
|
Write-Host ""
|
|
Write-Host " 2. MSI Mode для GPU + NIC:" -ForegroundColor White
|
|
Write-Host " Скачай MSI Utility v3, запусти от админа" -ForegroundColor Gray
|
|
Write-Host " GPU → MSI + High priority" -ForegroundColor Gray
|
|
Write-Host " NIC → MSI + High priority" -ForegroundColor Gray
|
|
Write-Host " (-3ms input lag)" -ForegroundColor DarkGreen
|
|
Write-Host ""
|
|
Write-Host " 3. NIC coalescing:" -ForegroundColor White
|
|
Write-Host " Device Manager → Network Adapter → Properties → Advanced" -ForegroundColor Gray
|
|
Write-Host " Interrupt Moderation → OFF" -ForegroundColor Gray
|
|
Write-Host " Receive Buffers → 4096" -ForegroundColor Gray
|
|
Write-Host " Transmit Buffers → 4096" -ForegroundColor Gray
|
|
Write-Host ""
|
|
|
|
# ── Итог ─────────────────────────────────────────────────
|
|
|
|
Write-Host "============================================" -ForegroundColor Cyan
|
|
Write-Host " Готово" -ForegroundColor Cyan
|
|
Write-Host "============================================" -ForegroundColor Cyan
|
|
Write-Host ""
|
|
|
|
$restart = Read-Host "Требуется перезагрузка. Перезагрузить сейчас? (y/n)"
|
|
if ($restart -eq "y") {
|
|
Write-Host "Перезагружаем..." -ForegroundColor Yellow
|
|
Restart-Computer -Force
|
|
}
|