-
-
Notifications
You must be signed in to change notification settings - Fork 21.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add session-id
CLI Argument to Allow for Debugger Session Identification
#64913
base: master
Are you sure you want to change the base?
Add session-id
CLI Argument to Allow for Debugger Session Identification
#64913
Conversation
3499e5a
to
ed0dd6d
Compare
07939e9
to
dd11da7
Compare
This is used in the editor when you have multiple debug sessions and you want to know which session is which. For online multiplayer development, this is important since you can use these identities to determine whether an instance should start as a server or a client. Additionally, you could use this session id simply to cross compare two different game sessions.
`get_session_id` and `set_session_id` have been added with proper documentation.
Now `push_front` calls are tracked and accounted for in indexing when each debugging instance is started.
dd11da7
to
e7eccef
Compare
I've rebased the commits to fix a merge conflict. |
OS::ProcessID pid = 0; | ||
|
||
if (instances_count > 1 && session_id_position >= 0) { | ||
args[session_id_position + front_pushes] = String::num_int64(i); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems that it's more simpler to add --session-id
here.
@@ -1650,6 +1658,8 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph | |||
GLOBAL_DEF("debug/settings/stdout/print_gpu_profile", false); | |||
GLOBAL_DEF("debug/settings/stdout/verbose_stdout", false); | |||
|
|||
Engine::get_singleton()->set_session_id(init_session_id); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The session ID (or index) may be not equal to the session index of RemoteDebugger because of the execution order of connections.
@kdada does #68054 make this PR obsolete or are these two PRs slightly different from one another? I still think that some command line options for session id might not be a terrible idea for testing outside of the editor, but perhaps that can be added on top of your PR? Otherwise, I can fix up and rebase. |
This comment was marked as off-topic.
This comment was marked as off-topic.
@IDreamInCode Please don't bump issues without contributing significant new information. Use the 👍 reaction button on the first post instead. Regarding the PR itself, I wonder if the CLI argument should also send the total amount of instances, so you know how many instances were created even on the 1st instance. This may be useful if you want to apply different (faster) graphics settings when running more than 2 instances, and have these settings apply to all instances. To avoid adding yet another CLI argument, the This isn't critical so it can be left to a future PR, but I thought it'd be worth mentioning. |
My apologies, I will use the thumbs up in the future!
…On Sun, Apr 28, 2024, 11:07 AM Hugo Locurcio ***@***.***> wrote:
@IDreamInCode <https://github.com/IDreamInCode> Please don't bump issues
without contributing significant new information. Use the 👍 reaction
button on the first post instead.
—
Reply to this email directly, view it on GitHub
<#64913 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACNNAAP3Q7F3BFKZVPAQLE3Y7UNDHAVCNFSM57VN27SKU5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TEMBYGE2TGNJTHEZA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
session-id
CLI Argument to Allow for Debugger Session Identificationsession-id
CLI Argument to Allow for Debugger Session Identification
As discussed in godotengine/godot-proposals#3357 , I have added the ability for Godot to be passed a session identifier which is then used by the debugger whenever there are multiple debugger sessions launched (
Debug > Multiple Instances
configuration larger than 1.)The
Engine
class has been modified by adding two methods:set_session_id
andget_session_id
; For each one I've added the appropriate documentation for their purpose and utility.While using Godot's multiple-instance debugger, users can call
Engine::get_session_id
to branch logic for their needs. For example, the session id can be used to tell one instance to host a server while the others establish a peer connection. This is a nice quality of life feature for developers of multiplayer games where they might want to start a server and multiple clients simultaneously. Or you could use session ids to branch between two different gameplay configurations such as character walk speeds or jump heights. This is a nice way to compare and contrast two drastically different gameplay scenarios for game testing.Here's a simplified idea on how this is supposed to be used within the editor.
From here, assuming multiple instances have been enabled by the user, the debugger window will open two or more windows with one instance hosting a server while the others connect as peers. This is essential for quickly testing networked multiplayer games.
Terminology Note
This patch refers to each Godot instance launched by the debugger as a "session", which is what they're called in the tabs above the debugger. However, in the
Debug
drop-down menu, these are referred as "instances". Sinceget_instance_id
is already used extensively in the engine code, using the wordsession
here seems appropriate. It might be worth considering changing the terminology in the debug menu to be consistent with the debugger tab at the bottom (i.e.Run Multiple Sessions / Run X Sessions
.)