in CppServerAndClient/Server/Server.cpp [158:202]
bool Server::InitializeGameLift(int listenPort, std::string logfile)
{
try
{
std::cout << "Init GameLift SDK...\n";
auto initOutcome = Aws::GameLift::Server::InitSDK();
if (!initOutcome.IsSuccess())
{
return false;
}
std::cout << "InitSDK Done!\n";
// Set parameters and call ProcessReady
std::string serverLog(logfile);
std::vector<std::string> logPaths;
logPaths.push_back(serverLog);
auto processReadyParameter = Aws::GameLift::Server::ProcessParameters(
std::bind(&Server::OnStartGameSession, this, std::placeholders::_1),
std::bind(&Server::OnProcessTerminate, this),
std::bind(&Server::OnHealthCheck, this),
listenPort, Aws::GameLift::Server::LogParameters(logPaths)
);
std::cout << "Process Ready...\n";
auto readyOutcome = Aws::GameLift::Server::ProcessReady(processReadyParameter);
if (!readyOutcome.IsSuccess())
return false;
std::cout << "Process Ready Done!\n";
mActivated = true;
return true;
}
catch (int exception)
{
std::cout << "Exception Code: " << exception << std::endl;
return false;
}
}