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

Javascript as a Game client for a Gamelift Server

0

Hi, Does anyone have experience in making a game in Javascript with Amazon gamelift as the Gameserver?

If yes, i am not able to find the correct API documentation for Browser javascript which I can use to make calls(of some sort) to Gamelift gameserver to create new session or join a session?

Thanks.

asked 3 years ago68 views
10 Answers
1

For those interested in building a game client using Javascript or Typescript, we have developed a client library that we are currently using in production.

Our library is modeled after the official C# SDK, and attempts to provide a comparable experience for the browser and node with a very similar API.

The library is available at the following repository and is Free and Open Source: https://codeberg.org/CodeOnCanvas/gamelift-realtime-client

Enjoy!

Matt

answered 2 months ago
0

GameLift offers its 'Realtime' product which is a packaged node server with all the configuration points ready for your scripts

https://docs.aws.amazon.com/gamelift/latest/developerguide/realtime-howitworks.html

This is probably the easiest place to start unless you want to write your own javascript server SDK and keep it up to date.

There are also some open source projects like https://github.com/dplusic/GameLift-Nodejs-ServerSDK which also could be useful

answered 3 years ago
0

Thanks for the Reply. Let me rephrase slightly: My scenario is, If i have a gamelift server as a game server, what API or services it offers so a javascript client can connect to it. So the whole point is does Gamelift offer any Javascript APIs for Client to consume and do the casual Match Making, Session, Presence, broadcasting information to all clients etc.

answered 3 years ago
0

Your Javascript clients should consume either the general AWS Javascript SDK parts required (https://github.com/aws/aws-sdk-js/blob/master/CHANGELOG.md) or call through a 'client service'

Your clients should use the Javascript SDK as with any GameLift integrated client to trigger calls to

  • StartMatchmaking and handle getting the results to get game session details to join
  • Join the game session directly or call CreatePlayerSession etc.

See https://docs.aws.amazon.com/gamelift/latest/developerguide/match-client.html https://docs.aws.amazon.com/gamelift/latest/developerguide/gamelift-sdk-interactions.html

For reference an overview of whats required is here: https://docs.aws.amazon.com/gamelift/latest/developerguide/gamelift-architecture.html

answered 3 years ago
0

As opposed to bringing up a new thread, is there anyone that can shed more light on this? Neither of the answers above appear to have addressed the question - or I'm totally missing something.

There appears no code in the AWS SDK linked above (https://github.com/aws/aws-sdk-js) that is for the client - only code for the client service.

a) We can already create the GameServer code in NodeJS b) We have already created the client service using the provided SDKs c) We can test this by creating a CLIENT in Unity using the " GameLift Realtime Client SDK" c) But can we create the CLIENT in JavaScript? Is there an SDK or other solution that will do that? Or are the only solutions c# based?

Thanks

answered 2 years ago
0

@REDACTEDUSER

Unfortunately there is no official GameLift Realtime client in Javascript as you've noticed here: https://docs.aws.amazon.com/gamelift/latest/developerguide/gamelift-supported.html

I will let the GameLift service team know of your interest in one.

The current SDK is dotnet core only, so you could:

  • Wrap it or your application to consume it (which may not be possible for browser based games etc) but depending how you distribute your client it may be possible.
  • Rebuild it for javascript (obviously would be unsupported) but its a simple message parsing system that should be fairly straightforward to use. Would require:
  1. A websocket in javascript
  2. The ability to send messages over those websockets based on the protobuf definition in the C# SDK
  3. A generated set of javascript wrappers based on that protobuf definition
  4. Some specialty message handling (ie Login/connection logic) ported from the C# SDK; Co

Complexity is reduced if you don’t use udp here but again that depends on your use case.

Obviously some caveats here:

  • There would be no official support for your client and help may be limited.
  • The protobuf file could change but it should generally be backwards compatible
  • Realtime is not built for very high speed / large data synchronization between client and servers, I would definitely experiment quickly wrt to your network transfer rate/load to see if Realtime is the right solution for your needs.

Someone recently took this on in this thread for C++ here: https://forums.awsgametech.com/t/connecting-to-the-realtimescript-based-server-after-reserving-a-game-session-successfully/9204/8

Neither are great answers so I am sorry about that.

answered 2 years ago
0

[quote="Pip, post:6, topic:7679"] There would be no official support [/quote] Pip,

Thanks for reconfirming. So same as a year ago 😦

I was hoping someone had a prototype project already in place to piggyback off / contribute to. I already have a one-way mock using HTML into a node script on the server - but that's push only. The socket solution in JS would be so perfect (not least for local testing as well).

Thanks for confirming

Rob

answered 2 years ago
0

Is there any update on this? I couldn't find a single github repo or sdk helping with realtime server connections in javascript.

answered 6 months ago
0

Hi @REDACTEDUSER

GameLift does not currently support RTS client SDK in JavaScript. Please let us know about your use cases and we can append them to RTS JavaScript Client SDK feature request and prioritize accordingly.

Thanks, James

answered 5 months ago
0

Hi James,

We want to have a simple plug&play solution for web based games. We have customers who would like to have their users engage with others. Often very simple games, so there is no need for huge server code. That's why we went with the RTS.

answered 5 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions