Skip to content

Instantly share code, notes, and snippets.

@nicolasleander
Created March 17, 2015 13:53
Show Gist options
  • Save nicolasleander/9670e7e0757e651c4d6a to your computer and use it in GitHub Desktop.
Save nicolasleander/9670e7e0757e651c4d6a to your computer and use it in GitHub Desktop.

Slot Designer 2.0

Overview

Defining games

Games are defined through a JSON based configuration.

{
    "symbols": [
        {"name": "Wild", "isWild": true},
        "Picture1",
        "Picture2",
        "Picture3",
        "Nine",
        "Ten",
        "Jack",
        "Queen",
        "King",
        "Ace",
        {"name": "Scatter", "wildReplace": false}
    ],
    "reelFreqs": {
        "Wild":      [1,1,1,1,1],
        "Picture1":  [2,3,2,2,3],
        "Picture2":  [2,3,3,3,4],
        "Picture3":  [3,3,3,2,3],
        "Nine":      [3,3,3,4,4],
        "Ten":       [4,2,3,3,3],
        "Jack":      [4,3,4,3,4],
        "Queen":     [3,4,4,4,3],
        "King":      [4,4,4,5,3],
        "Ace":       [4,5,4,4,3],
        "Scatter":   [2,1,1,1,1]
    },
    "paytable": [
        {"on": {"occurs":[2,3,4,5], "of": "Wild",       "mode": "line"}, "pay": [5,50,500,5000]},
        {"on": {"occurs":[2,3,4,5], "of": "Picture1",   "mode": "line"}, "pay": [3,40,200,1000]},
        {"on": {"occurs":[2,3,4,5], "of": "Picture2",   "mode": "line"}, "pay": [2,30,150,500]},
        {"on": {"occurs":[2,3,4,5], "of": "Picture3",   "mode": "line"}, "pay": [2,25,100,300]},
        {"on": {"occurs":[3,4,5], "of": "Nine",         "mode": "line"}, "pay": [20,75,200]},
        {"on": {"occurs":[3,4,5], "of": "Ten",          "mode": "line"}, "pay": [20,75,200]},
        {"on": {"occurs":[3,4,5], "of": "Jack",         "mode": "line"}, "pay": [15,50,100]},
        {"on": {"occurs":[3,4,5], "of": "Queen",        "mode": "line"}, "pay": [15,50,100]},
        {"on": {"occurs":[3,4,5], "of": "King",         "mode": "line"}, "pay": [10,25,50]},
        {"on": {"occurs":[3,4,5], "of": "Ace",          "mode": "line"}, "pay": [10,25,50]},
        {"on": {"occurs":[3,4,5], "of": "Scatter",      "mode": "scatter"}, "pay": [5,25,100], "trigger": "freespins"}
    ],
    "bonus": {
        "freespins": {
            "spins": 10, "multiplier": 3
        }
    }
}

Symbols

The symbols of your game need to be provided in a property called symbols as an array. Each symbol can either be a string carrying the symbol name or, for more complex symbols, an object. In the latter case the name of the symbol must be specified in the name property.

Here is the list of supported symbols properties and their meaning:

Property Type Default Value Description
isWild boolean false flag indicating whether the symbol is wild and can substitute for other symbols.
wildReplace boolean or array or string true determines whether the symbol can be substituted by wild symbols. if true then the symbol can be substituted by any wild, if false the symbol cannot be substituted by any wild symbol. If the value is an array then it must specify the list of wild symbol names that can substitute for this symbol. A string value can be used to let the symbol be replaced by wild symbols only for specific paymodes (this is useful in situations where the same symbol pays both as a scatter and on the paylines, then by setting the value of wildReplace to 'line' the symbol will be replaced by wild symbols only for line pays).
wildMultipliers array null array that specifies the multipliers to be applied when this symbol substitutes for other symbols. Can only be used when isWild is true. Values in the array are multipliers to be applied when a winning combination is obtained with the corresponding number of wild substitutions (first value in the array is the multiplier for one wild substitution and so on..). For a specific number of substitutions the highest possible multiplier is applied (e.g. providing wildMultipliers: [2, 4, 8] means apply 2x multiplier for one wild substitution, 4x multiplier for two wild substitutions, 8x multiplier for winning combinations obtained with three or more wild substitutions).
expand array null array that specifies the reels on which the symbol acts as an expanding wild. If the symbol expands on a reel, anytime it appears it will replace all other visible symbols on the same reel. The array must contain the (0-based) index of each reel you want the symbol to expand on (e.g. if expand: [0, 2] then the symbol expands on the first and third reels). Can only be used when isWild is true.

Reel strips

It is not mandatory to define the reel strips of the game, for instance you may want the engine to generate the reel strips for you, based on your requirements (see next section). Reel strips can be defined by either entering the frequencies of the symbols on each reel or by providing the complete reel strips. The number of visible rows is 3 by default.

If you provide the symbol frequencies the engine works out the corresponding reel strips itself. As shown in the example game configuration above you do this by providing a property called reelFreqs. The value of the property is an object whose keys are the symbol names while values are arrays containing the number of times a symbol appears on the corresponding reel starting from the left-most one.

You provide the complete reel strips using a property called reels. The value of this property is an array of arrays, each array listing the symbols of each reel starting from the left-most one. The following configuration snippet shows you what the reels property looks like:

"reels":[
    ['Picture3', 'Picture1', 'Scatter', 'Picture3', 'Ace', 'Queen', 'Queen', 'Wild', ...],
    ['Ace', 'King', 'Scatter', 'Nine', 'Ace', 'Ace', 'Ten', 'Picture1', ...],
    ['King', 'Jack', 'Scatter', 'Nine', 'Nine', 'King', 'Picture3', 'Picture2', 'King', ...],
    ['King', 'Queen', 'Scatter', 'King', 'Picture3', 'Ace', 'Ace', 'Jack', ...],
    ['King', 'Jack', 'Scatter', 'Nine', 'Nine', 'King', 'Picture3', 'Picture2', 'King', ...]
]

Mixed reel strips

You can let your game use multiple set of reel strips by specifying them in a probability table as shown here below:

"reels": [
        {"prob": 0.8, "value": [
            ["Butter","Eggs","Scale","Mayonnaise","Eggs","Scale","Sausage","Cheese"...],
            ["Butter","Butter","Scale","Butter","Bacon","Bacon","Steak","Mayonnaise"...],
            ["Bacon","Sausage","Scale","Cheese","Drumstick","Bacon","Cheese","Sausage"...],
            ["Sausage","Bacon","Scale","Sausage","Cheese","Mayonnaise","Cheese","Drumstick"...],
            ["Bacon","Butter","Scale","Butter","Eggs","Drumstick","Butter","Steak","Eggs"...]
        ]},

        {"prob": 0.2, "value": [
        ["Butter","Eggs","Scale","Mayonnaise","Eggs","Scale","Sausage","Cheese","Butter"],
          ["Butter","Butter","Scale","Butter","Bacon","Bacon","Steak","Mayonnaise","Mayonnaise"],
          ["Bacon","Sausage","Scale","Cheese","Drumstick","Bacon","Cheese","Sausage","Butter"],
          ["Sausage","Bacon","Scale","Sausage","Cheese","Mayonnaise","Cheese","Drumstick"],
          ["Bacon","Butter","Scale","Butter","Eggs","Drumstick","Butter","Steak","Eggs"]
        ]}
    ]

In the following example two sets of reel strips are defined by providing the symbols frequencies. In this case the two sets have equal chance to be picked. Each set is labeled using 'name' attribute. When specified, the name is used to refer to specific reel set in the generated excels.

"reelFreqs": [
    {prob: 0.5, name: 'NormalSet', "value": {
        'Atkins':    [1,1,1,1,1],
        'Steak':     [2,3,2,2,3],
        'Ham':       [2,3,3,3,4],
        'Drumstick': [3,3,3,2,3],
        'Sausage':   [3,3,3,4,4],
        'Eggs':      [4,2,3,3,3],
        'Butter':    [4,3,4,3,4],
        'Cheese':    [3,4,4,4,3],
        'Bacon':     [4,4,4,5,3],
        'Mayonnaise':[4,5,4,4,3],
        'Scale':     [2,1,1,1,1]
    }},
    {"prob": 0.5, name: 'NoWildSet', "value": {
        'Atkins':    [0,0,0,0,0],
        'Steak':     [2,3,2,2,3],
        'Ham':       [2,3,3,3,4],
        'Drumstick': [3,3,3,2,3],
        'Sausage':   [3,3,3,4,4],
        'Eggs':      [4,2,3,3,3],
        'Butter':    [4,3,4,3,4],
        'Cheese':    [3,4,4,4,3],
        'Bacon':     [4,4,4,5,3],
        'Mayonnaise':[4,5,4,4,3],
        'Scale':     [2,1,1,1,1]
    }}]

Reel strips generation

If you provide no reels in your game configuration, you can ask the engine to generate reel strips for you. You do so by providing an additional property called rtp where you specify your requirements for the reel strips in terms of theoretical payback percentage.

The value of this property can either be a number or an object. The object enables you to enter more than one constraint, each property of the object is a constraint for the reel strips generation.

The following example shows you how to generate a simple slot game (with no bonuses) that has a theoretical payback of 91.21%:

{
    "symbols": [
        {"name": "Wild", "isWild": true},
        "Picture1", "Picture2", "Picture3", "Nine", "Ten",
        "Jack", "Queen", "King", "Ace",
        {"name": "Scatter", "wildReplace": false}
    ],
    "rtp": 0.9121,
    },
    "paytable": [
        {"on": {"occurs":[2,3,4,5], "of": "Wild",       "mode": "line"}, "pay": [5,50,500,5000]},
        {"on": {"occurs":[2,3,4,5], "of": "Picture1",   "mode": "line"}, "pay": [3,40,200,1000]},
        {"on": {"occurs":[2,3,4,5], "of": "Picture2",   "mode": "line"}, "pay": [2,30,150,500]},
        {"on": {"occurs":[2,3,4,5], "of": "Picture3",   "mode": "line"}, "pay": [2,25,100,300]},
        {"on": {"occurs":[3,4,5], "of": "Nine",         "mode": "line"}, "pay": [20,75,200]},
        {"on": {"occurs":[3,4,5], "of": "Ten",          "mode": "line"}, "pay": [20,75,200]},
        {"on": {"occurs":[3,4,5], "of": "Jack",         "mode": "line"}, "pay": [15,50,100]},
        {"on": {"occurs":[3,4,5], "of": "Queen",        "mode": "line"}, "pay": [15,50,100]},
        {"on": {"occurs":[3,4,5], "of": "King",         "mode": "line"}, "pay": [10,25,50]},
        {"on": {"occurs":[3,4,5], "of": "Ace",          "mode": "line"}, "pay": [10,25,50]},
    ]
}

The following reel frequencies should be generated

Generating reels with {"total":0.9121}

Reel strips:
[
 ['Picture1', 'Picture1', 'Scatter', 'Jack', 'Wild', 'Jack', 'Queen', 'Queen', 'Jack', ...],
 ['Ace', 'Wild', 'Scatter', 'King', 'Ace', 'Picture1', 'Picture2', 'Nine', ...],
 ['Ten', 'Queen', 'Scatter', 'Picture3', 'Ten', 'Jack', 'Jack', 'Ten', ...],
 ['Ten', 'Queen', 'Scatter', 'Picture3', 'Ten', 'Jack', 'Jack', 'Ten', ...],
 ['Queen', 'Queen', 'Scatter', 'Queen', 'Jack', 'Picture2', 'Ten', 'Queen', ...]
]

Symbols frequencies on reels:
{
 'Wild':     [2, 3, 1, 1, 1],
 'Picture1':      [3, 1, 3, 3, 3],
 'Picture2':        [1, 2, 3, 3, 3],
 'Picture3':  [5, 1, 5, 5, 5],
 'Nine':    [1, 5, 5, 5, 4],
 'Ten':       [1, 5, 5, 5, 5],
 'Jack':     [7, 1, 7, 7, 7],
 'Queen':     [7, 1, 7, 7, 7],
 'King':      [1, 7, 7, 7, 7],
 'Ace': [1, 7, 7, 7, 7],
 'Scatter':      [1, 1, 1, 1, 1]
}

So what are the additional constraints you can provide in order to control the reel strips generation?

For each pay mode supported by the game you can set an upper limit or a lower limit to the corresponding theoretical payback percentage. You do so by injecting in the rtp object properties called paymodePaysMax and paymodePaysMin, where paymode is the paymode that you want to limit (scatter, line etc.). For instance you can have reel strips generated with a total payback percentage of 91.21% as before but this time set an additional constraint on the payback contribution of the scatter paymode, requiring that it does not go below 5%:

{
    "symbols": [
        {"name": "Wild", "isWild": true},
        "Picture1", "Picture2", "Picture3", "Nine", "Ten",
        "Jack", "Queen", "King", "Ace",
        {"name": "Scatter", "wildReplace": false}
    ],
    "rtp": { "total": 0.9121, "scatterPaysMin": 0.05 },
    },
    "paytable": [
        {"on": {"occurs":[2,3,4,5], "of": "Wild",       "mode": "line"}, "pay": [5,50,500,5000]},
        {"on": {"occurs":[2,3,4,5], "of": "Picture1",   "mode": "line"}, "pay": [3,40,200,1000]},
        {"on": {"occurs":[2,3,4,5], "of": "Picture2",   "mode": "line"}, "pay": [2,30,150,500]},
        {"on": {"occurs":[2,3,4,5], "of": "Picture3",   "mode": "line"}, "pay": [2,25,100,300]},
        {"on": {"occurs":[3,4,5], "of": "Nine",         "mode": "line"}, "pay": [20,75,200]},
        {"on": {"occurs":[3,4,5], "of": "Ten",          "mode": "line"}, "pay": [20,75,200]},
        {"on": {"occurs":[3,4,5], "of": "Jack",         "mode": "line"}, "pay": [15,50,100]},
        {"on": {"occurs":[3,4,5], "of": "Queen",        "mode": "line"}, "pay": [15,50,100]},
        {"on": {"occurs":[3,4,5], "of": "King",         "mode": "line"}, "pay": [10,25,50]},
        {"on": {"occurs":[3,4,5], "of": "Ace",          "mode": "line"}, "pay": [10,25,50]},
    ]
}

With the above requirements we got reel strips generated paying as much as before, but this time the scatter contribution to the total payback of the game is 5,04%.

Despite having the same total payback, this slot game is very different from the previous one: in this game the bonus is triggered once every hundred games and the contribution to the total payback from the freespin bonus is nearly 12%. In the previous game (where we did not set any contraint on the scatter) the scatter contribution to the total payback was 1,95%, resulting on a freespin bonus being entered once every three hundred games and contributing to the total payback by 4,77% only.

Paylines

Each element of the paytable array can have the following properties:

  • on: object or string that specifies the winning combination(s) for the payout(s) defined in the element.The object can have the following properties:

    • occurs array that lists the number of occurrences of the symbol specified in of needed to have a winning combination paying the corresponding value defined in pay. Properties occurs and pay must both be arrays having the same number of elements, except for the case when occurs is omitted. If occurs is omitted it defaults to a single value array corresponding to the number of reels in the game. For instance, providing the following element { on: {of: 'Queen', mode: 'line'}, pay: 10} in the paytable of a 5 reels game means "pay 10 times the credits bet on the line when player has 5 occurrences of the Queen symbol"
    • of: string value indicating the symbol or the sequence of symbols that defines the paying combination(s) Its value can be:
      • the name of a symbol
      • a conditional symbol in the form Symbol1|Symbol2|Symbol3 (matching ANY of the pipe-separated list of symbols provided, e.g. BAR1|BAR2|BAR3 means any BAR symbol)
      • or a sequence of symbols (line paymode only) in the form Symbol1,Symbol2,Symbol3. This last format can be used to define a combination that matches a specific sequence of symbols on the line and it's normally useful for 3 reels slot. When providing a sequence the values in the occurs property specify the number of symbols in the sequence that have been obtained on the line, reading the sequence from left to right. For instance by providing the following element in the paytable: {on: {occurs:[4,5], of:'Nine,Ten,Jack,Queen,King', mode: 'line'}, pay: [20, 50]} means "pay 20 times the credits bet on the line when player has the sequence Nine, Ten, Jack and Queen" and "pay 50 times the credits bet on the line when player has the sequence Nine, Ten, Jack, Queen and King"
    • mode: name of the paymode for the combination(s) defined in the element. The value can be one of line (paylines), scatter (scatter symbols), consecutive (scatter paying on adjacent reels), line_scatter (scattered symbol on an active payline). Defaults to line
  • pay: number or array that provides the payout(s) for the combination(s) defined in element

  • trigger: name of the bonus triggered by the combination(s) defined in element. The name of the bonus must match one of the properties specified in the bonus object

Paymodes

  • line: symbols aligned on an active payline. The win amount equals the value pecified in the paytable multiplied by the credits bet-per-line. See next section to know how to configure the alignment.
  • scatter: symbols scattered on the visible matrix. The win amount equals the value specified in the paytable multiplied by the total credits bet (number of selected paylines X credits bet-per-line)
  • consecutive: symbols scattered on consecutive reels. See next section to know how to configure the alignment.
  • line_scatter: symbols scattered on an active payline. It is important to remember that line_scatter wins do not interfer with line wins. That is, plain payline wins are evaluated by respecting the only-highest-win-on-an-active-payline-is-paid rule, while line_scatter wins evaluated regardless of plain payline wins and do not take this rule into account.

Paymodes configuration

Paymodes line and consecutive can be configured for what concerns alignment and whether or not coinciding hits are paid.

This is done by providing properties called paymodeMode in the game configuration, where paymode must be one of line and consecutive. The value can be either a string specifying the alignment, or an object with two properties: align, coinciding.

If no paymodeMode property is specified in the game configuration the default mode is applied to the corresponding paymode. The value for property coinciding is boolean and defaults to false: meaning that coinciding wins aren't paid.

For line paymode the value of align property must be one of:

  • left: symbols on consecutive reels from left to right. This is the default value
  • right: symbols on consecutive reels from right to left
  • left_right: symbols on consecutive reels from left to right and right to left. For this alignment the value of coinciding property determines whether in the case of coinciding wins on the same payline (one from left and one from right) both wins are paid or only the highest one

For consecutive paymode the value of align property must be one of:

  • left: scatter symbols on consecutive reels from left to right. This is the default value
  • right: scatter symbols on consecutive reels from right to left
  • left_right: scatter symbols on consecutive reels from left to right and right to left. For this alignment the value of coinciding property determines whether in the case of coinciding wins in the same window (one from left and one from right) both wins are paid or only the highest one
  • any: symbols on consecutive reels with no alignment. The value of coinciding property determines whether in the case of coinciding wins in the same window all wins are paid or only the highest one (for instance in a 7 reels game one could have a scatter on the first two reels, and then a scatter on the fourth and fifth reels, thus paying twice the combinations for two occurrences if coinciding wins are paid)

The code below shows how you can define a slot game with paylines paying from left to right and right to left with coinciding wins paid:

{
    ...
    "lineMode": {
    "align": "left_right",
    "coinciding": true
  }
    ...
}

Bonuses

We virtually supports any kind of bonus. In your game configuration you can specify one or more bonuses that will be triggered either by one or more of the paying combinations (the ones listed in the paytable) or with a custom trigger. The built-in bonus support of the system splits the various bonus types into two main categories: freespin-like bonuses and pick-a-price bonuses. Both categories include a vast number of bonus types, for instance all kind of freespin bonuses and dynamic bonuses fall in the first category, while wheels, pick-a-price and trails fall in the second one.

Depending on the rules of your game, bonuses can be re-triggered (triggered again while already playing the bonus) and through the configuration you can easily represent the situation where while already in a bonus you can trigger other bonuses (different than the one you are playing). For instance in one of your game you could define a freespin bonus that while it's been played can also trigger a pick-a-prize bonus.

Any property you use to describe the rules of a bonus is dynamic, this means that its value can either be specified as a constant or as a function that will be called every time the value is needed. This enables you to easily implement dynamic bonuses with rules that introduce a dependency on the state of the game (for instance you can award 10 spins when the bonus is triggered from the base game and award 3 spins only when the bonus is triggered again during free spins).

You declare the bonuses of your game in an object called bonus. Each property of the bonus object defines an individual bonus. The name of the property is the bonus name that you use to specify the triggers for the bonus in the paytable. The example below shows a game that defines two bonuses triggered by two different scatters:

}
    "paytable": [
        {"on": {"occurs":[2,3,4,5], "of": 'Scatter1',   "mode": 'scatter'}, "pay": [2,5,25,100], "trigger": 'superspins'},
        {"on": {"occurs":[2,3,4,5], "of": 'Scatter2',   "mode": 'scatter'}, "pay": [2,5,25,100], "trigger": 'pick-a-prize'}
    ],
    "bonus": {
    "superspins": {
        ...
        ...
    },
    "pick-a-prize": {
        ...
        ...
    }
}

You may be wondering how can you define the rules for your bonus(es) and how is it possible to represent different bonus types like freespins, wheels or pick-a-prize. You do this by using specific properties in your bonus object(s).

Before going through the list of properties that you can use, let's see how to implement a simple freespin bonus:

"paytable": [
    ...
    {"on": {"occurs":[2,3,4,5], of:'Scatter',   "mode": 'scatter'}, "pay": [2,5,25,100], "trigger": 'freespins'}
    ],
    "bonus": {
    "freespins": {
        "spins": [0, 5, 10, 15]
    }
}

The example above defines a game with a freespin bonus triggered by the scatter. The spin property defines the number of freespins awarded when the bonus is triggered. Because an array is given as its value then the elements in the array represent the number spins awarded for each scatter combination that triggers the bonus (0 spins are awarded for 2 scatters, 5 spins for 3 scatters, 10 spins for 4 scatters and 15 spins for five scatters). The spins property doesn't necessarily specify the number of freespins, it has a wider meaning as it represents more generically the number of times that the bonus game is played. For freespins bonuses playing the bonus means spinning the reels, but for other kind of bonuses the actual bonus game is not necessarily a reel game. To define non-freespin bonuses you can use the prize property, this enables you to represent all bonuses that ramdomly award prizes to the player, regardless of the way the bonus game is presented to the player (this includes trails, wheels, pick a prize etc.).

@Surjyendu
Copy link

Please help or give me the download link for Slot Designer 2.0 form windows system.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment