partial sync of engine/server.cpp and engine/client.cpp