Skip to content

slotopol/bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bot

GitHub release Hits-of-Code

Client emulator for slots server, scripted by Lua.

Serves to run scenarios that emulate the natural work of users, allows you to test the service API, determine the load on the database during normal workflow, and peak loads.

How it working

Bot have host engine with provided Lua-API and scripts running over this engine. Engine provides API for http-calls, JSON parser, crypto algorithms, path-functions, and some top-level API functions, see runlvm.go. Including two main functions to build scripts workflow: thread function, and sleep function.

Because the Lua virtual machine can only run in one system thread, thread functions creates new Lua virtual machine with all API registrations, that can be run at another goroutine. Function receives list of tables and strings in any order. Any given table spreads and all it's items sets to global scope to new created VM. So all items of table must have string keys, to get access in this VM. Values can be strings, numbers, booleans, tables without metatable. Any given string to thread function assumed as path to script that will be executed in new VM. Also to thread function can be given channel that assumed as exit channel. When job will be complete nil value will be sent to exit channel on success, or error message if error occurs.

How to build from sources

  1. Install Golang of last version.
  2. Clone project and download dependencies.
  3. Build project with script at task directory.

For Windows command prompt:

git clone https://github.com/slotopol/bot.git
cd bot
go mod download && go mod verify
task\build-win-x64.cmd

or for Linux shell or git bash:

git clone https://github.com/slotopol/bot.git
cd bot
go mod download && go mod verify
sudo chmod +x ./task/*.sh
./task/build-linux-x64.sh

Start slotopol server, and then bot can be run together with some script:

bot_win_x64 script/servinfo.lua

You can get the list of all provided games by command:

bot_win_x64 script/gamelist.lua

How to test server

To start single player emulation run followed script:

bot_win_x64 script/single.lua

To start group of players emulation run followed script:

bot_win_x64 script/group.lua

In this script you can change the value of usrnum to determine how many players online your configuration can keep. jobtime defines the testing time.

During the testing each user starts randomly from 1 to 15 games, and makes a spin each 1.3 seconds (this emulates playing at several browser tabs). If spin have a win, its waits supposed win animation, and randomly starts double-up bonus game. Average every 50 spins user randomly can change bet value or selected bet lines at last spin game. Sometimes he pause randomly 3..15 seconds. If the money runs out, the admin tops up his balance with a random amount.


(c) schwarzlichtbezirk, 2024.