Developers - cgloeckner/pyvtt GitHub Wiki

Developers Documentation

You are here to understand implementation details in order to improve or modify.

Software in Use

This software written in Python3 (mainly with 3.8.5) and is designed to be run on Linux-based system (main target is Linux Ubuntu, mostly developed and tested on Ubuntu 20.04 LTS). It serves as a HTTP(S) WSGI-based webserver using bottle and gevent. The database is driven by pony and several SQLite databases.

Software Architecture

The VTT is driven by an instance of the Engine class, which holds various subsystems:

  • Logging API based on python's logging module
  • Paths API for abstracting all paths referring to the local harddrive
  • an API for creating "fancy" (random) URLs
  • Settings API for loading JSON-based VTT-configurations
  • Patreon-Auth-API based on Patreon's OAuth API
  • E-Mail-Notification for unhandled exceptions based on python's smtplib module

The Web-Client is created using bottle's template API and jQuery. The most in-game-operations (such as moving tokens arond) are done via WebSockets, other tasks are mostly performed using Ajax requests.

Each game client holds its WebSocket until the game session is quit, so each of those sockets is handled by a Greenlet (see python's gevent module).

Database Design

There is a main database holding all GMs. Each GM also has his own database with all of his games, their scenes and existing tokens. Furthermore there is a directory dedicated for each GM with all the image data. So games are uniquely identified by a pair of GM- and Game-URL.

Developers Login

Inside the settings.json, make sure to set "type": "" within the login-section to enable the non-register-just-login-mode. You can quickly generate a new GM without relying on Patreon Auth.

Note: The GM's session id is stored on the browser's cache. Once it is reset, you cannot re-access your GM account (but you can query the session id form the SQLite database using e.g. sqlitebrowser or similar tools).