A scoring system for GPS based alternate reality games.
A websocket server is created in order to receive data about events in the game world. The data from all data sources is collated, de-duplicated and sorted in order to create a summary as is needed for scoring.
The websocket connection is also used to set the parameters of the game, and the parameters are sent to the clients in order to determine which information should be sent.
Game parameters are saved and loaded from a JSON file.
nodejs
openssl
- Create an SSL Certificate by running
generate-server-cert.sh
. Make sure to enter you domain name when asked for a "Common Name". This may well be 'localhost'. - Run the server as below and navigate to it using https (e.g. https://example.com:6543) in order to make your browser trust the server.
- Run
node minigame-server.js example.json
to create a new game config saved toexample.json
. - Connect your minigame helper clients to the server.
Clients communicate with the server using text/json over a websocket.
All messages have a msg
field specifying the message type as a string.
connect
client -> server: initiate or continue a connectionversion
number: the version to usesession
string (optional): the session to continue
connected
server -> client: connection initiatedsession
string: the id of the session that is currently being used
failed
server -> client: connection failed. Either the version is unsupported, or the requested session no longer exists.version
number: the version that the server speaks
badLlama
server -> client: the client has misbehaved and is being kickedreason
stringinsult
string
poi
: information about a POIguid
string: the POI identifierdata
object: the info, including at least:latE6
number: latitude * 10^6lngE6
number: longitude * 10^6included
boolean: if the POI is part of the gametag
string: a tag for the POI in the game
-
worldState
server -> client: send events that describe constructing the current world state from the blank state -
start
server -> client: start sending events as they happen -
end
server -> client: stop sending event as they happen -
event
client -> server: an event occurredtype
string: the event typetimestamp
number: when the event occurredteam
string: which team caused the eventplayer
string (optional): the player who caused the event- various other fields as needed
Events of the following type can be reported:
capture
poi
neutralise
poi
build
poi
destroy
poi
createLink
poiFrom
poiTo
destroyLink
poiFrom
poiTo
createLink
poiFrom
points
For each of these, poi is an object with either guid
(string) or latE6
and lngE6
(numbers).