#Is there a way to launch multiple instances with different parameters or environment variables?
12 messages · Page 1 of 1 (latest)
Interesting puzzle
I wonder when running those 3 instances they all get https://docs.godotengine.org/en/stable/classes/class_os.html#class-os-method-get-cmdline-args including the debug port? ... If so 1 has the lowest port num. Could they share this info? 🤔
Inherits: Object Operating System functions. Description: Operating System functions. OS wraps the most common functionality to communicate with the host operating system, such as the clipboard, vi...
I thought I wasn't seeing any of those additional debug args in this list. but I could double check when I get a chance
ah, perhaps I was using get_cmdline_user_args(). not sure. will check later on
I just tested this ... arguments are empty. But
printt('PID', OS.get_process_id())
It gets ugly but using (on MacOS)
printt('PID', OS.get_process_id())
var output = []
var exit_code = OS.execute("ps", ["-aef"], output)
var txt = output[0].split('\n')
for t in txt:
var tt:String = t
if tt.contains('Godot'):
printt(t)
You can find the others PID and do your thing?
hmmmm
I think it would be better to (carefully) have all of them attempt to be a server, and if the port is in use, just switch to client mode.
Yeah, that actually works well. The only problem that remains is that there's an error printed to the log every time, which I'd have to ignore
E 0:00:01:0674 lobby.gd:116 @ _init_server(): Couldn't create an ENet host. <C++ Error> Condition "!host" is true. Returning: ERR_CANT_CREATE <C++ Source> modules/enet/enet_connection.cpp:318 @ _create() <Stack Trace> lobby.gd:116 @ _init_server() lobby.gd:97 @ initialize() lobby.gd:70 @ _ready()
wish there was a way to suppress this.