Hopson97/open-builder

Make the client not launch until server is ready

Hopson97 opened this issue · 1 comments

Suggestion Title

Make client not launch until server has finished starting

Describe your suggestion

Right now there is a 500ms dselay in the launchBoth function in main.cpp, but sometimes this means the server has not finished setting up before the client has launched, meaning the client doesn't connect

Work Arounds

There are 3 work around for the time being:

Build and run in release modd

This will make the world generation faster, meaning the server will actually be ready before the client starts.

sh scripts/build.sh release
sh scripts/run.sh release

Run the server and the client separately

sh scripts/run.sh -server 4

#wait a few secs, then on another terminal

sh scripts/run.sh -client x

Edit the code a bit to increase the delay

In main.cpp there is a function called launchBoth

This is the function that will launch the server on one thread, wait about 500ms, and then launch the client.

You can increase the number in the sleep_for function call to mitigate the issue.

Solved by PR #79