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

Questions tagged with Amazon GameLift

Sort by most recent
  • 1
  • 90 / page

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

1
answers
0
votes
5
views
asked 14 days ago

GameLiftLocal Crashes when commands are given to it

We are in the process of testing GameLift for our game. We have created an Amazon Linux 2 VM under Virtual Box and have a working sample server form Github working and also have GameLiftLocal running on the machine. We run Gamelift running the following command: ``` [ec2-user@vm_gamelift3 GameLiftLocal-1.0.5]$ java -jar GameLiftLocal.jar ``` This seems to result in a successful startup: ``` 05:22:54,823 INFO || - [SocketIOServer] main - Session store / pubsub factory used: MemoryStoreFactory (local session store only) 05:22:59,344 WARN || - [ServerBootstrap] main - Unknown channel option 'SO_LINGER' for channel '[id: 0x88185e57]' 05:22:59,353 INFO || - [SDKConnection] main - GameLift SDK server (communicates with your game server) has started on http://localhost:5757 05:22:59,390 INFO || - [SocketIOServer] nioEventLoopGroup-2-1 - SocketIO server started at port: 5757 05:22:59,450 INFO || - [SdkWebSocketServer] WebSocketSelector-13 - WebSocket Server started on address localhost/127.0.0.1:5759 05:22:59,655 INFO || - [StandAloneServer] main - GameLift Client server (listens for GameLift client APIs) has started on http://localhost:8080 05:22:59,705 INFO || - [StandAloneServer] main - GameLift server sdk http listener has started on http://localhost:5758 ``` We also get a good connection when starting up the game server sample locally. However, when we attempt to issue the local server a command, it always comes back with an exception ``` [ec2-user@vm_gamelift3 ~]$ aws gamelift create-game-session --endpoint-url http://127.0.0.1:5758 --maximum-player-session-count 2 --fleet-id fleet-123 ``` ``` An error occurred (NullPointerException) when calling the CreateGameSession operation (reached max retries: 4): ``` The server does not completely crash, but does give a warning and a call stack of the exception that was caught ``` 05:25:31,497 WARN || - [GameLiftSdkHttpHandler] GameLiftSdkHttpHandler-thread-0 - Caught exception java.lang.NullPointerException at com.amazon.gamelift.handlers.GameLiftSdkHttpHandler.validateHeaders(GameLiftSdkHttpHandler.java:84) at com.amazon.gamelift.handlers.GameLiftSdkHttpHandler.handle(GameLiftSdkHttpHandler.java:55) at com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:79) at sun.net.httpserver.AuthFilter.doFilter(AuthFilter.java:83) at com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:82) at sun.net.httpserver.ServerImpl$Exchange$LinkHandler.handle(ServerImpl.java:700) at com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:79) at sun.net.httpserver.ServerImpl$Exchange.run(ServerImpl.java:672) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) 05:25:31,554 WARN || - [GameLiftSdkHttpHandler] GameLiftSdkHttpHandler-thread-0 - Caught exception null ``` This exception also occurs when we just try to describe the sessions, so it seems to be any command you issue the jar on that socket. How do I resolve this so that I can get to actually testing my code? Thank you! David
2
answers
0
votes
6
views
asked 24 days ago

How to communicate with GameLift Server with Java Client

I have a Java Client I am attempting to integrate with GameLift. I am able to use it to search for Active Fleets, Search Game Sessions, Create Game Sessions and Create Player Sessions. I do not know where to go from there. What API or Java method is used to communicate with the Server. I have the example Server setup and running. The example server code is shown here: https://docs.aws.amazon.com/gamelift/latest/developerguide/realtime-script.html The Java code I have written: //////////////////////////////////////// AmazonGameLift gameLift = AmazonGameLiftClientBuilder.standard() .withCredentials(new AWSStaticCredentialsProvider(credentials)) .withRegion("us-east-2") .build(); DescribeFleetAttributesRequest dfar = new DescribeFleetAttributesRequest(); DescribeFleetAttributesResult describeFleetResult = gameLift.describeFleetAttributes(dfar); CreateGameSessionRequest cgsRequest = new CreateGameSessionRequest().withFleetId(describeFleetResult.getFleetAttributes().get(0).getFleetId()) .withName("Sim Game") .withMaximumPlayerSessionCount(MAX_PLAYERS); CreateGameSessionResult cgsResult = this.gameLift.createGameSession(cgsRequest); byte[] array = new byte[[PLAYER_ID_LENGTH]]; // length is bounded by PLAYER_ID_LENGTH new Random().nextBytes(array); String playerID = new String(array, Charset.forName("UTF-8")); CreatePlayerSessionRequest cpsRequest = new CreatePlayerSessionRequest().withGameSessionId(cgsResult.getGameSession().getGameSessionId()) .withPlayerId(playerID); CreatePlayerSessionResult cpsResult = this.gameLift.createPlayerSession(cpsRequest); //////////////////////////////////////////////////////////////////////////////////////// I am assuming there is a way to communicate using to the Server using some call to cpsResult. My theory is to use cpsResult.getPlayerSession().marshal() But I do not understand how to use the marshall function. void marshall(ProtocolMarshaller protocolMarshaller) I am also not sure that is even the correct function to use. If anyone can point me in the right direction to start attempting Server communication I would be very grateful.
1
answers
0
votes
9
views
asked 5 months ago
  • 1
  • 90 / page