zxc23 / dcss-scoreboard

A bundle of scripts to create a scoreboard website for the roguelike game Dungeon Crawl Stone Soup..
9 stars 5 forks source link

DCSS Scoreboard

Tool to create a scoreboard for online DCSS games.

Code Climate Build Status

Why make another scoreboard?

High-level program flow

  1. loader.py: CLI entrypoint
    1. sources.py: download logfiles in parallel using wget --continue
    2. log_import.py: load each game (eg each line) from logfiles into the database
    3. scoring.py: score each unscored game:
    4. Handle streaks
    5. write_website.py: create the website directory
    6. Write all global pages (index, highscores, streaks)
    7. Write pages for players with newly scored games

How to use

Python 3.5+ is required. Install pre-requisites with pip install -r requirements.txt. If you want to use Postgres as your database server, also install the psycopg2 pip module (which requires libpq-dev on Ubuntu).

To use the code, run loader.py --help.

Windows users

  1. First, get Vagrant at https://www.vagrantup.com/ and install it.
  2. Install the vbguest plugin with vagrant plugin install vagrant-vbguest.
  3. Open in the git folder in cmd which should contain 'Vagrantfile', and run vagrant up. This will set up an Ubuntu VM and might take a while.
  4. Once the setup is complete, you should be able to visit http://localhost:8080/ in a web browser and see your development website!
  5. To update your development scoreboard, you can SSH into the machine with vagrant ssh and run ./update-scoreboard.sh.
  6. Ctrl-D will exit out of the VM's terminal. vagrant halt will shut down the VM when you're done. vagrant up will start it up again when you need it, and vagrant destroy will remove the VM entirely.

Alternatively, specify port 8000 when writing the website, cd /vagrant and python server.py & to start serving the website at http://localhost:8000/.

Postgresql Management

To create a user and database in Postgres, try the following commands:

sudo -u postgres createuser -D -A -P scoreboard
sudo -u postgres createdb -O scoreboard scoreboard

Development

You can see development status here: https://trello.com/b/9Nija4jC/dcss-scoreboard.