Last active
January 21, 2023 21:47
-
-
Save Visulth/6f9d403260b19fe995aa5a19a53350f2 to your computer and use it in GitHub Desktop.
Simple windows bat file for launching Unreal Engine as either standalone, server, host, or client.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@ECHO OFF | |
SETLOCAL ENABLEDELAYEDEXPANSION | |
REM =======MAKE SURE TO ADJUST THESE PARAMETERS TO YOUR BUILD======= | |
set unrealPath="F:\Program Files\Epic Games\UE_5.1\Engine\Binaries\Win64\UnrealEditor.exe" | |
set myProject="U:\Unreal Projects\PuzzlePlatforms\PuzzlePlatforms.uproject" | |
set map=/Game/ThirdPerson/Maps/ThirdPersonMap | |
REM================================================================= | |
set LF=^ | |
REM Two empty lines above are necessary | |
REM =====================NOTES==================================== | |
REM can add -server to boot as a server (instead of a game) | |
REM can add -game to boot as a game | |
REM can add -log | |
REM can add a map via: /Game/<PathAfterContentFolder>ExampleMapName -game -log | |
REM can add an IP address instead of the map | |
REM can add ?listen directly after ExampleMapName for Host machines (e.g., Play and Host) (without the -server tag) | |
REM ============================================================= | |
REM Set myIP and port to blank (uncomment the bottom lines, comment the top lines) to use user-prompted values | |
set myIP=127.0.0.1 | |
REM set "myIP=" | |
set port=7779 | |
REM set "port=" | |
REM ============================================================= | |
set "launched=" | |
set /a clients=0 | |
set /a servers=0 | |
set /a hosts=0 | |
set /a standalones=0 | |
if "!myIP!"=="" ( | |
set /p myIP="Enter a custom IP:!LF!" | |
) | |
if "!port!"=="" ( | |
echo. | |
set /p port="Enter a custom port:!LF!" | |
) | |
:LAUNCH | |
echo. | |
echo Local IP: "!myIP!" | |
echo. | |
echo Local Port: "!port!" | |
echo. | |
if not "!launched!"=="" ( | |
echo Launched: !launched! | |
) else ( | |
echo Launched: none | |
) | |
echo. | |
set "launchType=" | |
set /p launchType="Launch as standalone (blank), server (s), host (h), or client (c)?!LF!" | |
echo. | |
if "!launchType!"=="" ( | |
set launched=!launched!Standalone, | |
set launchParams=!map! -game -log | |
set /a standalones=!standalones!+1 | |
set launchType=standalone!standalones! | |
) | |
if /I "!launchType!"=="c" ( | |
set launched=!launched!Client, | |
set launchParams=!myIP!:!port! -game -log | |
set /a clients=!clients!+1 | |
set launchType=client !clients! | |
) | |
if /I "!launchType!"=="s" ( | |
set launched=!launched!Server, | |
set launchParams=!map! -server -log | |
set /a servers=!servers!+1 | |
set launchType=server !servers! | |
) | |
if /I "!launchType!"=="h" ( | |
set launched=!launched!Host, | |
set launchParams=!map!?listen -game -log | |
set /a hosts=!hosts!+1 | |
set launchType=host !hosts! | |
) | |
set launch="UnrealEngine !launchType!" !unrealPath! !myProject! !launchParams! | |
echo start !launch! | |
Start !launch! | |
echo. | |
cls | |
GOTO LAUNCH |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment