Skip to main content

How to use it

Now that you have everything up and ready, it's time to learn how to use it!

Prerequisites#

OR#

Creating a ticket#

It's time to create a ticket. This action mimics a player that would queue for a game. We will create a ticket using an HTTP request. You can use any tool you want to make the request. In this tutorial, we will use curl.

curl -X POST -H "Content-Type: application/json" -d '{"mode": "mode.casual"}' 127.0.0.1:51504/v1/tickets

This should create a ticket with mode casual as a research tag.

Retrieving data about a ticket#

Now that you have created a ticket, you can retrieve the data about the ticket using its ID. You will find the ID of the ticket in the response's body of the create ticket request

curl -X GET 127.0.0.1:51504/v1/tickets/[TICKET_ID]

Don't forget to change [TICKET_ID] by the id of your ticket

This should retrieve the data of your ticket

Deleting a ticket#

Now that you have created a ticket, you can delete the ticket using its ID. You will find the ID of the ticket in the response's body of the create ticket request. This action mimics a player that would leave the queue.

curl -X DELETE 127.0.0.1:51504/v1/tickets/[TICKET_ID]

Don't forget to change [TICKET_ID] by the id of your ticket

This should delete your ticket

Creating a match#

Now that you know how to create a ticket, you can create a match! To create a match, you will have to create 2 tickets. The director will match 2 players of the same mode together and create a server on Arbitrium. After a few seconds, a server should be deployed on Arbitrium.

img

You MUST have change the director's variables for this to work

You can get the connection (IP:PORT) data of your server from ticket's data. If you retrieve the data of a ticket and this ticket has been assigned a game, you will see the connection's data in the response body under the assignment.connection key.

{
"id": "c4jad75vcn5vtk9e70bg",
"assignment": {
"connection": "99.79.38.68:30312"
},
"search_fields": {
"tags": ["mode.casual"]
},
"extensions": {
"playerIp": {
"type_url": "type.googleapis.com/google.protobuf.StringValue",
"value": "MTkyLjE2OC42NS4z"
}
},
"create_time": {
"seconds": 1629922972,
"nanos": 632770900
}
}

After a ticket is assigned to a match, you have a few minutes to retrieve the data. After a few minutes, the ticket will be deleted and you will receive a 404 if you get the resource.

The matchmaker is used to start matches. It will not terminate your deployments nor your sessions. To stop them automatically, here are some options.

  • Set a time limit to your App Version. This will end your deployment automatically after the time limit.
  • From within your deployment, you can detect that all the players are disconnected (you will have to code this part) and terminate it automatically.