Skip to content

Commit

Permalink
feat: add treatment specific splash screen instructions
Browse files Browse the repository at this point in the history
this requires rolling the treatment when the participant is created
instead of when a game is built

* swapped out two resource-affecting event cards to avoid conflict
* squashed migrations
  • Loading branch information
sgfost committed Oct 14, 2024
1 parent 7e002a4 commit ab59f6e
Show file tree
Hide file tree
Showing 15 changed files with 218 additions and 160 deletions.
69 changes: 20 additions & 49 deletions client/src/components/sologame/Splash.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,42 +2,26 @@
<div class="d-flex flex-column justify-content-center align-items-center p-3 h-100 solo-game">
<b-row class="mb-5">
<b-col md class="px-5 d-flex flex-column justify-content-between">
<span class="text-center">
<h4 v-if="isFreeplay">Port of Mars: Solo Mode</h4>
<h4 v-else-if="isProlificBaseline">Game 1</h4>
<h4 v-else-if="isProlificVariable">Game 2</h4>
<span v-if="instructions" v-html="instructions"> </span>
<span v-else>
<h4>Port of Mars: Solo Mode</h4>
<p>
In this Port of Mars solo game you must balance investing resources for yourself versus
investing in the maintenance of your habitat's life support systems, called
<b>System Health</b>. There'll be a limited number of rounds where you can invest your
time in System Health or keep them for yourself to earn Points.
</p>
<p>
Whatever you don't invest in System Health will be converted to Points and added to your
Total Points. In other words, the more you invest in System Health, the less Points you
will earn, and vice versa. If System Health drops to 0, your life support systems will
fail and the game will end.
</p>
<p>
On each round after the first round, random event cards will be drawn that can have a
variety of effects on the game.
</p>
</span>
<p v-if="isFreeplay">
In this Port of Mars solo game you must balance investing resources for yourself versus
investing in the maintenance of your habitat's life support systems, called
<b>System Health</b>. There'll be a limited number of rounds where you can invest your
time in System Health or keep them for yourself to earn Points.
</p>
<p v-else-if="isProlificBaseline">
In this game you must balance investing resources for yourself versus investing in the
maintenance of a support system, called <b>System Health.</b> There'll be
<b>eight rounds</b> where you can invest your time in System Health or keep them for
yourself to earn Points.
</p>
<p v-else-if="isProlificVariable">
In this game you must also balance investing resources for yourself versus investing in
the maintenance of a support systems, called <b>System Health.</b> There'll be a limited
number of rounds where you can invest your time in System Health or keep them for yourself
to earn Points.
</p>
<p>
Whatever you don't invest in System Health will be converted to Points and added to your
Total Points. In other words, the more you invest in System Health, the less Points you
will earn, and vice versa. If System Health drops to 0, your life support systems will
fail and the game will end.
</p>
<p v-if="isFreeplay || isProlificVariable">
On each round after the first round, random event cards will be drawn that can have a
variety of effects on the game.
</p>
<p v-if="isProlificBaseline || isProlificVariable">
Each Point earned will be 1 cent in the final payment.
</p>
</b-col>
<b-col md class="d-flex flex-column align-items-center px-5">
<h4>Controls</h4>
Expand Down Expand Up @@ -79,7 +63,6 @@

<script lang="ts">
import { Vue, Component, Prop } from "vue-property-decorator";
import { SoloGameType } from "@port-of-mars/shared/sologame";
import SegmentedBar from "@port-of-mars/client/components/sologame/SegmentedBar.vue";
@Component({
Expand All @@ -88,23 +71,11 @@ import SegmentedBar from "@port-of-mars/client/components/sologame/SegmentedBar.
},
})
export default class Splash extends Vue {
@Prop({ default: "freeplay" }) gameType!: SoloGameType;
@Prop({ default: "" }) instructions!: string;
starting = false;
demoValue = 0;
get isFreeplay() {
return this.gameType === "freeplay";
}
get isProlificBaseline() {
return this.gameType === "prolificBaseline";
}
get isProlificVariable() {
return this.gameType === "prolificVariable";
}
begin() {
this.starting = true;
this.$emit("begin");
Expand Down
4 changes: 2 additions & 2 deletions client/src/components/sologame/ThresholdInfo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export default class ThresholdInfo extends Vue {
get twoEventsThresholdInfo(): string {
if (this.state.treatmentParams.thresholdInformation === "known") {
return `at or below ${this.state.twoEventsThreshold}`;
return `below ${this.state.twoEventsThreshold}`;
} else {
const range = this.state.twoEventsThresholdRange!;
return `between ${range.min}-${range.max}`;
Expand All @@ -34,7 +34,7 @@ export default class ThresholdInfo extends Vue {
get threeEventsThresholdInfo(): string {
if (this.state.treatmentParams.thresholdInformation === "known") {
return `at or below ${this.state.threeEventsThreshold}`;
return `below ${this.state.threeEventsThreshold}`;
} else {
const range = this.state.threeEventsThresholdRange!;
return `between ${range.min}-${range.max}`;
Expand Down
1 change: 1 addition & 0 deletions client/src/views/ProlificStudy.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
v-if="!started && !isStudyComplete"
@begin="begin"
:gameType="participantStatus.nextGameType"
:instructions="participantStatus.nextGameInstructions"
/>
<GameOver
v-else-if="isGameOver || isStudyComplete"
Expand Down
59 changes: 58 additions & 1 deletion server/fixtures/SoloGameTreatment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,12 @@ items:
isEventDeckKnown: true
thresholdInformation: known
isLowResSystemHealth: false
instructions: |
<h4>Game 1</h4>
<p>This game consists of a maximum of <strong>eight rounds</strong>. You can earn money by making investment decisions to keep <strong>System Health</strong> above 0. You get each round <strong>ten resource units</strong> which you can invest in System Health or keep them for yourselves. System Health declines each round with 5 units, and if System Health drops to 0, the game ends and you will receive 0 points for the whole game. If after eight rounds System Health is above 0, you receive the total number of points. Each point will be 1 cent in the final payment.</p>
<p>For example, if you invest 6 resource units in System Health, you earn 4 points and System Health increases by 6 units. At the start of the game System Health has 15 units, and the maximum level of System health is 25 units.</p>
<p>You get 15 seconds each round to make a decision using the controls at the right of the screen. When you make an investment decision, you move directly to the next round. If you do not make an investment decision, you do not earn points.</p>
<p>If you are ready, click the start button.</p>
# PROLIFIC VARIABLE TREATMENTS
prolificVariableTreatment1:
id: 14
Expand All @@ -101,38 +107,89 @@ items:
isEventDeckKnown: true
thresholdInformation: known
isLowResSystemHealth: false
instructions: |
<h4>Game 2</h4>
<p>This game is an extension of game 1. Like game 1 you get 10 resource units each round which you can invest in System Health or keep them for yourselves. Again System Health declines each round with 5 units, and if System Health drops to 0, it is game over and you will not receive any points and thus not any earnings.</p>
<p>What is <i>different</i> in game 2 is the following:</p>
<p>In this game the maximum number of rounds will be 11. From round 2 onwards, random event cards are drawn that can impact the System Health, your points and the resources available to invest in System Health.</p>
<p>If System Health is 16 or higher, 1 event card is drawn. If System Health drops below 16, 2 event cards are drawn, and if System Health drops below 9, 3 event cards are drawn.</p>
<p>The possible event cards will be listed on the screen at the right.</p>
<p>You get 15 seconds each round to make a decision using the controls at the right of the screen.</p>
<p>If you are ready, click the start button.</p>
prolificVariableTreatment2:
id: 15
gameType: prolificVariable
isNumberOfRoundsKnown: true
isEventDeckKnown: false
thresholdInformation: known
isLowResSystemHealth: false
instructions: |
<h4>Game 2</h4>
<p>This game is an extension of game 1. Like game 1 you get 10 resource units each round which you can invest in System Health or keep them for yourselves. Again System Health declines each round with 5 units, and if System Health drops to 0, it is game over and you will not receive any points and thus not any earnings.</p>
<p>What is <i>different</i> in game 2 is the following:</p>
<p>In this game the maximum number of rounds will be 11. From round 2 onwards, random event cards are drawn that can impact the System Health, your points and the resources available to invest in System Health.</p>
<p>If System Health is 16 or higher, 1 event card is drawn. If System Health drops below 16, 2 event cards are drawn, and if System Health drops below 9, 3 event cards are drawn.</p>
<p>You get 15 seconds each round to make a decision using the controls at the right of the screen.</p>
<p>If you are ready, click the start button.</p>
prolificVariableTreatment3:
id: 16
gameType: prolificVariable
isNumberOfRoundsKnown: true
isEventDeckKnown: false
thresholdInformation: known
isLowResSystemHealth: true
instructions: |
<h4>Game 2</h4>
<p>This game is an extension of game 1. Like game 1 you get 10 resource units each round which you can invest in System Health or keep them for yourselves. Again System Health declines each round with 5 units, and if System Health drops to 0, it is game over and you will not receive any points and thus not any earnings.</p>
<p>What is <i>different</i> in game 2 is the following:</p>
<p>In this game the maximum number of rounds will be 11. From round 2 onwards, random event cards are drawn that can impact the system health, your points and the resources available to invest in System Health.</p>
<p>If System Health is 16 or higher, 1 event card is drawn. If System Health drops below 16, 2 event cards are drawn, and if System Health drops below 9, 3 event cards are drawn.</p>
<p>You get 15 seconds each round to make a decision using the controls at the right of the screen.</p>
<p>If you are ready, click the start button.</p>
prolificVariableTreatment4:
id: 17
gameType: prolificVariable
isNumberOfRoundsKnown: false
isEventDeckKnown: true
thresholdInformation: known
isLowResSystemHealth: false
instructions: |
<h4>Game 2</h4>
<p>This game is an extension of game 1. Like game 1 you get 10 resource units each round which you can invest in System Health or keep them for yourselves. Again System Health declines each round with 5 units, and if System Health drops to 0, it is game over and you will not receive any points and thus not any earnings.</p>
<p>What is <i>different</i> in game 2 is the following:</p>
<p>In this game the maximum number of rounds is unknown but will between 6 and 14 rounds. From round 2 onwards, random event cards are drawn that can impact the System Health, your points and the resources available to invest in System Health.</p>
<p>If System Health is 16 or higher, 1 event card is drawn. If System Health drops below 16, 2 event cards are drawn, and if System Health drops below 9, 3 event cards are drawn.</p>
<p>The possible event cards will be listed on the screen at the right.</p>
<p>You get 15 seconds each round to make a decision using the controls at the right of the screen.</p>
<p>If you are ready, click the start button.</p>
prolificVariableTreatment5:
id: 18
gameType: prolificVariable
isNumberOfRoundsKnown: true
isEventDeckKnown: true
thresholdInformation: range
isLowResSystemHealth: false
instructions: |
<h4>Game 2</h4>
<p>This game is an extension of game 1. Like game 1 you get 10 resource units each round which you can invest in System Health or keep them for yourselves. Again System Health declines each round with 5 units, and if System Health drops to 0, it is game over and you will not receive any points and thus not any earnings.</p>
<p>What is <i>different</i> in game 2 is the following:</p>
<p>In this game the maximum number of rounds will be 11. From round 2 onwards, random event cards are drawn that can impact the system health, your points and the resources available to invest in System Health.</p>
<p>One event card will be drawn each round, but if System Health is below a certain level 1 extra card is drawn. You do not know this specific level, but it is somewhere between 12 and 18 units of System Health. If System Health drops even lower another extra event card will be drawn. You do not know this second level that triggers the additional card, but it is somewhere between 5 and 11 units of System Health.</p>
<p>The possible event cards will be listed on the screen at the right.</p>
<p>You get 15 seconds each round to make a decision using the controls at the right of the screen.</p>
<p>If you are ready, click the start button.</p>
prolificVariableTreatment6:
id: 19
gameType: prolificVariable
isNumberOfRoundsKnown: true
isEventDeckKnown: true
thresholdInformation: unknown
isLowResSystemHealth: false
isLowResSystemHealth: false
instructions: |
<h4>Game 2</h4>
<p>This game is an extension of game 1. Like game 1 you get 10 resource units each round which you can invest in System Health or keep them for yourselves. Again System Health declines each round with 5 units, and if System Health drops to 0, it is game over and you will not receive any points and thus not any earnings.</p>
<p>What is <i>different</i> in game 2 is the following:</p>
<p>In this game the maximum number of rounds will be 11. From round 2 onwards, random event cards are drawn that can impact the system health, your points and the resources available to invest in System Health. The lower the System Health the more likely additional event cards are drawn.</p>
<p>The possible event cards will be listed on the screen at the right.</p>
<p>You get 15 seconds each round to make a decision using the controls at the right of the screen.</p>
<p>If you are ready, click the start button.</p>
22 changes: 11 additions & 11 deletions server/fixtures/SoloMarsEventCard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -190,28 +190,28 @@ items:
prolificVariableEvent14:
id: 23
gameType: prolificVariable
codeName: "investSystemHealth8"
effect: "8 resources are immediately diverted to system health."
rollMin: 8
rollMax: 8
systemHealthMultiplier: 1
resourcesMultiplier: -1
prolificVariableEvent15:
id: 24
gameType: prolificVariable
codeName: "reduceSystemHealth1"
effect: "Lose 1 system health."
rollMin: 1
rollMax: 1
systemHealthMultiplier: -1
prolificVariableEvent16:
id: 25
prolificVariableEvent15:
id: 24
gameType: prolificVariable
codeName: "reducePoints1"
effect: "Lose 1 point."
rollMin: 1
rollMax: 1
pointsMultiplier: -1
prolificVariableEvent16:
id: 25
gameType: prolificVariable
codeName: "investSystemHealth8"
effect: "8 resources are immediately diverted to system health."
rollMin: 8
rollMax: 8
systemHealthMultiplier: 1
resourcesMultiplier: -1
prolificVariableEvent17:
id: 26
gameType: prolificVariable
Expand Down
13 changes: 13 additions & 0 deletions server/src/entity/ProlificStudyParticipant.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Column, Entity, JoinColumn, ManyToOne, OneToOne, PrimaryGeneratedColumn } from "typeorm";
import { ProlificStudy } from "./ProlificStudy";
import { User } from "./User";
import { SoloGameTreatment } from "./SoloGameTreatment";

@Entity()
export class ProlificStudyParticipant {
Expand All @@ -22,4 +23,16 @@ export class ProlificStudyParticipant {

@Column()
studyId!: number;

@ManyToOne(type => SoloGameTreatment)
prolificBaselineTreatment!: SoloGameTreatment;

@Column()
prolificBaselineTreatmentId!: number;

@ManyToOne(type => SoloGameTreatment)
prolificVariableTreatment!: SoloGameTreatment;

@Column()
prolificVariableTreatmentId!: number;
}
3 changes: 3 additions & 0 deletions server/src/entity/SoloGameTreatment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,7 @@ export class SoloGameTreatment {

@Column({ default: false })
isLowResSystemHealth!: boolean;

@Column({ nullable: true })
instructions?: string;
}
24 changes: 0 additions & 24 deletions server/src/migration/1724101985703-SoloGameProlific.ts

This file was deleted.

Loading

0 comments on commit ab59f6e

Please sign in to comment.