MultiplayerSample for gamelift (Lumberyard 1.17)

0

Hi,

I followed this tutorial and it seems that on compilation BUILD_GAMELIFT_SERVER is not defined.

So, my question is how to define properly BUILD_GAMELIFT_SERVER?

Thanks in advance.

asked 4 years ago9 views
9 Answers
0
Accepted Answer

BUILD_GAMELIFT_SERVER is defined only for dedicated servers.

Source:

dev_WAF_\3rdParty\aws_gamelift_server.json defines BUILD_GAMELIFT_SERVER when aws_gamelift_server_static or aws_gamelift_server_shared library is used.

These libraries are included by dedicated launchers in dev\Code\Launcher\DedicatedLauncher\wscript

win_profile_dedicated_uselib = ['AWS_GAMELIFT_SERVER_SHARED'],

Does that help?

answered 4 years ago
0

Hey @REDACTEDUSER thank you for your answer.

If i understood correctly, when i execute this command: "lmbr_waf configure build_win_x64_vs2017_release_dedicated -p game_and_engine --enabled-gameprojects MultiplayerSample --progress" it should build gamelift server. Or do i miss something?

But, when i upload it to gamelift i get this message: "Server process started correctly but did not call InitSDK() within 5 minutes" Based on this, I have a suspicion that BUILD_GAMELIFT_SERVER is not really defined.

answered 4 years ago
0

Well, I did everything according to the instructions:

  1. Build the multiplayer sample dedicated server
  2. Compile the assets for the dedicated server
  3. Create a server build package
  4. Test it locally But still got the same message:

"Server process started correctly but did not call InitSDK() within 5 minutes"

Wonder what i have missed.

answered 4 years ago
0

Yes however build command is only one step in that process. "release" builds are special builds that are ship-ready packages, as opposed to optimized dev builds.

Here are instructions on how to create a release build in Lumberyard end-to-end.

https://docs.aws.amazon.com/lumberyard/latest/userguide/game-build-release.html

And here is the doc for preparing MultiplayerSample for GameLift:

https://docs.aws.amazon.com/lumberyard/latest/userguide/network-multiplayer-gs-gamelift.html

Regarding "InitSDK()" error, it is likely coming up because the package is missing critical binaries in its deployment to GameLift.

answered 4 years ago
0

To recheck my suspicion, I added the following code into the project(MultiplayerSample):

#if defined(BUILD_GAMELIFT_SERVER)
    AZ_Printf("BUILD_GAMELIFT_SERVER", "Defined.");
#else
    AZ_Printf("BUILD_GAMELIFT_SERVER", "Not defined.");
#endif

and the printed result was - "Not defined".

In this regard, my question is still relevant.

How to define properly BUILD_GAMELIFT_SERVER?

answered 4 years ago
0

Hmm, that is really surprising as we test MultiplayerSample dedicated servers for each release to work in GameLift. Let me double check it on my side.

answered 4 years ago
0

So I've double-checked this topic:

  1. BUILD_GAMELIFT_SERVER is defined for GameLift gem, for example, I tested this change:

dev\Gems\GameLift\Code\Source\Session\GameLiftServerService.cpp:

    bool GameLiftServerService::StartGameLiftServer()
{
if (m_serverStatus == GameLift_NotInited)
{
#if defined(BUILD_GAMELIFT_SERVER) // my test change
static_assert(false, "BUILD_GAMELIFT_SERVER is definitely defined!");
#endif
Aws::GameLift::Server::InitSDKOutcome initOutcome = Aws::GameLift::Server::InitSDK();

That definitely breaks compilation on any *_dedicated build (I've tested with profile_dedicated and release_dedicated).

  1. BUILD_GAMELIFT_SERVER is not defined for MultiplayerSample gem-dll project, as it is not needed there. However, if you want to enable that macro for your own code, you can do so by modifying appropriate wscript file:
        win_debug_dedicated_uselib = ['AWS_GAMELIFT_SERVER_SHARED'],
win_profile_dedicated_uselib = ['AWS_GAMELIFT_SERVER_SHARED'],
win_performance_dedicated_uselib = ['AWS_GAMELIFT_SERVER_STATIC'],
win_release_dedicated_uselib = ['AWS_GAMELIFT_SERVER_STATIC'],

For example, I tested that by modifying dev\MultiplayerSample\Gem\Code\wscript and getting the following to error out at compile time in dev\MultiplayerSample\Gem\Code\Source\MultiplayerSampleModule.cpp.

            MultiplayerSample()
: CryHooksModule()
{
#if defined(BUILD_GAMELIFT_SERVER)
static_assert(false, "BUILD_GAMELIFT_SERVER is definitely defined!");
#endif

Could you check the same in your code and tell me what you are seeing?

That said, you don't need this in MultiplayerSample gem, because it is already enabled for all dedicated servers in Lumberyard dev\Code\Launcher\DedicatedLauncher\wscript .

answered 4 years ago
0

Hi @REDACTEDUSER

I've checked following Your example and, yes, indeed,

I have got the same result as Yours.

By the way, the missing step for gamelift build was to call gamelift_start_server.

Thank you very much for your help!

answered 4 years ago
0

Awesome! I'm glad you were able to find the missing piece.

answered 4 years ago

Adding new answers, comments, and votes is disabled.