Package Exports
- probity
- probity/src/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (probity) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
probity
Lightweight, reliable and fast generator of combinations for slot games.
Strong RNG is used under the hood.
The basics
All operations are synchronous.
For high-loaded projects it's recommended to run several probity modules simultaneously.
The module should always be loaded, and process requests from clients as they arrive.
You may set up a simple HTTP server for that, for example.
The library may be encapsulated to C/C++, Java etc.
Overview
Probity is a high-performance slot combination generator.
See how it works here.
System requirements
- linux or windows operation system
- intel/amd x64 processor
API
The module exports two methods:
load ( )
Loads module.
Returns true if the module loaded successfully.
action ( request )
Executes the action.request is expected to be JSON.
The return value is JSON as well.
is_loaded
This property sets to true if the module was successfully loaded previously.
Protocol description
General rule is:
Request is always has the following structure:
{ "action": "action_name"
... some other parameters ...
}Reply is always looks like this:
{ "request": {
... request json ...
},
"success": true
... some other data ...
}or
{ "error": 3
}See possible error codes below.
set_configuration
{ "action": "set_configuration",
"log": {
"file": "/path/to/file.log",
"stdout": true
},
"staging": true
}log.file is file for log storage. Specify null or skip it if log should not be stored.log.stdout is true to print error messages to stdout.
staging is true to allow test feature in get_combination.
expected reply:
{ "success": true
}set_game_definition
{ "action": "set_game_definition",
"game_id": "",
"context": ""
}game_id is unique game id stringdefinition is game definition string
expected reply:
{ "success": true
}select_game
{ "action": "select_game",
"game_id": "",
"session_id": "",
"session_data": ""
}game_id is game id stringsession_id some unique string used to distinguish player sessionssession_data player session data string
It's important to save and restore player session data between sessions.
Some games use it to keep the context of the game.
expected reply:
{ "success": true
"game" : {
...
}
"combination": {
...
}
}game is the paytable of the game selected.combination is the combination the player got in the previous session.
get_combination
{ "action": "get_combination",
"session_id": "",
"bet_sum": 9.95
}session_id is player session idbet_sum is bet sumtest optional reels array to be used instead of generating them.
Test reels are used for game development to explore different game situations.
You should disable this feature in production mode.
{ "success": true,
"combination": {
"reels": [
...
],
"events": [
{ ... },
{ ... },
{ ... }
...
],
"actual": {
"bet": 9.95,
"win": 15.50,
}
}
}combination is the combination generated with all the winning results (if any).reels are the reels randomly generated.events is an array of objects, where every object is a game event occured.actual.bet is actual bet sum that must be deducted from player balance.actual.win is actual win sum that must be added to player balance.
get_session_data
{ "action": "get_session_data",
"session_id": ""
}session_id is player session id
This requests player session data.
It's recommended to request and store it after every bet.
expected reply:
{ "success": true,
"session_data": "session data string"
}get_game_list
{ "action": "get_session_data"
}This returns list of available games previously set with set_game_definition.
expected reply:
{ "success": true,
"game_list": [
"first_game_id",
"second_game_id",
"and so on"
]
}Possible use case
Possible and recommended scenario of using probity:
- load module
- send
set_configurationto initialize it - send
set_game_definitionseveral times to load games wait for player request(s)
- player selects the game with
select_game - player generates the combinations with
get_combination - player session is stored using
get_session_data - goto 4
Steps 1-3 are executed only once at the beginning.
Steps 4-8 are repeated many times for every player.
All players must have unique session ids.
Error codes
1: unexpected (unknown) error
2: json is broken
3: incorrect action
4: action can not be completed
5: wrong request, incorrect parameter
6: api key is incorrect
7: game definition is incorrect
8: player session id not found or incorrect
9: player session data is incorrect
10: unknown game
11: error generating combination
Example
Some examples can be found here.