Running with the Backend
Launching the Backend
Currently the Standard License option only works for Windows development machines. We're working on getting MacOS and Linux supported.
- Standard License
- Custom License
Modify RedwoodBackend/config-settings.json
so the defaults.env
field uses the configuration environment you created earlier (e.g. project-name
):
{
//...
"defaults": {
"dir": "config/node",
"env": "project-name"
}
}
You can run the dev-initiator.exe
file in the RedwoodBackend
directory via the terminal or double click on the Run Dev.bat
script from File Explorer.
If you run the dev-initiator.exe
program from a terminal, make sure to start it from the RedwoodBackend
directory.
You can run the Dev Initiator with running the below command in the RedwoodBackend
directory:
yarn dev <config-environment>
For example: yarn dev project-name
.
Several logs will print to the console as the backend initializes; wait until you see All services ready
.
Running the Game
- Match Template
- RPG Template
- Blank Template
It's time to start the game, connect to the backend, and join a match!
-
Once the project is created and shaders are compiled, you will see the default Lyra level selected:
-
Open the Content Browser and open the level
/Content/Redwood/Frontend/L_RW_LyraFrontEnd
: -
Make sure you've selected
Play Standalone
under the PIE Net Mode (it's the default) and are still in theL_RW_LyraFrontEnd
level: -
Press the green play button:
-
You should see the Lyra frontend widget with the
LOGIN
/REGISTER
buttons enabled:warningIf you see these buttons greyed out/disabled and a label saying
Connecting to backend...
, there are some a few common issues:- You have another application bound to the port
3001
- You did not configure your
hosts
file properly to includedirector.localhost
- You did not change the
Director Uri
project setting to include:3001
- You started PIE before the Dev Initiator hasn't finished initializing. The connection retry logic will get exponentially slower after each retry, so you may need to restart PIE
- You have another application bound to the port
-
Register to create an account; any username/password works here. We use
test
andtest
for quick iteration. -
Login using the same username/password. The
Remember Me
functionality is part of the Redwood plugin. It will save aRedwoodSaveGame.sav
file in theSaveGames
folder with an authentication token to automatically login when the game starts the next time.warningIf you were able to register but the login process seems to hang for more than 5 seconds, you're likely having issues connecting to the Realm Frontend service. The common issues for that are similar:
- You have another application bound to the port
3011
- You did not configure your
hosts
file properly to includerealm-default.localhost
- You have another application bound to the port
-
You should be able to see a
PLAY
button now: -
Select
PLAY
; from here, you can either selectMATCHMAKING
orSTART LOBBY
to create a match. TheJOIN LOBBY
button will show a list of existing public lobbies.noteIt may take awhile for the server to load the first time. You may get a timeout and need to try again. If your ticket keeps going stale, you can increase the
ticket-stale-time-ms
variable you set earlier and restart the Dev Initiator.infoServer initialization is shorter in a packaged/cooked game. When running with the
local
game server provider, you're using uncooked content throughUnrealEditor.exe
. Using theagones
game server provider will have the shortest initialization time due always having a warm server already started waiting to get the match details. Hathora's startup time is also quite fast, with their Enterprise tier having the best performance.
It's time to start the game, connect to the backend, start the overworld servers, and join!
-
Install NodeJS/Yarn if you haven't yet
infoWe need this extra dependency for persistent-server games since the server isn't started when matchmaking finds a match. Persistent games are assumed to already be started, so we need to use a provided tool to create and start that server before we try to join.
-
Once the project is created and shaders are compiled, you will see the default L_Overworld level selected:
-
Open the Content Browser and open the level
/Content/Maps/L_Title
: -
Make sure you've selected
Play Standalone
under the PIE Net Mode (it's the default) and are still in theL_RW_LyraFrontEnd
level: -
Press the green play button:
-
You should see the frontend widget with the
REGISTER
/LOGIN
buttons enabled:warningIf you see these buttons greyed out/disabled and a label saying
Connecting to backend...
, there are some a few common issues:- You have another application bound to the port
3001
- You did not configure your
hosts
file properly to includedirector.localhost
- You did not change the
Director Uri
project setting to include:3001
- You started PIE before the Dev Initiator hasn't finished initializing. The connection retry logic will get exponentially slower after each retry, so you may need to restart PIE
- You have another application bound to the port
-
Register to create an account; any username/password works here. We use
test
andtest
for quick iteration. -
Login using the same username/password.
warningIf you were able to register but the login process seems to hang for more than 5 seconds, you're likely having issues connecting to the Realm Frontend service. The common issues for that are similar:
- You have another application bound to the port
3011
- You did not configure your
hosts
file properly to includerealm-default.localhost
- You have another application bound to the port
-
You should be able to see a dropdown and be able to create a character:
-
Before you can join the server, we need to create it:
-
Open a terminal to the
RedwoodBackend
directory -
Create an admin user (changing the env arg to your config environment name):
yarn cli create-admin admin --env project-name
noteYou'll be prompted for a password for this new user, but you can optionally set the
RW_PASSWORD
environment variable to skip manually entering it each time. -
Start a GameServerProxy using the preconfigured
overworld
game profile (changing the env arg to your config environment name):yarn cli create-proxy overworld overworld --user admin --env project-name --start-on-boot --proxy-ends --public
noteThe
--start-on-boot
flag will not only start this proxy when the backend boots up (and it hasn't ended), it will also start it immediately. Only admin users can specify this flag.The
--proxy-ends
flag will end the GameServerProxy when the backing GameServerCollection ends. You typically wouldn't set this for production realms/worlds as you'd want to keep them around perpetually even if the servers stop temporarily (i.e. during a game server upgrade). However, often times in development, it may be beneficial to start with a clean slate world each time we restart it, hence specifying it here.Starting this up will automatically run a shard/server for each of the zones (5 for this template). This involves running the UnrealEditor.exe for each shard, which can consume a bit of RAM (~1.2GB for each shard).
-
-
Once the terminal says
Proxy created successfully
you can press theJoin
button in Unreal to queue for the proxy/world and be admitted: -
The backend is using uncooked data from the Unreal assets for the servers running, so you can't modify any of the Unreal assets while the servers are still running. You can stop the GameServerProxy's backing GameServerCollection (aka each of the shard servers for the world) by running the below command in the
RedwoodBackend
terminal you had open before:yarn cli stop-proxy --user admin --env project-name <the-proxy-id-returned-from-the-start-proxy-command>
For example, if your
start-proxy
command returned:[05:47:18.119] INFO (70364): Proxy created successfully: cm1ol7o270001xhxi5z3d7fw2
then you would run:
yarn cli stop-proxy --user admin --env project-name cm1ol7o270001xhxi5z3d7fw2
-
In the Unreal project you created earlier, open the
/Content/Maps/L_Title
map. -
Change the Net Mode in the play settings to Play Standalone
-
Optionally change the number of players to whatever you'd like. Below we'll just show the steps for a single player, but you can repeat them to get multiple players in the same match.
-
Click the Play button
-
You should now see the Register, Login, and Quit buttons:
If you're stuck seeing the Connecting to the director... screen, make sure you've launched the
dev-initiator.exe
program, there are no errors, and double check any firewall/security prompts that may be preventing it from connecting.noteIf you're still having trouble connecting, make sure you don't have other applications using conflicting ports. The Redwood backend by default runs on ports
3000
and3001
. These config variables can be changed by adding them to the_index.yaml
file you created earlier. Below is what you can add to the end of the file; change the ports respectively:director:
connection:
backend:
port: 3000
frontend:
port: 3001
realm:
connection:
backend:
game-server-access:
port: 3000You would also need to change the port in the Director Address variable in the Class Defaults section of the B_TitlePlayerController blueprint in
/Content/GameFramework
using thedirector.connection.frontend.port
config variable you specified above. -
Click the Register button and enter a username and password. If that's successful, you'll be automatically logged in and see the character selection screen. Press the
+
button to create a new character: -
Enter a character name and click Create. You'll be taken back to the character selection screen. You should see your new character in the drop down menu:
-
After selecting your character, click the Join button to join the matchmaking queue:
-
If you're seeing the below error, you didn't correctly configure the backend to point to your project:
-
If everything was configured properly, any clients that signed up before should be put into a match. The Blank template has a simple match where players can move around as a floating cube with WASD and the mouse.
That's it! You're using Redwood to start your servers and route clients into those servers via matchmaking or queueing! Let's learn how to run things without the backend running for faster development iterations.