By using AWS re:Post, you agree to the Terms of Use

Questions tagged with Amazon GameLift

Sort by most recent

Browse through the questions and answers listed below or filter and sort to narrow down your results.

Installing NodeJS + NPM in a Build fleet (not Realtime Script)

Hi all, I have an existing game using Unity for the frontend, but NodeJS for the backend. I can't port my backend over to Unity any time soon, so I've managed to get it working on GameLift in its current state. But there's room for improvement. First I'll explain how I've set it up: 1. Used an unofficial AWS GameLift NodeJS Server SDK (https://github.com/dplusic/GameLift-Nodejs-ServerSDK). (Apologies if it's against the rules to link to unofficial SDKs here - I'm happy to redact this, just thought it would add some context) 2. Prepackaged a NodeJS v16 binary into the build zip that I upload to GameLift 3. Prepackaged my node_modules folders (all of the dependencies) in the build zip 4. My startup script (start.sh) sets up the NodeJS binary and executes Node within the calling process Here's what my start.sh looks like: ``` #!/bin/bash echo "Running 'node src/game-lift/GameLift.js' from Process ID $$" echo "Setting up node" PWD=`pwd` PATH=$PATH:$PWD/deps/node-v16.16.0-linux-x64/bin node --version echo "Executing 'node dist/src/game-lift/GameLift.js'" exec node dist/src/game-lift/GameLift.js ``` `exec` ensures that NodeJS is run within the same process as the calling script, so that GameLift can monitor the process for irregularities (I assume). I launch the Fleet with the following command: ``` aws gamelift create-fleet \ --name REDACTED-fleet-name \ --build-id build-REDACTED \ --ec2-instance-type m5.large \ --ec2-inbound-permissions 'FromPort=1234,ToPort=1234,IpRange=0.0.0.0/0,Protocol=TCP' \ --fleet-type ON_DEMAND \ --runtime-configuration 'ServerProcesses=[{LaunchPath=/local/game/start.sh,ConcurrentExecutions=1}],MaxConcurrentGameSessionActivations=1,GameSessionActivationTimeoutSeconds=600' ``` Two concerns about this approach: 1. Prepackaging NodeJS is not cool / sustainable. I'd rather install it in install.sh, using some platform independent method. 2. Running `exec` to ensure Node doesn't break out into another process seems hacky and potentially problematic. I would rather set the launch path to simply `node` and add the script as a parameter. For example: ``` --runtime-configuration 'ServerProcesses=[{LaunchPath=node,Parameters=dist/src/game-lift/GameLift.js,ConcurrentExecutions=1}],MaxConcurrentGameSessionActivations=1,GameSessionActivationTimeoutSeconds=600' ``` Maybe I'm overthinking item #2 - it might not be a problem as-is But as for #1, I would love to take advantage of that install.sh script. Previously I was installing NodeJs in install.sh via N (https://github.com/mklement0/n-install). But I found that Node was not available in start.sh. I even SSH'd in and it seemed like NodeJS was not installed. **Question #1**: Am I misunderstanding what install.sh does? Should I be able to use it to install NodeJS (or any dependency) and later on use that dependency in my launch script? **Question #2**: Anyone got any tips on how to install Node in GameLift reliably? Yum? N? Nvm? etc. I know NodeJS isn't officially supported, but I'm hoping to get just a general idea of what should and should not be possible in GameLift. Any help would be greatly appreciated.
1
answers
0
votes
46
views
profile picture
asked 2 months ago

Help needed compiling Gamelift for PS5

Hello! I'm porting to PS5 an existing UE4 game that uses Gamelift for multiplayer. I did not find a UE4 plugin for Gamelift with PS5 support already available, so I tried cloning the aws repository and building Gamelift from source using the PS5 SDK compiler and CMake integration. But I get a compilation error on the third party dependencies and I don't know how to fix them. Here is the output log: ``` cmake.exe -DCMAKE_TOOLCHAIN_FILE="D:\Utils\PS5\Prospero\Tools\CMake\PS5.cmake" -A Prospero ./.. -DBUILD_ONLY=gamelift -- Found Git: C:/Program Files/Git/cmd/git.exe (found version "2.37.0.windows.1") -- TARGET_ARCH not specified; inferring host OS to be platform compilation target -- Building AWS libraries as shared objects -- Generating windows build config -- Building project version: 1.8.187 -- Configuring Prospero -- -- Configuring done -- Generating done -- Build files have been written to: D:/Utils/aws_sdk/out-ps5/.deps Microsoft (R) Build Engine version 16.11.2+f32259642 pour .NET Framework Copyright (C) Microsoft Corporation. Tous droits réservés. Checking Build System Performing configure step for 'AwsCCommon' -- Configuring Prospero -- CMake Deprecation Warning at CMakeLists.txt:25 (cmake_policy): The OLD behavior for policy CMP0077 will be removed from a future version of CMake. The cmake-policies(7) manual explains that the OLD behaviors of all policies are deprecated and that a policy should be set to OLD only under specific short-term circumstances. Projects should be ported to the NEW behavior and not rely on setting a policy to OLD. -- attempting to use sanitizer list address;undefined -- Packaging is only supported on Linux -- Configuring done -- Generating done CUSTOMBUILD : CMake warning : [D:\Utils\aws_sdk\out-ps5\.deps\AwsCCommon.vcxproj] Manually-specified variables were not used by the project: CMAKE_TOOLCHAIN_FILE -- Build files have been written to: D:/Utils/aws_sdk/out-ps5/.deps/build/src/AwsCCommon-build Building Custom Rule D:/Utils/aws_sdk/third-party/CMakeLists.txt Performing build step for 'AwsCCommon' Microsoft (R) Build Engine version 16.11.2+f32259642 pour .NET Framework Copyright (C) Microsoft Corporation. Tous droits réservés. Checking Build System Building Custom Rule D:/Utils/aws_sdk/out-ps5/.deps/build/src/AwsCCommon/CMakeLists.txt environment.c D:\Utils\aws_sdk\out-ps5\.deps\build\src\AwsCCommon\source\posix\environment.c(26,25): error : implicit declaration of function 'getenv' is invalid in C99 [-Werror,-Wimplicit-function-declaration] [D:\Utils\aws_sdk\out-ps5\.deps\build\src\AwsCCommon-build\aws-c-common.vcxproj] [D:\Utils\aws_sdk\out-ps5\.deps\AwsCCommon.vcxproj] const char *value = getenv(aws_string_c_str(variable_name)); ^ D:\Utils\aws_sdk\out-ps5\.deps\build\src\AwsCCommon\source\posix\environment.c(26,17): error : incompatible integer to pointer conversion initializing 'const char *' with an expression of type 'int' [-Werror,-Wint-conversion] [D:\Utils\aws_sdk\out-ps5\.deps\build\src\AwsCCommon-build\aws-c-common.vcxproj] [D:\Utils\aws_sdk\out-ps5\.deps\AwsCCommon.vcxproj] const char *value = getenv(aws_string_c_str(variable_name)); ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ D:\Utils\aws_sdk\out-ps5\.deps\build\src\AwsCCommon\source\posix\environment.c(42,9): error : implicit declaration of function 'setenv' is invalid in C99 [-Werror,-Wimplicit-function-declaration] [D:\Utils\aws_sdk\out-ps5\.deps\build\src\AwsCCommon-build\aws-c-common.vcxproj] [D:\Utils\aws_sdk\out-ps5\.deps\AwsCCommon.vcxproj] if (setenv(aws_string_c_str(variable_name), aws_string_c_str(value), 1) != 0) { ^ D:\Utils\aws_sdk\out-ps5\.deps\build\src\AwsCCommon\source\posix\environment.c(50,9): error : implicit declaration of function 'unsetenv' is invalid in C99 [-Werror,-Wimplicit-function-declaration] [D:\Utils\aws_sdk\out-ps5\.deps\build\src\AwsCCommon-build\aws-c-common.vcxproj] [D:\Utils\aws_sdk\out-ps5\.deps\AwsCCommon.vcxproj] if (unsetenv(aws_string_c_str(variable_name)) != 0) { ^ 4 errors generated. C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(241,5): error MSB8066: la build personnalisée de 'D:\Utils\aws_sdk\out-ps5\.deps\CMakeFiles\5f1e4345a9d911eaa5fc8616d695c793\AwsCCommon-configure.rule;D:\Utils\aws_sdk\out-ps5\.deps\CMakeFiles\5f1e4345a9d911eaa5fc8616d695c793\AwsCCommon-build.rule;D:\Utils\aws_sdk\out-ps5\.deps\CMakeFiles\5f1e4345a9d911eaa5fc8616d695c793\AwsCCommon-install.rule;D:\Utils\aws_sdk\out-ps5\.deps\CMakeFiles\291e455fb70b57eb98a005f919e01343\AwsCCommon-complete.rule;D:\Utils\aws_sdk\out-ps5\.deps\CMakeFiles\075aa0e2c4544e3f37305cb661ccfd02\AwsCCommon.rule;D:\Utils\aws_sdk\third-party\CMakeLists.txt' s'est arrêtée. Code 1. [D:\Utils\aws_sdk\out-ps5\.deps\AwsCCommon.vcxproj] Performing configure step for 'AwsChecksums' -- Configuring Prospero -- -- Configuring done -- Generating done CUSTOMBUILD : CMake warning : [D:\Utils\aws_sdk\out-ps5\.deps\AwsChecksums.vcxproj] Manually-specified variables were not used by the project: CMAKE_TOOLCHAIN_FILE -- Build files have been written to: D:/Utils/aws_sdk/out-ps5/.deps/build/src/AwsChecksums-build Building Custom Rule D:/Utils/aws_sdk/third-party/CMakeLists.txt Performing build step for 'AwsChecksums' Microsoft (R) Build Engine version 16.11.2+f32259642 pour .NET Framework Copyright (C) Microsoft Corporation. Tous droits réservés. Checking Build System Building Custom Rule D:/Utils/aws_sdk/out-ps5/.deps/build/src/AwsChecksums/CMakeLists.txt aws-checksums.vcxproj -> D:\Utils\aws_sdk\out-ps5\bin\Release\libaws-checksums.so Building Custom Rule D:/Utils/aws_sdk/out-ps5/.deps/build/src/AwsChecksums/CMakeLists.txt prospero-lld : error : cannot open Release\aws-checksums_stub_weak.a: no such file or directory [D:\Utils\aws_sdk\out-ps5\.deps\build\src\AwsChecksums-build\aws-checksums-tests.vcxproj] [D:\Utils\aws_sdk\out-ps5\.deps\AwsChecksums.vcxproj] C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(241,5): error MSB8066: la build personnalisée de 'D:\Utils\aws_sdk\out-ps5\.deps\CMakeFiles\67b316f4a8998627537e1875c6cc3c62\AwsChecksums-configure.rule;D:\Utils\aws_sdk\out-ps5\.deps\CMakeFiles\67b316f4a8998627537e1875c6cc3c62\AwsChecksums-build.rule;D:\Utils\aws_sdk\out-ps5\.deps\CMakeFiles\67b316f4a8998627537e1875c6cc3c62\AwsChecksums-install.rule;D:\Utils\aws_sdk\out-ps5\.deps\CMakeFiles\291e455fb70b57eb98a005f919e01343\AwsChecksums-complete.rule;D:\Utils\aws_sdk\out-ps5\.deps\CMakeFiles\075aa0e2c4544e3f37305cb661ccfd02\AwsChecksums.rule;D:\Utils\aws_sdk\third-party\CMakeLists.txt' s'est arrêtée. Code 1. [D:\Utils\aws_sdk\out-ps5\.deps\AwsChecksums.vcxproj] CMake Error at CMakeLists.txt:224 (message): Failed to build third-party libraries. -- Configuring incomplete, errors occurred! ``` So I have two questions: - am I doing all this for nothing and is there a precompiled PS5 library available upon request? - if not, could you help me fix the compile error so I can make my own plugin with PS5 support? Thanks!
2
answers
0
votes
47
views
asked 3 months ago