Web app that requires one machine to be running a local server. Players can then register, login and connect to the main game. Players can then see their information on the main device (a device to display the index page to all users) as well as on their own device (preferably a mobile device) and place bids against each other.
Tested using:
PHP 7.0.8
with PHPUnit 5.7.4
to run the test casesComposer 1.00-beta2
MySQL 5.7.4
Apache 2.4.18
This will assume you have all the programs downloaded / running and will not walk through using Composer and PHPUnit
All the schemas are located in the director MySQL/
.
To add the schema (assuming you are in the correct directory):
mysql < MySQL/schema.sql
Chip Manager depends a lot on your config file, named config.ini
which you should create and store in the root directory
The basic structure of the config file looks something like
[database]
username = username
password = password
server = server_address
database = database_name
[information]
address = local_address
logfile = log_file
You should replace each of the variables to match your setup.
The index page will list everyone who is playing at the moment (by getting their connection status) and list them along with their current information (such as their current bid / total chips).
play.php
handles the client side of the game and allows people to play via a mobile friendly web client. This is very
similar to the Android app so switching between both shouldn't be an issue
A main screen will be present at the game table and this will display the index.php
page.
Players will then use their own devices to access the server running the game, register using register.php
, login using login.php
and then be
redirected to play.php
where they will be able to place bids and participate in the game.
As players place bids, their information will be shown on the main screen. When a player wins, clicking "player has won" will transfer all the bid chips to that player.
The API calls are intended for external applications (such as the Android app) as well as for the use of some basic game tasks.
Each php file returns 3 parameters in the form of JSON:
Name | Description | Always Present |
---|---|---|
error | If there is an error message present, a string description will be returned. Else, 0 will be returned | TRUE |
success | Whether the transaction was successful or not (0 or 1) | TRUE |
data | The data that was returned. Will often have sub levels of JSON. | FALSE |
API calls that affect the game in progress or get information about the current game. These are stored in the api/game
directory.
Get's all the connected players ID's in an array under data['players']
.
Get's all the connected players information including:
The player information is stored under data['players']
.
Logs in the player based on username / password combination and sets the player as connected.
Requires two POST
parameters:
username
- Username of player to loginpassword
- Password to verify the playerLet's the game know the player has won the current game. They will receive all the chips that all players have bid.
Requires one GET
or POST
parameter:
ID
- The winning players IDFor verification, it returns the winning players ID under data['winner']
and the amount the player has won under data['chips_won']
.
API calls that affect the player. Requires the ID
as a GET
or POST
parameter.
Places a new bid for the player.
Requires an additional GET
or POST
parameter:
amount
- The amount the player wants to betReturns all player info under data
Gets all the users current information.
Takes an additional optional parameter:
needs_update
- If set to 1
, will check if the player needs to be updated before returning informationReturns all player info under data
Resets the player current bid to 0
Checks if the player needs to be updated. If so, return all player information.
Returns whether the player was updated under data['needs_update']
and information about the player under data['player']