Pub-sub technologies

From Inforail
Jump to: navigation, search

Keywords

pub-sub, publish-subscribe, MQTT, AMQP, ZeroMQ, messaging patterns

Objective

Explore the publish-subscribe messaging pattern and have fun in the process, by creating a multiplayer computer game.


Generic requirements

  • While previous assignments required the use of low-level socket primitives, you are now encouraged to leverage high-level shortcuts. Instead of dealing with sockets and bytes, express yourself in terms such as publisher, consumer or message.
  • The recommended underlying technology for your game is MQTT or AMQP, though you are free to choose something else if it meets your needs better.
  • The suggested games are defined below, but feel free to invent your own game, as long as the rules are clear and the pub-sub pattern is present.

Documentation

The game must be defined through a formal specification. Use diagrams to illustrate the flow of the messages, the topology of your nodes, etc.


Team work

You can work in teams, if:

  • everybody writes their own implementation of a client in a different language
  • you cover multiple platforms (desktops, web-browsers, Android and iOS)

Game rules

Mentalink

This game is supposed to verify the statement two people look at the same thing but see different things. It does so in way that is similar to the Dixit board game.

Preparation

  • A set of images is required, they will be distributed to the players during the game
  • The images can be of any type, but it is recommended for them to contain a single object, or otherwise be describable by one or two words.

Gameplay

  • At least 2 players are required
  • An image is randomly selected and sent to every participating player
  • The image is displayed on the screen of each player
  • A countdown of N seconds starts, during which
    • Every player can type and send (asynchronously) words that define what they see
    • When there is a match
      • the remaining time is the number of points earned
      • a new image is sent to the players
      • the countdown is reset

The game is over when the players fail to produce a match in the allocated time. The total score is the sum of accumulated points throughout the rounds.

Rule variations

  • Allow partial matches, i.e. give fewer points if only X out of Y players made a match
  • Bonus for mega-matches, i.e. give extra points everyone produced a matching word
  • Bonus points for producing a match with fewer guess-words



Netcontact

This is a computer implementation of the word-game Contact.

  • The game requires at least 3 players
  • The game-master chooses secret a word and provides it to the server
  • When the game starts, the first letter of the word is shown to every player
  • During the game:
    • Any player can submit a definition any time (i.e. asynchronously)
    • Another player can send the contact signal to indicate they think they know what the definition stands for.
    • A 5-second countdown is initiated, during which:
      • both players have to type their word and submit it to the server
      • the game master can type as many words as they want, attempting to guess what the others thought of
    • If any of the game master's guesses was right, there was no "contact" and the game moves on
    • Otherwise, if the game master did not guess correctly and if the other players did establish contact, the next letter of the secret word is revealed.

The game ends when the word is revealed entirely.


Remarks

  • Fast typing might produce typos, thus it is recommended to tolerate minor differences in submitted words; make the comparison case-insensitive, accept a Hamming distance of 1, etc.
  • The game master can optionally reveal the next letter without a "contact", to ensure there will be no deadlocks caused by complicated words or incompetent players.


CUC

This is an adaptation of Что? Где? Когда?, with potential applications in the Moldovan CUC championship. This is technically a game aid, rather than a game on its won, the purpose of this tool is to ease the distribution of questions and accompanying materials.

Preparation

  • The game master produces a set of questions, that may be accompanied by graphical material
  • Form the teams
    • a team can have up to 6 people
    • each team chooses a captain
    • each team has a unique name

Gameplay

  • The game master publishes a question, every player receives it.
  • The question and the optional graphical material, must be displayed on the client.
  • A timer starts counting down 60 seconds
  • The team discusses the question and tries to figure out what the answer is
  • The captain types a response and sends it to the server
    • Responses received after the 60 second limit are labeled as overdue
  • The game master receives the submitted answers
    • they're displayed in tabular form: team name, time of arrival, answer


There is no automated process of accepting or rejecting answers, this is left as an exercise for the game master.


Recommendations

  • Kivy is a framework that enables you to create a cross-platform GUI (Linux, Windows, OSX, Android, iOS)
  • When creating a web-based client of your game, consider:
  • WebSTOMP gives you AMQP over websockets


References