+1 vote

I have a setup where multiple users can be "using" a scene. When a client wants to access the scene, they make a request to the server. If the scene already exists, the server gives the current state of the scene to the client. If the scene does not already exist, the server creates the scene and sends that initial state to the client. If all clients stop using a scene, the scene is deleted.

If the server decides there is no client using the scene, but at the same time, receives a new client requesting the scene, this might end up a deleted scene trying to send its state to the client.

Does Godot handle multiple incoming rpc commands in parallel (or handle a single rpc command in parallel with the server's own code? Or are all the functions run in order for that frame of the game? (e.g. server runs local _process functions completely before moving to the first rpc received during this frame which is handled completely before the second rpc...) Does this kind of code require some kind of mutex lock? Or am I in the clear to leave it simple without the lock?

Thank you!

in Engine by (104 points)
edited by

1 Answer

0 votes

There is only one network tree in scenetree.

Network commands may not be queued in order but they are emitted one at a time.

by (431 points)
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.