Skip to content
shmvonPublic

About

Bargaining Simulation Tool (BFORE): collective bargaining simulation, translatable

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Bargaining Simulation Tool (BFORE)

A web-based serious game about collective bargaining and inequality at company level, developed within the EU-funded research project Bargaining For Equality (BFORE, HIVA – KU Leuven).

Live at sim.bfore.be.

The game

The player is the workers' representative at Li-Ion, a fictitious battery maker with 194 employees. Over 5–10 bargaining rounds the player:

  1. reads the social dashboard: nominal wage, purchasing power, hirings/layoffs, and the gender, age and ethnic pay gaps, wage inequality, pay differentials and the union premium;
  2. makes a wage claim, in view of the company's gains and inflation. Claiming more than the gains costs temporary jobs; claiming less creates jobs;
  3. chooses a method: a percentage increase, a flat (absolute) increase, or a one-off bonus;
  4. sets promotions, which give chosen groups (by gender, age, origin, pay level, job category, union membership) a larger share of the increase.

There is no preset target: success depends on the player's own view of fairness. The game ends with a comparison against the starting situation and a short questionnaire. Anonymous results are collected for research.

The model (wage equation, gap measures, increase rules) is described in docs/WORKPLAN.md.

Languages

The site is available in 25 languages, covering the national languages of all EU countries plus the UK, Norway, Iceland and Switzerland. Players first choose a country, which sets the currency and the languages offered; English is always available. The choice is remembered for the next visit.

All texts live in Excel files in translations/, so translators and policymakers can edit them without touching code. Most translations are drafts awaiting native-speaker review. The page /translations on the site lists every file with its quality level, review progress and a download link.

File Contents
translations/en.xlsx English master texts (add new texts here)
translations/xx.xlsx One file per language. Sheets: Read me, Texts (English / Translation / Notes / Status), Format (number and currency style, quality level), Glossary
translations/countries.xlsx Countries: languages offered, currency, exchange rate to EUR, wage slider
python3 i18n_tools.py check      # missing translations, broken {placeholders}
python3 i18n_tools.py sync       # after adding texts to en.xlsx: copy new keys to all languages
python3 i18n_tools.py new xx     # start a new language file

Changed Excel files are picked up by the running site within seconds; no restart is needed.

Running locally

Requires Python 3.9+.

pip install -r requirements.txt
cp .env.example .env             # then set DOWNLOAD_CODE in .env
python app.py

Open http://localhost:8500.

Configuration

Settings come from environment variables. Locally they can also come from a .env file, which is never committed.

Variable Default Meaning
DOWNLOAD_CODE (empty) Code for downloading the collected data at /download. If it is not set, downloading is switched off
DATA_DIR local: data/ next to app.py; container: /app/data Folder for all runtime data (see below)
SECRET_KEY generated once into DATA_DIR/.secret_key Key that signs the players' sessions
PORT 8500 Port for python app.py (the Docker image uses 5000)

Data

Code and data are kept apart. The image contains only code and texts; all runtime data lives in DATA_DIR:

File Contents
fdb.db Collected results of all finished games (rounds, questionnaire, country, language)
prefs.db Last chosen country and language per visitor
<id>-user.db One game in progress; removed after 3 hours
.secret_key Session key, so games survive a restart

Nothing has to be seeded: the workforce and all game data are generated by the code, and the files above are created on first use. A new, empty data folder or volume is a clean start.

To restart from a download, put the downloaded fdb.db (and optionally prefs.db) in seeds/. At startup, a seed file is copied into the data folder only if that file is not there yet, so existing data is never overwritten. Seed files are kept out of git but are included in the Docker image, so they also fill an empty volume on the server.

  • Locally the data goes to data/ in the project folder. Delete its contents for a fresh start.
  • In the container it goes to /app/data, where the persistent volume is mounted. Local data never reaches the image (.dockerignore) or git (.gitignore).

Deployment

The Dockerfile builds the image used on the CaaS host (port 5000). Build it for the server's processor, also on an Apple Silicon Mac:

docker build --platform linux/amd64 -t <registry>/<path>/bfore-sim:latest .
docker push <registry>/<path>/bfore-sim:latest

On the CaaS host:

  • Map the persistent volume to /app/data in the container. It may start empty. Without a volume, results are lost on each redeploy.
  • Set DOWNLOAD_CODE as an environment variable of the container (not in the Dockerfile, which is public).
  • The server log shows the data folder in use, whether it is writable, whether fdb.db exists yet, and whether a download code is set.

Project structure

Path Purpose
app.py Creates the Flask app, starts the cleanup thread
website.py Routes and the simulation model
i18n.py Translations, country/language switch, number and currency formatting, /translations page
i18n_tools.py Command-line maintenance of the translation files
config.py Settings (DATA_DIR, DOWNLOAD_CODE, PORT)
cleanup.py Removes unfinished player databases after 3 hours
templates/ Jinja templates; base.html, _dashboard.html and _locale.html are shared
static/ CSS, scripts, logos
docs/ Work plan, suggested improvements, plan for an offline LLM-persona experiment

Data and privacy

Each game uses its own small SQLite database. When a player submits the questionnaire, their rounds and answers are added to DATA_DIR/fdb.db, together with the country and language used. No names or contact details are collected. Data files are excluded from git and from the Docker image. Do not commit them.

Documentation

Licence

Copyright © 2026 Sem Vandekerckhove and Karolien Lenaerts (HIVA – KU Leuven).

This tool was built with public research funding, so anyone may use, adapt and translate it. To keep it that way, it is released under the GNU Affero General Public License v3.0 or later (LICENSE). This covers the code and also the texts, translations and game model in this repository. In short:

  • you may use, copy, change and redistribute it, also commercially;
  • if you distribute a changed version, or run one as a website, you must publish its full source code under the same licence and keep the copyright notices;
  • there is no warranty.

Improvements are welcome back in this repository, as an issue or a pull request, so every user benefits. We are also glad to hear where the tool is used.

How to cite

Please cite the tool when you use it or data collected with it:

Vandekerckhove, S., & Lenaerts, K. (2026). Bargaining Simulation Tool (BFORE) [Computer software]. HIVA – KU Leuven. https://github.com/shmvon/bfore-sim

The citation details are in CITATION.cff; GitHub's Cite this repository button gives the same reference in APA and BibTeX.


Funded by the European Union. Views and opinions expressed are those of the authors only and do not necessarily reflect those of the European Union.

About

Bargaining Simulation Tool (BFORE): collective bargaining simulation, translatable

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages