+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!

asked May 21, 2018 in Engine by shianiawhite (93 points)
edited May 21, 2018 by shianiawhite

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.

answered Jul 20, 2018 by hungrymonkey (427 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.