laravel-game-essentials

Packagist Packagist License Scrutinizer Code Quality Build Status

Game Essentials for Laravel 5.*. This package is required and used by few packages in Sweaty Chair Studio creating the basic data and essential functions for a gaming server backend. This provides functions such as registering players and assign the players to a game. After that the data can be used for analytics purpose.

If you are using other packages that requires this package, this will be added automatically and you do not need to install it manually. However, you can still use this package alone without using other packages.

Table of Contents

Installation

Install this package via Composer:

$ composer require furic/game-essentials

If you are using Laravel 5.5 or later, then installation is done. Otherwise follow the next steps.

Open config/app.php and follow steps below:

Find the providers array and add our service provider.

'providers' => [
    // ...
    Furic\GameEssentials\GameEssentialsServiceProvider::class
],

Configuration

To create table for game essentials in database run:

$ php artisan migrate

Usage

Games Table

| Name            | Type     | Not Null |
|-----------------|----------|----------|
| id              | integer  |     ✓    |
| name            | varchar  |     ✓    |
| version_ios     | integer  |     ✓    |
| version_android | integer  |     ✓    |
| version_tvos    | integer  |     ✓    |
| created_at      | datetime |          |
| updated_at      | datetime |          |

Players Table

| Name          | Type     | Not Null |
|---------------|----------|----------|
| id            | integer  |     ✓    |
| facebook_id   | varchar  |          |
| gamecenter_id | varchar  |          |
| playgames_id  | varchar  |          |
| udid          | varchar  |          |
| name          | varchar  |          |
| ip            | varchar  |     ✓    |
| created_at    | datetime |          |
| updated_at    | datetime |          |

GamePlayer Privot Table

| Name       | Type     | Not Null |
|------------|----------|----------|
| id         | integer  |     ✓    |
| game_id    | integer  |     ✓    |
| player_id  | integer  |     ✓    |
| channel    | integer  |     ✓    |
| version    | integer  |     ✓    |
| is_hack    | tinyint  |     ✓    |
| created_at | datetime |          |
| updated_at | datetime |          |

API URLs

GET <server url>/api/games/{id} Returns a JSON data from a given game ID, for debug usage only.

GET <server url>/api/games/{id}/versions Returns a JSON data containing the versions from a given game ID, for client checking the latest game version and perform force-update.

GET <server url>/api/games/{id}/players Returns a JSON array of all players from a given game ID, for debug usage only.

GET <server url>/api/players/{id} Returns a JSON data from a given player ID, for debug usage only.

GET <server url>/api/players/name/{name} Returns a JSON data from a given player name, for debug usage only.

POST <server url>/api/players Creates a JSON data of a player with given POST data. If the player is already exists with the given UDID, Facebook ID, or game servies IDs, it update the player data instead.

PUT <server url>/api/players/{id} Updates a JSON data of a player with a given player id.

GET <server url>/api/players/{id}/games Returns a JSON array of all players from a given game ID, for debug usage only.

API Document can be found here.

TODO

License

laravel-game-essentials is licensed under a MIT License.