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.
nodejsopenssl
- 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.jsonto 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.
connectclient -> server: initiate or continue a connectionversionnumber: the version to usesessionstring (optional): the session to continue
connectedserver -> client: connection initiatedsessionstring: the id of the session that is currently being used
failedserver -> client: connection failed. Either the version is unsupported, or the requested session no longer exists.versionnumber: the version that the server speaks
badLlamaserver -> client: the client has misbehaved and is being kickedreasonstringinsultstring
poi: information about a POIguidstring: the POI identifierdataobject: the info, including at least:latE6number: latitude * 10^6lngE6number: longitude * 10^6includedboolean: if the POI is part of the gametagstring: a tag for the POI in the game
-
worldStateserver -> client: send events that describe constructing the current world state from the blank state -
startserver -> client: start sending events as they happen -
endserver -> client: stop sending event as they happen -
eventclient -> server: an event occurredtypestring: the event typetimestampnumber: when the event occurredteamstring: which team caused the eventplayerstring (optional): the player who caused the event- various other fields as needed
Events of the following type can be reported:
capturepoi
neutralisepoi
buildpoi
destroypoi
createLinkpoiFrompoiTo
destroyLinkpoiFrompoiTo
createLinkpoiFrompoints
For each of these, poi is an object with either guid (string) or latE6 and lngE6 (numbers).