To calculate the actual game score or detect invalid score submitted by the player, we need some game related data at the end of the game. This also helps us to simulate games on our server. This will also help us to track the game played by the user in case of any mismatch in score, false claim by the user etc.
There are two methods for transmitting game logs to the WinZO server:
Batching: This method involves sending game logs in batches. The game is configured with a specified time interval, and once initiated, it begins collecting game logs. After the defined interval elapses, the accumulated logs are sent to the WinZO server.
All Logs at Once: Unlike the batching method, this approach sends all game logs in a single transmission. Upon game initiation, logging begins, and upon completion of the game, along with the submission of the final score i.e SubmitScore event, all the accumulated game logs are sent to the WinZO server simultaneously.
Each method has its advantages and may be chosen based on factors such as data volume, network efficiency, and server compatibility.
Game will get these config data for game logs in the SetUpGame event:
sendGameLogs = type bool (true - send game logs, false, do not send game logs)
batchType: type int
a. 0, // send game logs in submit score only
b. 1, // send game logs in batches only
c. 2 // send game logs in both
batchInterval = float (in sec) : this is the time interval in which game needs to send the game logs
Game logs will be send via two methods:
Send in Submit Score: send complete game logs at once
Batchmode: (send game logs in batches)
Parent key name should be “gameLogs”:
Add two keys in the game logs
batchCount: It will be the count of every batch and it will be an incremental value from 1 to N. where 1 is the START packet and N is the END packet.
packetType: It is a string value.
a. START: The very first packet
b. RUNNING: In between the game (2 to N-1)
c. END: Nth packet
d. FINAL: complete game logs sending in submit score
{ batchCount:int// number of current batch (incremental) 1 to N,packetType(string), { START, // for the first packet RUNNING, // in between game packets END, // Last batch FINAL // Along submit score packet in needed }, finalScore, gameData:{ gamelogs}}
Send game logs along with submit score data.
// This is an example you can have // any name of this class and keys according to your game // use namespace for this class as well // Game data example [Serializable]publicclassGameLogs {publicint finalScore;publicint batchCount;publicstring packetType;publicRecordedGameLogs gameLogs =newRecordedGameLogs(); // Key name must be "gameLogs" } [Serializable]publicclassRecordedGameLogs {publicList<RecordData> recordGameData =newList<RecordData>(); } [Serializable]publicclassRecordData {publicint respinLeft;publicint disconnectionCount;publicList<int> tokenArray =newList<int>();publicint diceRollCount;publicint NumberOfMoveToken;publicstring Challengeid; } // On Game Over // At submit score call //Add gameData in the submit score packet on gameover.Dictionary<string,IList> scoreData =newDictionary<string,IList>(); //Mandatory Keys //Add Scene InfoList<string> scenename =newList<string>();scenename.Add(SceneNames.WINZO_GAME_SCENE); //Add Time Elapsed InfoList<int> timelist =newList<int>();timelist.Add(timeElapsed); // Add elapsed here //Add Player Score ArrayList<ObscuredInt> score = scores; //Add all other player scores, get opponent ids in //SetUpGame Event Data List<object> oppoPlayerScores =newList<object>(); //1st opponentMultipleOpponentScore oppoPlayerScore1 =new MultipleOpponentScore(opponentId1, opponentScore1); oppoPlayerScores.Add(oppoPlayerScore1); //2nd opponent MultipleOpponentScore oppoPlayerScore2 = new MultipleOpponentScore(opponentId2, opponentScore2); oppoPlayerScores.Add(oppoPlayerScore2); List<object> allGameData = new List<object>(); //Add all data to this object GameLogs gameLogs = new GameLogs(); // Convert json into string of collected game data allGameData.Add(gameLogs); scoreData.Add(IntegrationEvents.SceneName, scenename); scoreData.Add(IntegrationEvents.Scores, score); scoreData.Add(IntegrationEvents.TimeElapsed, timelist); scoreData.Add(IntegrationEvents.GameData, allGameData); scoreData.Add(IntegrationEvents.OppPlayerScore,oppoPlayerScores); WinzoEventManager.TriggerEvent(IntegrationEvents.SubmitScore, scoreData);