Skip to content

Creating a new Scenario

MFHolm edited this page Jan 30, 2018 · 8 revisions

The scenario defines what indicators, decisions and roles are in the game. Furthermore the scenario defines the start year, the number of steps in each iteration (this is however not used at the moment), the duration of the simulation, the delay of each step and the game logic used in the simulation. The code below shows the default scenario.

function makeScenario(): Scenario {
    var ret: Scenario;
    var dec1: Decision = new Decision("SubEast", "Heating subsidies", 0, 0, 100, "E", 'Dec1 describe');
    var dec2: Decision = new Decision("ResEast", "Renewable investments", 0, 0, 100, "F", 'Dec2 describe');
    var dec3: Decision = new Decision("SubWest", "Heating subsidies", 0, 0, 100, "E", 'Dec1 describe');
    var dec4: Decision = new Decision("ResWest", "Renewable investments", 0, 0, 100, "F", 'Dec2 describe');

    var ind1: Indicator = new Indicator("CO<sub>2</sub>", 'CO2Emission', 't/person', 7.56, 2, 'Click to see the CO2 emissions (in annual tonnes per person) in the countries', 2);
    var ind2: Indicator = new Indicator("Comfort", 'comfort', "scale (0-100)", 12, 0, 'Descrip Comfort',2);
    var ind3: Indicator = new Indicator("Air Temperature", 'airtemperature', ' &#x2103;', 13, 0, 'Air Temperature description',2);
    var ind4: Indicator = new Indicator("GDP", 'gdp', "USD/person", 14, 0, 'Describe GDP', 2);
    var ind5: Indicator = new Indicator("CO<sub>2</sub>", 'CO2Emission', 't/person', 7.56, 2, 'Click to see the CO2 emissions (in annual tonnes per person) in the countries', 21);
    var ind6: Indicator = new Indicator("Comfort", 'comfort', "scale (0-100)", 12, 0, 'Descrip Comfort', 21);
    var ind7: Indicator = new Indicator("Air Temperature", 'airtemperature', ' &#x2103;', 13, 0, 'Air Temperature description', 21);
    var ind8: Indicator = new Indicator("GDP", 'gdp', "USD/person", 14, 0, 'Describe GDP', 21);

    var role1: Role = new Role("East", [dec1, dec2], [ind2, ind3, ind4], 'AA3939');
    var role2: Role = new Role("West", [dec3, dec4], [ind5, ind7, ind8], 'AA6C39');
    var role3: Role = new Role("Observer", [], [ind1, ind2, ind3, ind4], '226666');

    var ret: Scenario = new Scenario([role1, role2, role3], 2017, 1, 396, 2500, new GameLogic(2), "Scenario 2p","scenario2");
    return ret;
}

var scenario = makeScenario();

The decisions and indicators are defined as variables that are passed along to the roles in lists. The roles are then passed along to the scenario constructor. The arguments of the constructor of scenario are shown below.

constructor(p_roles: Role[], p_start, p_step, p_duration, p_delay, p_gameLogic, p_name: string, p_id: string)

This means that in the default scenario the roles are role1, role2 and role3 as defined above, the start year is 2017, number of steps in each iteration is one, the duration is 396 months which is 33 years, the delay of each step is 2500 ms, the game logic is the one specified in mainGameLogic.ts, the name is "Scenario 2p", and the id is "scenario2".

A new scenario can be created by following this same structure. New indicators, decisions and roles can be introduced as described in the previous pages in this wiki. However it is important that a role called "Observer" is present, as this is used as a default role. Start year, duration and delay can be whatever you want. As mentioned, step is not used at the moment.