Run in "dedicated server" mode from the editor

I am attempting to debug a dedicated server build, and I would like to make use of the “remote” node list available when running a project from the editor, but I also need the OS.has_feature("dedicated_server") to return true, since this is how much of the server-only logic is gated. Is this possible?

I’m using v4.2.2

1 Like

Have you ever found a solution?

@elenakrittik @eke
Long time, no solution, but here it is: (This is for version 4.3, but should work for 4.2.2)

  1. On the top header of the Godot application, click the Debug.
    image

  2. Then, click `Customize Run Instances.

  3. This will open a menu that allows you to customize the instance that is loaded upon hitting the play button. Click Enable Multiple Instances in the top left corner. You are going to need at least 2. One for the server and one for the client.


    image

  4. On any instance, you can add a feature tag. Add dedicated_server to any instance of your choosing. (I recommend you choose the first one to make adding/removing additional clients slightly easier, as you don’t need to re-add the tag)

BOOM! You can now run both the server and a small number of clients without exporting the project. Make sure the server creates itself on launch and the client automatically connects to the server. (IP = localhost and the port can be any number between 1024–49151).

Edit:

If you have your server and client as separate projects, you can still enable the dedicated_server tag on a standalone instance. Just start the server project whenever you need to test something.

(Unrelated: In my opinion, working with 2 separate projects for one game is cumbersome at best. I’d recommend to instead make a system to separate the client/server scripts and/or scenes on startup)

1 Like