Asset variance log
- Asset is divided into cashable and non-cashable to send to the designated category respectively. e.g., Tiny Farm has two categories; cash type (bell) and non-cash type (gold)
- Collecting asset (cash, game money, etc.) variance log from the game server aims to analyze the play pattern of each user for a better service.
Category¶
Common Server 172.19.1.10 | noncash_var_log, cash_var_log |
---|---|
Test Server 222.112.182.65 | test_noncash_var_log, test_cash_var_log |
Log specification¶
Note
The snake-cased field, like server_id
, is transformed to camel case, like serverId
, when it stores in the final storage (BigQuery), and the log sent in the unspecified form, such as serverid
, is not saved in its column.
Field Name | Description | Type | Required |
---|---|---|---|
date | The time storing log, Format: yyyy-mm-dd hhss e.g., 2012-01-19 16:24:00 | string | Y |
channel | C2S: HIVE, KAK: Kakao, LIN: LINE, WEI: Weibo | string(3) | Y |
user_id | Hub uid sent from the client (In case of other channels, it means the user_id used on each channel) | bigint | Y |
user_seq | The of user account used by game server (PK) | bigint | N |
lang | Language code sent from the client ISO 639-2 (3-byte language code) e.g., KOR | string(3) | Y |
game | Use the brand name of game (e.g., derbydays). The third item of app_id e.g., com.com2us.littlelegends.kakao.freefull.apple.global.ios.universal → littlelegends | string(50) | Y |
market | Market information "TS": SKT Tstore "OL": KT OllehMarket "OZ": LGU+ OzStore "AP": Apple Appstore "GO": Google Play "SA": Samsung Apps "LE": Com2us Lebi | string(2) | Y |
level | User level in the game | int | Y |
action_id | User’s Action ID relevant to changes in unique game money in games Range: [1–(2^31−1)] API or protocol distinguishes actions in games, so game servers should define each ID about action Once you define, do not change it. Test is necessary | int | Y |
action_name | The value mapping 1:1 to action_id. If action_id is different, so is action_name e.g., Feeding, Harvesting, etc. The actual data is stacked based on the action_id. If changed, metatable is automatically updated | string(50) | Y |
item_id | Item identifier caused asset variance. Set this value as 0 if the asset variance action is unrelated to the item. Range: [1–(2^31−1)] This parameter is needed when action is related to item. Each game should define the item ID Once you define, do not change it. Test is necessary | int | Y |
item_name | The value mapping 1:1 to item_id. All values should have explanations except when item_id is 0. Input 0 when item_id is 0 Brief about item_id | string(50) | Y |
asset_id | Set this value from 1 to 100 for cashable asset/social media point, and from 101 and higher for non-cashable asset Once you define, do not change it. Test is necessary (cf. If the cashable asset is what user usually gets rather than buys in games, set from 101 and higher numbers) | int | Y |
asset_name | Brief about asset_id (e.g., bell, star, goldball, gold) | string(50) | Y |
amount_prev | The amount of asset right before asset variance relevant to asset_id | bigint | Y |
amount_var | The amount of asset variance relevant to asset_id. Asset decrease: Negative number, Asset increase: Positive number | bigint | Y |
amount_curr | The amount of asset right after asset variance relevant to asset_id. amount_curr = amount_prev + amount_var | int | Y |
amount_free_prev | The amount of free asset right before asset variance relevant to asset_id (added due to the amended Act on Settlement of Funds in Japan) | bigint | Y (added on Jan.18.2018) |
amount_free_var | The amount of free asset variance relevant to asset_id Asset decrease: Negative number, Asset increase: Positive number (added due to the amended Act on Settlement of Funds in Japan) | bigint | Y (added on Jan.18.2018) |
amount_free_curr | The amount of asset right after free asset variance relevant to asset_id (added due to the amended Act on Settlement of Funds in Japan) amount_free_curr = amount_free_prev + amount_free_var | int | Y (added on Jan.18.2018) |
amount_paid_prev | The amount of paid asset right before asset variance relevant to asset_id (added due to the amended Act on Settlement of Funds in Japan) | bigint | Y (added on Jan.18.2018) |
amount_paid_var | The amount of paid asset variance relevant to asset_id Asset decrease: Negative number, Asset increase: Positive number (added due to the amended Act on Settlement of Funds in Japan) | bigint | Y (added on Jan.18.2018) |
amount_paid_curr | The amount of asset right after paid asset variance relevant to asset_id (added due to the amended Act on Settlement of Funds in Japan) amount_paid_curr = amount_paid_prev + amount_paid_var | int | Y (added on Jan.18.2018) |
client_ip | Client IP. This value extracts the value of country from GeoIP | string(32) | Y |
country | Input the country code directly if client_ip is not given e.g., KR | string(2) | N |
server_ip | server IP | string(32) | Y |
company | Game publishing company, the target of log: e.g., "C2S": Com2uS, "GVI": Com2uS Holdings | string(3) | Y |
server_id | Server code Refer to Table of Server Code to input server code (JSON Enter Code) | string | Y |
is_emulator | If connecting with Emulator for PC such as BlueStacks, return 1; unless, return 0 to the PC version, return 2 | tinyint(1) | Not required, but recommended. |
game_language | Language in games with two small letters e.g., ko Reference: Identifier Policy | varchar | Not required, but recommended. (added on Jan.18.2018) |
account_id | Unique account identifier in server (PK) | bigint | N (added on Jan.18.2018) |
deviceid | Device ID on HIVE. The identifier which abstracts advertising identifier (Android: AdvertisingID; iOS: IDFA) | bigint | N (added on Jan.18.2018) |
guid | Unique key generated per log Random format such as uuid is recommended | varchar(64) | N |
real_count | The actual number of assets user got e.g., When user gets ten assets at once, only one log is left but the actual number of the asset is ten | int | Y (added on Sep.04.2019) |
Scribe type¶
<?php
$GLOBALS['THRIFT_ROOT'] = '/dev/scribe-php'; // The route is an example. Modify it in accordance with the development environment.
include_once $GLOBALS['THRIFT_ROOT'].'/scribe.php';
include_once $GLOBALS['THRIFT_ROOT'].'/transport/TSocket.php';
include_once $GLOBALS['THRIFT_ROOT'].'/transport/TFramedTransport.php';
include_once $GLOBALS['THRIFT_ROOT'].'/protocol/TBinaryProtocol.php';
…
public function writeCashVarLog(.....params.....) // Function is an example as well. Modify it in accordance with the development environment. (Category, however, should be fixed as ‘cash_var_log’)
{
$msg['category'] = 'cash_var_log';
$msg['message'] = array();
$msg['message']['date'] = date('Y-m-d H:i:s', time());
$msg['message']['channel'] = $channel;
$msg['message']['user_id'] = $uid;
$msg['message']['country'] = $country;
$msg['message']['lang'] = $lang;
$msg['message']['game'] = $game;
$msg['message']['market'] = $market;
$msg['message']['level'] = $level;
$msg['message']['action_id'] = $action_id; // Once you define, change is unavailable.
$msg['message']['action_name'] = $action_name;
$msg['message']['item_id'] = $item_id; // Once you define, change is unavailable.
$msg['message']['item_name'] = $item_name;
$msg['message']['asset_id'] = $asset_id; // Use the value between 1 and 100 for each game.
$msg['message']['asset_name'] = $asset_name;
$msg['message']['amount_prev'] = $amount_prev;
$msg['message']['amount_var'] = $amount_var;
$msg['message']['amount_curr'] = $amount_curr;
$msg['message'] = json_encode($msg['message']);
$entry = new LogEntry($msg);
$messages = array($entry);
//var_dump($messages);
$socket = new TSocket('localhost', 1463, TRUE); // the target host to send logs(fixed port)
$transport = new TFramedTransport($socket);
$protocol = new TBinaryProtocol($transport, FALSE, FALSE);
$scribe_client = new scribeClient($protocol, $protocol);
$transport->open();
$scribe_client->Log($messages);
$transport->close();
}
public function writeNonCashVarLog(.....params.....) // Function is an example as well. Modify it in accordance with the development environment. (Category, however, should be fixed as ‘noncash_var_log’)
{
$msg['category'] = 'noncash_var_log';
$msg['message'] = array();
$msg['message']['date'] = date('Y-m-d H:i:s', time());
$msg['message']['channel'] = $channel;
$msg['message']['user_id'] = $uid;
$msg['message']['country'] = $country;
$msg['message']['lang'] = $lang;
$msg['message']['game'] = $game;
$msg['message']['market'] = $market;
$msg['message']['level'] = $level;
$msg['message']['action_id'] = $action_id; // Once you define, change is unavailable.
$msg['message']['action_name'] = $action_name;
$msg['message']['item_id'] = $item_id; // Once you define, change is unavailable.
$msg['message']['item_name'] = $item_name;
$msg['message']['asset_id'] = $asset_id; // Use the value between 1 and 100 for each game.
$msg['message']['asset_name'] = $asset_name;
$msg['message']['amount_prev'] = $amount_prev;
$msg['message']['amount_var'] = $amount_var;
$msg['message']['amount_curr'] = $amount_curr;
$msg['message'] = json_encode($msg['message']);
$entry = new LogEntry($msg);
$messages = array($entry);
//var_dump($messages);
$socket = new TSocket('localhost', 1463, TRUE); // the target host to send logs(fixed port)
$transport = new TFramedTransport($socket);
$protocol = new TBinaryProtocol($transport, FALSE, FALSE);
$scribe_client = new scribeClient($protocol, $protocol);
$transport->open();
$scribe_client->Log($messages);
$transport->close();
}
?>
How to use¶
- Asset Variance Log helps examine the state of item delivery/retrieval by asset and checks the retrieval rate. The amount of sales depends on the retrieval rate.
- Distinguishable item type and user action in game shows where the item delivery/retrieval is actively performed.
- It is available to check the details of additional item sales or free assets by various types of event.
- Make sure to discuss with game project manager, PIC of platform planning team and BI planning team about how to distinguish Asset/Action/Item before using the log.