全站通知:

专用服务器

阅读

    

2025-06-18更新

    

最新编辑:君凰越

阅读:

  

更新日期:2025-06-18

  

最新编辑:君凰越

来自护核纪元CoreKeeperWIKI_BWIKI_哔哩哔哩
跳到导航 跳到搜索
页面贡献者 :
君凰越


  • 本指南将介绍如何为《护核纪元》设置专用服务器。大部分细节仅适用于Windows系统,但部分内容也适用于Linux服务器。
  • 启动专用服务器时,会弹出一个PowerShell窗口,你必须让它保持运行状态,直到你想关闭服务器。要关闭服务器,请调出PowerShell窗口并按下Q键。
  • 如果你使用自动重启脚本,它还会附带一个批处理文件,该文件会与PowerShell同时运行,用于检查服务器是否仍在运行。使用自动重启脚本时,若要关闭服务器,请调出自动重启脚本窗口,按下CTRL+C,接着按Y,然后按Enter。完成以上操作后,再调出服务器的PowerShell窗口并按下Q键关闭服务器。

    搭建专用服务器

  • 在公开游戏代码前,请务必做好备份。
  • 专用服务器的\worlds\文件夹可能在首次保存后才会显示,通常在玩家登录约30秒后出现。
  • 你可以选择粘贴另一个\worlds\文件夹,或自行创建该文件夹并将世界文件放入其中。

    从Steam安装主分支专用服务器

  • 访问 steam://install/1963720 通过Steam安装服务器。

    从SteamCMD安装主分支专用服务器

  • 下载SteamCMD
    steamcmd +force_install_dir c:\corekeeperdedicatedserver\ +login anonymous +app_update 1963720 +quit

    由玩家制作的Docker容器

    存档数据与服务器配置文件位置

  • 在主菜单上使用此快捷键(Ctrl+Alt+B)备份客户端数据。
    %userprofile%\Desktop\CoreKeeperSaves.zip

    主分支客户端游戏世界

    %APPDATA%\..\LocalLow\Pugstorm\Core Keeper\Steam\YOURSTEAMID\worlds\

    打开文件夹的命令

    cmd /k FOR /D %a IN ("%APPDATA%\..\LocalLow\Pugstorm\Core Keeper\Steam\*") DO explorer %a & exit

    主分支客户端存档(角色)

    %APPDATA%\..\LocalLow\Pugstorm\Core Keeper\Steam\YOURSTEAMID\saves\

    打开文件夹的命令

    cmd /k FOR /D %a IN ("%APPDATA%\..\LocalLow\Pugstorm\Core Keeper\Steam\*") DO explorer %a\saves\ & exit

    主分支专用服务器游戏世界

    %APPDATA%\..\LocalLow\Pugstorm\Core Keeper\DedicatedServer\worlds\

    打开文件夹的命令

    cmd /k explorer %APPDATA%\..\LocalLow\Pugstorm\Core Keeper\DedicatedServer\worlds\ & exit

    主分支专用服务器配置文件

     %APPDATA%\..\LocalLow\Pugstorm\Core Keeper\DedicatedServer\ServerConfig.json

    打开文件夹的命令

    cmd /k explorer %APPDATA%\..\LocalLow\Pugstorm\Core Keeper\DedicatedServer\ServerConfig.json & exit

    自动重启脚本

  • 导航至《Core Keeper 专用服务器》的安装目录,将 Launch.PS1 和 Launch.bat 替换为以下内容;或重命名并调整脚本以适配新文件名。若通过 Steam 客户端安装,可通过以下方式找到安装目录:打开 Steam,右键点击游戏,选择“管理”→“浏览本地文件”。若通过前文提到的 SteamCMD 命令安装,安装目录为 c:\corekeeperdedicatedserver\
  • 若保留 Launch.PS1 和 Launch.bat 的原文件名,未来更新可能会覆盖这些文件,需重新执行此操作。

    Launch.PS1

      # Feel free to change these (see README), but keep in mind that changes to this file might be overwritten on update
      $Date = Get-Date -format "yyyyMMdd"
      $DateStr = './logs/CoreKeeperServerLog-{0:yyyyMMdd}.txt' -f $Date
      $CoreKeeperArguments = @("-batchmode", "-logfile", $DateStr) + $args
      $script:ckpid = $null
      
      function Quit-CoreKeeperServer {
      	if ($script:ckpid -ne $null) {
      		taskkill /pid $ckpid.Id
      		Wait-Process -InputObject $ckpid
      		Write-Host "Stopped CoreKeeperServer.exe"
      	}
      }
      
      try {
      	if (Test-Path -Path "GameID.txt") {
      		Remove-Item -Path "GameID.txt"
      	}
      
      	$script:ckpid = Start-Process -PassThru -FilePath %0\..\CoreKeeperServer.exe -ArgumentList $CoreKeeperArguments
      	Write-Host "Started CoreKeeperServer.exe"
      
      	# Wait for GameID
      	while (!(Test-Path -Path "GameID.txt")) {
      		Start-Sleep -Milliseconds 100
      	}
      	
      	Get-Process | Where-Object { $_.MainWindowTitle -like 'CoreKeeperPowershell' } | Stop-Process
      	$host.UI.RawUI.WindowTitle = "CoreKeeperPowershell"
      	
      	Write-Host -NoNewline "Game ID: "
      	Get-Content "GameID.txt"
      	Write-Host "Press q to quit, DON'T close the window or the server process will just keep running"
      	   While ($KeyInfo.VirtualKeyCode -eq $Null -or $KeyInfo.VirtualKeyCode -ne 81) {
      		$KeyInfo = $Host.UI.RawUI.ReadKey("NoEcho, IncludeKeyDown")
      	}
      }
      finally {
      	Quit-CoreKeeperServer
      	pause
      }
    

    Launch.bat

       @echo off
       :loop
       tasklist /fi "ImageName eq CoreKeeperServer.exe" /fo csv 2>NUL | find /I "CoreKeeperServer.exe">NUL
       if "%ERRORLEVEL%" NEQ "0" start powershell -executionpolicy unrestricted -File Launch.ps1 %*
       timeout 10
       goto loop