Inspector

Most extreme case is making a lightweight version of the environment completely toggleable. We have this for every game that integrates onto the trainer platform. You can view it here

Full in-game integrations can also do this, but it's a heavier lift for game studios, so a popular choice is a scenario generator. You can do so with the following code.

Start by defining the game world scenarios

const scenarios = [
  {
    gameArea,
    paddleLeft: { ...paddleLeft, y: 100 },
    paddleRight: { ...paddleRight, y: 200 },
    ball: { radius: ballRadius, x: 125, y: 300, dx: -4, dy: -4 }
  },
  {
    gameArea,
    paddleLeft: { ...paddleLeft, y: 300 },
    paddleRight: { ...paddleRight, y: 150 },
    ball: { radius: ballRadius, x: 200, y: 100, dx: -4, dy: 4 }
  },
  {
    gameArea,
    paddleLeft: { ...paddleLeft, y: 250 },
    paddleRight: { ...paddleRight, y: 50 },
    ball: { radius: ballRadius, x: 200, y: 200, dx: -4, dy: -4 }
  },
  {
    gameArea,
    paddleLeft: { ...paddleLeft, y: 125 },
    paddleRight: { ...paddleRight, y: 200 },
    ball: { radius: ballRadius, x: 125, y: 300, dx: -4, dy: 4 }
  }    
]

Next, use the state space conversion function:

Next you simply call the function to get the probabilities in each situation: