How to run dedicated server with console access on windows 10 PC for Unreal Engine
- User
How to run dedicated server with console access on windows 10 PC for Unreal Engine
- 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
- Unreal Engine Installed: Ensure you have Unreal Engine (preferably the latest stable version) installed on your Windows 10 PC.
- Project Setup: You should have an Unreal Engine project that you intend to host as a dedicated server.
- Visual Studio Installed: For compiling server code, Visual Studio (2017, 2019, or later) with C++ support is recommended.
- 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.
-
Enable Dedicated Server Target
-
Navigate to your project’s root directory.
-
If a
Sourcefolder doesn't exist, generate it by adding C++ classes to your project via the Unreal Editor. -
Inside the
Sourcefolder, locate your project’s.Build.csfile (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");
-
-
Modify
.uprojectFile- Open your project's
.uprojectfile in a text editor. - Ensure it includes
"Server"in theTargetPlatformsor similar configurations if necessary.
- Open your project's
-
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.
-
Open the Project in Unreal Editor
- Launch your project in Unreal Engine Editor.
-
Build the Dedicated Server
- Go to File > Package Project > Build Configuration and select
Development ServerorShipping Serverbased 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.
- Go to File > Package Project > Build Configuration and select
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 -archiveReplace
UE_4.xxand 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.
-
Open Command Prompt
- Press
Win + R, typecmd, and pressEnterto open the Command Prompt.
- Press
-
Navigate to the Server Executable Directory
-
Use the
cdcommand to navigate to your server's binary directory. For example:cd "C:\Path\To\YourProject\Binaries\Win64"
-
-
Launch the Server Executable with Console Access
Execute the server with desired parameters. Here's a basic command structure:
YourProjectServer.exe YourMap?listen -LogExplanation 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
MyGameand you want to loadMyMap, the command would be:MyGameServer.exe MyMap?listen -Log -
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 -
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.
-
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.
-
Port Forwarding (Router Configuration)
- Access your router’s configuration page (commonly through
192.168.1.1or similar). - Navigate to Port Forwarding settings.
- Forward the server port (default
7777for Unreal Engine) to your PC’s local IP address. - Save and apply the settings.
Note: Exact steps vary depending on the router model.
- Access your router’s configuration page (commonly through
Step 5: Automate Server Launch (Optional)
For convenience, you can create a batch file to automate launching the server with desired parameters.
-
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
-
-
Save the File
- Save the file with a
.batextension, such asLaunchServer.bat.
- Save the file with a
-
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
- Unreal Engine Dedicated Server Documentation
- Unreal Engine Networking and Multiplayer Guide
- Unreal Engine Forums – Great place to ask questions and seek assistance from the community.
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.