By using AWS re:Post, you agree to the Terms of Use
Questions in Game Tech
Sort by most recent

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

Cannot create concurrent game sessions on spot instances in GameLift fleet

I'm working on getting a GameLift fleet up and running. I've been testing in GameLift Local for a while now and just recently started using GameLift proper to test the server build. I have it set to be able to handle 10 concurrent processes per instance (with ten ports specified for use), and I only have one instance running. I can connect to the instance just fine with one client, but I cannot connect with additional clients, even though I set it to allow up to ten. Checking the GameSessions tab for the Fleet in the GameLift console, I can see that only one GameSession is ever active at a time. I'm also seeing a bunch of SERVER_PROCESS_CRASHED events in the event tab that say "Server process exited without calling ProcessEnding(), exitCode(0)," and these are happening between every 5 to 10 minutes. I'm assuming the two issues are connected but I'm not sure how to fix it. I've looked for solutions but I haven't found anything that works yet. The game server is built in Unity, and there's a couple of parts of the code that I'm curious might be the issue, even though I never saw any such errors in GameLift local. First, I wonder if I'm calling Application.Quit() to quickly after calling ProcessEnding(). Right now I have them running like this: ``` var result = GameLiftServerAPI.ProcessEnding(); _networkManager.ServerManager.StopConnection(true); Application.Quit(); ``` Based on some other posts I've seen, it sounds like I need to wait until the ProcessEnding() result is true, but shouldn't it already wait to get the result in this context before calling Application.Quit()? Second, I thought it's possible that my method for setting the port might be causing an issue. I had seen a post that said it wasn't working on Linux at one point, but I tested it on a regular Linux EC2 instance in a dummy project with multiple processes running, and they were able to increment through the array of ports I set looking for unused ports. That code is like this: ``` private void SelectAvailablePort() { foreach (var port in ports) { bool available = false; available = IsListeningPortAvailable(port); if (available) { sessionPort = port; break; } } } public bool IsListeningPortAvailable(int port) => !IPGlobalProperties.GetIPGlobalProperties().GetActiveUdpListeners().Any(x => x.Port == port); ``` I'm not sure if this is breaking something on the server, since I was able to get it to work fine in the dummy project on a Linux instance, but since I cannot get past the single GameSession and I remember seeing someone saying it didn't work on Linux, it makes me wonder if it could be the issue. Do you see anything in the code above that could be causing the issue, or if not, is there something else I should try checking to see if it's the source of the problem. Again, I'm just trying to get the game to allow for multiple GameSessions per instance, but only one server process is active at a time. When I try to connect from a second client, I get an error that says there weren't any server processes available. Any advice you may have would be greatly appreciated!
0
answers
0
votes
5
views
asked 3 days ago

Gamelift fleet creation from real-time script stuck in "Activating" status with insufficient event logs

Hi community, I was trying to initiate a Gamelift fleet using an zip file from s3 (created by CDK Asset). However the fleet created will get stuck in "Activating" for more than one hour and then error. No usable event log is emitted from console during "Activating". I can ssh into the game server in error status but not sure if that is helpful. Any help would be appreciated on how to debug further. (More context: the server files themselves are fine. I uploaded the zip file directly to create the script and the fleet from the script is created just fine). The s3 access rights seem to be okay too, I followed the example [here ](https://github.com/aws-samples/amazon-gamesparks-integration-with-gamelift/blob/c90c91e78712437c307eed4d7886ae75cda2cfe5/packages/infra/lib/matchmaking-stack.ts). The CDK code for uploading server to s3 and creating the script is as follows) ```Typescript import { Role, PolicyStatement, ServicePrincipal } from "aws-cdk-lib/aws-iam"; import { Asset } from "aws-cdk-lib/aws-s3-assets"; import { Bucket } from "aws-cdk-lib/aws-s3"; import { CfnScript } from "aws-cdk-lib/aws-gamelift"; ... // Upload gamelift real-time server script as cdk asset const scriptAsset = new Asset(this, "MyAsset", { path: pathToScript, }); const assetBucket = Bucket.fromBucketName( this, "ScriptAssetBucket", scriptAsset.s3BucketName ); const scriptAccessRole = new Role(this, "ScriptAccessRole", { assumedBy: new ServicePrincipal("gamelift.amazonaws.com"), }); scriptAccessRole.addToPrincipalPolicy( new PolicyStatement({ actions: ["s3:GetObject", "s3:GetObjectVersion"], resources: [`${assetBucket.bucketArn}/${scriptAsset.s3ObjectKey}`], }) ); const script = new CfnScript(this, "RealTimeScript", { name: `my-script`, version: "0.1", storageLocation: { bucket: scriptAsset.s3BucketName, key: scriptAsset.s3ObjectKey, roleArn: scriptAccessRole.roleArn, }, }); script.node.addDependency(scriptAccessRole); ```
1
answers
0
votes
14
views
asked 18 days ago
1
answers
0
votes
16
views
asked 20 days ago