Here is a nut to crack:
I’m creating a multiplayer game with both server and client being instances of Defold engine.
Now I want to the server to have a tickrate of 0.1 seconds (10 updates/second) and was therefor suggested to use the socket.sleep() function. Question is where I should do it.
Server is headless and authoritative and all messages coming in there first needs to be processed, all gameobjects in server needs to be updated. The full gamestate will then be packaged and sent as package to the clients. THEN the server can allow itself to sleep.
To complicate things this also includes physics handling like collision responses and raycast responses.
Just putting a socket.sleep() in the end of the server.script update loop just wont do it as I have no control of when the different scripts are being updated and when messages are done being sent.
Having the headless instance respecting the framerate would help some of course and is requested since earlier BUT I still dont know if all messages/physics etc has been sent so I can package the gamestate and send it to the clients before update is done.
Any suggestions?
I remember something about proxycollections having their own update loop? Maybe that could solve something.