Game data acquisition method and device, equipment and storage medium
By dividing and storing game data according to access frequency and separately, the data transmission and storage pressure problems in game applications are solved, and efficient data acquisition and traffic overhead are achieved.
Patent Information
- Application Number
- CN202410147320.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-01-31
- Publication Date
- 2025-08-01
AI Technical Summary
In game applications, clients constantly requesting user game data in full, resulting in a large amount of traffic overhead, and the existing technology has failed to effectively solve the data transmission pressure and storage pressure.
By dividing game data into two parts based on access frequency, data with higher access frequency and lower access frequency are backed up in the cache, data with lower access frequency is stored in the database, and stored in different data structures respectively. The client requests to obtain data based on the data type.
It effectively reduces the storage pressure and data transmission pressure of the server, reduces traffic overhead, and improves data acquisition efficiency and user experience.
Smart Images

Figure CN120393431A_ABST
Abstract
Description
Technical Field
[0001] Embodiments of the present application relate to the field of computer technology, and particularly to a method, apparatus, device, and storage medium for obtaining game data. Background Art
[0002] In game applications, the game data generated by users is relatively important data, which has characteristics such as a large amount of data, multiple data types, and complex data structures.
[0003] In related technologies, the server assigns a data structure to each user in the database to permanently record the game data generated by the user. When the user logs in to the game each time, the server backs up all the game data corresponding to the user in the cache. In the case where the client requests all the game data corresponding to the user in full, the server sends all the corresponding game data in the cache to the client for the client to perform logical processing or data display.
[0004] However, since the client continuously requests all the game data of the user in full, a large amount of traffic overhead will be generated. Summary of the Invention
[0005] Embodiments of the present application provide a method, apparatus, device, and storage medium for obtaining game data. The technical solution is as follows:
[0006] According to one aspect of the embodiments of the present application, a method for obtaining game data is provided. The method includes:
[0007] Receiving a data acquisition request from a client, where the data acquisition request is used to acquire game data of at least one data type, and the game data of the at least one data type is related to the user account logged in to the client;
[0008] For a first data type among the at least one data type, when the first data type belongs to a first type set, acquiring the game data of the first data type from the cache, where the game data of each data type in the first type set is backed up in the cache, and the game data of each data type in the first type set is permanently stored in the database in a first data structure;
[0009] When the first data type belongs to a second type set, acquiring the game data of the first data type from the database, where the game data of each data type in the second type set is permanently stored in the database in a second data structure, and the access frequency of the game data stored in the first data structure is greater than the access frequency of the game data stored in the second data structure;
[0010] Send the game data corresponding to the at least one data type to the client.
[0011] According to one aspect of the embodiments of the present application, there is provided an apparatus for obtaining game data, the apparatus comprising:
[0012] An acquisition request receiving module, configured to receive a data acquisition request from a client, the data acquisition request being used to acquire game data of at least one data type, and the game data of the at least one data type being related to a user account logged in to the client;
[0013] A game data acquisition module, configured to, for a first data type among the at least one data type, when the first data type belongs to a first type set, acquire the game data of the first data type from a cache, wherein the game data of each data type in the first type set is backed up in the cache, and the game data of each data type in the first type set is permanently stored in a database in a first data structure;
[0014] The game data acquisition module is further configured to, when the first data type belongs to a second type set, acquire the game data of the first data type from the database, wherein the game data of each data type in the second type set is permanently stored in the database in a second data structure, and the access frequency of the game data stored in the first data structure is greater than the access frequency of the game data stored in the second data structure;
[0015] A game data sending module, configured to send the game data corresponding to the at least one data type to the client.
[0016] According to one aspect of the embodiments of the present application, there is provided a computer device, the computer device comprising a processor and a memory, and a computer program is stored in the memory, and the computer program is loaded and executed by the processor to implement the above-mentioned method for obtaining game data.
[0017] According to one aspect of the embodiments of the present application, there is provided a computer-readable storage medium, and a computer program is stored in the readable storage medium, and the computer program is loaded and executed by a processor to implement the above-mentioned method for obtaining game data.
[0018] According to one aspect of the embodiments of the present application, there is provided a computer program product, the computer program product comprising a computer program, and the computer program is stored in a computer-readable storage medium. A processor of a computer device reads the computer program from the computer-readable storage medium, and the processor executes the computer program, so that the computer device executes the above-mentioned method for obtaining game data.
[0019] The technical solution provided by the embodiment of the present application may include the following beneficial effects:
[0020] By dividing the game data in the database into two parts based on the access frequency: the game data with a higher access frequency and the game data with a lower access frequency, and backing up the game data with a higher access frequency in the cache of the server, instead of backing up all the game data in the cache, the storage pressure on the server is effectively reduced. At the same time, for the two parts of game data, they are respectively divided and stored in different data types, and the client is supported to request and obtain game data based on the data type, so that the server does not need to return all the game data, thereby reducing the data transmission pressure and the traffic overhead required for data transmission. Description of the Drawings
[0021] To more clearly illustrate the technical solutions in the embodiments of the present application, the following will briefly introduce the drawings required for the description of the embodiments. Obviously, the following drawings are only some embodiments of the present application. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings.
[0022] Figure 1 It is a schematic diagram of the solution implementation environment provided by an embodiment of the present application;
[0023] Figure 2 It is a schematic diagram of the solution implementation environment provided by another embodiment of the present application;
[0024] Figure 3 It is a flowchart of the method for obtaining game data provided by an embodiment of the present application;
[0025] Figure 4 It is a schematic diagram of the personal information tab provided by an embodiment of the present application;
[0026] Figure 5 It is a schematic diagram of the personal information card provided by an embodiment of the present application;
[0027] Figure 6 It is a schematic diagram of the personal information tab provided by another embodiment of the present application;
[0028] Figure 7 It is a schematic diagram of the setting interface provided by an embodiment of the present application;
[0029] Figure 8 It is a schematic diagram of the game record tab provided by an embodiment of the present application;
[0030] Figure 9 It is a schematic diagram of the close relationship tab provided by an embodiment of the present application;
[0031] Figure 10 It is a flowchart of a method for caching game data corresponding to a first data structure provided by an embodiment of the present application;
[0032] Figure 11 It is a flowchart of a method for obtaining game data provided by another embodiment of the present application;
[0033] Figure 12 It is a block diagram of a device for obtaining game data provided by an embodiment of the present application;
[0034] Figure 13 It is a block diagram of a device for obtaining game data provided by another embodiment of the present application;
[0035] Figure 14 It is a block diagram of a computer device provided by an embodiment of the present application. Detailed implementation manners
[0036] To make the objectives, technical solutions and advantages of the present application clearer, the following will further describe the embodiments of the present application in detail with reference to the accompanying drawings.
[0037] Before introducing and explaining the embodiments of the present application, first, relevant terms involved in the embodiments of the present application will be explained.
[0038] 1. Zonesvr: Zone Server, the lobby server, which is used to provide user account login functions, lobby services, and the main business logic based on user accounts. Zonesvr can provide services in a clustered manner. After the user completes the client login, most of the key data is cached on Zonesvr, and Zonesvr regularly writes back part of the data to the database. For example, the write-back frequency can be configured to 1 to 5 minutes according to the actual usage situation. Most of the client requests are directly processed on Zonesvr, and the other part of the requests are passed by Zonesvr to other servers for further processing. Optionally, Zoneid (Zone ID, lobby identity) is the globally unique identifier of Zonesvr. One Zonesvr corresponds to one Zoneid. One Zonesvr can allow multiple clients to log in and provide services for them.
[0039] 2. DB: Data Base, the database, which is a warehouse for organizing, storing, and managing data according to data structures.
[0040] 3. Data structure: It is the way for a computer to store and organize data. It can refer to a collection of data elements that have one or more specific relationships with each other, such as linked lists, queues, stacks, arrays, etc.
[0041] 4. RoleInDB: The game role storage table is used to store the game data with relatively high access frequency corresponding to users, such as the basic data corresponding to users (such as nickname, avatar, etc.).
[0042] 5. RoleExtDB: The additional data storage table is used to store the game data with relatively low access frequency corresponding to users, such as the game data, social data, achievement data, and other statistical data corresponding to users.
[0043] 6. Uin: Unique Identifier Number, the unique identification number, which can be the globally unique identification ID (Identity Document) of the role of the user in the game application.
[0044] 7. RoleKeyDB: The user account information table. When logging in to the game through a third-party application (such as a social application, a chat application, etc.), it is necessary to map through RoleKeyDB to find the unique identification number Uin (such as the user account) of the user in the game.
[0045] 8. CS protocol: The Client / Sever protocol, which is the specification of the communication data used to generate interactive content agreed between the client and the server, and can realize the communication of the specified content between the client and the server through the pre-determined CD protocol.
[0046] Please refer to Figure 1 , which shows a schematic diagram of the solution implementation environment provided by an embodiment of the present application. The implementation environment may include: a terminal device 10 and a server 20.
[0047] The terminal device 10 may be an electronic device such as a mobile phone, a tablet computer, a multimedia playback device, a PC (Personal Computer), a smart robot, a vehicle-mounted terminal, a wearable device, an AR (Augmented Reality) device, a VR (Virtual Reality) device, an MR (Mixed Reality) device, etc. The client of the game application may be installed and run in the terminal device 10.
[0048] Among them, the game application can be any one of, for example, a Massive Multiplayer Online Role-Playing Game (MMORPG), a casual game, a party game, a sandbox game, a tower defense game, an action adventure game, a Multiplayer Online Battle Arena (MOBA) game, a First-Person Shooting Game (FPS), a multiplayer gunfight survival game, a Third-Person Shooting Game (TPS), a simulation game (SLG), etc. The embodiments of the present application do not limit this.
[0049] Optionally, the game application can be an online application. Exemplarily, for the client of the game application, it can be installed and run on different terminal devices 10 for different users to use. For example, the game application can be installed and run on different terminal devices 10 in the form of a mobile game (Mobile Game), a PC game (PC Game), a web page, a mini-program, etc. The embodiments of the present application do not limit this.
[0050] The server 20 is used to provide background services for the client of the game application in the terminal device 10. For example, the server 20 can be the background server of the above game application. The server 20 can be a single server, a server cluster composed of multiple servers, or a cloud computing service center.
[0051] The terminal device 10 and the server 20 can communicate with each other through the network 30. The network 30 can be a wired network or a wireless network.
[0052] Exemplarily, as Figure 2 shown, the user can play games through the client of the game application installed and run on the terminal device 10, such as controlling a virtual object to move in the virtual environment provided by the client, viewing different user interfaces provided by the client, and communicating with other users.
[0053] The above server 20 can be implemented as the Zonesvr corresponding to the game application. The server 20 can include one or more Zonesvrs. Each Zonesvr can be used to provide user account login functions, lobby services, game data recording and storage, and the main business logic based on the user account. The same Zonesvr can provide services for multiple users, that is, communicate and connect with multiple terminal devices 10.
[0054] In one example, the server 20 is correspondingly provided with a database for storing game data corresponding to game applications. The game data may refer to data generated by a user through a client, such as basic data entered, operation data, competition data, social data, achievement data, combat power data, friend data, leaderboard data, data of virtual objects controlled, dynamic data, data allocated by the client to the user, and other statistical data, etc. The embodiments of the present application do not make any limitations thereto. Optionally, the database may be implemented as, for example, TcaplusDB (a database designed for games), NoSQL (a non-relational database), Hbase database, etc. The embodiments of the present application do not make any limitations thereto.
[0055] Optionally, the server 20 stores the game data in two parts. For example, a first data structure and a second data structure are respectively set for each user. The game data corresponding to each data type in the first type set is persistently stored in the first data structure (such as RoleInDB), and the game data corresponding to each data type in the second type set is persistently stored in the second data structure (such as RoleExtDB). The access frequency of the game data corresponding to the first type set is greater than that of the game data corresponding to the second type set.
[0056] Among them, the access frequency refers to the number of accesses within a certain period of time, which is used to indicate the usage frequency of the game data. The embodiments of the present application do not make any limitations to the first data structure and the second data structure. The game data corresponding to the first data structure can be classified and stored based on each data type in the first type set, and the game data corresponding to the second data structure can be classified and stored based on each data type in the second type set.
[0057] In the embodiments of the present application, the data types can be divided according to the actual scenario. Exemplarily, multiple data types can be obtained by dividing different game tabs provided by the client. For example, the personal profile tab, game match tab, achievement tab, tab, game friend tab, match history tab, historical record tab, lobby tab, etc. can be respectively divided into one data type; or multiple data types can be obtained by dividing different sections in the game tab. For example, sections such as game character information and commonly used virtual objects can be respectively divided into one data type. The embodiments of the present application do not make any limitations to the method of dividing data types, and it can be set and adjusted according to actual usage requirements.
[0058] Optionally, a data structure is set for each data type to store the corresponding game data. The data structures corresponding to the data types in the first type set can be nested in the first data structure, and the data structures corresponding to the data types in the second type set can be nested in the second data structure. Optionally, the data structure corresponding to the data type can further nest a sub-data structure. For example, a sub-data structure corresponding to a certain historical game session can be nested in the data structure corresponding to the historical record tab. The embodiments of the present application do not limit this.
[0059] The above-mentioned first type set can be obtained by counting the game types corresponding to the game data with a relatively high access frequency, and the above-mentioned second type set can be obtained by counting the game types corresponding to the game data with a relatively low access frequency. Optionally, the game data with an access frequency greater than or equal to the frequency threshold can be determined as the game data with a relatively high access frequency, and the game data with an access frequency less than the frequency threshold can be determined as the game data with a relatively low access frequency; or the game data with an access frequency greater than or equal to the frequency threshold and a data size less than the size threshold can be determined as the game data with a relatively high access frequency, and the game data with an access frequency less than the frequency threshold or a data size greater than or equal to the size threshold can be determined as the game data with a relatively low access frequency. The embodiments of the present application do not limit this.
[0060] Among them, the frequency threshold and the size threshold can be set and adjusted according to actual usage requirements. The data size is used to indicate the size of the game data, such as the size of the memory it occupies.
[0061] In one example, the server 20 is also correspondingly provided with a cache. The cache can be implemented as a hardware or software component embedded in the game application or server memory, and it can automatically store game data temporarily (i.e., the verb: cache). For example, the cache can be a kind of high-speed memory, which can be used for high-speed data exchange. In the embodiments of the present application, the cache is used to back up the game data corresponding to the first data structure in a third data structure. For example, for each user, when the user logs in to the client, the server 20 (such as the Zonesvr connected to the client) can back up the game data stored in the first data structure corresponding to the user in the database to the cache in a third data structure.
[0062] For example, as Figure 1 shown, the client can determine the current required data type according to the game tab currently browsed by the user, generate a data acquisition request based on this data type, and send the data acquisition request to the server. After receiving the data acquisition request, the server obtains the corresponding game data from the cache or the database according to the data type in the data acquisition request, and packs and returns it to the client. The client performs logical processing or interface display based on the received game data.
[0063] Next, the technical solution provided by the present application will be introduced and described through method embodiments. For content not described in the embodiments of the present application, reference may be made to the following embodiments.
[0064] Please refer to Figure 3 , which shows a flowchart of a method for obtaining game data provided by an embodiment of the present application. The execution subject of each step of this method may be Figure 1 the server 20 in the implementation environment of the solution shown in, and this method may include the following steps (step 301 to step 304):
[0065] Step 301, receive a data acquisition request from the client. The data acquisition request is used to acquire game data of at least one data type, and the game data of the at least one data type is related to the user account logged in to the client.
[0066] The above client may refer to the client corresponding to a game application. During the process of the user browsing the game tab provided by the client, the client can determine the above at least one data type according to the game tab, and generate a data acquisition request based on the at least one data type.
[0067] Exemplarily, when there is a correspondence between the game tab and the data type, the client can directly determine the data type corresponding to the game tab as the data type to be requested. For example, refer to Figure 4 , in response to the user opening the personal profile tab 400, the client can directly determine the data type corresponding to the personal profile tab 400 as the data type to be requested. When there is a correspondence between the sections in the game tab and the data type, the client can directly determine the data types corresponding to each section in the game tab as the data types to be requested. For example, refer to Figure 4 , in response to the user opening the personal profile tab 4, the client can directly determine the data types corresponding to the basic information section 401, the common virtual object section 402, etc. in the personal profile tab 400 as the data types to be requested.
[0068] In one example, the data acquisition request may include the type identifier of at least one data type and the unique identification number Uin corresponding to the user. The type identifier is used to uniquely represent the data type. When dividing the data types, the server assigns a type identifier to each data type. The Uin can be used to determine the data structure corresponding to the user (such as the first data structure, the second data structure, the third data structure), and the type identifier can be used to determine the data type requested by the client.
[0069] Exemplarily, the enumeration definition of the server for each data type may be expressed as follows:
[0070]
[0071]
[0072] Among them, each data type is respectively assigned a type identifier. For example, the type identifier corresponding to the data type "trophy data" (such as the corresponding trophy tab) is 1, and the type identifier corresponding to the data type "friend intimacy data" (such as the corresponding in-game friend tab) is 2. It should be noted that the above enumeration is only exemplary, and the number of data types can be expanded according to actual usage requirements.
[0073] Optionally, the data acquisition request may further include sub-data types under the data type. That is, for each data type, the server can further divide it into multiple sub-data types. For example, the data structure corresponding to the historical record tab can also be divided into multiple sub-data types for historical game matches, and the sub-data structure corresponding to each sub-data type is used to store the game data corresponding to a historical game match. Optionally, the sub-data type is correspondingly set with a sub-type identifier to uniquely identify the sub-data type. For example, the GID (Globally Unique Identifier) corresponding to the historical game match can be directly determined as the sub-type identifier of the sub-data type corresponding to the historical game match.
[0074] Exemplarily, an embodiment of the present application provides a general CS protocol for game data acquisition. The data acquisition request generated based on this CS protocol may include the user's Uin, type identifier Type, and sub-type identifier Key. For example, the general protocol structure corresponding to the data acquisition request can be expressed as follows:
[0075]
[0076] Optionally, Type in the data acquisition request binds to the type identifier of the specified data type, and different values of the type identifier represent different data types.
[0077] The game data corresponding to at least one of the above data types may refer to the data required for the client to perform logical processing or interface display for the game tab. Optionally, the game data of at least one of the above data types may refer to the game data corresponding to the user account logged in on the client, or may refer to the game data corresponding to the friend user account of the user account, or may also refer to the game data corresponding to the teammate user account of the user account. The embodiment of the present application does not limit this.
[0078] For example, refer to Figure 4, in response to the user opening their personal profile tab 400, the data acquisition request sent by the client includes the Uin corresponding to the user to instruct the server to pull the profile information corresponding to the user. Refer to Figure 5 and Figure 6 , in response to the user's click operation on the avatar of a certain friend in the friend list, the client displays the personal profile card 501 of the friend. In response to the user's trigger operation on the profile option 502 in the personal profile card 501, the client displays the personal profile tab 503 of the friend. The data acquisition request sent by the client includes the Uin corresponding to the friend to instruct the server to pull the profile information corresponding to the friend. Optionally, for the personal profile card 501 and the personal profile tab 503, the client can send a data acquisition request respectively. The data acquisition request corresponding to the personal profile card 501 includes the type identifier of the data type corresponding to the personal profile card 501, and the data acquisition request corresponding to the personal profile tab 503 includes the type identifier of the data type corresponding to the personal profile tab 503.
[0079] Step 302, for the first data type among at least one data type, when the first data type belongs to the first type set, obtain the game data of the first data type from the cache, where the game data of each data type in the first type set is backed up in the cache, and the game data of each data type in the first type set is permanently stored in the database in the first data structure.
[0080] The first data type can refer to any one of at least one data type. The first type set can refer to a list or set obtained by statistically analyzing the game types corresponding to the above-mentioned game data with a higher access frequency. Optionally, the server can traverse the first type set through the type identifier of the first data type to determine whether the first data type belongs to the first type set.
[0081] In one example, the server defines a processing handle for each data type, and the processing handle is used to indicate the acquisition method of the game data of the data type. The acquisition method includes at least one of the following: obtaining game data only from the cache, obtaining game data only from the database, and obtaining game data from both the cache and the database. The server can obtain the game data of the first data type through the processing handle.
[0082] Exemplarily, each processing handle defines a structure field, a type field, a first processing function, a second processing function, a third processing function, and an error code. Among them, the structure field is used to indicate whether the data type belongs to the first type set, and the type field is used to indicate whether the data type belongs to the second type set. The server can determine the acquisition method of the game data based on the structure field and the type field.
[0083] The first processing function is used to obtain game data of the data types in the first type set. When the first data type belongs to the first type set, the server can obtain the game data of the first data type through the first processing function. The second processing function is used to obtain game data of the data types in the second type set. When the first data type belongs to the second type set, the server can obtain the game data of the first data type through the second processing function. The third processing function is used to determine whether to enable data protection, and the error code is used to indicate enabling data protection.
[0084] For example, the processing handle can be defined as follows:
[0085]
[0086] Among them, Type is used to represent the data type, such as a type identifier; FieldsList is a structure field, which can be used to indicate the storage location of the game data in the cache (or the first data structure); ExtDataType is a type field, such as a type identifier, which can be used to indicate the corresponding data type in the second data structure, that is, the storage location of the game data in the second data structure.
[0087] Exemplarily, taking the first data type as an example, the determination process of the acquisition method of the game data may include the following content:
[0088] 1. Obtain the processing handle corresponding to the first data type.
[0089] Optionally, the processing handles in the server can be traversed according to the type identifier of the first data type to obtain the processing handle that matches the type identifier as the processing handle of the first data type. For example, the server can match the type identifier of the first data type with Type in the processing handle to determine the processing handle corresponding to the first data type.
[0090] 2. If the structure field in the processing handle is not empty, it is determined that the first data type belongs to the first type set.
[0091] The value of this structure field is determined based on the storage location of the game data in the cache. When the structure field is not empty, it indicates that the game data corresponding to the first data type is backed up in the server's cache, and the value of this structure field can be used to indicate the storage location of the game data corresponding to the first data type in the cache, and thus it can be determined that the first data type belongs to the first type set.
[0092] If the structure field in the processing handle is empty, it indicates that the game data corresponding to the first data type is not backed up in the server's cache, and thus it can be determined that the first data type does not belong to the first type set.
[0093] 3. If the type field in the processing handle is not empty, it is determined that the first data type belongs to the second type set.
[0094] Optionally, during the process of setting the processing handle, when the first data type belongs to the second type set, the server sets the type field in the processing handle corresponding to the first data type to the type identifier corresponding to the first data type; when the first data type does not belong to the second type set, the server sets the type field in the processing handle corresponding to the first data type to be empty (such as NULL). Therefore, when the type field is not empty, it can be determined that the first data type belongs to the second type set. If the type field in the processing handle is empty, it is determined that the first data type does not belong to the second type set.
[0095] Optionally, the game data of the first data type can be stored only in the first data structure, or only in the second data structure, or a part of it (such as the part with high access frequency and small data scale) can be stored in the first data structure, and a part of it (such as the part with low access frequency or large data scale) can be stored in the second data structure. The embodiments of the present application do not limit this.
[0096] In one example, after determining the processing handle corresponding to the first data type, step 302 may further include the following content:
[0097] 1. Based on the role identifier in the data acquisition request, determine the first game data set corresponding to the role identifier in the cache. The first game data set stores the game data corresponding to the role identifier in the third data structure.
[0098] The role identifier is used to uniquely identify the user, and it can be implemented as the Uin corresponding to the user (such as the user account). Optionally, for each user who has completed client login, the server allocates a third data structure for each user to cache the game data corresponding to the first data structure of the user, so as to obtain the first game data set corresponding to the user. The game data in the first game data set is classified and stored according to each data type in the first type set. The game data corresponding to the third data structure is the same as the game data corresponding to the first data structure, and the third data structure and the first data structure may not be the same.
[0099] By comparing the role identifier in the data acquisition request with the role identifiers corresponding to each first game data set one by one, the first game data set corresponding to the role identifier in the cache can be obtained.
[0100] 2. Execute the first processing function to obtain the game data of the first data type from the first game data set in the cache based on the structure field.
[0101] Optionally, the server executes a first processing function to pull the data at the storage location indicated by the structure field in the first game dataset, so as to obtain the game data of the first data type.
[0102] Optionally, the value of the structure field can be determined based on the character identifier and the storage location of the game data in the cache. Then, the first processing function can be executed to directly obtain the game data of the first data type from the cache based on the structure field.
[0103] Optionally, in the case where the first game dataset is not in the cache, the server can also obtain the game data of the first data type from the first data structure in the database.
[0104] Step 303, in the case where the first data type belongs to the second type set, obtain the game data of the first data type from the database, where the game data of each data type in the second type set is permanently stored in the database in a second data structure, and the access frequency of the game data stored in the first data structure is greater than the access frequency of the game data stored in the second data structure.
[0105] The second type set can refer to a list or set obtained by counting the game types corresponding to the game data with a lower access frequency as described above. Optionally, the server can traverse the second type set through the type identifier of the first data type to determine whether the first data type belongs to the second type set.
[0106] In one example, after determining the processing handle corresponding to the first data type, step 303 may further include the following content:
[0107] 1. Based on the character identifier in the data acquisition request, determine the second game dataset corresponding to the character identifier in the database. The second game dataset stores the game data corresponding to the character identifier in a second data structure.
[0108] Compare the character identifier in the data acquisition request with the character identifiers corresponding to each second game dataset one by one, and the second game dataset corresponding to the character identifier in the database can be obtained. The game data in the second game dataset is classified and stored according to each data type in the second type set.
[0109] 2. Execute a second processing function to obtain the game data of the first data type from the second game dataset in the database based on the type field, where the type field is used to indicate the first data type.
[0110] Optionally, the server executes a second processing function to pull the data of the data type indicated by the type field in the second game dataset, so as to obtain the game data of the first data type. In this way, the server only needs to obtain and transmit the game data corresponding to the first data type, without obtaining all the game data corresponding to the character identifier, thereby reducing the data transmission pressure and being beneficial to reducing the data transmission time, and further improving the user experience.
[0111] Optionally, when the data acquisition request further includes a sub-data type under the first data type, the server can also execute a second processing function to obtain the game data of the sub-data type from the second game dataset based on the type field and the sub-data type. For example, first obtain the game data of the first data type based on the type field, and then obtain the game data corresponding to the sub-data type from the game data of the first data type. In this way, only part of the game data in the game data of the first data type is obtained, without obtaining all the game data of the first data type, thereby further reducing the data transmission pressure.
[0112] In one example, the embodiments of the present application support the data protection function of game data. For example, the server sets a privacy switch for each data type. When the privacy switch corresponding to the data type is turned on, the game data corresponding to the data type is enabled for data protection, and the game data corresponding to the data type is not allowed to be obtained by other users; when the privacy switch corresponding to the data type is turned off, the game data corresponding to the data type is enabled for data protection, and the game data corresponding to the data type is allowed to be obtained by other users.
[0113] Optionally, before obtaining the game data of the first data type, the embodiments of the present application may further include the following content:
[0114] 1. When the game data of the first data type does not belong to the user account logged in to the client, execute a third processing function to detect whether the game data of the first data type is enabled for data protection.
[0115] Optionally, the character identifier in the data acquisition request can be compared with the character identifier corresponding to the user account to determine whether the game data of the first data type belongs to the user account logged in to the client. If the two are the same, the game data of the first data type belongs to the user account logged in to the client. If the two are different, the game data of the first data type does not belong to the user account logged in to the client.
[0116] Data protection means that the game data can only be obtained by oneself and cannot be obtained by other users. The third processing function can be used to detect the status of the privacy switch corresponding to the first data type to determine whether the game data of the first data type is enabled for data protection.
[0117] If the game data of the first data type belongs to the user account logged in on the client, then the third processing function does not need to be executed.
[0118] 2. If the game data of the first data type has data protection enabled, an error code is sent to the client.
[0119] When the server detects that the privacy switch corresponding to the first data type is in the on state, it sends an error code to the client to indicate to the user that the game data of the first data type is under data protection and cannot be obtained. When the game data of the first data type has data protection enabled, the server does not need to obtain the game data of the first data type.
[0120] 3. If the game data of the first data type does not have data protection enabled, the steps of obtaining the game data of the first data type from the cache or from the database are executed.
[0121] When the server detects that the privacy switch corresponding to the first data type is in the off state, it obtains the game data of the first data type.
[0122] For example, referring to Figures 7 to 9 , the setting interface 700 includes a privacy switch 701 corresponding to the match record (a data type). When the second user account switches the privacy switch 701 to the off state, that is, the match record is enabled for display, the server can obtain the match data of the first user account and the match data of the second user account respectively, so that the first user account logged in on the client can view the match data of the first user account and the match data of the second user account respectively through the personal profile tab in the match record tab 800.
[0123] The setting interface 700 also includes a privacy switch 702 corresponding to the intimate relationship (a data type). When the second user account switches the privacy switch 702 to the on state, that is, the display of the intimate relationship is turned off, the server can only obtain the intimate relationship data of the first user account and cannot obtain the intimate relationship data of the second user account. Therefore, the first user account can still view the intimate relationship data of the first user account through the personal profile tab in the intimate relationship tab 900, but cannot view the intimate relationship data of the second user account in the intimate relationship tab 900.
[0124] Step 304: Send the game data corresponding to at least one data type to the client.
[0125] Optionally, for each data type, the game data of the data type can be stored only in the first data structure, or only in the second data structure, or a part of it (such as the part with higher access frequency and smaller data scale) can be stored in the first data structure, and a part of it (such as the part with lower access frequency or larger data scale) can be stored in the second data structure. The embodiments of the present application do not limit this.
[0126] Exemplarily, taking the first data type as an example, the embodiments of the present application may further include the following content:
[0127] 1. When the structure type in the processing handle is not empty and the type field is not empty, the server can determine that for the game data corresponding to the first data structure, a part of it is stored in the first data structure and a part of it is stored in the second data structure. Then, the server can package the game data of the first data type obtained from the cache and the game data of the first data type obtained from the database to obtain the game data corresponding to the first data type, and then send the game data corresponding to the first data type to the client.
[0128] 2. When the structure field is not empty and the type field is empty, the server can determine that the game data corresponding to the first data structure is stored only in the first data structure. Then, the server can determine the game data of the first data type obtained from the cache as the game data corresponding to the first data type, and then send the game data corresponding to the first data type to the client.
[0129] 3. When the structure field is empty and the type field is not empty, the server can determine that the game data corresponding to the first data structure is stored only in the second data structure. Then, the server can determine the game data of the first data type obtained from the database as the game data corresponding to the first data type, and then send the game data corresponding to the first data type to the client.
[0130] Optionally, the server can send the game data corresponding to at least one data type to the client in parallel to improve the data transmission efficiency. Or, the server adds the game data corresponding to at least one data type to the message queue in sequence to send to the client in sequence.
[0131] In an example, after receiving the data acquisition request, the server can compare the update version number carried in the data acquisition request with the update version number stored in the server to determine whether the game data of the first data type is updated. When the update version number carried in the acquisition request is the same as the update version number stored in the server, the server does not acquire the game data of the first data type and instructs the client to continue using the game data of the first data type in the client local area. This is beneficial to reducing the workload of the server.
[0132] In the embodiments of the present application, the client does not need to pay attention to the storage logic of game data, nor does it need to obtain all game data. It only needs to focus on the actual scene it is in and send the required data types to the server, and the server can obtain and return the corresponding game data according to the data types.
[0133] In summary, the technical solution provided by the embodiments of the present application divides the game data in the database into two parts based on the access frequency: game data with a higher access frequency and game data with a lower access frequency, and backs up the game data with a higher access frequency in the cache of the server, without backing up all game data in the cache, thereby effectively reducing the storage pressure on the server. At the same time, for the two parts of game data, they are respectively divided and stored in different data types, and the client is supported to request and obtain game data based on the data types, so that the server does not need to return all game data, thereby reducing the data transmission pressure and the traffic overhead required for data transmission.
[0134] In addition, the data types in the embodiments of the present application support rapid expansion, which is beneficial to improving the generality and expandability of the technical solution provided by the embodiments of the present application.
[0135] In some embodiments, when the user logs in to the client, the server backs up the game data corresponding to the first data structure in the cache of the server in the third data structure, facilitating the client and the server to quickly access this part of game data and perform logical calculations.
[0136] Exemplarily, this process may include the following: when the user logs in to the client, the client will connect to a lobby server Zonesvr, and Zonesvr will find the first data structure RoleInDB corresponding to the user from the database according to the Uin corresponding to the user, and back up the game data corresponding to RoleInDB in the cache of the server in the third data structure Role.
[0137] For example, refer to Figure 10, when the user logs in to the client 1001 of the game application through a third-party application different from the game application, the client 1001 can obtain an openID through the third-party application. The client 1001 sends a login request carrying the openID to the server 1002 (such as Zonesvr). The server 1002 queries the Uin corresponding to the user from the RolekeyDB in the database 1003 based on the openID. The server 1002 obtains the game data corresponding to RoleInDB from the database 1003 based on the Uin, and stores the game data corresponding to RoleInDB in the cache of the server 1002 in the form of Role. The server 1002 sends the game data corresponding to Role to the client 1001, and the client 1001 performs logical processing or interface display based on the game data corresponding to Role.
[0138] During the user's online period, all changes to the game data are implemented by directly modifying Role, and the game data is updated to RoleInDB or RoleExtDB by periodically writing back to the database.
[0139] For example, when the access frequency of the changed game data is greater than or equal to the frequency threshold and the data scale is less than the scale threshold, the changed game data is updated to RoleInDB; when the access frequency of the changed game data is less than the frequency threshold or the data scale is greater than or equal to the scale threshold, the changed game data is updated to RoleExtDB.
[0140] In one example, the embodiments of the present application set two interfaces, init_role_by_db and make_db_role_info, to implement the synchronization of the game data corresponding to RoleInDB and the game data corresponding to Role. Among them, init_role_by_db is used to initialize the game data corresponding to Role according to the game data corresponding to RoleInDB; and make_db_role_info is used to update the game data corresponding to RoleInDB according to the game data corresponding to Role. The parameters of these two interfaces are both the data pointer LPROLE corresponding to Role and the data pointer LPROLEINDB corresponding to RoleInDB. RoleInDB and Role basically contain the same game data to achieve fast mapping of the game data.
[0141] Exemplarily, RoleInDB mainly contains data structures such as the player's Uin, Base (basic data), Property (normal data), Game (game data), and Others (other data). Role flattens the game data, and all game data that needs to be stored can correspond one by one to the data structures included in RoleInDB.
[0142] In the case of changing game data (with a relatively high access frequency), the server needs to add it both in RoleInDB and Role, and the corresponding mapping logic can be implemented by means of init_role_by_db and make_db_role_info. Optionally, a third interface can also be set for the second data structure to update the game data with a relatively low access frequency in Role to the second data structure. After the update is completed, the game data with a relatively low access frequency in Role is deleted to reduce the storage pressure on the server.
[0143] In some embodiments, the enumeration definition of the data types in RoleExtDB can be as follows:
[0144]
[0145] For example, if the above ExtDataType (type field) = 3, the server can send "player's historical social messages" to the client; if the above ExtDataType (type field) = 4, the server can send "brief information of the player's historical battle list" to the client.
[0146] In summary, the technical solution provided by the embodiments of the present application effectively reduces the storage pressure on the server by only backing up the game data with a relatively high access frequency in the server's cache, rather than backing up all game data in the cache.
[0147] In some embodiments, the processing handles in the server are managed by an information manager, and the information manager contains the processing handles corresponding to each data type.
[0148] Exemplarily, the processing handles registered in the information manager can be represented as follows:
[0149]
[0150] For example, the content in the first {} in the information manager g_roleInfomap registers the processing handle corresponding to the data type "trophy data", and the content in the second {} registers the processing handle corresponding to the data type "friend intimacy data".
[0151] In one example, the embodiments of the present application support the registration of a processing handle for a newly added data type. Exemplarily, this process may include the following: when a newly added data type is obtained, a newly added processing handle corresponding to the newly added data type is constructed; the newly added processing handle is added to the information manager to complete the registration of the newly added processing handle.
[0152] Wherein, the newly added data type refers to a data type newly divided for game data. After the newly added processing handle corresponding to the newly added data type is constructed, registration information can be constructed based on the newly added processing handle, and the registration information is added to the information manager to achieve the registration of the newly added processing handle.
[0153] The registration information may include the name, type identifier, etc. of the newly added data type.
[0154] In one example, the embodiments of the present application support the deregistration of a processing handle for a deleted data type. Exemplarily, this process may include the following: when a deleted data type is obtained, the processing handle corresponding to the deleted data type is removed from the information manager to deregister the processing handle corresponding to the deleted data type.
[0155] The deleted data type may refer to any data type deleted for game data. Optionally, deleting the registration information corresponding to the deleted data type in the information manager can deregister the processing handle corresponding to the deleted data type.
[0156] In one example, the method for constructing a processing handle may include the following:
[0157] 1. When the first data type belongs to the first type set and does not belong to the second type set, the storage location of the first data type in the cache is set as the value of the structure field in the processing handle corresponding to the first data type, and the value of the type field in the processing handle corresponding to the first data type is set to be empty.
[0158] Optionally, after the structure field and the type field are determined, the first processing function, the second processing function, the third processing function, and the error code are automatically converted for the first data type. For example, the first processing function is constructed based on the structure field, the second processing function is constructed based on the type field, the third processing function is constructed based on the first data type, and the error code is constructed based on the first data type.
[0159] This can indicate that the server only needs to pull the game data of the first data type from the cache (i.e., the first data structure).
[0160] 2. When the first data type does not belong to the first type set but belongs to the second type set, set the value of the structure field in the processing handle corresponding to the first data type to null, and set the value of the type field in the processing handle corresponding to the first data type to the type identifier at the time of registration of the first data type.
[0161] This can indicate that the server only needs to pull the game data of the first data type from the second data structure.
[0162] 3. When the first data type belongs to both the first type set and the second type set, set the storage location of the first data type in the cache to the value of the structure field in the processing handle corresponding to the first data type, and set the value of the type field in the processing handle corresponding to the first data type to the type identifier at the time of registration of the first data type.
[0163] This can indicate that the server needs to pull the game data of the first data type from both the third data structure and the second data structure at the same time.
[0164] In summary, the technical solution provided by the embodiments of the present application, by setting up the processing handle, enables the server to quickly locate and obtain game data only by comparing the type identifiers, thereby improving the efficiency of obtaining game data. At the same time, by supporting the addition and deletion of the processing handle, the flexibility of adjusting the processing handle is improved, which is conducive to reducing the complexity of data type adjustment.
[0165] In some embodiments, taking the server as the lobby server Zonesvr, the first data structure as RoleInDB, the second data structure as RoleExtDB, and the third data structure as Role, the technical solution provided by the embodiments of the present application is described with reference to Figure 11 , and it may further include the following content.
[0166] 1. The first user opens the personal profile tab.
[0167] Optionally, after the first user logs in to the client of the game application, the first user can browse his own personal profile tab. For example, in response to the trigger operation of the first user on his own avatar, the client displays the personal profile tab for the first user, and this personal profile tab can be used to display the game data of the first data type corresponding to the first user, such as the basic data, battle record data, achievement data, etc. corresponding to the first user.
[0168] 2. The client requests the game data of the first data type.
[0169] Optionally, the client sends a data acquisition request to the Zonesvr connected to it. The data acquisition request includes the type identifier of the first data type, the Uin corresponding to the first user, and the possible Key (sub-type identifier).
[0170] 3. The Zonesvr acquires the processing handle of the first data type.
[0171] Optionally, the Zonesvr acquires the processing handle of the first data type from the above information manager according to the type identifier of the first data type.
[0172] 4. In the case where the third data structure Role corresponding to the Uin is not backed up in the cache of the Zonesvr, query the first data structure RoleInDB in the Zonesvr.
[0173] Optionally, the Zonesvr can acquire the game data of the first data type from the first data structure RoleInDB, and back up the game data of the first data structure RoleInDB corresponding to the Uin to the cache of the Zonesvr in the style of the third data structure Role.
[0174] Optionally, in the case where the third data structure Role corresponding to the Uin has been backed up in the cache of the Zonesvr, the Zonesvr can directly acquire the game data of the first data type from Role.
[0175] 5. In the case where the game data of the first data type requested by the client corresponds to the first user, the Zonesvr executes the first processing function in the processing handle of the first data type to acquire the game data of the first data type from the third data structure Role.
[0176] Optionally, in the case where the game data of the first data type requested by the client belongs to the second user, the Zonesvr executes the third processing function in the processing handle of the first data type to determine whether the privacy switch corresponding to the first data type is turned on. In the case where the privacy switch corresponding to the first data type is turned on, the Zonesvr returns an error code to the client to indicate that the game data of the first data type corresponding to the second user cannot be acquired. In the case where the privacy switch corresponding to the first data type is turned off, the Zonesvr executes the first processing function to acquire the game data of the first data type from the third data structure Role corresponding to the second user.
[0177] 6. When the type field in the processing handle is not empty, Zonesvr queries the second data structure RoleExtDB in the database and executes the second processing function in the processing handle to pull out the game data of the first data type from the second data structure RoleExtDB. That is, Zonesvr obtains the game data of the first data type from the second data structure RoleExtDB based on the type identifier of the first data type, the Uin corresponding to the first user, and the possibly existing Key.
[0178] 7. Zonesvr returns the game data corresponding to the first data type to the client.
[0179] Optionally, the game data of the first data type obtained from the second data structure RoleExtDB and the game data of the first data type obtained from the first data structure RoleInDB are packaged to obtain the game data to be returned to the client.
[0180] Optionally, when the type field in the processing handle is empty, Zonesvr can directly send the game data of the first data type obtained from the third data structure Role to the client.
[0181] Optionally, the client executes the calculation logic required to display the personal profile tab based on the game data corresponding to the first data type and displays the personal profile tab corresponding to the first user to the first user.
[0182] In summary, the technical solution provided by the embodiments of the present application divides the game data in the database into two parts based on the access frequency: the game data with a higher access frequency and the game data with a lower access frequency, and backs up the game data with a higher access frequency in the cache of Zonesvr, without the need to back up all the game data in the cache, thereby effectively reducing the storage pressure on Zonesvr. At the same time, for the two parts of game data, they are respectively divided and stored in different data types, and the client is supported to request and obtain game data based on the data type, so that Zonesvr does not need to return all the game data, thereby reducing the data transmission pressure and the traffic overhead required for data transmission.
[0183] The following is an embodiment of the device of the present application, which can be used to execute the method embodiment of the present application. For the details not disclosed in the embodiment of the device of the present application, please refer to the method embodiment of the present application.
[0184] Please refer to Figure 12, which shows a block diagram of a game data acquisition device provided by an embodiment of the present application. This device has the functions of implementing the above method examples, and these functions can be implemented by hardware or by hardware executing corresponding software. This device can be the computer device introduced above or can be set in the computer device. As Figure 12 shown, the device 1200 includes: an acquisition request receiving module 1201, a game data acquisition module 1202, and a game data sending module 1203.
[0185] The acquisition request receiving module 1201 is configured to receive a data acquisition request from a client, where the data acquisition request is used to acquire game data of at least one data type, and the game data of the at least one data type is related to the user account logged in the client.
[0186] The game data acquisition module 1202 is configured to, for a first data type among the at least one data type, when the first data type belongs to a first type set, acquire the game data of the first data type from a cache, where the game data of each data type in the first type set is backed up in the cache, and the game data of each data type in the first type set is permanently stored in a database in a first data structure.
[0187] The game data acquisition module 1202 is further configured to, when the first data type belongs to a second type set, acquire the game data of the first data type from the database, where the game data of each data type in the second type set is permanently stored in the database in a second data structure, and the access frequency of the game data stored in the first data structure is greater than the access frequency of the game data stored in the second data structure.
[0188] The game data sending module 1203 is configured to send the game data corresponding to each of the at least one data type to the client.
[0189] In some embodiments, as Figure 13 shown, the device 1200 further includes: a processing handle acquisition module 1204 and a type set determination module 1205.
[0190] The processing handle acquisition module 1204 is configured to acquire a processing handle corresponding to the first data type, where the processing handle is used to indicate the acquisition method of the game data of the data type, and a structure field and a type field are defined in the processing handle, where the structure field is used to indicate whether the data type belongs to the first type set, and the type field is used to indicate whether the data type belongs to the second type set.
[0191] A type set determination module 1205, configured to determine that the first data type belongs to the first type set if the structure field is not empty.
[0192] The type set determination module 1205 is further configured to determine that the first data type belongs to the second type set if the type field is not empty.
[0193] In some embodiments, a first processing function for obtaining game data of the data types in the first type set and a second processing function for obtaining game data of the data types in the second type set are further defined in the processing handle; the game data acquisition module 1202 is further configured to:
[0194] Based on the character identifier in the data acquisition request, determine a first game data set corresponding to the character identifier in the cache, where the first game data set stores the game data corresponding to the character identifier in a third data structure;
[0195] Execute the first processing function to obtain the game data of the first data type from the first game data set in the cache based on the structure field.
[0196] In some embodiments, a second processing function for obtaining game data of the data types in the second type set is further defined in the processing handle; the game data acquisition module 1202 is further configured to:
[0197] Based on the character identifier in the data acquisition request, determine a second game data set corresponding to the character identifier in the database, where the second game data set stores the game data corresponding to the character identifier in the second data structure;
[0198] Execute the second processing function to obtain the game data of the first data type from the second game data set in the database based on the type field, where the type field is used to indicate the first data type.
[0199] In some embodiments, a sub-data type under the first data type is further included in the data acquisition request; the game data acquisition module 1202 is further configured to execute the second processing function to obtain the game data of the sub-data type from the second game data set based on the type field and the sub-data type.
[0200] In some embodiments, a third processing function for determining whether to enable data protection and an error code for indicating enabling the data protection are further defined in the processing handle;
[0201] Such as Figure 13As shown, the device 1200 further includes: a data protection detection module 1206 and an error code sending module 1207.
[0202] The data protection detection module 1206 is configured to execute the third processing function to detect whether the game data of the first data type is enabled for data protection when the game data of the first data type does not belong to the user account logged in to the client.
[0203] The error code sending module 1207 is configured to send the error code to the client if the game data of the first data type is enabled for data protection.
[0204] The game data acquisition module 1202 is further configured to execute the step of acquiring the game data of the first data type from the cache or from the database if the game data of the first data type is not enabled for data protection.
[0205] In some embodiments, the game data acquisition module 1202 is further configured to:
[0206] When the structure field is not empty and the type field is not empty, the game data of the first data type acquired from the cache and the game data of the first data type acquired from the database are packaged to obtain the game data corresponding to the first data type;
[0207] Alternatively, when the structure field is not empty and the type field is empty, the game data of the first data type acquired from the cache is determined as the game data corresponding to the first data type;
[0208] Alternatively, when the structure field is empty and the type field is not empty, the game data of the first data type acquired from the database is determined as the game data corresponding to the first data type.
[0209] In some embodiments, as Figure 13 shown, the device 1200 further includes: a processing handle setting module 1208.
[0210] The processing handle setting module 1208 is configured to, when the first data type belongs to the first type set and does not belong to the second type set, set the storage location of the first data type in the cache as the value of the structure field in the processing handle corresponding to the first data type, and set the value of the type field in the processing handle corresponding to the first data type to be empty.
[0211] Alternatively, the processing handle setting module 1208 is further configured to, when the first data type does not belong to the first type set but belongs to the second type set, set the value of the structure field in the processing handle corresponding to the first data type to be empty, and set the value of the type field in the processing handle corresponding to the first data type to the type identifier at the time of registration of the first data type.
[0212] Alternatively, the processing handle setting module 1208 is further configured to, when the first data type belongs to both the first type set and the second type set, set the storage location of the first data type in the cache as the value of the structure field in the processing handle corresponding to the first data type, and set the value of the type field in the processing handle corresponding to the first data type to the type identifier at the time of registration of the first data type.
[0213] In some embodiments, the processing handle is managed by an information manager; as Figure 13 shown, the apparatus 1200 further includes: a processing handle registration module 1209.
[0214] The processing handle registration module 1209 is configured to, when obtaining a new data type, construct a new processing handle corresponding to the new data type; add the new processing handle into the information manager to complete the registration of the new processing handle.
[0215] Alternatively, the processing handle registration module 1209 is further configured to, when obtaining a data type to be deleted, remove the processing handle corresponding to the data type to be deleted from the information manager to cancel the registration of the processing handle corresponding to the data type to be deleted.
[0216] In summary, the technical solution provided by the embodiments of the present application divides the game data in the database into two parts based on the access frequency: game data with a higher access frequency and game data with a lower access frequency, and backs up the game data with a higher access frequency in the cache of the server, without the need to back up all the game data in the cache, thereby effectively reducing the storage pressure on the server. At the same time, for the two parts of game data, they are respectively divided and stored according to different data types, and the client is supported to request and obtain game data based on the data type, so that the server does not need to return all the game data, thereby reducing the data transmission pressure and the traffic overhead required for data transmission.
[0217] It should be noted that for the device provided in the above embodiments, when implementing its functions, only the division of the above functional modules is used for illustration. In actual applications, the above functions can be allocated to different functional modules according to needs, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the device provided in the above embodiments and the method embodiments belong to the same concept. For the specific implementation process, please refer to the method embodiments and will not be elaborated here.
[0218] Please refer to Figure 14 , which shows a block diagram of a computer device provided in an embodiment of the present application. This computer device can be used to implement the method for obtaining game data provided in the above embodiments. Specifically, it may include the following content.
[0219] The computer device 1400 includes a central processing unit (such as a CPU (Central Processing Unit), a GPU (Graphics Processing Unit), and an FPGA (Field Programmable Gate Array), etc.) 1401, a system memory 1404 including a RAM (Random-Access Memory) 1402 and a ROM (Read-Only Memory) 1403, and a system bus 1405 connecting the system memory 1404 and the central processing unit 1401. The computer device 1400 further includes a basic input / output system (Input Output System, I / O system) 1406 for transmitting information between various components in the server, and a mass storage device 1407 for storing an operating system 1413, application programs 1414, and other program modules 1415.
[0220] The basic input / output system 1406 includes a display 1408 for displaying information and input devices 1409 such as a mouse and a keyboard for user input. Among them, both the display 1408 and the input devices 1409 are connected to the central processing unit 1401 through an input / output controller 1410 connected to the system bus 1405. The basic input / output system 1406 may further include an input / output controller 1410 for receiving and processing inputs from multiple other devices such as a keyboard, a mouse, or an electronic stylus. Similarly, the input / output controller 1410 also provides outputs to a display screen, a printer, or other types of output devices.
[0221] The mass storage device 1407 is connected to the central processing unit 1401 through a mass storage controller (not shown) connected to the system bus 1405. The mass storage device 1407 and its associated computer-readable medium provide non-volatile storage for the computer device 1400. That is to say, the mass storage device 1407 may include a computer-readable medium (not shown) such as a hard disk or a CD-ROM (Compact Disc Read-Only Memory) drive.
[0222] Without loss of generality, the computer-readable medium may include computer storage media and communication media. Computer storage media includes volatile and non-volatile, removable and non-removable media implemented by any method or technology for storing information such as computer-readable instructions, data structures, program modules, or other data. Computer storage media includes RAM, ROM, EPROM (Erasable Programmable Read-Only Memory), EEPROM (Electrically Erasable Programmable Read-Only Memory), flash memory or other solid-state storage technologies, CD-ROM, DVD (Digital Video Disc) or other optical storage, magnetic tape cartridges, tapes, disk storage or other magnetic storage devices. Of course, those skilled in the art will know that the computer storage media is not limited to the above several types. The above-mentioned system memory 1404 and mass storage device 1407 may be collectively referred to as memory.
[0223] According to an embodiment of the present application, the computer device 1400 may also be run by connecting to a remote computer on a network such as the Internet. That is, the computer device 1400 may be connected to the network 1412 through a network interface unit 1411 connected to the system bus 1405, or in other words, the network interface unit 1411 may also be used to connect to other types of networks or remote computer systems (not shown).
[0224] The memory further includes a computer program, which is stored in the memory and is configured to be executed by one or more processors to implement the above method for obtaining game data.
[0225] In some embodiments, a computer-readable storage medium is also provided. A computer program is stored in the storage medium, and when the computer program is executed by a processor, it is used to implement the above method for obtaining game data.
[0226] Optionally, the computer-readable storage medium may include: ROM (Read-Only Memory), RAM (Random-Access Memory), SSD (Solid State Drives), or optical discs, etc. Among them, the random access memory may include ReRAM (Resistance Random Access Memory) and DRAM (Dynamic Random Access Memory).
[0227] In some embodiments, a computer program product is further provided. The computer program product includes a computer program, and the computer program is stored in a computer-readable storage medium. The processor of the computer device reads the computer program from the computer-readable storage medium, and the processor executes the computer program, so that the computer device executes the above-mentioned method for obtaining game data.
[0228] It should be noted that, before and during the process of collecting the relevant data of the user in the embodiments of the present application, a prompt interface, a pop-up window or a voice prompt message can be displayed. The prompt interface, the pop-up window or the voice prompt message is used to prompt the user that their relevant data is being collected currently, so that the present application only starts to execute the relevant steps of obtaining the relevant data of the user after obtaining the confirmation operation of the user on the prompt interface or the pop-up window. Otherwise (that is, when the confirmation operation of the user on the prompt interface or the pop-up window is not obtained), the relevant steps of obtaining the relevant data of the user are ended, that is, the relevant data of the user is not obtained. In other words, all user data collected in the present application is processed strictly in accordance with the requirements of relevant national laws and regulations. Obtaining the informed consent or separate consent of the personal information subject is carried out under the condition of the user's consent and authorization, and subsequent data use and processing behaviors are carried out within the scope of laws, regulations and the authorization of the personal information subject, and the collection, use and processing of relevant user data need to comply with the relevant laws, regulations and standards of relevant countries and regions. For example, the game data involved in the present application is obtained under full authorization.
[0229] It should be understood that "a plurality of" as mentioned herein refers to two or more. "And / or" describes the association relationship of associated objects and indicates that there can be three relationships. For example, A and / or B can represent three situations: A exists alone, both A and B exist simultaneously, and B exists alone. The character " / " generally indicates an "or" relationship between the associated objects before and after. In addition, the step numbers described herein only exemplarily show a possible execution sequence between steps. In some other embodiments, the above steps may not be executed in the numbered order. For example, two steps with different numbers can be executed simultaneously, or two steps with different numbers can be executed in the reverse order of the illustration. The embodiments of the present application do not limit this.
[0230] The above are only exemplary embodiments of the present application and are not intended to limit the present application. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principle of the present application shall be included within the protection scope of the present application.
Claims
1. A method for obtaining game data, characterized in that, The method includes: Receiving a data acquisition request from a client, the data acquisition request being used to acquire game data of at least one data type, and the game data of the at least one data type being related to the user account logged in the client; For a first data type among the at least one data type, when the first data type belongs to a first type set, acquiring the game data of the first data type from a cache, wherein the game data of each data type in the first type set is backed up in the cache, and the game data of each data type in the first type set is permanently stored in a database in a first data structure; When the first data type belongs to a second type set, acquiring the game data of the first data type from the database, wherein the game data of each data type in the second type set is permanently stored in the database in a second data structure, and the access frequency of the game data stored in the first data structure is greater than the access frequency of the game data stored in the second data structure; Sending the game data corresponding to the at least one data type to the client.
2. The method according to claim 1, characterized in that, Before acquiring the game data of the first data type from the cache when the first data type belongs to the first type set, it further includes: Acquiring a processing handle corresponding to the first data type, the processing handle being used to indicate the acquisition method of the game data of the data type, and a structure field and a type field being defined in the processing handle, the structure field being used to indicate whether the data type belongs to the first type set, and the type field being used to indicate whether the data type belongs to the second type set; If the structure field is not empty, determining that the first data type belongs to the first type set; If the type field is not empty, determining that the first data type belongs to the second type set.
3. The method according to claim 2, wherein A first processing function for acquiring the game data of the data type in the first type set is further defined in the processing handle; The acquiring the game data of the first data type from the cache includes: Based on the character identifier in the data acquisition request, determining a first game data set corresponding to the character identifier in the cache, and the first game data set stores the game data corresponding to the character identifier in a third data structure; Executing the first processing function to acquire the game data of the first data type from the first game data set in the cache based on the structure field.
4. The method according to claim 2, wherein A second processing function for acquiring the game data of the data type in the second type set is further defined in the processing handle; The acquiring the game data of the first data type from the database includes: Based on the character identifier in the data acquisition request, determining a second game data set corresponding to the character identifier in the database, and the second game data set stores the game data corresponding to the character identifier in the second data structure; Execute the second processing function to obtain the game data of the first data type from the second game data set in the database based on the type field, where the type field is used to indicate the first data type.
5. The method according to claim 4, wherein The data acquisition request further includes a sub-data type under the first data type; The step of executing the second processing function to obtain the game data of the first data type from the second game data set in the database based on the type field includes: Execute the second processing function to obtain the game data of the sub-data type from the second game data set based on the type field and the sub-data type.
6. The method according to claim 2, wherein A third processing function for determining whether to enable data protection and an error code for indicating the enabling of the data protection are further defined in the processing handle; the method further includes: In the case where the game data of the first data type does not belong to the user account logged in to the client, execute the third processing function to detect whether the data protection of the game data of the first data type is enabled; If the data protection of the game data of the first data type is enabled, send the error code to the client; If the data protection of the game data of the first data type is not enabled, execute the step of obtaining the game data of the first data type from the cache or obtaining the game data of the first data type from the database.
7. The method according to claim 2, characterized in that, Before sending the game data corresponding to the at least one data type to the client, it further includes: In the case where the structure field is not empty and the type field is not empty, pack the game data of the first data type obtained from the cache and the game data of the first data type obtained from the database to obtain the game data corresponding to the first data type; Or, In the case where the structure field is not empty and the type field is empty, determine the game data of the first data type obtained from the cache as the game data corresponding to the first data type; Or, In the case where the structure field is empty and the type field is not empty, determine the game data of the first data type obtained from the database as the game data corresponding to the first data type.
8. The method according to claim 1, wherein Before receiving the data acquisition request from the client, it further includes: In the case where the first data type belongs to the first type set and does not belong to the second type set, set the storage location of the first data type in the cache as the value of the structure field in the processing handle corresponding to the first data type, and set the value of the type field in the processing handle corresponding to the first data type to be empty; Or, In the case where the first data type does not belong to the first type set and belongs to the second type set, set the value of the structure field in the processing handle corresponding to the first data type to be empty, and set the value of the type field in the processing handle corresponding to the first data type to the type identifier at the time of registration of the first data type; Or, When the first data type belongs to the first type set and also belongs to the second type set, set the storage location of the first data type in the cache to the value of the structure field in the processing handle corresponding to the first data type, and set the value of the type field in the processing handle corresponding to the first data type to the type identifier at the time of registration of the first data type.
9. The method according to claim 2, characterized in that, The processing handle is managed by an information manager; the method further includes: When a new data type is obtained, construct a new processing handle corresponding to the new data type; add the new processing handle to the information manager to complete the registration of the new processing handle. Or, When a data type to be deleted is obtained, remove the processing handle corresponding to the data type to be deleted from the information manager to cancel the registration of the processing handle corresponding to the data type to be deleted.
10. A device for obtaining game data, characterized in that, The device includes: An acquisition request receiving module, configured to receive a data acquisition request from a client, where the data acquisition request is used to acquire game data of at least one data type, and the game data of the at least one data type is related to the user account logged in to the client; A game data acquisition module, configured to, for a first data type among the at least one data type, when the first data type belongs to the first type set, acquire the game data of the first data type from the cache, where the game data of each data type in the first type set is backed up in the cache, and the game data of each data type in the first type set is permanently stored in a database in a first data structure; The game data acquisition module is further configured to, when the first data type belongs to the second type set, acquire the game data of the first data type from the database, where the game data of each data type in the second type set is permanently stored in the database in a second data structure, and the access frequency of the game data stored in the first data structure is greater than the access frequency of the game data stored in the second data structure; A game data sending module, configured to send the game data corresponding to each of the at least one data type to the client.
11. A computer device, characterized in that, The computer device includes a processor and a memory, and a computer program is stored in the memory, and the computer program is loaded and executed by the processor to implement the method for acquiring game data according to any one of claims 1 to 9.
12. A computer-readable storage medium, characterized in that, A computer program is stored in the computer-readable storage medium, and the computer program is loaded and executed by a processor to implement the method for acquiring game data according to any one of the above claims 1 to 9.
13. A computer program product, characterized in that, The computer program product includes a computer program, the computer program is stored in a computer-readable storage medium, and the processor reads and executes the computer program from the computer-readable storage medium to implement the method for acquiring game data according to any one of claims 1 to 9.