Repository navigation
Starting Games, Getting Join Codes, and Setting Teams
Before you can do anything else, you'll need to start a game. Only one game can be running at a time per admin.
Here's how you'd start a game with two teams. You can set that 2 to a 0 for no teams (general audience only), or however many teams you need.
Godot Plugin - Run
ScryMirror.start_game(2)API - HTTP POST to https://glooplab.live/api/scryGameData/gameControllerCommand/
{
"creatorName": "yourName",
"key": 12345,
"command": "startGame",
"teamCount" : 2,
"joinMode" : "uniqueCodes" //This option is necessary but doesn't do anything interesting (yet!)
}After you create a game, the server will respond with some game information including the Join Codes.
Godot Plugin - Connect to the game_started signal. When you successfully start a game, this signal will include the join codes.
func _ready() -> void:
ScryMirror.game_started.connect(_my_function)
func _my_function(joinCodes:Array):
print(joinCodes)
# Something like ["W5PCPB","W5PCPB-KM8"] will be on the consoleThe API Response - After successfully starting a game, the server will respond with a bunch of game info, including the join codes.
{
"msg": "",
"error": false,
"joinCode": "W5PCPB", //The join code
"teams": {
"1": {
"joinCode": "KM8", //A join code "team suffix"
"members": [],
"scoreBoard": {},
"currentEvent": {},
"name": "Team 1",
"size": 0
},
"2": {
"joinCode": "X8L", //Another join code "team suffix"
"members": [],
"scoreBoard": {},
"currentEvent": {},
"name": "Team 2",
"size": 0
},
"joinMode": "uniqueCodes"
}
}Audience members navigate to http://glooplab.live/ and punch in a join code to join the game.
...Except there's more than one. Which do they use? Let's use those examples.
- W5PCPB - Puts the player in the General Audience group. This "team" always exists.
- W5PCPB-KM8 - The first in the array, puts the player on Team 1.
- W5PCPB-X8L - The second in the array, puts the player on Team 2.
SNAZZY DEV PROTIP: you can stick the codes in as a URL parameter (http://glooplab.live/?joinCode=W5PCPB ) and it'll auto fill in. Great for easy Discord links and QR codes.
You can limit Events (questions) and parts of the Scoreboard to certain teams, and include or exclude the General Audience as well. This lets you control who knows what and who chimes in when during your game. We'll get into the details on how to do that later.
Stopping a game will end all Events, and archive all data on the server. Players will get kicked out back to the code screen with a notice the game has ended. Games do not automatically stop, even if your Game Runner app tries to start a new one, or crashes or resets etc.
Godot Plugin - Run this. Note that there's a game_stopped() signal you can connect to, so your project can respond to the game ending.
ScryMirror.stop_game()API - HTTP POST
{
"creatorName": "yourName",
"key": 12345,
"command": "stopGame",
}