IN THIS ARTICLE
Running Multiplayer Projects
Running projects using the Multiplayer Gem in Open 3D Engine (O3DE) requires that you correctly build your project and set configuration options to run your project.
Build your project
When building your project, be sure do the following:
- Ensure your project is properly configured.
- Build your project’s
GameLauncher
andServerLauncher
targets.
Running your project
Next, run the game either in standalone mode, using the ImGui options to host, or by using O3DE Editor.
Testing in the Editor
You can run multiplayer projects in O3DE Editor using Ctrl+G. For more information, refer to Test Multiplayer Projects in the O3DE Editor.
Running locally using ImGui options
- Launch your
ServerLauncher
either from Visual Studio or from your build directory. - Press the
HOME
key to enable the debug menu. - Select the
Host
option. - Select a level to load to begin hosting.
- Use the
Launch Local Client
option to automatically launch a client connected to the server.
Running server and client launchers in standalone
Manual configuration using the application’s console
You can manually launch the executables for Client and Server and configure them using the application’s console command line.
- Launch both
ClientLauncher
andServerLauncher
. - In
ServerLauncher
press~
to open the command line. - Run the command
host
to begin hosting. - Run the command
LoadLevel <path to level>
to load a level. - In
ClientLauncher
press~
to open the command line. - Run the command
connect <IP Address:Port>
to connect to the server. If running locally,connect
will default to localhost.
Using pre-defined config files
You can manually launch the executables for Client and Server and pass a pre-defined configuration file to each for them to execute on launch. Commands in these cfgs files are executed in listed order.
In the root of your project directory create
launch_client.cfg
andlaunch_server.cfg
.Open
launch_server.cfg
and edit it to look like the following:host LoadLevel <path to Level>
Open
launch_client.cfg
and edit it to look like the following:connect <IP Address:Port>
Alternatively, you can do the following for testing against localhost server running on the default port.
connect
Run the server using
MultiplayerSample.ServerLauncher.exe --console-command-file=launch_server.cfg
Run the client using
MultiplayerSample.ClientLauncher.exe --console-command-file=launch_client.cfg
It is necessary to run the Server first so the Client has a host to connect to.
The preceding commands can be run either from a command line in your build directory or by setting command line arguments in your preferred execution method.