Skip to main content

MySimulation

Overview

The mysimulation is a library that supports simulating the player's playing results when participating in a slot game. This library helps game designers predict whether the game's RTP is as expected or not, helping to come up with an accurate solution.

Functionality:

  • Manage all of simulations for a game such as
    • Create new simulation.
    • List simulations.
    • Download the simulation reports.
  • And together with internal interface
    • Used as a library for a game to run their own logic.
    • Start & stop worker to run these simulations.

How to use MySimulation in Debug Tools

Access the debug tool at: Debug Tool.

The MySimulation Site

This is the MySimulation site, from here you can take the following actions:

  • Auto Refresh Button: When the Auto Refresh Button is on, you can see the current progress of the simulation. [1]
  • Create New Simulation: Using to create a new simulation. [2]
  • View List of Simulation [3]: In one of the row, you can take two actions:
    • Download Report: Return a simulation report file and will auto download on your device.
    • Recreate Simulation: Create a new simulation that like the simulation want to recreate.

mysimulation_site

Read the Simulation Report

Here is a simulation report example.

mysimulation_report

In a simulation report, we have six fix columns and some optional extra columns.

  • Six fix columns: Except rtp column, the remain columns is created from the AWP algorithm.

    • payout_min: The AWP result will return a payout range, such as [0,1], [1,5]... Payout_min is a min of payout range, example:

      • With payout range [0,1], payout_min is 0.
    • payout_max: The same payout_min, payout_max is a max of payout range, example:

      • With payout range [0,1], payout_max is 1.

    Developers will choose randomly target_rtp between payout_min and payout_max. Then choose the result that has rtp equal target_rtp or smaller and nearest to target_rtp.

    • rtp: Is a actual rtp that player get from current spin, example:

      • Player bet $1 and player win $10 that mean rtp is 10
    • final_hit_rate: Is a ratio chosen based on calculation from the AWP algorithm.

    • normal_game_hit_rate: Is a randomly selected ratio from 0 to 1 before get payout. The normal_game_hit_rate will be compared with max_hit_rate of bet_experience at awp_setting. If normal_game_hit_rate is greater than max_hit_rate, the AWP result will return a payout range [0,0].

    • volatility: Is the payout volatility over each spin. That is calculated based on the formula:

      sumOfSquare=sumOfSquare+gamePayout2sumOfSquare=sumOfSquare+gamePayout^2

      volatility=sumOfSquarespinbetStake2(totalPayouttotalBet)2volatility=\sqrt{\frac{sumOfSquare}{spin*betStake^2}-(\frac{totalPayout}{totalBet})^2}

      In there:

      • gamePayout: current game payout

      • spin: current number of spin at the time

      • totalPayout:total Payout for all of the spins already done

      • totalBet: total bet amount for all of the spins already done

  • Optional Extra columns: Each game will have difference option extra columns.

How to integrate MySimulation library in backend service

At internal/server/serve.go file, need to call New mysimulation and register mysimulation server, example:

package server

import (
...

mysimulationcli "gitlab.nautilusgames.tech/marketplace/mysimulation"
mysimpkg "gitlab.nautilusgames.tech/marketplace/mysimulation/pkg"

...
)

func Serve(cfg *config.Config) {
...

mySimulation, err := mysimulationcli.New(entDriver, func(ctx context.Context, ssr mysimpkg.SimulationSpinRequest) (mysimpkg.SimulationSpinResult, error) {
// TODO: handle simulationSpinResult
return mysimpkg.SimulationSpinResult{}, nil
})
if err != nil {
logger.Fatal("init my simulation failed", zap.Error(err))
}
mySimulation.RegisterGrpcServer(server)
mySimulation.RegisterHttpServer(ctx, service.HttpServeMux())
mySimulation.StartRunner()
defer mySimulation.StopRunner()

...
}