# Design of Game Data Acquisition System Based on Artificial Intelligence Algorithm

Authors: Xiangrui Li; Huayi Wang
Journal: Security and Communication Networks
 (2022)

---

## Abstract

Game data collection system is a tool used to collect the behavior data of users about the game. It can be used for data analysis of user behavior so that game manufacturers can keep abreast of market dynamics and popular trends, and they also can have a deeper understanding of the behavioral habits and psychology of player user groups. The defects of the current data acquisition system include that the data are not encrypted. The network transmission efficiency is relatively low. The acquisition speed is slow, and the settings cannot be dynamically changed. This paper proposes to study how to enhance the acquisition ability and improve the analysis efficiency in the design of data acquisition system for solving these problems. Therefore, on the basis of artificial intelligence algorithm, this paper designs a game data collection system by using artificial neural network algorithm, support vector algorithm, and cluster analysis algorithm, which solves the basic problem of slow data collection in current data collection and plays a role in improving the efficiency of network transmission. The experimental results in this paper show that when the number of data is more than 300, the time-consuming time reaches more than 68 ms. When the number of written data is more than 300, it takes more than 181 ms. When the number of deleted data is more than 300, it takes more than 236 ms. From the above data, it shows that the designed game data collection system is rapid and efficient.


---

## Body

## 1. Introduction

With the rapid development of mobile Internet technology and the popularity of smartphones in recent years, China’s mobile game industry has also seen rapid development. The current data collection method is to implant relevant collection tools in the game to obtain real-time user game behavior data, to understand market dynamics and popular trends, so that the behavioral habits and psychology of the player user group can be grasped more deeply.China’s game industry has also developed rapidly. The game market is gradually transitioning from the incremental market to the stock market. How to snatch existing game users to increase game revenue has become the biggest challenge for game manufacturers. Therefore, based on artificial intelligence algorithm, this paper applies it in the research of game data collection system, which can greatly improve the optimization and operation efficiency of the game, expanding the analysis of market channels, so that precise marketing can be carried out.The game data collection system designed by artificial intelligence algorithm in this paper has the following major innovations:(1)
It can not only collect general data that all mobile games need to use, but also collect custom data customized for business needs according to the configuration files issued by developers. Developers only need to add this tool to project dependencies through Gradle, and call the tool’s initialization code in application to complete the tool integration.(2)
Using the non-buried point solution can quickly and automatically obtain a large amount of inspiring user operation information, which is of great value in game applications dominated by user interaction. Through analyzing the user’s behavior data, the click probability of the user on the corresponding interface of the application can be quickly analyzed, so that the research and development engineers can make more in-depth optimization for some function points that users pay much attention to.(3)
It also improves tool stability. The number of crashes brought to the game due to insufficient tool stability should be minimized to avoid additional problems for developers. Tool usage should be as simple and understandable as possible. The interface for users to call should be as simple as possible to reduce the learning cost for developers to integrate this tool.


## 2. Related Work

Artificial intelligence is a branch of computer science that attempts to understand the essence of intelligence and produce a new type of intelligent machine that can respond in a manner similar to human intelligence. Research in this field includes robotics, language recognition, image recognition, natural language processing, and expert systems, etc. Artificial intelligence has been used in many fields. Wang et al. proposed a new hybrid approach that used an ensemble data fluctuation network (DFN) and multiple artificial intelligence (AI) algorithms, which was called the DFN-AI model [1]. Majetta et al. described a method of generating large amounts of data and using it to find the relationship between a room controller and a certain room. Simulation scenarios with different room location, usage, and controller models could be defined and developed with it [2]. Wang has built a linguistics artificial intelligence teaching model with improved machine learning algorithms. The efficiency of the teaching process was improved according to the teaching needs of linguistics. A pedagogical evaluation was conducted, and an MCTS-based root cause analysis algorithm was also optimized [3]. Grath et al. intend to investigate the clinical utility of applying deep learning denoising algorithms to standard wide-field optical coherence tomography angiography (OCT-A) images [4]. Zakaria et al. discussed the optimization of hyperparameters for both models. Then sensitivity analysis and uncertainty analysis were performed. The model’s ability to predict river levels with different lead times (1, 3, 6, 9, 12, and 24 hours) was then investigated [5]. Sebastianelli et al. aimed to describe a new tool to support agencies in implementing targeted responses, which was based on quantitative and multiscale elements to combat and prevent emergencies, such as the current COVID-19 pandemic [6]. Liu et al. presented a crowd-sourced inference method with variational tempering that obtains the ground truth. Both worker reliability and task difficulty level were taken into account, and local optima was ensured [7]. Mirotta et al. focused on interpreting fuel rod behavior during power pulses using an online fuel motion monitoring system called a hodoscope [8]. The study of Nowakowski et al. included a simulation of e-waste collection requests in Tokyo, Philadelphia, and Warsaw, which was the algorithm used to compare various city, street, and building layouts. The results showed that the best of the four algorithms was simulated annealing to facilitate mobile on-demand collection of e-waste, and the worst was tabu search [9]. Barcelos et al. introduced a new current-based method to identify bearing damage, applying artificial intelligence algorithms. Experiments and field tests showed promising results, validating the method for bearing damage diagnosis [10]. The work of Prabakaran introduced a new current-based approach that applied artificial intelligence algorithms to identify bearing damage. Experiments and field tests presented promising results, validating this method for the diagnosis of bearing damage [11]. Mihai et al. in the paper aimed to develop three machine learning algorithms. It could significantly improve the drug discovery process, which was possible to combine computer scientists and drug development experts [12]. The landslide susceptibility maps produced by Chen et al.’s research could be used to manage landslide hazards and risks in counties, township, and other similar areas [13]. However, the above-mentioned field research on artificial intelligence algorithms only stays in the theoretical part, and the practicality is not strong.


## 3. Artificial Intelligence Algorithms

### 3.1. Artificial Neural Networks

Overview: the term “Artificial Neural Network” (ANN) is derived from biomedical neural networks. A neuron can establish connections with multiple surrounding neurons through dendrites and axons to receive, process, and transmit information [14]. The human body’s complex nervous system is built on hundreds of millions of neurons. Therefore, building a neural network that mimics the biological nervous system can help understand and capture the information implicit in the data. A single neuron model is shown in Figure 1.Figure 1
Single neuron structure.The forward transmission of neuron information can be represented by(1)y=fwixi+b.In formula (2), Xi represents the input signal; wi represents the weight; b represents the bias part; y represents the signal output. The commonly used activation function is the sigmoid function as(2)fx=11+expx.In traffic forecasting, traffic data are input into the forecasting model as a time series. First, the training of the model needs to be completed. Then the trained model is used to make predictions. Usually, the optimization objective can be set as the error:(3)Ex=12∑i=1Nyixi−yixi2.In formula (3), yi(xi) represents the output data; yi′ (xi) represents the target data; and N represents the number of data. Neural networks have often been used in combination with other optimization algorithms in traffic prediction in previous studies to obtain better prediction models [15].


### 3.2. Support Vector Machine Algorithm

Support vector machine (SVM) is a class of generalized linear classifiers that perform binary classification on data by supervised learning. It is a classifier with sparsity and robustness. Originally developed for solving linearly separable problems, support vector machine algorithms were developed on the basis of statistical theory and then gradually extended to the nonlinear case.The mapping from the input feature space to thek-dimensional space in nonlinear classification is as(4)x∈Rl⟶y∈Rk.The classification can be done using(5)gx=wTx+w0=∑i=1Nsλiyixix+w0.In formula (5), Ns represents the number of support vectors. Typical choices of kernel functions are as(6)Kx,z=xTz+1q,q>0,(7)Kx,z=exp−x−z2σ2,(8)Kx,z=tanhβxTz+γ.After a suitable kernel function is selected, the mapping to a higher dimensional space is implicitly defined. The Wolfe double optimization task becomes(9)max∑iλi−12∑i,jλλyyKxi,xj∑iλiyi=0.The resulting linear classification is as follows:(10)Ifgx=∑i=1NsλyKxi,x+wo<0,x∈w1w2.Figure2 shows a nonlinear SVM architecture, where the number of nodes is determined by the number of support vectors.Figure 2
SVM architecture of kernel functions.The SVM algorithm has great advantages in dealing with problems with smaller sample sizes. In case of larger problem design or when dealing with multiclassification problems, it is difficult to implement due to the complex solving process and the large amount of computation [16].


### 3.3. Cluster Analysis Algorithms

Meaning: agglomeration refers to the division of a collection of physical or abstract objects into multiple classes or groups, so that all objects belonging to the same class have a high degree of similarity, while objects in different classes are quite different [17]. The dissimilarity is calculated according to the attribute value of the described object, and the distance is the most commonly used measure. The class to be divided into clustering is unknown, which is different from classification, that is, clustering is an unsupervised observational learning. It is a data reduction technique that groups together variables or cases with similar data characteristics. It can be used in the development and research of data storage technology in the design and research of game data acquisition systems, and can construct Mysql database by using cluster analysis algorithm.Suppose thatx = (x1,…,xp), y = (y1,…,yp) are two points in space whose Minkowski distance is(11)dx,y=∑ipxi−yim1m,m>0.Whenm = 1, 2, ∞, three commonly used distances are obtained:(1)
Whenm = 1, it is the absolute value distance as(12)dx,y=∑ipxi−yi.(2)
Whenm = 2, it is the Euclidean distance as (13)dx,y=∑ipxi−yi2.(3)
Whenm =  ∞, it is the Chebyshev distance as(14)dx,y=maxixi−yi.Minkowski distance satisfies the following three properties as(15)dx,y=dy,x,(16)dx,y≤dx,z+dz,y,(17)Ifx≠y,dx,y>0,dx,x=0.It should be noted that Minkowski distance is only limited to measure the similarity between numerical individuals and cannot be used to measure the similarity of attribute individuals. Observing the expression of Min’s distance, it is easy to know that Min’s distance is easily affected by larger data and ignores data with smaller values [18]. Min’s distance often has a large error when there is data with a large value in a certain sample. In addition, Min’s distance does not eliminate the effect of dimension. Since there is a linear correlation between the data, it will affect the distance between them. To eliminate this effect, the researchers propose the Mahalanobis distance based on the covariance between the data. Two vectors are randomly selected from the sample, and their Mahalanobis distance is as(18)dx,y=x−y∑−1x−yT.(1)
It is often necessary to discriminate the effect of a certain kind of clustering in practice. The standard function of clustering used is as follows.Between-class dispersion sum of squares functions:(19)J=∑jkCj−CTCj−C.In formula (19), k represents the number of clusters; cj represents the class center of a cluster; c represents the sample center.(2)
Within-class dispersion sum of squares functions:(20)J=∑j=1k∑i=1Nixij−cj2.In formula (20), xij represents an individual (sample data point) in cluster j; cj is the cluster center; k is the number of clusters set according to prior knowledge; Ni represents the sample capacity of cluster j; xij−cj represents the distance from xij to the class center cj.Therefore, it can be seen from the above method that the artificial neural network algorithm can play a role in helping it establish the framework of the data acquisition system in the framework of the data acquisition system. The support vector machine method can help the establishment of the reporting module in the data acquisition system. The cluster analysis algorithm can help the design of data storage services, and the data acquisition system designed by the above algorithm is of great significance at present.


## 3.1. Artificial Neural Networks

Overview: the term “Artificial Neural Network” (ANN) is derived from biomedical neural networks. A neuron can establish connections with multiple surrounding neurons through dendrites and axons to receive, process, and transmit information [14]. The human body’s complex nervous system is built on hundreds of millions of neurons. Therefore, building a neural network that mimics the biological nervous system can help understand and capture the information implicit in the data. A single neuron model is shown in Figure 1.Figure 1
Single neuron structure.The forward transmission of neuron information can be represented by(1)y=fwixi+b.In formula (2), Xi represents the input signal; wi represents the weight; b represents the bias part; y represents the signal output. The commonly used activation function is the sigmoid function as(2)fx=11+expx.In traffic forecasting, traffic data are input into the forecasting model as a time series. First, the training of the model needs to be completed. Then the trained model is used to make predictions. Usually, the optimization objective can be set as the error:(3)Ex=12∑i=1Nyixi−yixi2.In formula (3), yi(xi) represents the output data; yi′ (xi) represents the target data; and N represents the number of data. Neural networks have often been used in combination with other optimization algorithms in traffic prediction in previous studies to obtain better prediction models [15].


## 3.2. Support Vector Machine Algorithm

Support vector machine (SVM) is a class of generalized linear classifiers that perform binary classification on data by supervised learning. It is a classifier with sparsity and robustness. Originally developed for solving linearly separable problems, support vector machine algorithms were developed on the basis of statistical theory and then gradually extended to the nonlinear case.The mapping from the input feature space to thek-dimensional space in nonlinear classification is as(4)x∈Rl⟶y∈Rk.The classification can be done using(5)gx=wTx+w0=∑i=1Nsλiyixix+w0.In formula (5), Ns represents the number of support vectors. Typical choices of kernel functions are as(6)Kx,z=xTz+1q,q>0,(7)Kx,z=exp−x−z2σ2,(8)Kx,z=tanhβxTz+γ.After a suitable kernel function is selected, the mapping to a higher dimensional space is implicitly defined. The Wolfe double optimization task becomes(9)max∑iλi−12∑i,jλλyyKxi,xj∑iλiyi=0.The resulting linear classification is as follows:(10)Ifgx=∑i=1NsλyKxi,x+wo<0,x∈w1w2.Figure2 shows a nonlinear SVM architecture, where the number of nodes is determined by the number of support vectors.Figure 2
SVM architecture of kernel functions.The SVM algorithm has great advantages in dealing with problems with smaller sample sizes. In case of larger problem design or when dealing with multiclassification problems, it is difficult to implement due to the complex solving process and the large amount of computation [16].


## 3.3. Cluster Analysis Algorithms

Meaning: agglomeration refers to the division of a collection of physical or abstract objects into multiple classes or groups, so that all objects belonging to the same class have a high degree of similarity, while objects in different classes are quite different [17]. The dissimilarity is calculated according to the attribute value of the described object, and the distance is the most commonly used measure. The class to be divided into clustering is unknown, which is different from classification, that is, clustering is an unsupervised observational learning. It is a data reduction technique that groups together variables or cases with similar data characteristics. It can be used in the development and research of data storage technology in the design and research of game data acquisition systems, and can construct Mysql database by using cluster analysis algorithm.Suppose thatx = (x1,…,xp), y = (y1,…,yp) are two points in space whose Minkowski distance is(11)dx,y=∑ipxi−yim1m,m>0.Whenm = 1, 2, ∞, three commonly used distances are obtained:(1)
Whenm = 1, it is the absolute value distance as(12)dx,y=∑ipxi−yi.(2)
Whenm = 2, it is the Euclidean distance as (13)dx,y=∑ipxi−yi2.(3)
Whenm =  ∞, it is the Chebyshev distance as(14)dx,y=maxixi−yi.Minkowski distance satisfies the following three properties as(15)dx,y=dy,x,(16)dx,y≤dx,z+dz,y,(17)Ifx≠y,dx,y>0,dx,x=0.It should be noted that Minkowski distance is only limited to measure the similarity between numerical individuals and cannot be used to measure the similarity of attribute individuals. Observing the expression of Min’s distance, it is easy to know that Min’s distance is easily affected by larger data and ignores data with smaller values [18]. Min’s distance often has a large error when there is data with a large value in a certain sample. In addition, Min’s distance does not eliminate the effect of dimension. Since there is a linear correlation between the data, it will affect the distance between them. To eliminate this effect, the researchers propose the Mahalanobis distance based on the covariance between the data. Two vectors are randomly selected from the sample, and their Mahalanobis distance is as(18)dx,y=x−y∑−1x−yT.(1)
It is often necessary to discriminate the effect of a certain kind of clustering in practice. The standard function of clustering used is as follows.Between-class dispersion sum of squares functions:(19)J=∑jkCj−CTCj−C.In formula (19), k represents the number of clusters; cj represents the class center of a cluster; c represents the sample center.(2)
Within-class dispersion sum of squares functions:(20)J=∑j=1k∑i=1Nixij−cj2.In formula (20), xij represents an individual (sample data point) in cluster j; cj is the cluster center; k is the number of clusters set according to prior knowledge; Ni represents the sample capacity of cluster j; xij−cj represents the distance from xij to the class center cj.Therefore, it can be seen from the above method that the artificial neural network algorithm can play a role in helping it establish the framework of the data acquisition system in the framework of the data acquisition system. The support vector machine method can help the establishment of the reporting module in the data acquisition system. The cluster analysis algorithm can help the design of data storage services, and the data acquisition system designed by the above algorithm is of great significance at present.


## 4. Construction and Design of the Data Acquisition System

### 4.1. Acquisition Process

The entire data collection tool collection process starts after the data collection tool SDK is initialized when the app starts. When the app is installed for the first time, it obtains and reports the information required for app channel statistics. When it is started for the first time today, it will report yesterday’s PV data and startup times and other total data from yesterday. Otherwise, it will report the application profile data that needs to be counted for this startup, such as the startup time and the duration of the application used after the last startup. The collection of real-time data such as player behavior occurs after the application is started and when an interaction event occurs during the player’s operation. After the original touch event is generated, the original event information needs to be matched with the information of the view layer. Then, the target data are obtained by step-by-step reflection according to the data path, and after finding the original interaction event of the data, the data are reported according to the reporting policy. The data analysis module processes the data and generates data files, and the interaction module grabs the data files and uploads them to the server. The overall workflow of the data acquisition tool is shown in Figure3.Figure 3
Workflow diagram.


### 4.2. Outline Design of Technical Architecture

From the perspective of technical implementation, the mobile game application data collection tools are mainly divided into two parts: One part is data collection, and the other part is data reporting. Among them, the core part is data collection. The data collection and data reporting are connected to the SQLite database through the Handler message mechanism. This section will introduce the outline design of the technical architecture of the mobile game application data collection tool in two parts: the outline design of the technical architecture of data collection and the outline design of the technical architecture of data reporting.


### 4.3. Outline Design of Data Acquisition Technology Architecture

The overall technical architecture adopts a top-to-bottom transmission design. The mobile game application receives touch events from the user, and the system calls the callback method of the related event when the event occurs. Since the custom AOP code has been inserted into the header of the callback method by means of byte code instrumentation at compile time, the AOP code acts as a proxy to perform data collection and processing operations for related events [19]. After the data collection is completed, the collected relevant data are distributed through the handler message delivery mechanism to distribute the messages of the user operation events, and the messages are cached in the message queue. The outline design of the data acquisition technology architecture is shown in Figure 4.Figure 4
Data acquisition technology architecture diagram.


### 4.4. Outline Design of Data Reporting Technical Architecture

The data reporting part defines the data reporting policy, which determines whether the current data needs to be reported. The data sources include the current in-memory cached data from the Handler message distribution center and the historical data stored in the SQLite database. The schematic design of the data reporting technology architecture is shown in Figure5.Figure 5
Overview of data reporting technology.As can be seen from the figure, the data reporting technology includes the current in-memory cached data from the Handler message distribution center and the historical data stored in the SQLite database, which are loaded into the data storage server through the Kafka cluster.


### 4.5. Outline Design of the General Data Acquisition Module

The general data collection module is responsible for collecting general data. This module will introduce the collection of general data from four parts: application overview, channel statistics, user equipment, and PV statistics.


#### 4.5.1. Application Overview

The application profile mainly collects crash information, supplemented by application version, device identification information, usage time, and startup times. Crash information plays an essential role in the development process. By collecting crash information, it can count the stack information of various exceptions that occur in user scenarios. Developers repair crashes in time to reduce the frequency of crashes, which can improve the stability of the application and improve the user experience. The model class design of the application profile is given in Table1.Table 1
Application overview model class.
Model typeField nameMeaningApplication Data BlockappVersionApplication versioncrashInfoApplication crash informationdeviceTagDevice identificationusedTimeLength of uselaunchCountNumber of starts


#### 4.5.2. Channel Design

Channel statistics mainly count the channel from which the application currently used by the user is downloaded. The purpose of obtaining geographic location information is to better statistically analyze the geographic distribution of the user. To realize channel statistics, this paper designs a custom multichannel packaging tool. It writes the channel information in the generated package through a custom multichannel packaging tool, so that the data collection SDK can obtain the channel information when the application is running. The model class design of channel statistics is given in Table2.Table 2
Channel statistics model class.
Model typeField nameMeaningChannel Data BlockchannelNameChannel namedeviceNameDevice nameuserPositionUser location


#### 4.5.3. User Equipment

User device statistics system version number, screen resolution, remaining memory, networking mode, IP address, and other device information, such as ACTIVITY_SERVICE, CONNECTIVITY_SERVICE, and WIFI_SERVICE, etc. By obtaining the object corresponding to the system service, the corresponding device information can be obtained. The model class design of the user equipment is given in Table3.Table 3
User device model class.
Model typeField nameMeaningDevice Data BlockdeviceModelDevice modelsystemVersionSystem version numberScreenScreen resolutioniResolutionRemaining memoryMemory remainNetworking methodnetModeNetwork operatornetOperatorIP addressipAdressUser location


#### 4.5.4. PV Statistics

PV statistics are responsible for counting the number of clicks each person has on each page every day. The statistical information includes the name of the current page and the corresponding PV times. These data are of great significance for the statistics of users’ preferences for APP usage. The model class definition of PV statistics is given in Table4.Table 4
PV statistics model class.
Model typeField nameMeaningPVD Data BlockpageNamePage namedeviceTagUser device IDpagePVCountPage PV count.The statistical method of PV time mainly updates the PV times of the page in the corresponding data table by implanting the database update operation in the onCreate method of activity or fragment. It takes an event page as an example. If users open a certain event page frequently, it means that the current activities in the online environment are very attractive to users, which has great guiding significance for future event organization and strategy formulation.


### 4.6. Data Storage Service

This paper uses Kafka as the message system for server-side data storage. Since Kafka is distributed, it can meet the requirements of high concurrency and high throughput brought by real-time data reporting by data collection tools. The processing flow of the data storage service data flow is shown in Figure6.Figure 6
Processing flow of data storage service data flow.As a message middleware, the Kafka cluster is not only responsible for processing the data reported from the client, storing the data in MySql in turn, but also processing the data query from the data statistics analysis service and the PC front-end, and extracting the data from MySql. As the amount of business data increases, the number of Kafka can be increased to horizontally expand Kafka and improve the throughput of the Kafka cluster. The specific storage of MySql data is similar to the client’s SQLite storage [20].This section is the key chapter of this paper and is the realization part of the whole data acquisition tool. In this chapter, the design and implementation of general data collection module, custom data collection module, user behavior data collection module, byte code instrumentation module, data reporting module, and server-side data storage module of game application data collection tools are introduced in detail in combination with the artificial intelligence algorithm analysis and outline design in the Methods section. Through the detailed introduction in this chapter, all requirements of the game application data acquisition system have been completed.


## 4.1. Acquisition Process

The entire data collection tool collection process starts after the data collection tool SDK is initialized when the app starts. When the app is installed for the first time, it obtains and reports the information required for app channel statistics. When it is started for the first time today, it will report yesterday’s PV data and startup times and other total data from yesterday. Otherwise, it will report the application profile data that needs to be counted for this startup, such as the startup time and the duration of the application used after the last startup. The collection of real-time data such as player behavior occurs after the application is started and when an interaction event occurs during the player’s operation. After the original touch event is generated, the original event information needs to be matched with the information of the view layer. Then, the target data are obtained by step-by-step reflection according to the data path, and after finding the original interaction event of the data, the data are reported according to the reporting policy. The data analysis module processes the data and generates data files, and the interaction module grabs the data files and uploads them to the server. The overall workflow of the data acquisition tool is shown in Figure3.Figure 3
Workflow diagram.


## 4.2. Outline Design of Technical Architecture

From the perspective of technical implementation, the mobile game application data collection tools are mainly divided into two parts: One part is data collection, and the other part is data reporting. Among them, the core part is data collection. The data collection and data reporting are connected to the SQLite database through the Handler message mechanism. This section will introduce the outline design of the technical architecture of the mobile game application data collection tool in two parts: the outline design of the technical architecture of data collection and the outline design of the technical architecture of data reporting.


## 4.3. Outline Design of Data Acquisition Technology Architecture

The overall technical architecture adopts a top-to-bottom transmission design. The mobile game application receives touch events from the user, and the system calls the callback method of the related event when the event occurs. Since the custom AOP code has been inserted into the header of the callback method by means of byte code instrumentation at compile time, the AOP code acts as a proxy to perform data collection and processing operations for related events [19]. After the data collection is completed, the collected relevant data are distributed through the handler message delivery mechanism to distribute the messages of the user operation events, and the messages are cached in the message queue. The outline design of the data acquisition technology architecture is shown in Figure 4.Figure 4
Data acquisition technology architecture diagram.


## 4.4. Outline Design of Data Reporting Technical Architecture

The data reporting part defines the data reporting policy, which determines whether the current data needs to be reported. The data sources include the current in-memory cached data from the Handler message distribution center and the historical data stored in the SQLite database. The schematic design of the data reporting technology architecture is shown in Figure5.Figure 5
Overview of data reporting technology.As can be seen from the figure, the data reporting technology includes the current in-memory cached data from the Handler message distribution center and the historical data stored in the SQLite database, which are loaded into the data storage server through the Kafka cluster.


## 4.5. Outline Design of the General Data Acquisition Module

The general data collection module is responsible for collecting general data. This module will introduce the collection of general data from four parts: application overview, channel statistics, user equipment, and PV statistics.


### 4.5.1. Application Overview

The application profile mainly collects crash information, supplemented by application version, device identification information, usage time, and startup times. Crash information plays an essential role in the development process. By collecting crash information, it can count the stack information of various exceptions that occur in user scenarios. Developers repair crashes in time to reduce the frequency of crashes, which can improve the stability of the application and improve the user experience. The model class design of the application profile is given in Table1.Table 1
Application overview model class.
Model typeField nameMeaningApplication Data BlockappVersionApplication versioncrashInfoApplication crash informationdeviceTagDevice identificationusedTimeLength of uselaunchCountNumber of starts


### 4.5.2. Channel Design

Channel statistics mainly count the channel from which the application currently used by the user is downloaded. The purpose of obtaining geographic location information is to better statistically analyze the geographic distribution of the user. To realize channel statistics, this paper designs a custom multichannel packaging tool. It writes the channel information in the generated package through a custom multichannel packaging tool, so that the data collection SDK can obtain the channel information when the application is running. The model class design of channel statistics is given in Table2.Table 2
Channel statistics model class.
Model typeField nameMeaningChannel Data BlockchannelNameChannel namedeviceNameDevice nameuserPositionUser location


### 4.5.3. User Equipment

User device statistics system version number, screen resolution, remaining memory, networking mode, IP address, and other device information, such as ACTIVITY_SERVICE, CONNECTIVITY_SERVICE, and WIFI_SERVICE, etc. By obtaining the object corresponding to the system service, the corresponding device information can be obtained. The model class design of the user equipment is given in Table3.Table 3
User device model class.
Model typeField nameMeaningDevice Data BlockdeviceModelDevice modelsystemVersionSystem version numberScreenScreen resolutioniResolutionRemaining memoryMemory remainNetworking methodnetModeNetwork operatornetOperatorIP addressipAdressUser location


### 4.5.4. PV Statistics

PV statistics are responsible for counting the number of clicks each person has on each page every day. The statistical information includes the name of the current page and the corresponding PV times. These data are of great significance for the statistics of users’ preferences for APP usage. The model class definition of PV statistics is given in Table4.Table 4
PV statistics model class.
Model typeField nameMeaningPVD Data BlockpageNamePage namedeviceTagUser device IDpagePVCountPage PV count.The statistical method of PV time mainly updates the PV times of the page in the corresponding data table by implanting the database update operation in the onCreate method of activity or fragment. It takes an event page as an example. If users open a certain event page frequently, it means that the current activities in the online environment are very attractive to users, which has great guiding significance for future event organization and strategy formulation.


## 4.5.1. Application Overview

The application profile mainly collects crash information, supplemented by application version, device identification information, usage time, and startup times. Crash information plays an essential role in the development process. By collecting crash information, it can count the stack information of various exceptions that occur in user scenarios. Developers repair crashes in time to reduce the frequency of crashes, which can improve the stability of the application and improve the user experience. The model class design of the application profile is given in Table1.Table 1
Application overview model class.
Model typeField nameMeaningApplication Data BlockappVersionApplication versioncrashInfoApplication crash informationdeviceTagDevice identificationusedTimeLength of uselaunchCountNumber of starts


## 4.5.2. Channel Design

Channel statistics mainly count the channel from which the application currently used by the user is downloaded. The purpose of obtaining geographic location information is to better statistically analyze the geographic distribution of the user. To realize channel statistics, this paper designs a custom multichannel packaging tool. It writes the channel information in the generated package through a custom multichannel packaging tool, so that the data collection SDK can obtain the channel information when the application is running. The model class design of channel statistics is given in Table2.Table 2
Channel statistics model class.
Model typeField nameMeaningChannel Data BlockchannelNameChannel namedeviceNameDevice nameuserPositionUser location


## 4.5.3. User Equipment

User device statistics system version number, screen resolution, remaining memory, networking mode, IP address, and other device information, such as ACTIVITY_SERVICE, CONNECTIVITY_SERVICE, and WIFI_SERVICE, etc. By obtaining the object corresponding to the system service, the corresponding device information can be obtained. The model class design of the user equipment is given in Table3.Table 3
User device model class.
Model typeField nameMeaningDevice Data BlockdeviceModelDevice modelsystemVersionSystem version numberScreenScreen resolutioniResolutionRemaining memoryMemory remainNetworking methodnetModeNetwork operatornetOperatorIP addressipAdressUser location


## 4.5.4. PV Statistics

PV statistics are responsible for counting the number of clicks each person has on each page every day. The statistical information includes the name of the current page and the corresponding PV times. These data are of great significance for the statistics of users’ preferences for APP usage. The model class definition of PV statistics is given in Table4.Table 4
PV statistics model class.
Model typeField nameMeaningPVD Data BlockpageNamePage namedeviceTagUser device IDpagePVCountPage PV count.The statistical method of PV time mainly updates the PV times of the page in the corresponding data table by implanting the database update operation in the onCreate method of activity or fragment. It takes an event page as an example. If users open a certain event page frequently, it means that the current activities in the online environment are very attractive to users, which has great guiding significance for future event organization and strategy formulation.


## 4.6. Data Storage Service

This paper uses Kafka as the message system for server-side data storage. Since Kafka is distributed, it can meet the requirements of high concurrency and high throughput brought by real-time data reporting by data collection tools. The processing flow of the data storage service data flow is shown in Figure6.Figure 6
Processing flow of data storage service data flow.As a message middleware, the Kafka cluster is not only responsible for processing the data reported from the client, storing the data in MySql in turn, but also processing the data query from the data statistics analysis service and the PC front-end, and extracting the data from MySql. As the amount of business data increases, the number of Kafka can be increased to horizontally expand Kafka and improve the throughput of the Kafka cluster. The specific storage of MySql data is similar to the client’s SQLite storage [20].This section is the key chapter of this paper and is the realization part of the whole data acquisition tool. In this chapter, the design and implementation of general data collection module, custom data collection module, user behavior data collection module, byte code instrumentation module, data reporting module, and server-side data storage module of game application data collection tools are introduced in detail in combination with the artificial intelligence algorithm analysis and outline design in the Methods section. Through the detailed introduction in this chapter, all requirements of the game application data acquisition system have been completed.


## 5. Game Data Acquisition System Test and Results

This section tests and analyzes the mobile game data collection tool to verify whether the design and implementation of the tool meet the design requirements of the tool.


### 5.1. Test Environment

Based on the support vector machine algorithm in the artificial intelligence algorithm, combined with its characteristics in data analysis, the latest data on the distribution of Android platform versions released on the official website of Google Android developers show that Android 5.1, Android 6.0, Android 7.0, and Android 8.0 versions occupy 19.2%, 28.1%, 22.3%, and 21.7% of the market share, respectively, which occupies the top four in market share. Therefore, this article selects an Android mobile phone with the above four Android versions as the test mobile phone in this chapter. The selected mobile phone parameters are given in Table5.Table 5
Test phone parameter information.
Device modelSystem versionScreen size (inch)Screen resolutionOPPO R9Android 5.15.51920∗1080Meizu MX6Android 6.05.51920∗1080Huawei nova2 PlusAndroid 7.05.51920∗1080Redmi K50 ProAndroid 8.06.71920∗1080


### 5.2. Test Plan

The testing part of this paper will start from two aspects, namely, functional testing and performance testing. The goal of functional testing is to verify whether each module of the data acquisition tool meets the basic data acquisition functional requirements, including the general data acquisition module and the custom data acquisition module, to ensure the integrity of the tool function [21]. Since this article collects data from Android mobile games, this article takes the practice project chess and card game as an example and tests the functional requirements and performance requirements of the data collection tool according to the requirements put forward by the above evaluation in this article.


### 5.3. Functional Test of the General Data Acquisition Module

The function test of the general data acquisition module will start from the four functions of application overview information, channel statistics information, user equipment information, and PV statistics information to test whether the data collected by each function is correct. The test details of the general data acquisition module are as follows:


#### 5.3.1. Test Content

Collect all information including application profile information, channel statistics, user device information, and PV statistics, such as app version number, crash information, app download channel number, phone screen resolution, page clicks, etc.


#### 5.3.2. Test Steps

Through the channel packaging tool, the information of three different channels, Test1, Test2, and Test3, is written to the generated Release APK file. Then it opens the game, collects the application overview, channel statistics, and user device information, and clicks the button to switch pages to collect PV statistics on different pages. Finally, by inserting the code that accesses the data out-of-bounds in the code, the crash information is counted when this code is executed.Figure 7
Test result graph.


#### 5.3.3. Expected Results

(1)
During the running of the game, there is no game lag phenomenon(2)
When the array out-of-bounds code is executed, the application flashes back, and the collected Crash information is also caused by the out-of-bounds array(3)
The application profile data, channel statistics, user equipment data, and PV statistics are all the correct data collectedTest results are shown in Figure7.


### 5.4. Function Test of the Custom Data Acquisition Module

The function of the custom data acquisition module is mainly based on the needs of the game project itself, configure the target data file to collect, and collect the corresponding data. This section will take chess and card games as an example to test the collection of the following information: time when entering/exiting the game; the time when the purchase room card option in the mall interface is clicked; the specific room card amount data of this option; the push message of the operation activity is clicked; entering the game selection page, the specific game is clicked event. The test details of the custom data acquisition module are as follows:


#### 5.4.1. Test Content

Collect the time of entering the game and exiting the game; the specific amount data when the recharge amount option is clicked; the news push of the operation activity is clicked; the event of the subgame is selected.


#### 5.4.2. Test Steps

First, it configures a custom data collection configuration file on the server and delivers it to the client. Next, it opens the chess and card game, receives the configuration file, collects the time of entering the game, then enters the mall interface, and selects room cards of different numbers in turn. After collecting the amount information of the selected room card, it enters the game selection interface. When Doudizhu or Mahjong is selected, it determines which game is selected to capture the event. When there is a news push of operational activities, it collects the page address to which the clicked news push jumps. Finally, when the user exits the game, the time of exiting the game is collected.


#### 5.4.3. Expected Results

(1)
During the running of the game, there is no game lag(2)
The collected time, amount, url, and other data will be displayed in the console in the form of logs


#### 5.4.4. Test Results

The result is shown in Figure8.Figure 8
Functional test result graph.


### 5.5. Data Collection Performance Test

The data collection performance test mainly tests the time-consuming situation of collecting data, and the result of the data collection performance test is an important basis for judging whether the data collection tool meets the basic requirements of mobile game collection data [22]. This article will generate a large amount of user behavior data by frequently operating the game within a certain period of time. It judges whether the performance of the data collection tool meets the actual use requirements according to whether there is a freeze or crash. The data acquisition performance test results are shown in Figure 9.Figure 9
Relationship between time consumption, acquisition rate, and number of acquisitions.From the table that when the number of continuously collected data is less than 1000, the time consumption is within the acceptable range within 3 seconds, and there is no stuck phenomenon or crash phenomenon.


### 5.6. Data Read and Write Performance Test

The data read and write performance test mainly tests the time-consuming situation of reading and writing data in the SQLite database, to verify whether there is a serious performance problem when using the SQLite database to read and write data under the non-real-time reporting strategy. The test method is to modify the reporting policy to batch reporting and set the reporting threshold to 1000. It adds time-counting code to the methods of inserting data and reading data, respectively, and outputs time-consuming through the console.


### 5.7. Test Results

After the above functional tests of each module of the data acquisition tool, it shows the functions of each module, passing the test, and are in line with expectations. The functional test results show that the data acquisition tool can complete the functions of general data acquisition and custom data acquisition and has the function of local database storage. The evaluation of the data storage service based on the clustering algorithm is no different than the previous data storage service. Through functional testing, the mobile game data collection tool has met the expectations of functional design requirements and completed the basic functions of data collection and data reporting [23, 24]. The performance test of the system includes the data acquisition performance test and the data read and write performance test. If the test passes, it means that the test results of the system meet the expected values and perfectly fit the normal operation of the game application.


## 5.1. Test Environment

Based on the support vector machine algorithm in the artificial intelligence algorithm, combined with its characteristics in data analysis, the latest data on the distribution of Android platform versions released on the official website of Google Android developers show that Android 5.1, Android 6.0, Android 7.0, and Android 8.0 versions occupy 19.2%, 28.1%, 22.3%, and 21.7% of the market share, respectively, which occupies the top four in market share. Therefore, this article selects an Android mobile phone with the above four Android versions as the test mobile phone in this chapter. The selected mobile phone parameters are given in Table5.Table 5
Test phone parameter information.
Device modelSystem versionScreen size (inch)Screen resolutionOPPO R9Android 5.15.51920∗1080Meizu MX6Android 6.05.51920∗1080Huawei nova2 PlusAndroid 7.05.51920∗1080Redmi K50 ProAndroid 8.06.71920∗1080


## 5.2. Test Plan

The testing part of this paper will start from two aspects, namely, functional testing and performance testing. The goal of functional testing is to verify whether each module of the data acquisition tool meets the basic data acquisition functional requirements, including the general data acquisition module and the custom data acquisition module, to ensure the integrity of the tool function [21]. Since this article collects data from Android mobile games, this article takes the practice project chess and card game as an example and tests the functional requirements and performance requirements of the data collection tool according to the requirements put forward by the above evaluation in this article.


## 5.3. Functional Test of the General Data Acquisition Module

The function test of the general data acquisition module will start from the four functions of application overview information, channel statistics information, user equipment information, and PV statistics information to test whether the data collected by each function is correct. The test details of the general data acquisition module are as follows:


### 5.3.1. Test Content

Collect all information including application profile information, channel statistics, user device information, and PV statistics, such as app version number, crash information, app download channel number, phone screen resolution, page clicks, etc.


### 5.3.2. Test Steps

Through the channel packaging tool, the information of three different channels, Test1, Test2, and Test3, is written to the generated Release APK file. Then it opens the game, collects the application overview, channel statistics, and user device information, and clicks the button to switch pages to collect PV statistics on different pages. Finally, by inserting the code that accesses the data out-of-bounds in the code, the crash information is counted when this code is executed.Figure 7
Test result graph.


### 5.3.3. Expected Results

(1)
During the running of the game, there is no game lag phenomenon(2)
When the array out-of-bounds code is executed, the application flashes back, and the collected Crash information is also caused by the out-of-bounds array(3)
The application profile data, channel statistics, user equipment data, and PV statistics are all the correct data collectedTest results are shown in Figure7.


## 5.3.1. Test Content

Collect all information including application profile information, channel statistics, user device information, and PV statistics, such as app version number, crash information, app download channel number, phone screen resolution, page clicks, etc.


## 5.3.2. Test Steps

Through the channel packaging tool, the information of three different channels, Test1, Test2, and Test3, is written to the generated Release APK file. Then it opens the game, collects the application overview, channel statistics, and user device information, and clicks the button to switch pages to collect PV statistics on different pages. Finally, by inserting the code that accesses the data out-of-bounds in the code, the crash information is counted when this code is executed.Figure 7
Test result graph.


## 5.3.3. Expected Results

(1)
During the running of the game, there is no game lag phenomenon(2)
When the array out-of-bounds code is executed, the application flashes back, and the collected Crash information is also caused by the out-of-bounds array(3)
The application profile data, channel statistics, user equipment data, and PV statistics are all the correct data collectedTest results are shown in Figure7.


## 5.4. Function Test of the Custom Data Acquisition Module

The function of the custom data acquisition module is mainly based on the needs of the game project itself, configure the target data file to collect, and collect the corresponding data. This section will take chess and card games as an example to test the collection of the following information: time when entering/exiting the game; the time when the purchase room card option in the mall interface is clicked; the specific room card amount data of this option; the push message of the operation activity is clicked; entering the game selection page, the specific game is clicked event. The test details of the custom data acquisition module are as follows:


### 5.4.1. Test Content

Collect the time of entering the game and exiting the game; the specific amount data when the recharge amount option is clicked; the news push of the operation activity is clicked; the event of the subgame is selected.


### 5.4.2. Test Steps

First, it configures a custom data collection configuration file on the server and delivers it to the client. Next, it opens the chess and card game, receives the configuration file, collects the time of entering the game, then enters the mall interface, and selects room cards of different numbers in turn. After collecting the amount information of the selected room card, it enters the game selection interface. When Doudizhu or Mahjong is selected, it determines which game is selected to capture the event. When there is a news push of operational activities, it collects the page address to which the clicked news push jumps. Finally, when the user exits the game, the time of exiting the game is collected.


### 5.4.3. Expected Results

(1)
During the running of the game, there is no game lag(2)
The collected time, amount, url, and other data will be displayed in the console in the form of logs


### 5.4.4. Test Results

The result is shown in Figure8.Figure 8
Functional test result graph.


## 5.4.1. Test Content

Collect the time of entering the game and exiting the game; the specific amount data when the recharge amount option is clicked; the news push of the operation activity is clicked; the event of the subgame is selected.


## 5.4.2. Test Steps

First, it configures a custom data collection configuration file on the server and delivers it to the client. Next, it opens the chess and card game, receives the configuration file, collects the time of entering the game, then enters the mall interface, and selects room cards of different numbers in turn. After collecting the amount information of the selected room card, it enters the game selection interface. When Doudizhu or Mahjong is selected, it determines which game is selected to capture the event. When there is a news push of operational activities, it collects the page address to which the clicked news push jumps. Finally, when the user exits the game, the time of exiting the game is collected.


## 5.4.3. Expected Results

(1)
During the running of the game, there is no game lag(2)
The collected time, amount, url, and other data will be displayed in the console in the form of logs


## 5.4.4. Test Results

The result is shown in Figure8.Figure 8
Functional test result graph.


## 5.5. Data Collection Performance Test

The data collection performance test mainly tests the time-consuming situation of collecting data, and the result of the data collection performance test is an important basis for judging whether the data collection tool meets the basic requirements of mobile game collection data [22]. This article will generate a large amount of user behavior data by frequently operating the game within a certain period of time. It judges whether the performance of the data collection tool meets the actual use requirements according to whether there is a freeze or crash. The data acquisition performance test results are shown in Figure 9.Figure 9
Relationship between time consumption, acquisition rate, and number of acquisitions.From the table that when the number of continuously collected data is less than 1000, the time consumption is within the acceptable range within 3 seconds, and there is no stuck phenomenon or crash phenomenon.


## 5.6. Data Read and Write Performance Test

The data read and write performance test mainly tests the time-consuming situation of reading and writing data in the SQLite database, to verify whether there is a serious performance problem when using the SQLite database to read and write data under the non-real-time reporting strategy. The test method is to modify the reporting policy to batch reporting and set the reporting threshold to 1000. It adds time-counting code to the methods of inserting data and reading data, respectively, and outputs time-consuming through the console.


## 5.7. Test Results

After the above functional tests of each module of the data acquisition tool, it shows the functions of each module, passing the test, and are in line with expectations. The functional test results show that the data acquisition tool can complete the functions of general data acquisition and custom data acquisition and has the function of local database storage. The evaluation of the data storage service based on the clustering algorithm is no different than the previous data storage service. Through functional testing, the mobile game data collection tool has met the expectations of functional design requirements and completed the basic functions of data collection and data reporting [23, 24]. The performance test of the system includes the data acquisition performance test and the data read and write performance test. If the test passes, it means that the test results of the system meet the expected values and perfectly fit the normal operation of the game application.


## 6. Conclusions

This paper describes the design and research of a game data acquisition system based on artificial intelligence algorithms. The whole paper used artificial neural network algorithm in artificial intelligence algorithm and support vector machine algorithm to construct four modules of game data acquisition system: general data acquisition module, automatic data acquisition module, user behavior data acquisition module and data reporting module. This paper used the cluster analysis algorithm to conduct research and evaluation. It can be seen from the evaluation results that the mobile game application data collection tool functionally fulfills the functional requirements of general data collection, custom data collection, event data collection, data reporting, and back-end data storage. In addition, there is no stuttering phenomenon in the process of collecting data, which is in line with the performance requirements. It can be seen from the above that the game application data collection system provides basic data collection functions for individual developers and small and medium-sized enterprises, which helps users to collect data generated by users when operating games faster and more conveniently, to provide an important data basis for the subsequent improvement of product experience and optimization of product strategy. Mainly in the following aspects: only relying on client-side statistics cannot fully collect data, and some data still needs the cooperation of the server to complete. Taking the statistics of crash data as an example, the crash data obtained by the client-side statistics can only show the situation of crash occurring on this single mobile phone device and cannot obtain the total number of crash occurrences of the game application that day from a macro perspective. The ranking list of the total number of occurrences after aggregation of the same crash type, whether the number of crashes today has increased or decreased compared with the number of crashes yesterday, and so on. Therefore, after the client collects the data and reports it to the server, the server needs to classify, aggregate, and count the data to maximize the utilization of the collected data.



---

*Source: 1679092-2022-07-31.xml*