Skip to content

Documentation

qBla edited this page Mar 26, 2024 · 2 revisions


Rules And Mechanics

Gameplay

The game starts with everyone being at home. Every player is initialized with a certain amount of MU, HP, a Learning Speed and an infection status. Initially their ED is 1. They can now visit the other stations with the restriction that they have to choose between the office and the school every round and can visit one of them only once per round. After each round the players lose 10 HP and if they are infected with a virus another 10 HP. Additionally, if they encountered an infected person in one of the stations, there is a chance that they become infected. Every round consists of two phases: The daylight phase, during which they can go to the office, school, town hall, and mall, and the evening phase, in which they have to choose between visiting the lounge, home, and the town hall if there is a town hall meeting.

The duration of the Day Phase can be customized before starting the game and has the same duration throughout each round. The Night Phase has no set duration and can only be ended by the host.

Players

Players have the following six attributes:

Attribute Setup Notes
Money Units (MU) Random value between 40 and 15 (normal distribution) Player wealth, can be increased through working (int)
Health Points (HP) Random value between 40 and 15 (normal distribution) Represents player health and reflects cost of living (int)
Infection Status Random (Bernoulli) Player virus infection state (boolean)
Learning Speed (LS) Random integer between 50 and 15 divided by 100 (normal distribution) Determines how much education level increases on learning (double)
Stress Level (SL) 0 Adds an additional penalty on health point loss, increases through working and learning (int)
Education Level (EL) 1 Affects the income (int)

Actions

Players can take the following logged actions within the various stations:

Action Location Phase Cost (MU) Effect
Create Petition Town Hall Evening - Making a petition available for voting
Vote on Petition Town Hall Day - Decision comes into effect or not
Close Petition Town Hall Evening - Close a petition therefore deciding if it will take effect (Automatically matches all yes and no votes)
List all open petitions Town Hall Day / Evening - Display all currently open petitions
Delete petition Town Hall Evening - Deletes a petition opened by this player
Buy Health Points Mall Day 10 Increases health points (health gain is decreased for every prior usage)
Buy Disinfectant Mall Day 10 Grants immunity to infection for the round
Buy Health Check Mall Day 15 Grants details on health status, including stress level, infection status and health points
Gift to other Player Mall Day Custom Transfers Money Units to another player as a gift
Invest in stocks Mall Day Custom Grants a dividend (15%) in money units, boosts the economy
Invest in Vaccination Fund Mall Day Custom Increases the chance to find a vaccine
Work Office Day - Increases the money units (2 * office factor which is initially 5 * education level) and stress level
Learn School Day 10 Increases the education (Change equals the learning speed of the player) and stress level (By 4)
Relax Lounge Evening 5 Decreases the stress level
Buy Care Package Hospital On Entry 20 Reduces the hospital stay to one day
The following Actions are listed for a complete list only as they happen implicitly
Visit Mall Day - Enter the building if possible
Exit Mall Evening - Leave the building if possible
Visit Town Hall Day / Evening - Enter the building if possible
Exit Town Hall Day - Leave the building if possible
Visit Market Square Day / Evening - Enter the building if possible
Exit Market Square Day / Evening - Leave the building if possible
Visit Home Day / Evening - Enter the building if possible
Exit Home Day / Evening - Leave the building if possible
Visit Office Day - Enter the building if possible
Exit Office Day - Leave the building if possible
Visit School Day - Enter the building if possible
Exit School Day - Leave the building if possible
Visit Lounge Evening - Enter the building if possible
Exit Lounge Evening - Leave the building if possible

Note: Work and Learn are exclusive from one another. Only one of these actions can be performed in a round and not more than once. Meaning a player has to choose if they want to learn or work.

Stations

  • There are eight stations that players can or must visit:
  • The mall (supermarket, bank, pharmacy), where players can purchase goods and services that they require or are helpful for the game.
  • The office, where players can earn money.
  • The lounge, where players can reduce their stress level.
  • The school, where players can learn and raise their education.
  • Home, where players can be in quarantine and gain information about the gameplay.
  • The town hall, where they can decide on changes that affect the gameplay
  • The hospital, where people are staying that run out of HP
  • Market Square that acts as a social infoboard

Mall

Accessibility Actions
Day Phase Buy HP, Buy Disinfectant, Buy Health Check, Gift, Invest in Stocks, Invest in Vaccination Fund

The mall aggregates in-game actions that are associated with a bank (money investment and transfer), a grocery store (buy HP) and a pharmacy (buy disinfectant and health checks). In the mall players can purchase the following goods and services with their associated effects:

  • Health points: Players can purchase HP for 10 MU. The first purchase gives them 10 HP, the second 5HP, the third 2.5 HP, etc.
  • A disinfectant: The disinfectant reduces the likelihood of being infected for its buyer. It does not protect other players from infection. For a player with Corona the disinfectant is therefore useless. The initial price is 10 MU.
  • A health check that gives players information about their SL, HP and IS. This costs 20 MU.
  • The vaccine fund: With increasing investment, the likelihood of a Corona vaccine being developed increases. The likelihood is initially set to (gross vaccine fund/10,000)^2, so that it is rather unlikely the vaccine is developed in early rounds.
  • The stock fund: Players can purchase stocks and get every round 15% dividend for it. Additionally, every round the office factor increases by (gross stock investment/400), which means that for every 400 MU of stocks the factor increases by 1 every round. Send money to other players

Office

Accessibility Actions
Day Phase Work

Each day phase, players can either work at the office to gain money based on their education level or go to school to increase their education level. By registering in the office, players get an amount of money that equals (2 x ED x Office factor) MU. However, it increases their SL by 1.

School

Accessibility Actions
Day Phase Learn

If players want to invest in better future income, they can increase their education level once per day by learning in school. By registering in the school, players can increase their ED in the height of their LS. However, it increases their SL by 4.

Lounge

Accessibility Actions
Night Phase Relax

The lounge can be accessed day and night. It serves as a social hub in the evening phases if no petitions need to be created or discussed. Furthermore, the "relax" action can be used to reduce one’s stress level. The lounge is one of two meeting places. Every stay in the lounge reduces their SL by 6 and .

Town Hall

Accessibility Actions
Day Phase, Night Phase Create Petition, Vote on Petitions, Delete Petition, List all open Petitions

The town hall is the space for social participation. Game rule changes can be discussed, formulated as a petition through specific UI, and then opened for voting. Votes can then be placed starting from the next day phase.

Hospital

Accessibility Actions
Only and automatically on 0 HP Buy Care Package

The hospital is a special building that can only be entered when a player’s HP reaches zero. They then spend two rounds (day/night phases) in the hospital until they are recovered. They can purchase the care package in the hospital for 10 MU, such that their hospital stay is reduced to one round. In the case the health insurance exists this is automatically purchased.

Home

Accessibility Actions
Day Phase

Each round, all players spawn at home. Home offers access to a manual on game rules and the buildings/stations through an integrated web browser. Home can also be used for isolation to prevent the spreading of the virus.

Market Square

Accessibility Actions
Day Phase, Night Phase

The market square acts as a social hub during the day and provides information on the in-game economy and infection numbers through graphs that are displayed through an in-game browser

Scales

Furthermore, there are a couple of scales that influence the gameplay (These values can be adjusted in the "scales_raw" xml-file:

Scales Initial Value
cost disinfectant 10
cost hp 10
cost health check 15
office factor 5
cost school 10
infection probability 5
HP loss every round 5
stock dividend (%) 15
growth per stock (inverse) 400
income tax level 0
property tax level 0
health insurance 0
school cost free 0
lockdown 0
minimum wage 0
disappropriation 0
social safety 0
hp loss due to covid 10
cost lounge 5
cost care package 20

Infection

Initially every player is set with an infection status. This infection status can change by five mechanisms:

Mechanic Outcome
An infected player can get into quarantine, which means staying in the home station for the entire round. In this case their infection status is set to not infected. Cure
A player that is not infected can become infected by being in the same station with someone that is infected without using disinfectant. The mechanism is implemented such that if an infected player is at a station the likelihood of each player that visited the station after him is reduced by a constant factor that is currently set to 5. This means the player immediately after an infected player has a 20% chance of being infected, the next player a 4% chance, and so on. However, this likelihood is cumulative. If a player visited one station as the third person behind an infected person and as the first person behind another infected player, and another station as the second person behind an infected player, their total infection probability is 0.8% + 20% + 4% = 24.8%. Infection
After a hospital stay players are automatically not infected Cure
The vaccine cures all players. Cure
There is a 10% chance for every player to spontaneously get infected after every round, if otherwise no one is infected anymore. This is only prevented if the vaccine is available. This means that the only way to end the pandemic is for the vaccine to be available. All players staying at home is not a possible strategy to end the effects of Corona. Infection

Petitions And Votes

Petitions

The petition mechanism consists of a series of steps

  1. Create a petition
  2. Open a petition
  3. Vote on a petition
  4. Close petition

The steps 1, 2 and 4 happen during the night phase in the town hall. Step 3 is available during the day phase in the town hall.

Step 1 – Create a petition The vote database distinguishes between two kinds of petitions: templates and customized or user created petitions. By sending the actioncode votetemp a list of all templates for petitions is received. These contain a text, a scale and a valuetype information. Each petition changes one of the fundamental game scales in the scales database. The scale sent by the actioncode is the one that the petition changes. These scales are either integers (tax rates e.g.) or booleans (lockdown e.g.), therefore the backend sends this information as well. In the townhall players should be able to select a template and set a value. Once they have done this, they can send such a customized petition back to the backend and by this register the petition. This is done via the votedev actioncode that requires a JSON array. This array should contain [text, scale, value]. The actioncode returns a unique ID for the petition. In case of a mistake, the petition can be deleted with the actioncode delvote that requires the ID of the petition.

Step 2 – Open the petition With the actioncode openvote a petition is marked as open. Unless it is opened players cannot vote on it. The actioncode requires the ID of the petition.

Step 3 – Vote on the petition During the day phases every player should be able to vote on the petitions that are currently open for him. The actioncode listopenvote gives a list of all open petitions and requires a player-ID. It then gives a list of open petitions that the player with the given ID has not voted on. This means that giving an ID to the backend that no player has will give all open petitions. The actioncode returns a JSON array with the ID and the text of all open petitions for the given player. A player can vote on all these petitions and select either their approval or disapproval (e.g. by selecting “yes” or “no”). With the actioncode vote this is sent to the backend. This actioncode requires three values: player-ID, petition-ID and a string “yes” or “no”.

Step 4 – Close the petition During a town hall meeting in the night phase open petitions can be closed by sending the actioncode closevote that requires the voteid. This actioncode automatically counts the votes and implements the result.

Votes

During a town hall meeting the present players can design a petition. These petition follow one of eight basic patterns:

Petition Pattern Petition Effect
Free school -
Lockdown lounge is closed
Change the income tax rate Changes the income tax rate
Change the property tax rate Changes the property tax rate
Change minimum wage The minimum wage is set to (2*OfficeFactor + x) MU. This however sets the maximum wage to (2 * OfficeFactor * HighestED - x) MU.
Disappropriate the wealthy Every player is disappropriated of every MU more than x they have at the end of every round.
Introduce health insurance The care package is automatically purchased and paid by the tax fund.
Introduce social safety Players that have a negative amount of MU at the end of a round are automatically set to 10 MU. This is paid from the tax fund.

Note: Social safety, School tuition, and health insurance are paid from the tax fund. The tax fund is filled by the income and property tax. If after a round there are not enough taxes collected the deficit is divided among all players.

Backend

Setup

Once the server is running copy the url of the ACHandler into the script BackendConnection as the private const string Url.

Example: public const string Url = "..../ACHandler.php";

XML-Files

scales_raw

This file holds all values of the scales within its items. Values are ordered as follows:

Scales
cost disinfectant
cost hp
cost health check
office factor
cost school
infection probability
HP loss every round
stock dividend (%)
growth per stock (inverse)
income tax level
property tax level
health insurance
school cost free
lockdown
minimum wage
disappropriation
social safety
hp loss due to covid
cost lounge
cost care package

Tables

The following tables proved most valuable for further research on the game. They track voice activity, petitions and their outcomes, changes on the scales and player stats.

instance

Example Entry: [{"name":"ExampleInstance", "current_round":8, "status":"active", "for_testing":0, "created_at":"2022-09-20 16:22:34.436071", "updated_at":"2022-09-23 17:50:44.702814"}]

Item Meaning
name Name of the instance
current_round The current round of the instance
status States if the instance is still in an active state
for_testing -
created_at Time of creation of the instance
updated_at Last update (e.g. round change)

game_data

Example Entry: {"instance_name":"ExampleInstance", "title":"vaccinationFund", "value":"100", "round":8, "reason":"player #22 invested 4 MU", "created_at":"2022-08-20 17:27:20.056002"}

Item Meaning
instance_name Name of the instance
title States the affected game data like vaccination fund, taxAmount, infection states, stock funds
value The value of the game data
round The current round associated with the change
reason Event that triggered the current change
created_at Time at which the event took place

player_data

Example: {"player_plays_on_instance_id":20, "title":"healthPoints", "value":"42", "round":5, "reason":"new round", "created_at":"2022-08-20 15:44:51.512356"}

Item Meaning
player_plays_on_instance_id References the player
title Defines the affected player stat
value The value of the player state
round The current round of the instance
reason “new round” references the value at the change to a new day / Other reasons can be events like registered player, learned or worked for …. money units
created_at The time at which the event took place

petition

Example Entry: {"id":20, "current_value":0, "proposed_value":10, "status":"closed", "petition_template_id":4, "instance_name":"ExampleInstance", "created_at":"2022-08-20 16:56:44.977793", "updated_at":"2022-08-20 17:02:47.188235"}

petition_template_id Meaning
1 school Cost Free
2 lockdown
3 income Tax Level
4 property Tax Level
5 minimum Wage
6 disappropriation
7 health Insurance
8 social Safety
9 stock Income Tax Exempt
10 tax Revenue For Vaccine
11 happier Players
12 town Hall Allowance

action_log

Example Entry: {"id":90, "player_plays_on_instance_id":17, "round":1, "action":"exited", "additional_data":"office", "created_at":"2022-08-20 15:24:05.708799"}

scale_value

Example Entry: {"instance_name":"ExampleInstance", "scale_title":"healthInsurance", "value":"true", "round":4, "reason":"closed petition #8", "created_at":"2022-08-20 15:49:14.487473"}

voice_activity

Example Entry: {"id":4200, "player_plays_on_instance_id":22, "round":1, "building":"city", "start":"2022-09-20 16:25:42.561185", "end":"2022-09-20 16:25:44.072818", "created_at":"2022-09-20 16:24:44.613187", "is_creative":1}

Note: During gameplay sessions a host can flag players as non creative if they tend to talk about non game related topics. This helps to later filter out those fragments.

vote

Example Entry: {"player_plays_on_instance_id":24, "petition_id":6, "is_positive":1, "created_at":"2022-08-20 15:22:46.758234"}

Further Requirements

Photon PUN

PUN Version: 2.40 Photon lib: 4.1.6.11

We used Photon PUN as our multiplayer network solution. In order to use the project in its provided form, please install Photon PUN. Furthermore PUN App Ids are required. Enter these Ids under "Assets/Photon/PhotonUnityNetworking/Resources/PhotonServerSettings.asset" in the input fields "App Id PUN" and "App Id Voice".

TextMeshPro

Please install all TextMeshPro sample assets directly in Unity.

URP

We used the URP from Unity for the project.