Skip to content

This is the web-based red-green game, which is a multiplayer online version of a game normally played during the closing session of Embedded Linux Conference. In the physical game, audience members hold up red and green colored cards to indicate answers to trivia questions. This simulates that for remote/virtual conference sessions.

License

Notifications You must be signed in to change notification settings

tbird20d/red-green

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Quickstart

To start a new game, you can just access the cgi script (rg.cgi) and click 'reset', then click 'really reset!!'

See "how to test" below, for different methods of running a standalone local instance of a server that can serve the script.

Running under another web server

To run on a machine with an existing web server, put rg.cgi into /usr/lib/cgi-bin, and change the data path to where you put the trivia.py and rps.py files. The data path must be read/writable by the cgi script (which means the web server).

Then point your browser at: https://server.address/cgi-bin/rg.cgi for the CGI version of the script, or use: https://server.address/rg for the WSGI verison of the script

Running with local web server

To run on a machine without a web server, run ./start-cgi-server.

Then point your browser at: https://localhost:8000/rg.cgi

To log in as admin, use this url: https://localhost:8000/rg.cgi?user_id=admin_game_admin

Running with apache2

I added the following line to /etc/apache2/conf-available/wsgi.conf

WSGIScriptAlias /rg /usr/lib/cgi-bin/rg.cgi

Executing the game

pre-game

  • Remove user registration files in the rgdata directory
  • Remove winner files in the rgdata directory
  • Remove leftover answer, rps, and still-in data

('make clean' will do all this)

Operating the game

On the admin screen, you will see a menu showing controls for the game.

there are 4 main phases:

  • registration
  • trivia
  • rock-paper-scissors
  • end

The game progresses in 2 sets of rounds, for two different games: 1 Red-green trivia game 2 rock-paper-scissors game

Every operation performed (link clicked, or data entry submitted) changes the game's data file. If you click on the wrong thing, or enter the wrong data, you can click 'undo' to revert to a previous game state.

Announcement and introductory documentation

July 14, 2020:

Sorry, but there is very little documentation for the game. However, there is this README.md file with some of the game setup, and hopefully when you log in to the game as administrator (which is described in the README file) it is not too hard to figure out how the moderator drives the game. The administrator has extra game controls that are not visible to the game players.

The main script of the game is 'rg.cgi', and it can be run as either a CGI script or a WSGI program.

The presence or absence of a file: rgdata/suppress_refresh controls whether the client browsers automatically refresh pages as the game progresses. If the file is present, users must be instructed to move to the next page by clicking on a link. If the file is absent (the default), then when the administrator changes the game state, client browsers will automatically refresh and load the next item in the game sequence.

Sample trivia data for the game is in rgdata/trivia.py, and the format is fairly self-explanatory (but there are some comments in that file that describe the data format.) The trivia data used for the ELC 2020 closing session is in the file trivia-2020-elc.py. To use those trivia questions, you would copy that file into rgdata/trivia.py and reset the game using the administrator interface.

As a note, the game was written quite hastily, so it should not be used as an example of my best code. ;-) Also, a number of odd choices were made in terms of data storage, in order to allow the game to scale. It does not use a database, but rather simple text files for the game and user data. The game does seem to function as intended for a multiplayer game.

Status of standalone play

After the ELC 2020 closing session, I received a few requests to play the trivia as a standalone game (not moderated or controlled by an admin). I started work on this, but didn't have time to finish it. This is described in the source as SINGLE mode, which is an alternative to the regular "group" mode used for multiplayer play. It almost works, but has a few bugs that need to be worked out. However, I didn't want to wait longer to publish the source. The single-player mode is still a work-in-progress.

In the standalone mode, the pages have timeout counters on them, that will force the user forward through the trivia questions. This will prevent someone from using an arbitrary (long) amount of time to research answers. Since there's no score, I'm not sure what the point of this would be (but I might add a score for this mode later).

How to test (on specific machines)

There are notes for Tim's development machines.

desktop machine local work

personal server work

closinggame.net work

linux laptop work

About

This is the web-based red-green game, which is a multiplayer online version of a game normally played during the closing session of Embedded Linux Conference. In the physical game, audience members hold up red and green colored cards to indicate answers to trivia questions. This simulates that for remote/virtual conference sessions.

Resources

License

Stars

Watchers

Forks

Packages

No packages published