MENU

cs2服务器搭建教程

• August 13, 2024 • Read: 285 • csgo2阅读设置

第一步 安装SteamCMD
前往Steam Developer官网下载SteamCMD。
https://developer.valvesoftware.com/w/index.php?title=SteamCMD:zh-cn&uselang=zh

第二步 安装CS2服务端
将SteamCMD解压到数据盘

数据盘需要至少50G才能安装CS2

运行SteamCMD,等待更新和自检完成,依次输入下面的命令开始自动下载CS2服务端。

start steamcmd.exe +login 账号 密码 +force_install_dir cs2_sv +app_update 730 validate +quit 

执行后一般会在steamcmd根目录下创建cs2_sv,这一步可能会下载出错,一般是网络问题,挂一个Steam++即可,或者下载完成再运行一次防止文件缺失

Steam++ 下载:https://gitee.com/rmbgame/SteamTools/releases

第三步 安装MetaMod
前往MetaMod官网下载MetaMod
https://www.sourcemm.net/downloads.php/?branch=master

MetaMod

下载后解压addons文件夹到game/csgo目录内

然后修改gameinfo.gi,在第23行后添加一行Game csgo/addons/metamod,修改后如下

gameinfo.gi

"GameInfo"
{
    // ********************************************************************************
    // ********************************************************************************
    // ********************************************************************************
    // DO NOT EDIT THIS FILE DIRECTLY - YOU PROBABLY WANT TO EDIT CSGO_CORE/GAMEINFO.GI
    // ********************************************************************************
    // ********************************************************************************
    // ********************************************************************************

    game         "Counter-Strike 2"
    title         "Counter-Strike 2"
    title_pw    "E58F8DE68190E7B2BEE88BB1EFBC9AE585A8E79083E694BBE58ABF"
    
    LayeredOnMod    csgo_imported
    SatelliteDir    csgo_gc

    FileSystem
    {
        SearchPaths
        {
            Game_LowViolence    csgo_lv // Perfect World content override
            Game    csgo/addons/metamod
            Game    csgo
            Game    csgo_imported
            Game    csgo_core
            Game    core

            Mod        csgo
            Mod        csgo_imported
            Mod        csgo_core

            AddonRoot            csgo_addons

            LayeredGameRoot        "../game_otherplatforms/etc" [$MOBILE || $ETC_TEXTURES] //Some platforms do not support DXT compression. ETC is a well-supported alternative.
            LayeredGameRoot        "../game_otherplatforms/low_bitrate" [$MOBILE]
        }

        "UserSettingsPathID"    "USRLOCAL"
        "UserSettingsFileEx"    "cs2_"
    }

    Engine2
    {
        "DepotBuildDateTimeInTitleBar" "1"
        "InitFilterTextEarly" "1"
        "CNPW"    "CD535060BE7CF1821AFF685103743B65BF52"
        "LvConfig"    "0"
    }
    
    InputSystem
    {
        "ButtonCodeIsScanCode"        "1"
        "LockButtonCodeIsScanCode"    "1"
    }

    pulse
    {
        "pulse_enabled"                    "1"
    }

    DelayedConCommands
    {
        "connect_lobby" "1"
        "connect" "1"
        "playcast" "1"
        "csgo_econ_action_preview" "1"
        "csgo_download_match" "1"
        "playdemo" "1"
        "gcconnect" "1"
    }

    ConVars
    {
        // Bandwidth control default: 300,000 Bps
        "rate"
        {
            "min"        "98304"
            "default"    "786432"
            "max"        "1000000"
        }
        "sv_minrate"    "98304"
        "sv_maxunlag"    "0.200"

        "cl_interp_ratio" "0"

        // GOTV controls
        "tv_secret_code"        "0"
        "tv_relay_secret_code"    "0"
        "tv_update_hibernation_enabled" "0"

        // Performance
        "sv_parallel_checktransmit"        "2"
        "fps_max"        "400"
        "fps_max_ui"
        {
            "default"    "200"
            "version"    "2"
        }
        "r_add_views_in_pre_output"        "1"

        // Nav fixups
        "nav_path_fixup_climb_up_segments" "1"
        "nav_gen_agent_radius_buffer" "0.75"
        "nav_gen_jump_connection_min_overlap_ratio" "0.1"

        // CSM override
        "csm_slope_scale_db_override" "3"
        
        // SSAO customization for CSGO (this is used on viewmodels)
        "r_ssao_radius"                "8"
        "r_ssao_strength"            "3"
        "r_ssao_bias"                "2.5"

        // this cache kills performance due to mutex contention
        "bone_decode_cache_enabled" "0"

        // Disable warning about oscillating panorama classes
        "panorama_classes_oscillation_warning" "0"

        // Spew warning when adding/removing classes to/from the top of the hierarchy
        "panorama_classes_perf_warning_threshold_ms" "0.75"

        // Panorama - enable render target cache
        "panorama_disable_render_target_cache" "0"

        // Panorama - enable minidumps on JS exceptions
        "panorama_js_minidumps" "1"

        // HLTV AutoDirector - disable it for now so that it doesn't interfere with our spectator camera during replays / hltv / demos
        // Needs to be revisited when we re-enable AutoDirector
        "spec_autodirector" "false"

        // Grass
        "r_grass_quality"                "3"
        "r_grass_alpha_test"            "1"
        "r_grass_density_mode"            "1"
        "r_grass_start_fade"            "3000"
        "r_grass_end_fade"                "3900"

        // Disable smooth morph normals
        "r_smooth_morph_normals"        "0"

        // Default to binding keys based on keyboard position instead of key name
        "input_button_code_is_scan_code"        "1"
        "input_button_code_is_scan_code_scd"    "1"

        // Disable Cubemap Brightening
        "lb_cubemap_normalization_max"         "1"

        // For low quality shaders, cubemap bounds are scaled by this percentage of the fade region
        "lb_low_quality_shader_fade_region_rescale"    "0.5"
        
        // Use normal quality compression even in MET, this makes compiles in MET slower than
        // the default of fastest (0), but reduces artifacts that are confusing to artists since 
        // it's not clear that texture compression quality is different in MET than when regularly compiled.
        "rc_default_texture_encode_quality" "2"

        // The engine default of 50 for CS:GO is too high, drop down to a more sensible 
        // default value.
        "mouse_pitchyaw_sensitivity"    "3"
        "pitch_extra_mouse_sensitivity"    "1.0"

        "r_size_cull_threshold"            "0.33"
        "r_size_cull_threshold_fade"    "7.5"
        "inferno_scorch_decals" "0"

        // Steam Audio project specific convars
        "snd_musicvolume"
        {
            "version"    "2"
        }
        "snd_steamaudio_enable_custom_hrtf"                    "0"
        "snd_steamaudio_enable_perspective_correction"        "1"
        "snd_steamaudio_perspective_correction_factor"        "1.0"
        "snd_steamaudio_normalize_default_hrtf_volume"        "1"
        "snd_steamaudio_default_hrtf_volume_gain"            "0.0"
        "snd_hrtf_distance_behind"                            "50"
        "snd_steamaudio_max_hrtf_normalization_gain_db"        "6.0"
        "snd_steamaudio_enable_pathing"                        "1"
        "snd_steamaudio_source_pathing_debug"                "0"

        "snd_event_browser_default_stack"            "csgo_mega"
        "snd_event_browser_default_vsnd_field"        "public.vsnd_files_track_01"


        // Need much tighter sound clock sync
        "snd_delay_sound_ms_max"    "40"

        //don't let people miss with speaker config settings.
        "speaker_config"
        {
            "min"        "-1"
            "default"    "-1"
            "max"        "-1"
        }

        "cl_disconnect_voice_fade"    "-1.0"
        "cl_disconnect_soundevent"    "StopSoundEvents.StopAllExceptMusic"
        
        // Physics specific customization
        "phys_use_position_based_toi_test" "1"

        // VOIP Settings.
        "voice_in_process"    "1"
        "voice_threshold"
        {
            "version" "2"
        }

        "sv_long_frame_ms" "15"
        "cq_buffer_bloat_msecs_max" "64"
    }

    // Temporarily allowing this because the particle files that are tripping this up ALSO crash PET so I 
    // cannot fix them. We'll sort this out Monday 2/13/23.
    //ResourceCompiler
    //{
    //    // See csgo_imported's gameinfo.gi
    //    "DeprecatedBehaviorVersionsAllowed"    "0"
    //}

    GMS
    {
        "Advertise"                                        "1"
        "RequireLoginForDedicatedServers"                "1"
    }
    
    GameInstructor
    {
        "SaveToSteamStats" "1"
    }

    SupportedLanguages
    {
        "brazilian" "3"
        "bulgarian" "3"
        "czech" "3"
        "danish" "3"
        "dutch" "3"
        "english" "3"
        "finnish" "3"
        "french" "3"
        "german" "3"
        "greek" "3"
        "hungarian" "3"
        "italian" "3"
        "indonesian" "3"
        "japanese" "3"
        "koreana" "3"
        "latam" "3"
        "norwegian" "3"
        "polish" "3"
        "portuguese" "3"
        "romanian" "3"
        "russian" "3"
        "schinese" "3"
        "spanish" "3"
        "swedish" "3"
        "tchinese" "3"
        "thai" "3"
        "turkish" "3"
        "ukrainian" "3"
        "vietnamese" "3"
    }
    
    CS2WorkshopManager
    {
        "RequiredTag" "CS2"
        "HighlightEntriesMissingRequiredTag" "1"
    }
    
    AssetBrowser
    {
        retail_filter0        "characters/models/"
        retail_filter1        "materials/decals/sprays/"
        retail_filter2        "panorama/"
        retail_filter3        "patches/"
        retail_filter4        "stickers/"
        retail_filter5        "weapons/"
        retail_filter6        "materials/models/inventory_items/"
    }

    AddonConfig    
    {
        "VpkDirectories"
        {
            "exclude"       "maps/content_examples"
            "include"       "maps"
            "include"       "cfg/maps"
            "include"       "materials"
            "include"       "models"
            "include"       "panorama/images/overheadmaps"
            "include"       "panorama/images/map_icons"
            "include"       "particles"
            "include"       "resource/overviews"
            "include"       "scripts/vscripts"
            "include"       "sounds"
            "include"       "soundevents"
            "include"       "lighting/postprocessing"
            "include"       "postprocess"
            "include"       "addoninfo.txt"
        } 
        "AllowAddonDownload" "1"
        "AllowAddonDownloadForDemos" "1"
        "DisableAddonValidationForDemos" "1"
    }
}

第四步 安装CounterStrikeSharp
前往CounterStrikeSharp Github下载CSS

https://github.com/roflmuffin/CounterStrikeSharp/releases


CounterStrikeSharp

下载完成后解压到/game/csgo/addons文件中,按照压缩包目录结构解压到对应目录中。

第五步 安装MatchZy

前往MatchZy Github下载插件,不要下带有runtime的。
MatchZy

下载完成后解压到/game/csgo文件中,按照压缩包目录结构解压到对应目录中。

第六步 安装Steam客户端
有些情况下会导致无法启动服务端,这时候就需要安装Steam客户端来补全依赖。

就是安装你们平时玩游戏用的那个Steam客户端如果不会装建议重开。

第七步 启动服务器
启动服务器的文件在game/bin/win64下,我们需要在这个文件夹下创建一个启动用的Bat脚本方便后续启动。

cs2 -dedicated -console +port 端口 +map de_mirage +game_type 0 +game_mode 1 -maxplayers_override 16 -insecure +exec server.cfg
参数说明:

-dedicated 无需Steam客户端启动(可能没用)

-console 以命令行模式运行

+map de_mirage 默认地图为米垃圾

+game_type 0 控制游戏模式

+game_mode 0 控制游戏模式

-maxplayers_override 16 最多16名玩家

-insecure 屏蔽VAC

+exec server.cfg 运行CFG

点击你创建的bat应该会正常启动服务器

第八步 设置游戏
1.服务器配置

编辑/game/csgo/cfg/server.cfg

hostname "服务器名"sv_password "服务器密码留空就是不设置"

sv_setsteamaccount "服务器TOKEN"

sv_kick_players_with_cooldown 0 //不踢出被OW封禁的玩家

获取服务器TOKEN请上Steam服务器管理游戏ID是730直接创建即可

Last Modified: August 23, 2024
Archives QR Code
QR Code for this page
Tipping QR Code