LogoLogo
  • Introduction
  • Getting Started
    • Setup
      • Windows WSL Instructions (new)
      • Windows WSL Instructions
      • Linux Instructions
    • Creating your experiment
    • Running your experiment
    • Updating your experiment
  • Conceptual Overview
    • Game Life Cycle
      • Customising when players submit stages
    • Concepts
    • Randomization & Batches
    • API
  • Guides
    • V2 Migration
    • Managing the Data
    • Special Empirica Components
    • The Admin Panel
    • Deploying Your Experiment
      • Ubuntu tutorial
  • Tutorials
    • Beginner Experiment: Prisoner's Dilemma
      • Part 1: Before you start
      • Part 2: Creating the Experiment in Empirica
      • Part 3: Getting Accustomed to the Code
      • Part 4: Coding the Prisoner's Dilemma Game
        • Part 4.1: Removing example code
        • Part 4.2: Intro Text
        • Part 4.3: Set up the game stages
        • Part 4.4: Build the "Choice" React Component
        • Part 4.5: Build the "Result" React Component
        • Part 4.6: Compute the Score
      • Part 5: Customizing the experiment
        • Part 5.1: Changing the number of rounds
        • Part 5.2: Turning the chat on and off
      • Part 6: Deployment
  • FAQ
    • I need help!
    • The Processes and Elements of an Empirica Experiment
    • Managing Players and Games
  • Resources
    • Helpful Linux Commands
    • Code Editors
    • Javascript and React
  • Links
    • Empirica website
    • Twitter
    • GitHub
Powered by GitBook
On this page
  • When players submit (end) a stage
  • What players see when they have submitted a stage

Was this helpful?

Edit on GitHub
Export as PDF
  1. Conceptual Overview
  2. Game Life Cycle

Customising when players submit stages

When players submit (end) a stage

Instead of having players wait until the end of the stage, you can have them submit their answer. This will set the Stage as submitted for them. If all the other players have also submitted the Stage, then the players move on to the next Stage or Round.

To set the stage to submitted you need to run this method from the player prop:

player.stage.set("submit", true);

This will change this property, that you can use to see if the stage has been submitted (it is a Boolean, true or false):

player.stage.get("submit");

For example, you could create a button, that has a handle method for onClick that will do the necessary with the player's answer and call player.stage.set("submit", true).

What players see when they have submitted a stage

Once a player submits for the stage, you might want to show something different on the screen. For example, instead of showing the stage's question/task (and avoiding players submitting multiple responses), you could show a message thanking the player for submitting the stage and telling them that they will have to wait for all players to submit the stage before they can move on to the next one.

You can do this by setting a conditional that renders different elements depending on what player.stage.get("submit") returns.

For example:

{
player.stage.get("submit")
    ? <div> Thank you for your answer. The next stage will start when all the other 
    players have submitted their answer. </div>
    : <div><Question player={player} /></div>
}
PreviousGame Life CycleNextConcepts

Last updated 3 years ago

Was this helpful?