This is basically a question about how Composer works.
I am making a turn based game where the player can run a local multiplayer server. This requires a server loop. I’m wanting to make it so that the player can have multiple games going at the same time but I want one server loop.
What I want to do is start a server loop from the menu “scene” but access client info from inside the various instances of the game which are a different scene. Also, I need the server running and accessible while the player is in other scenes.
Normally, I would put the server loop in a module, but I’m talking about a loop that is running off a timer.performwithdelay() and I don’t know what causes that to freeze (besides leaving the app)
So, should I put the server loop function in main.lua and make it global? If I then switch scenes can the loop run in the background? Do I have to put it in main.lua? As of now, the only thing in main.lua is a call to create the main menu scene.
Any advice is appreciated.