godotengine / godot-proposals

Godot Improvement Proposals (GIPs)
MIT License
1.16k stars 97 forks source link

Separate cmd args per debug instance #6232

Closed aekobear closed 1 year ago

aekobear commented 1 year ago

Describe the project you are working on

I'm working on a multiplayer game with a dedicated server + client model. The server and clients get run as separate executables

Describe the problem or limitation you are having in your project

Because Godot's Multiplayer API only allows an instance to be a server or a client, the way I test / debug my application locally is to select Debug > Run Multiple Instances

However all of these instances receive the exact same command line arguments, which forces me to create a special debugging scene with buttons for choosing server or client

Describe the feature / enhancement and how it helps to overcome the problem or limitation

The ability to set different command-line arguments for each of the (up to 4) debug instances will allow me to quickly test my client-server game in a way that closely mirrors the production version (server will be controlled via command line)

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

add 4 more fields to the Project settings for each of the debug instances:

image

All instances would receive the "Main Run Args" in addition to the args unique to the instance. So in the example above, Instance 1 would receive "foo server=true" whereas Instance 2 would only receive "foo"

If this enhancement will not be used often, can it be worked around with a few lines of script?

As far as I can tell this cannot be achieved without creating a custom scene requiring the user (me) to choose which instance should be a server and which should be a client

Is there a reason why this should be core and not an add-on in the asset library?

The ability to run multiple instances is already a core feature, but it is limited by the fact that all 4 instances are identical. There are situations (server-client, A B feature testing, game with pop-out UI, etc) where developers want the instances to behave differently, and command line arguments are a direct way to tell instances how to behave

aekobear commented 1 year ago

I found an issue with similar discussion: https://github.com/godotengine/godot-proposals/issues/3357

But I decided to make this a new proposal because while a built-in variable for identifying the running instance would help solve the problem, it's still somewhat limiting and would lead to code that only works when run in editor. Being able to pass server=true to one of my instances lets me accurately test my code in a way that matches production use

YuriSizov commented 1 year ago

This is a duplicate of https://github.com/godotengine/godot-proposals/issues/522. And there is a PR implementing that one, actually, https://github.com/godotengine/godot/pull/57975 🙃

aekobear commented 1 year ago

This is a duplicate of #522. And there is a PR implementing that one, actually, godotengine/godot#57975 upside_down_face

sorry I missed that in my search! but thanks for info and I'm glad to hear it's in the works :raised_hands: