0 votes

My goal is to create a Multiplayer Card Game. The General idea is that there is a 'Matchmaking Lobby' where all players connect to initially, then it grabs two players and throws them into a room of their own that should be running in an entirely separate thread.

However I am very unclear on how Threads work in some cases here.

1) If a scene or node is created in a separate thread, is that thread alive until the node is removed or just until it is finished being instanced?

2) While I could get players into their own room and set up their own 'game loop', how do I make sure RPCs (Remote Procedure Calls) exist in that thread? There doesn't seem to be a clear way to force them into it?

3) I considered creating two separate threads using the low-level networking for pushing/pulling data, however I have a similar confusion to my above issue. If one of these threads were to push data that emitted a signal, would the receiver of that signal be run in the same thread or would it by default run in the main thread?

Worst case scenario is I can have multiple instances of the server running, with the matchmaking lobby redirecting clients to the relevant port but I'd prefer to avoid this inter-process if possible (or as long as until one process can't handle anymore threads).

Thank you for reading!

in Engine by (12 points)

I've not done this myself, but cant each room be its own scene instanced under /root? For each player, just hide any room that they are not in (which will also hide the players that are children of that room). The rpc's will still work because they act on nodes with the same path.

Not sure I see the need for multiple threads or servers.

I'm not concerned about threads, servers etc for sending the relevant actions to the relevant users. I'm concerned about how well the game could scale. What I mean is how far I could get with one thread of logic for multiple games before response times to specific games start to choke because the thread is upheld from earlier responses.

I'm interested to know this as well. Have you ever found out the answer to your question?

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.