#Differentiate between multiple sessions

9 messages · Page 1 of 1 (latest)

fair pivot
#

I'm currently working on a multiplayer game. I run two instances, by entering Debug->Run Multiple Instances -> 2 Instances.
When printing with GD.Print("Text"); I only get this in the output field and I can't figure out which instance printed "Text". Is there a way to differentiate the instance in the output?

brave heron
#

It does seem like there is a built in way to get that info. But you could do a little extra work to get a workaround going.

Set the window title and prefix your log messages.

# Global per instance
var instance_identifier = str(randi())

# Should only be called once
func _ready():
    DisplayServer.window_set_title(instance_identifier)

func your_other_func():
    print(instance_identifier, " ", "Text")

Alternatively, you can start the editor in a separate terminal and run the second instance there.

fair pivot
#

Okay, thanks 🙂

fair pivot
brave heron
#

yes that is correct. This approach does not integrate well with the debugger.
Are you using windows as an operating system?

fair pivot
#

Nope linux

brave heron
#

ok, but you could potentially use the same or a similar "trick" as me to know what window belongs to which session 🙂 (probably depends heavily on your desktop environment)

The first window always belongs the the first session and the second window always belongs to the second session.

#

Hope that works for you as well 😄

fair pivot
#

Okay, I think that was not always true for me in the past... But not sure