Skip to content
TheChatArchiveThe Chat Archive
o1-mini-2024-09-12· OpenAIAi2 WildChat-4.8M (AI2)

How to run dedicated server with console access on windows 10 PC for Unreal Engine

  1. User

    How to run dedicated server with console access on windows 10 PC for Unreal Engine

  2. Assistant

    Running a dedicated Unreal Engine server with console access on a Windows 10 PC involves several steps, including setting up your project for dedicated server support, packaging the server build, and running it with appropriate command-line parameters to enable console access. Below is a comprehensive guide to help you through the process.


    Prerequisites

    1. Unreal Engine Installed: Ensure you have Unreal Engine (preferably the latest stable version) installed on your Windows 10 PC.
    2. Project Setup: You should have an Unreal Engine project that you intend to host as a dedicated server.
    3. Visual Studio Installed: For compiling server code, Visual Studio (2017, 2019, or later) with C++ support is recommended.
    4. Basic Knowledge: Familiarity with Unreal Engine project structure, C++ (if modifying server code), and command-line operations.

    Step 1: Configure Your Project for Dedicated Server

    Before packaging a dedicated server, ensure your project is set up to support it.

    1. Enable Dedicated Server Target

      • Navigate to your project’s root directory.

      • If a Source folder doesn't exist, generate it by adding C++ classes to your project via the Unreal Editor.

      • Inside the Source folder, locate your project’s .Build.cs file (e.g., MyProject.Build.cs).

      • Open the file in Visual Studio or your preferred code editor.

      • Ensure that the build targets support server builds. Add or verify the following lines:

        PublicDefinitions.Add("UE_SERVER=1");
        
    2. Modify .uproject File

      • Open your project's .uproject file in a text editor.
      • Ensure it includes "Server" in the TargetPlatforms or similar configurations if necessary.
    3. Check Network Settings

      • Ensure that your game’s networking settings (like ports, replication settings) are correctly configured for a server environment.

    Step 2: Package the Dedicated Server Build

    Unreal Engine allows you to package a dedicated server version of your game.

    1. Open the Project in Unreal Editor

      • Launch your project in Unreal Engine Editor.
    2. Build the Dedicated Server

      • Go to File > Package Project > Build Configuration and select Development Server or Shipping Server based on your needs.
      • Choose File > Package Project > Windows > Dedicated Server.
      • Select a directory where the server build will be outputted.
      • Wait for the packaging process to complete. The server executable will typically be located in [YourProject]/Binaries/Win64/ and named like [ProjectName]Server.exe.

    Alternatively, using Command Line:

    You can also build the dedicated server using the command line with RunUAT.bat:

    "C:\Program Files\Epic Games\UE_4.xx\Engine\Build\BatchFiles\RunUAT.bat" BuildCookRun -project="C:\Path\To\YourProject.uproject" -noP4 -platform=Win64 -clientconfig=Development -serverconfig=Development -cook -allmaps -build -stage -pak -archive
    

    Replace UE_4.xx and project paths accordingly.


    Step 3: Run the Dedicated Server with Console Access

    Once your server build is ready, you can run it via the command line to access the server console.

    1. Open Command Prompt

      • Press Win + R, type cmd, and press Enter to open the Command Prompt.
    2. Navigate to the Server Executable Directory

      • Use the cd command to navigate to your server's binary directory. For example:

        cd "C:\Path\To\YourProject\Binaries\Win64"
        
    3. Launch the Server Executable with Console Access

      Execute the server with desired parameters. Here's a basic command structure:

      YourProjectServer.exe YourMap?listen -Log
      

      Explanation of Parameters:

      • YourProjectServer.exe: The dedicated server executable.
      • YourMap: The map you want the server to load.
      • ?listen: Starts the server in listen mode, allowing players to connect directly.
      • -Log: Opens the server with a logging console for access to server commands and logs.

      Example:

      Suppose your project is named MyGame and you want to load MyMap, the command would be:

      MyGameServer.exe MyMap?listen -Log
      
    4. Additional Useful Command-Line Arguments

      • -port=7777: Specify a custom port for the server.
      • -MaxPlayers=16: Limit the maximum number of players.
      • -IP=0.0.0.0: Bind the server to a specific IP address.

      Example with Additional Arguments:

      MyGameServer.exe MyMap?listen -Log -Port=7777 -MaxPlayers=16 -ip=192.168.1.100
      
    5. Interact with the Server Console

      Once the server starts, the Command Prompt window will display the server logs. You can interact with the server by typing console commands directly into this window.

      Common Console Commands:

      • open [MapName]: Change the map.
      • kick [PlayerName]: Kick a player from the server.
      • shutdown: Shut down the server.
      • list: List all connected players.

      Example:

      To change the map to NewMap, type:

      open NewMap
      

    Step 4: Configuring Firewall and Network Settings

    To allow other players to connect to your dedicated server, ensure the necessary ports are open.

    1. Windows Firewall

      • Open Windows Defender Firewall settings.
      • Navigate to Allow an app or feature through Windows Defender Firewall.
      • Click Change settings and then Allow another app....
      • Browse to your server executable (MyGameServer.exe) and add it.
      • Ensure that both Private and Public networks are checked.
    2. Port Forwarding (Router Configuration)

      • Access your router’s configuration page (commonly through 192.168.1.1 or similar).
      • Navigate to Port Forwarding settings.
      • Forward the server port (default 7777 for Unreal Engine) to your PC’s local IP address.
      • Save and apply the settings.

      Note: Exact steps vary depending on the router model.


    Step 5: Automate Server Launch (Optional)

    For convenience, you can create a batch file to automate launching the server with desired parameters.

    1. Create a Batch File

      • Open Notepad or any text editor.

      • Enter the server launch command. For example:

        @echo off
        cd "C:\Path\To\YourProject\Binaries\Win64"
        start MyGameServer.exe MyMap?listen -Log -Port=7777 -MaxPlayers=16
        
    2. Save the File

      • Save the file with a .bat extension, such as LaunchServer.bat.
    3. Run the Batch File

      • Double-click the batch file to launch your dedicated server with console access automatically.

    Troubleshooting Tips

    • Server Not Starting: Ensure all prerequisites are met, the server executable is correctly built, and all necessary ports are open.
    • Firewall Issues: Double-check Windows Firewall and any third-party firewalls to ensure they aren't blocking your server.
    • Port Conflicts: Make sure the port you're trying to use isn't already in use by another application.
    • Performance: Dedicated servers can be resource-intensive. Ensure your PC meets the hardware requirements to run both the server and any other applications smoothly.

    Additional Resources


    By following the above steps, you should be able to successfully run a dedicated Unreal Engine server with console access on your Windows 10 PC. This setup allows you to host multiplayer games, manage server settings in real-time, and provide a stable environment for players to connect and enjoy your game.