Game attribute synchronization method and apparatus, storage medium, and electronic device
By directly synchronizing game attributes between the engine layer and script layer of the terminal device, the problem of programming language limitations is solved, the efficiency of game attribute synchronization is improved, and efficient cross-language synchronization is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- NETEASE (HANGZHOU) NETWORK CO LTD
- Filing Date
- 2022-10-17
- Publication Date
- 2026-05-01
AI Technical Summary
In existing technologies, the game attribute synchronization process is limited by the binding mechanism of programming languages, resulting in low synchronization efficiency, especially in programming language environments that do not support the binding mechanism, where game attributes cannot be effectively synchronized.
Game attributes are synchronized at the engine layer of the terminal device, and the corresponding attributes are looked up in the script layer. The basic data types of the programming language are used directly for synchronization, avoiding the dependence on the binding mechanism and keeping the game attribute data types in the script layer consistent with those in the engine layer.
This enables game attribute synchronization between the engine layer and script layer within the terminal device to be unrestricted by programming languages, thus improving the efficiency of game attribute synchronization.
Smart Images

Figure CN115531885B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of game technology, and in particular to a game attribute synchronization method, a game attribute synchronization device, a computer-readable storage medium, and an electronic device. Background Technology
[0002] In the gaming industry, when game attributes such as a character's health, name, and equipment change, it's necessary to maintain synchronization between the client and server. On the client side, to balance data processing performance and development efficiency, the attribute mechanism is often implemented through an engine layer and a script layer. The engine layer uses a high-compilation-efficiency programming language, such as C++, while the script layer uses a high-development-efficiency programming language, such as Python.
[0003] Currently, in order to achieve game attribute synchronization between the engine layer and the script layer in the client, a data binding mechanism is usually used to link different programming languages for library sharing.
[0004] However, when using the binding mechanism to synchronize attribute information, the client's programming language must support the binding mechanism, which limits the client's attribute information synchronization process and thus affects the efficiency of game attribute synchronization in the client. Summary of the Invention
[0005] This disclosure provides a game attribute synchronization method, a game attribute synchronization device, a computer-readable storage medium, and an electronic device, which enables the synchronization of client attribute information during the game process to be unrestricted by programming languages, thereby improving the efficiency of game attribute synchronization in game terminals.
[0006] In a first aspect, one embodiment of this disclosure provides a game attribute synchronization method, which includes synchronizing the attribute content of a first attribute in the engine layer based on the attribute content of the game attribute to be synchronized; finding the second attribute corresponding to the first attribute in the script layer based on the first attribute; and synchronizing the attribute content of the second attribute based on the attribute content of the game attribute to be synchronized.
[0007] In an optional embodiment of this disclosure, synchronizing the attribute content of a first attribute in the engine layer based on the attribute content of the game attribute to be synchronized includes: receiving the game attribute to be synchronized sent by the server; wherein the game attribute to be synchronized includes at least an attribute identifier and attribute content; finding the first attribute corresponding to the attribute identifier in the engine layer; and synchronizing the content of the first attribute based on the attribute content to obtain the synchronized first attribute content.
[0008] In an optional embodiment of this disclosure, finding the second attribute corresponding to the first attribute in the script layer based on the first attribute includes: determining the attribute category identifier to which the first attribute belongs; and finding the second attribute corresponding to the first attribute in the script layer based on the attribute category identifier.
[0009] In an optional embodiment of this disclosure, finding the second attribute corresponding to the first attribute in the script layer based on the attribute category identifier includes: finding the attribute that matches the attribute identifier of the first attribute from multiple attributes in the attribute category identifier in the script layer, and obtaining the second attribute.
[0010] In one optional embodiment of this disclosure, the attribute category identifier indicates that the data type of the corresponding attribute is a composite data type, and / or the data type of the second attribute is a basic data type.
[0011] In an optional embodiment of this disclosure, the game attribute synchronization method further includes: receiving attribute addition information sent by the server; and adding game attributes corresponding to the attribute addition information in the engine layer and the pin layer according to the attribute addition information.
[0012] In an optional embodiment of this disclosure, adding game attributes corresponding to the newly added attribute information to the engine layer and the pin layer based on the newly added attribute information includes: determining the correlation between the newly added game attribute and the current game attributes; wherein, the newly added game attribute refers to the game attribute corresponding to the newly added attribute information; and associating the newly added game attribute with the game attribute with the highest correlation.
[0013] Secondly, one embodiment of this disclosure provides a game attribute synchronization device, which includes: a first synchronization module for synchronizing the attribute content of a first attribute in the engine layer based on the attribute content of the game attribute to be synchronized; an attribute lookup module for finding a second attribute corresponding to the first attribute in the script layer based on the first attribute; and a second synchronization module for synchronizing the attribute content of the second attribute based on the attribute content of the game attribute to be synchronized.
[0014] In an optional embodiment of this disclosure, the attribute synchronization module is specifically used to receive game attributes to be synchronized sent by the server; wherein, the game attributes to be synchronized include at least an attribute identifier and an attribute content; a first attribute corresponding to the attribute identifier is found in the engine layer; the content of the first attribute is synchronized based on the attribute content to obtain the synchronized first attribute content.
[0015] In an optional embodiment of this disclosure, the attribute lookup module is specifically used to determine the attribute category identifier to which the first attribute belongs; and to find the second attribute corresponding to the first attribute in the script layer based on the attribute category identifier.
[0016] In an optional embodiment of this disclosure, the attribute lookup module is specifically used to find the attribute that matches the attribute identifier of the first attribute from multiple attributes in the attribute category identifier in the script layer, thereby obtaining the second attribute.
[0017] In an optional embodiment of this disclosure, the attribute lookup module is used to identify the data type of the corresponding attribute as a composite data type, and / or the data type of the second attribute as a basic data type.
[0018] In an optional embodiment of this disclosure, the information receiving module is used to receive attribute addition information sent by the server; the attribute adding module is used to add game attributes corresponding to the attribute addition information in the engine layer and the pin layer according to the attribute addition information.
[0019] In an optional embodiment of this disclosure, the attribute addition module is used to determine the correlation between the newly added game attribute and the current game attributes; wherein, the newly added game attribute refers to the game attribute corresponding to the attribute addition information; and the newly added game attribute is associated with the game attribute with the highest correlation.
[0020] Fourthly, one embodiment of this disclosure provides a computer-readable storage medium having a computer program stored thereon that, when executed by a processor, implements the game attribute synchronization method described above.
[0021] Fifthly, one embodiment of this disclosure provides an electronic device, including: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to perform the above-described game attribute synchronization method by executing the executable instructions.
[0022] The technical solution disclosed herein has the following beneficial effects:
[0023] The aforementioned game attribute synchronization method can synchronize game attributes at the engine layer of the terminal device after receiving the attribute content of the game attributes to be synchronized. Then, it searches for the corresponding attribute in the engine layer from the script layer of the terminal device and modifies the found attribute according to the attribute content of the game attributes to be synchronized, thereby achieving game attribute synchronization within the terminal device. This method does not require the use of a binding mechanism to convert operations on game attributes in the script layer into operations on game attributes in the engine layer. Instead, it directly keeps the data type of the game attributes in the script layer the same as that in the engine layer. This avoids the requirement in traditional technologies that the programming language used by the terminal device must support the binding mechanism, thus solving the technical problem of poor compatibility with programming languages in the current game attribute synchronization process, which leads to low game attribute synchronization efficiency. It achieves the technical effect of improving the efficiency of game attribute synchronization within the terminal device by eliminating the limitation of programming languages in the game attribute synchronization process between the engine layer and the script layer.
[0024] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this disclosure. Attached Figure Description
[0025] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure. It is obvious that the drawings described below are merely some embodiments of this disclosure, and those skilled in the art can obtain other drawings based on these drawings without any inventive effort.
[0026] Figure 1 This illustration schematically shows a game attribute synchronization method based on a binding mechanism in this exemplary embodiment;
[0027] Figure 2 This illustration schematically shows a client-side game attribute synchronization method based on a binding mechanism in this exemplary embodiment;
[0028] Figure 3 This illustration schematically shows a diagram of a native dictionary attribute interface in this exemplary embodiment;
[0029] Figure 4 This illustration schematically shows an architecture diagram of a game attribute synchronization system in this exemplary embodiment;
[0030] Figure 5 This illustration schematically shows a flowchart of a game attribute synchronization method in this exemplary embodiment;
[0031] Figure 6 This illustration schematically shows a diagram of game attributes in a client terminal according to this exemplary embodiment;
[0032] Figure 7 This illustration schematically shows a structural diagram of a game attribute synchronization device in this exemplary embodiment;
[0033] Figure 8 This schematically illustrates a flowchart of a game attribute synchronization method in a script layer according to this exemplary embodiment;
[0034] Figure 9 This schematic diagram illustrates a scenario where game attributes are synchronized in a script layer according to this exemplary embodiment.
[0035] Figure 10 This illustration shows a schematic diagram of a game attribute corresponding to newly added attribute information in this exemplary embodiment;
[0036] Figure 11 This illustration shows a schematic diagram of the synchronization of newly added game attributes in a script layer in this exemplary embodiment;
[0037] Figure 12 This illustration schematically shows a structural diagram of a game attribute synchronization device in this exemplary embodiment;
[0038] Figure 13 This schematic diagram illustrates another game attribute synchronization device structure in this exemplary embodiment;
[0039] Figure 14 The schematic diagram illustrates the structure of an electronic device according to this exemplary embodiment. Detailed Implementation
[0040] Exemplary embodiments will now be described more fully with reference to the accompanying drawings. However, exemplary embodiments can be implemented in many forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided to make this disclosure more comprehensive and complete, and to fully convey the concept of exemplary embodiments to those skilled in the art. The described features, structures, or characteristics can be combined in any suitable manner in one or more embodiments. In the following description, numerous specific details are provided to give a full understanding of embodiments of this disclosure. However, those skilled in the art will recognize that the technical solutions of this disclosure can be practiced with one or more specific details omitted, or other methods, components, apparatus, steps, etc., can be employed. In other instances, well-known technical solutions are not shown or described in detail to avoid obscuring various aspects of this disclosure.
[0041] Furthermore, the accompanying drawings are merely illustrative of this disclosure and are not necessarily drawn to scale. The same reference numerals in the drawings denote the same or similar parts, and therefore repeated descriptions of them will be omitted. Some block diagrams shown in the drawings are functional entities and do not necessarily correspond to physically or logically independent entities. These functional entities may be implemented in software, in one or more hardware modules or integrated circuits, or in different network and / or processor devices and / or microcontroller devices.
[0042] The flowchart shown in the attached diagram is merely an illustrative example and does not necessarily include all steps. For example, some steps may be broken down, while others may be combined or partially combined; therefore, the actual execution order may change depending on the specific circumstances.
[0043] During game development, a large number of game objects are created on the server side, and the attribute information of each game object is predefined. Taking a game character as an example, a game character can include game attributes such as health (the data type corresponding to health is integer, int), name (the data type corresponding to health is string), weapon inventory, and various weapons in the weapon inventory (the data type corresponding to the weapon inventory and various weapons is dictionary, dict, where dict contains keys and values, where the key is the unique identifier of the weapon, and the value is the specific attribute content of the corresponding weapon).
[0044] After defining the game attributes of each game object on the server side, when the client connects to the server for the first time, the server sends all game attributes of each game object to the client. Subsequently, when a player's specific game attribute changes—for example, a game character's health decreases—the server generates corresponding attribute synchronization information for that specific attribute and sends it to the client. This attribute synchronization information includes the game attribute content to be synchronized. When the client receives the corresponding attribute synchronization information, it synchronizes the corresponding game attributes in the client according to the information, in order to maintain synchronization between the client's attributes and the server's game attributes.
[0045] To balance game system performance and game development efficiency, the attribute mechanism is implemented through both the engine layer and the script layer. The underlying logic implemented in the engine layer typically uses a high-efficiency compiled programming language, such as C++, to improve the game system's runtime performance; while the game logic implemented in the script layer uses a more flexible scripting language, such as Python, to improve game development efficiency.
[0046] Currently, client-side applications typically use the same programming language as the server-side application to synchronize game attributes. For example, if the server-side engine layer uses C++ and the script layer uses Python, then the client-side application connecting to the server will also use C++ for its engine layer and Python for its script layer. Therefore, the client-side application also uses a binding mechanism to synchronize game attributes between the engine and script layers.
[0047] The binding mechanism is an application programming interface and a wrapper that links two languages, allowing a library designed for one programming language to be used directly in another.
[0048] Figure 1 The illustration shows a schematic diagram of a game attribute synchronization method based on a binding mechanism in this exemplary embodiment.
[0049] refer to Figure 1 The server and client each contain an engine layer and a script layer, respectively. On the server side, when the attribute information in the script layer is modified, the corresponding game attributes in the engine layer are synchronized through a binding mechanism. Simultaneously, the engine layer can obtain the modification of the corresponding game attributes and generate attribute synchronization information to send to the client. The client, on the other hand, uses the binding mechanism to synchronize game attributes between its internal engine layer and script layer.
[0050] The following will combine Figure 2 This paper provides a detailed explanation of the process of synchronizing attribute information between the engine layer and the script layer in the client using the binding mechanism.
[0051] Figure 2 The illustration shows a schematic diagram of a client-side game attribute synchronization method based on a binding mechanism in this exemplary embodiment.
[0052] In step S201, attribute synchronization information is received.
[0053] The attribute synchronization information includes at least the attribute identifier and attribute content of the game attributes to be synchronized.
[0054] After receiving the attribute synchronization information sent by the server, the client's engine layer executes step S202 to modify the game attributes. That is, in the engine layer, based on the identifier of the attribute to be synchronized and the index of the game attribute, the corresponding game attribute is quickly located and its attribute content is modified to the aforementioned attribute content to be synchronized.
[0055] For example, the game attribute health point (hp) corresponding to id 2 is the game character's health. If the game character's health becomes 0, the attribute synchronization information generated by the server will be "the attribute content of attribute information with id=2 has been modified to 0". When the engine layer in the client receives the attribute synchronization information sent by the server, it looks up the game attribute based on the index of health identifier (id) -> hp, and synchronizes the attribute content to 0.
[0056] In step S203, game attributes are synchronized. For example, based on the binding mechanism, game attributes in the script layer are encapsulated into a data type consistent with the native data type of game attributes in the engine layer, and attribute synchronization information is automatically synchronized to the script layer based on the engine layer reference, thereby realizing game attribute synchronization in the client.
[0057] exist Figure 1 and Figure 2The client's script layer, as shown, contains data related to the binding mechanism (the data related to the binding mechanism is unrelated to specific business logic and attribute information), engine layer attribute references, and corresponding native dictionary attribute interfaces (or native attribute interfaces of composite data types such as native list attribute interfaces).
[0058] For example, engine-layer property references use a binding mechanism to map the corresponding property information data type in the script layer to the engine layer. Taking the native dictionary property interface as an example, the native dictionary property interface is a native data type encapsulated according to the binding mechanism. That is, the binding mechanism can encapsulate the property information of the dictionary data type in the script layer into a form consistent with the basic data type dictionary and list, making it convenient for clients to use.
[0059] In computer programming languages, primitive data types include basic data types and composite data types. Basic data types are the most fundamental data types in a programming language, such as integer (int), character (char), boolean (bool), floating-point (float), double-precision floating-point (double float), string (string), and void (no type). Composite data types are composed of basic data types and / or other composite data types, and can include arrays, structs, pointers, references, enumerations (enum), unions, dictionaries (dict), and lists (list).
[0060] Figure 3 The illustration shows a schematic diagram of a native dictionary attribute interface in this exemplary embodiment.
[0061] refer to Figure 3 Taking the native dictionary attribute interface as an example, suppose each game character contains game attributes including hp (health points), name, and a dictionary data type bag (backpack, where the key of the equipment in the backpack is the equipment ID, and the value is the equipment's attack and defense). Here, the player's hp is 50, name is monkey, and the backpack bag contains two pieces of equipment: equipment numbered 1001 has an attack and defense of 100 and 200 respectively, and equipment numbered 1002 has an attack and defense of 50 and 300 respectively.
[0062] Meanwhile, the above three game attributes belong to a dictionary data type root attribute information, and each attribute information contains a unique identifier.
[0063] Depend on Figure 3 As can be seen, the data types of multiple attribute information shown in the native dictionary attribute interface are all native data types. Game attributes of basic data types include the attribute's value, data type, identifier (id), and key. Game attributes of composite data types include the key, identifier (id), and data type. Game attributes of composite data types do not have a value; their specific value is displayed as a key-value pair. Furthermore, game attributes corresponding to composite data types can correspond to game attributes corresponding to basic data types.
[0064] However, the aforementioned method of using binding mechanisms to synchronize attribute information requires that the client's programming language support binding. However, clients that must use specific programming languages, such as JavaScript commonly used in web games, cannot support binding mechanisms for attribute information synchronization. This limits the client's attribute information synchronization process to the programming language, resulting in low efficiency in game attribute synchronization.
[0065] This exemplary embodiment addresses the aforementioned problems and proposes a game attribute synchronization method. This method, within the script layer of the terminal device, directly uses basic data types from the programming language to synchronize game attributes. This is equivalent to copying the game attributes from the engine layer within the script layer, thereby improving the performance of the terminal device in acquiring game attributes. First, the engine layer synchronizes the corresponding first attribute based on the game attributes to be synchronized sent by the server. Then, the script layer searches for the second attribute corresponding to the first attribute, and finally synchronizes the second attribute based on the attribute content of the game attributes to be synchronized. This achieves synchronization of game attributes between the script layer and the engine layer in the terminal device.
[0066] The following is a brief introduction to the application environment of the game attribute synchronization method provided by the exemplary embodiments of this disclosure:
[0067] Figure 4 A system architecture diagram for synchronizing game attributes is provided as an exemplary embodiment of this disclosure, such as... Figure 4 As shown, this game attribute synchronization system can include multiple terminal devices, which can be either server-side (401) or client-side (402). Each terminal device contains at least an engine layer (403) and a script layer (404). Taking client-side (402) as an example, the engine layer (403) provides the application programming interface for game programming, determining game performance, etc.; the script layer (404) is attached to the game engine framework and primarily handles the game logic of the business layer.
[0068] In a game scenario, when a game attribute of a game character changes, the server performs a 401 error to modify the game attribute and generates attribute synchronization information, which includes the attribute content of the game attribute to be synchronized.
[0069] After receiving the attribute synchronization information sent by the server 401, the client 402 synchronizes the attribute content of the first attribute in the engine layer 403 based on the attribute content of the game attribute to be synchronized; then, the client 402 finds the second attribute corresponding to the first attribute in the script layer 404 based on the first attribute; and synchronizes the attribute content of the second attribute based on the attribute content of the game attribute to be synchronized.
[0070] It should be noted that a server-side 401 or client-side 402 error can refer to a single server or a server cluster consisting of multiple servers.
[0071] It should be understood that, Figure 1 In the system architecture shown, the number of server 401 and client 402 is merely exemplary; more or fewer numbers are within the scope of this disclosure. Furthermore, in the above example operating scenario, server 401 and client 402 are both terminal devices, such as personal computers, servers, PDAs, laptops, or any other computing devices with network connectivity. The network for communication between server 401 and client 402 can include various types of wired and wireless networks.
[0072] The following example uses the aforementioned client 402 as the execution subject, and illustrates how the game attribute synchronization method is applied to the aforementioned client 402.
[0073] Figure 5 This schematically illustrates a flowchart of a game attribute synchronization method in this exemplary embodiment. See also... Figure 5 The game attribute synchronization method provided by the exemplary embodiments of this disclosure includes the following steps S501-S503:
[0074] Step S501: Synchronize the attribute content of the first attribute in the engine layer based on the attribute content of the game attribute to be synchronized.
[0075] Among them, the game attribute to be synchronized refers to the game attribute whose attribute content has changed, and the first attribute is the attribute in the engine layer that corresponds to the game attribute to be synchronized. For example, when the health attribute of a game character becomes 0, the game attribute to be synchronized is the health attribute, the attribute content is 0, and the first attribute is the health attribute in the engine layer.
[0076] For example, taking a game character's health as the game attribute to be synchronized, when a game character enters the game scene, assuming the character's health becomes 0, the server can prioritize synchronizing the health attribute and generate game attributes to be synchronized to send to the client. These game attributes to be synchronized are the attribute synchronization information mentioned above.
[0077] Step S502: Find the second attribute corresponding to the first attribute in the script layer based on the first attribute.
[0078] The game attributes contained in the engine layer and the script layer are in a one-to-one correspondence. For example, if the engine layer contains attributes such as health and name, then the script layer also contains corresponding health and name attributes. The second attribute is the game attribute in the script layer that corresponds to the first attribute. For example, if the first attribute is the health attribute in the engine layer, then the second attribute is the health attribute in the script layer.
[0079] For example, after the first attribute in the engine layer is synchronized, the second attribute corresponding to the first attribute in the script layer is found.
[0080] The following Figure 3 Based on the game attributes shown, it will be combined with Figure 6 An example illustration is provided for the attribute graphs of game attributes in the engine layer and script layer.
[0081] Figure 6 This illustration schematically depicts game attributes in a client terminal according to this exemplary embodiment. (Reference) Figure 6 The game attributes contained in the engine layer include health (key=hp), name (key=name), and game equipment (key=bag), and the game attribute to which these three game attributes belong is the root attribute (key=root). Meanwhile, the game attributes in the script layer correspond to the game attributes in the engine layer.
[0082] In this context, game attributes and their parent game attributes can form a parent-child relationship, which is relative. For example, for equipment (key = bag), its parent attribute is the root attribute (key = root), so equipment (key = hp) is a child attribute. Simultaneously, equipment (key = bag) is also the parent attribute of equipment 1001 (key = 1001) and equipment 1002 (key = 1002). Furthermore, the parent attribute must be a composite data type (e.g., dictionary type dict), while a game attribute with a basic data type (e.g., integer type int) cannot be a parent attribute.
[0083] Step S503: Synchronize the attribute content of the second attribute based on the attribute content of the game attribute to be synchronized.
[0084] In some embodiments of this disclosure, the technical solutions provided can perform game attribute synchronization at the engine layer of the terminal device after receiving the attribute content of the game attributes to be synchronized. Then, the corresponding attribute in the engine layer is searched in the script layer of the terminal device, and the searched attribute is modified according to the attribute content of the game attributes to be synchronized, thereby achieving game attribute synchronization within the terminal device. This method does not require the use of a binding mechanism to convert operations on game attributes in the script layer into operations on game attributes in the engine layer. Instead, it directly maintains the data type of the game attributes in the script layer as the same as that in the engine layer. This avoids the requirement in traditional technologies that the programming language used by the terminal device must support the binding mechanism, thus solving the technical problem of poor compatibility with programming languages in the current game attribute synchronization process, leading to low game attribute synchronization efficiency. It achieves the technical effect of improving the efficiency of game attribute synchronization within the terminal device by eliminating the limitation of programming languages in the game attribute synchronization process between the engine layer and the script layer.
[0085] In step S501 above, when the client synchronizes the attribute content of the first attribute in the engine layer based on the attribute content of the game attribute to be synchronized, the client can synchronize the game attribute in the engine layer based on the game attribute to be synchronized.
[0086] In an exemplary embodiment of this disclosure, the client receives game attributes to be synchronized from the server; finds the first attribute corresponding to the attribute identifier in the engine layer; and synchronizes the content of the first attribute based on the attribute content to obtain the synchronized content of the first attribute.
[0087] The game attributes to be synchronized must include at least an attribute identifier and an attribute content. The attribute identifier can be the game attribute's ID or key; the attribute content can be the game attribute's value. For example, if a game character's health attribute changes to 0, the game attribute to be synchronized could be "the value of the attribute with ID 2 has been modified to 0".
[0088] For example, after receiving the attribute identifier and attribute content of the game attribute to be synchronized from the server, the client can find the first attribute corresponding to the attribute identifier in the client's engine layer, so as to synchronize the content of the first attribute based on the attribute content. Since the engine layer has an identifier for each game attribute, and the engine layer maintains an index of identifier id->game attribute, the corresponding game attribute can be quickly located and its game content modified based on the index.
[0089] The following will be based on Figure 6 Based on the correspondence between game attributes in the engine layer and script layer of the client terminal shown, and combined with Figure 7The process of synchronizing the content of the first attribute is explained in detail.
[0090] refer to Figure 7 Suppose that the client receives the game attribute to be synchronized from the server as "the value of the attribute with id=2 has been modified to 0", where the attribute to be synchronized is identified as id=2 and the attribute content is 0.
[0091] The client locates the first attribute corresponding to the attribute identifier in the engine layer. Based on the index of identifier id->game attribute in the engine layer, it determines that id=2 corresponds to the health attribute. Finally, based on the attribute content, the value of the health attribute for id=2 is changed from 50 to 0. At this point, the attribute content of the health attribute in the client's script layer is not yet synchronized, meaning the value is still 50.
[0092] By finding the first attribute corresponding to the attribute identifier in the engine layer, the content of the first attribute can be synchronized. This allows for quick location of the attribute to be synchronized based on the attribute identifier, enabling direct synchronization of game attributes in the engine layer of the client, thereby improving the efficiency of game attribute synchronization.
[0093] Depend on Figure 7 It is known that after the game attributes of the client's engine layer are synchronized with those of the server, the corresponding game attributes of the script layer are not yet synchronized. The following will combine... Figure 8 , Figure 9 The process of synchronizing the game attributes corresponding to the script layer is illustrated.
[0094] Figure 8 The flowchart illustrating a game attribute synchronization method in a script layer is shown in this exemplary embodiment. See also... Figure 8 In an optional embodiment of this disclosure, step 502, which searches for the second attribute corresponding to the first attribute in the script layer based on the first attribute, may include the following steps S801-S802:
[0095] Step S801: Determine the attribute category identifier to which the first attribute belongs.
[0096] In an exemplary embodiment of this disclosure, when the second attribute corresponding to the first attribute in the script layer is found based on the first attribute, the attribute category identifier to which the first attribute belongs can be determined.
[0097] The attribute category identifier to which the first attribute belongs can also be called the parent attribute of the first attribute. The second attribute is the same attribute identifier in the script layer as the first attribute in the engine layer, for example, the same key value.
[0098] According to some embodiments of this disclosure, the attribute category identifier indicates that the data type of the corresponding attribute is a composite data type, and / or the data type of the second attribute is a basic data type.
[0099] For example, the data types of game attributes in the script layer use primitive data types. The attribute content of game attributes corresponding to basic data types within these primitive data types cannot be directly modified. This is because these basic data types are stored within composite data types, thus protecting the attribute content. For instance, the attribute content for health (HP) is located under the key of the root attribute (key=root) dictionary data type.
[0100] Therefore, when synchronizing game attributes for basic data types in the native data types, the association between the engine layer and the script layer is established through the parent attribute of the composite data type. Thus, the parent attribute can be searched first before attribute synchronization. That is, when the second attribute (e.g., HP) corresponding to the first attribute (e.g., HP) in the script layer is found based on the first attribute, the attribute category identifier (e.g., root attribute) to which the first attribute belongs can be determined.
[0101] by Figure 7 Taking the first attribute shown as the health attribute of a game character as an example, when synchronizing the health attribute in the script layer, the attribute category identifier to which the health attribute belongs in the engine layer can be determined, that is, the root attribute whose parent attribute is id=1 (key=root).
[0102] Step S802: Determine the attribute corresponding to the attribute category identifier in the script layer.
[0103] For example, based on the association relationship between the parent attribute of the composite data type between the engine layer and the script layer, the attribute corresponding to the attribute category identifier to which the first attribute belongs can be determined in step S801.
[0104] For example, if the attribute category of the first attribute in the engine layer is identified as the root attribute (key=root) with id=1, and the data type of the root attribute is a composite data type, then the root attribute (key=root) of the script layer is determined based on the association relationship.
[0105] Step S803: Based on the attribute corresponding to the attribute category identifier, find the second attribute corresponding to the first attribute in the script layer.
[0106] For example, after determining the root attribute (key=root) of the script layer based on the association relationship, the attribute content of the health attribute (key=hp) associated with the root attribute (key=root) of the script layer can be synchronized.
[0107] By determining the attribute category identifier of the first attribute in the engine layer, the corresponding second attribute can be found in the script layer for game attribute synchronization. The attribute content of the child attributes of basic data types that cannot be directly modified can be synchronized according to the parent attribute of the composite data type, thereby improving the efficiency of game attribute synchronization.
[0108] In an exemplary embodiment of this disclosure, when the second attribute corresponding to the first attribute is found in step S803, the attribute that matches the attribute identifier of the first attribute can be found from multiple attributes in the attribute category identifier in the script layer to obtain the second attribute.
[0109] For example, the attribute category identifier maintains multiple sub-attribute information under its corresponding attribute. For instance, the root attribute (key=root) in the script layer includes a health attribute (key=hp), a name attribute (key=name), and an equipment attribute (key=bag). The game attribute to be synchronized can be determined based on the attribute identifier (key=hp) of the first attribute, thereby synchronizing the health attribute.
[0110] By identifying the game attributes to be synchronized under the attribute category identifier in the script layer by attribute identifier, the game attributes that need to be synchronized can be accurately located, thereby further improving the efficiency of game attribute synchronization.
[0111] exist Figure 8 Based on the game attribute synchronization method shown in the script layer. Figure 9 This illustration shows a schematic diagram of game attributes synchronized in a script layer according to this exemplary embodiment.
[0112] like Figure 9 As shown, after finding the second attribute corresponding to the first attribute in the script layer, the script layer can implement the instruction root[hp]=0 to synchronize the value of the second attribute's health attribute (key=hp) to 0, thereby realizing the synchronization of game attributes between the engine layer and the script layer in the client.
[0113] Furthermore, during the synchronization of game character attributes, in addition to modifying the attribute content mentioned above, game attributes can also be added. For example, the equipment attribute (key=bag) could be updated to include new equipment.
[0114] In an exemplary embodiment of this disclosure, attribute addition information sent by the server is received; and game attributes corresponding to the attribute addition information are added in the engine layer and script layer according to the attribute addition information.
[0115] The newly added attribute information refers to newly added game attributes. This information must include at least the attribute identifier, attribute content, and the parent attribute of the new game attribute. For example, if a new piece of equipment is added with the attribute ID 1003, and the equipment has an attack power of 70 and a defense power of 35, then the newly added attribute information would be: "The attribute with ID=4 has added an attribute with key=1003, ID=11, value=dict. The attribute with ID=11 includes attributes with key=attack, ID=12, value=70, and attributes with key=defense, ID=13, value=35." Here, the attribute with ID=4 is the parent attribute of the newly added game attribute with ID=11.
[0116] Based on some embodiments of this disclosure, the following will be combined with Figure 10 This document explains the process of adding game attributes corresponding to the newly added attribute information at the engine and script layers based on the attribute information. Figure 10 This illustration shows a schematic diagram of a game attribute corresponding to newly added attribute information in this exemplary embodiment.
[0117] like Figure 10 As shown, suppose the server sends the attribute addition information as follows: "The attribute id=4 has added an attribute with key=1003, id=11, value=dict. The attribute id=11 includes attributes with key=attack, id=12, value=70, and key=defense, id=13, value=35." Then, the corresponding game attributes will be added at both the engine layer and the script layer.
[0118] After receiving the attribute addition information from the server, the client adds the corresponding attribute with key=1003 in the client's engine layer. Simultaneously, in the script layer, it creates the corresponding native data type for the game attribute.
[0119] When adding new game attributes, the game attributes corresponding to the attribute addition information sent by the server are created directly. This avoids the need for some technologies to change the game attribute synchronization operation at the script layer to the game attribute synchronization process at the engine layer, thereby improving the efficiency of obtaining game attributes and further improving the efficiency of game attribute synchronization on terminal devices.
[0120] Figure 10 As shown, the primitive data types created in the script layer are not associated with the current game attributes, therefore game attribute synchronization is not completed in the script layer. Therefore, it is necessary to establish a relationship between the newly added game attributes in the script layer and the existing game attributes.
[0121] In an exemplary embodiment of this disclosure, the correlation between the newly added game attribute and the existing game attributes is determined; the newly added game attribute is then associated with the game attribute with the highest correlation.
[0122] Among them, newly added game attributes refer to the game attributes corresponding to newly added attribute information; correlation refers to the possibility of establishing a parent-child relationship between existing game attributes and newly added game attributes.
[0123] For example, the relationship between the newly added game attribute and the existing game attributes can be determined based on the attribute addition information sent by the server. For instance, in the attribute addition information "The attribute with id=4 has added an attribute with key=1003, id=11, and value=dict", the game attribute with id=4 is the existing game attribute, and the game attribute with id=11 is the newly added game attribute.
[0124] exist Figure 10 Based on the newly added attribute information, game attributes corresponding to the newly added attribute information are added at the engine layer and script layer. Figure 11 The game attribute with the highest correlation between key=bag and key=1003 can be associated with the newly added game attribute key=1003, thus achieving synchronization of game attributes between the script layer and the engine layer.
[0125] According to some embodiments of this disclosure, the association between newly added game attributes can be established in advance based on the attribute addition information at the script layer, and then the association between the newly added game attributes and the current game attributes can be established.
[0126] According to some other embodiments of this disclosure, the association between the newly added game attributes and the current game attributes can be established in advance at the script layer based on the attribute addition information, and then the association between the newly added game attributes can be established.
[0127] Associating newly added game attributes with the most relevant game attribute allows for the establishment of a connection between the new attribute information and the current game attribute after the new attribute information is added at the script layer. This enables game attribute synchronization between the engine layer and the script layer. This process can improve the performance of retrieving game attributes and further enhance the efficiency of game attribute synchronization.
[0128] Based on any of the above embodiments, if a new game attribute is added, it can be added directly to the existing game attribute without determining its associated parent attribute. If a game attribute is modified, the parent attribute of the game attribute to be synchronized is first found in the engine layer, and then the attribute content is modified.
[0129] Furthermore, in order to implement the above-mentioned game attribute synchronization method, one embodiment of this disclosure provides a game attribute synchronization device. Figure 12 A schematic diagram of the game attribute synchronization device is shown.
[0130] The game attribute synchronization device 1200 includes a first synchronization module 1201, an attribute lookup module 1202, and a second synchronization module 1203.
[0131] The first synchronization module 1201 is used to synchronize the attribute content of the first attribute in the engine layer based on the attribute content of the game attribute to be synchronized; the attribute lookup module 1202 is used to find the second attribute corresponding to the first attribute in the script layer based on the first attribute; the second synchronization module 1203 is used to synchronize the attribute content of the second attribute based on the attribute content of the game attribute to be synchronized.
[0132] The game attribute synchronization device 1200 provided in this illustrative embodiment can execute the technical solution of the game attribute synchronization method in any of the above embodiments. Its implementation principle and beneficial effects are similar to those of the game attribute synchronization method. Please refer to the implementation principle and beneficial effects of the game attribute synchronization method. It will not be repeated here.
[0133] Furthermore, one embodiment of this disclosure also provides another game attribute synchronization device. Figure 13 A schematic diagram of the game attribute synchronization device is shown.
[0134] The game attribute synchronization device 1300 includes an attribute synchronization module 1301, an attribute search module 1302, an information receiving module 1303, and an attribute addition module 1304.
[0135] In an optional embodiment, the attribute synchronization module 1301 is specifically used to receive game attributes to be synchronized sent by the server; wherein the game attributes to be synchronized include at least an attribute identifier and an attribute content; a first attribute corresponding to the attribute identifier is found in the engine layer; the content of the first attribute is synchronized based on the attribute content to obtain the synchronized first attribute content.
[0136] In an optional embodiment, the attribute lookup module 1302 is specifically used to determine the attribute category identifier to which the first attribute belongs; and to find the second attribute corresponding to the first attribute in the script layer based on the attribute category identifier.
[0137] In an optional embodiment, the attribute lookup module 1302 is specifically used to find the attribute that matches the attribute identifier of the first attribute from multiple attributes in the attribute category identifier in the script layer, and obtain the second attribute.
[0138] In an optional embodiment, the attribute lookup module 1302 is used to identify the data type of the corresponding attribute as a composite data type, and / or the data type of the second attribute as a basic data type.
[0139] In an optional embodiment, the information receiving module 1303 is used to receive attribute addition information sent by the server; the attribute adding module 1304 is used to add game attributes corresponding to the attribute addition information in the engine layer and the pin layer according to the attribute addition information.
[0140] In an optional embodiment, the attribute addition module 1304 is used to determine the correlation between the newly added game attribute and the current game attributes; wherein, the newly added game attribute refers to the game attribute corresponding to the attribute addition information; and the newly added game attribute is associated with the game attribute with the highest correlation.
[0141] The game attribute synchronization device 1300 provided in the illustrative embodiment of this disclosure can execute the technical solution of the game attribute synchronization method in any of the above embodiments. Its implementation principle and beneficial effects are similar to those of the game attribute synchronization method. Please refer to the implementation principle and beneficial effects of the game attribute synchronization method. It will not be repeated here.
[0142] In exemplary embodiments of this disclosure, a computer-readable storage medium is also provided, on which a program product capable of implementing the methods described above is stored. In some possible embodiments, various aspects of the present invention may also be implemented as a program product comprising program code that, when the program product is run on a terminal device, causes the terminal device to perform the steps of the various exemplary embodiments of the present invention described in the "Exemplary Methods" section above.
[0143] According to embodiments of the present invention, a program product for implementing the above-described method may employ a portable compact disc read-only memory (CD-ROM) and include program code, and may run on a terminal device, such as a personal computer. However, the program product of the present invention is not limited thereto. In this document, a readable storage medium may be any tangible medium containing or storing a program that may be used by or in conjunction with an instruction execution system, apparatus, or device.
[0144] The program product may employ any combination of one or more readable media. A readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples (a non-exhaustive list) of readable storage media include: electrical connections having one or more wires, portable disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.
[0145] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, carrying readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A readable signal medium may also be any readable medium other than a readable storage medium, capable of sending, propagating, or transmitting programs for use by or in conjunction with an instruction execution system, apparatus, or device.
[0146] The program code contained on the readable medium may be transmitted using any suitable medium, including but not limited to wireless, wired, optical fiber, RF, etc., or any suitable combination thereof.
[0147] Program code for performing the operations of this invention can be written in any combination of one or more programming languages, including object-oriented programming languages such as Java and C++, and conventional procedural programming languages such as C or similar languages. The program code can execute entirely on the user's computing device, partially on the user's computing device, as a standalone software package, partially on the user's computing device and partially on a remote computing device, or entirely on a remote computing device or server. In cases involving remote computing devices, the remote computing device can be connected to the user's computing device via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computing device (e.g., via the Internet using an Internet service provider).
[0148] In an exemplary embodiment of this disclosure, an electronic device capable of implementing the above-described method is also provided.
[0149] Those skilled in the art will understand that various aspects of the present invention can be implemented as systems, methods, or program products. Therefore, various aspects of the present invention can be specifically implemented in the following forms: entirely hardware implementations, entirely software implementations (including firmware, microcode, etc.), or implementations combining hardware and software aspects, collectively referred to herein as “circuits,” “modules,” or “systems.”
[0150] The following reference Figure 14 To describe an electronic device 1400 according to this embodiment of the present invention. Figure 14 The electronic device 1400 shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of the present invention.
[0151] like Figure 14 As shown, the electronic device 1400 is manifested in the form of a general-purpose computing device. The components of the electronic device 1400 may include, but are not limited to: at least one processing unit 1410, at least one storage unit 1420, a bus 1430 connecting different system components (including storage unit 1420 and processing unit 1410), and a display unit 1440.
[0152] The storage unit stores program code, which can be executed by the processing unit 1410 to perform the steps described in the "Exemplary Methods" section of this specification according to various exemplary embodiments of the present invention. For example, the processing unit 1410 can perform actions such as... Figure 5 Steps S501 to S503 are shown in the diagram.
[0153] Storage unit 1420 may include readable media in the form of volatile storage units, such as random access memory (RAM) 14201 and / or cache memory 14202, and may further include read-only memory (ROM) 14203.
[0154] Storage unit 1420 may also include a program / utility 14204 having a set (at least one) of program modules 14205, such program modules 14205 including but not limited to: operating system, one or more application programs, other program modules and program data, each or some combination of these examples may include an implementation of a network environment.
[0155] Bus 1430 can represent one or more of several types of bus structures, including a memory cell bus or memory cell controller, a peripheral bus, a graphics acceleration port, a processing unit, or a local bus using any of the various bus structures.
[0156] Electronic device 1400 can also communicate with one or more external devices 1500 (e.g., keyboard, pointing device, Bluetooth device, etc.), and with one or more devices that enable a user to interact with electronic device 1400, and / or with any device that enables electronic device 1400 to communicate with one or more other computing devices (e.g., router, modem, etc.). This communication can be performed via input / output (I / O) interface 1450. Furthermore, electronic device 1400 can also communicate with one or more networks (e.g., local area network (LAN), wide area network (WAN), and / or public networks, such as the Internet) via network adapter 1460. As shown, network adapter 1460 communicates with other modules of electronic device 1400 via bus 1430. It should be understood that, although not shown in the figures, other hardware and / or software modules can be used in conjunction with electronic device 1400, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0157] From the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein can be implemented by software or by combining software with necessary hardware. Therefore, the technical solutions according to the embodiments of this disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (such as a CD-ROM, USB flash drive, external hard drive, etc.) or on a network, including several instructions to cause a computing device (such as a personal computer, server, terminal device, or network device, etc.) to execute the methods according to the embodiments of this disclosure.
[0158] Furthermore, the above figures are merely illustrative of the processes included in the method according to exemplary embodiments of the present invention, and are not intended to be limiting. It is readily understood that the processes shown in the above figures do not indicate or limit the temporal order of these processes. Additionally, it is readily understood that these processes may be executed synchronously or asynchronously, for example, in multiple modules.
[0159] It should be noted that although several modules or units for the device used to perform actions have been mentioned in the detailed description above, this division is not mandatory. In fact, according to embodiments of this disclosure, the features and functions of two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided and embodied by multiple modules or units.
[0160] Other embodiments of this disclosure will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure and include common knowledge or customary techniques in the art not disclosed herein. The specification and embodiments are to be considered exemplary only, and the true scope and spirit of this disclosure are indicated by the claims.
[0161] It should be understood that this disclosure is not limited to the precise structures described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this disclosure is defined only by the appended claims.
Claims
1. A method for synchronizing game attributes, characterized in that, Applied to terminal devices, the game attribute synchronization method includes: The attribute content of the first attribute in the engine layer is synchronized based on the attribute content of the game attribute to be synchronized; Determine the attribute category identifier to which the first attribute belongs, and find the attribute that matches the attribute identifier of the first attribute from multiple attributes in the attribute category identifier in the script layer to obtain the second attribute; The attribute content of the second attribute is synchronized based on the attribute content of the game attribute to be synchronized.
2. The game attribute synchronization method according to claim 1, characterized in that, The synchronization of the attribute content of the first attribute in the engine layer based on the attribute content of the game attribute to be synchronized includes: The game attributes to be synchronized are sent by the server; wherein the game attributes to be synchronized include at least an attribute identifier and the attribute content. The first attribute corresponding to the attribute identifier is found in the engine layer; The content of the first attribute is synchronized based on the attribute content to obtain the synchronized first attribute content.
3. The game attribute synchronization method according to claim 1, characterized in that, The attribute category identifier indicates that the data type of the corresponding attribute is a composite data type, and / or, The data type of the second attribute is a basic data type.
4. The game attribute synchronization method according to claim 1, characterized in that, Also includes: Receive attribute addition information sent by the server; Based on the newly added attribute information, the game attributes corresponding to the newly added attribute information are added to the engine layer and the script layer.
5. The game attribute synchronization method according to claim 4, characterized in that, The step of adding game attributes corresponding to the newly added attribute information to the engine layer and the script layer based on the newly added attribute information includes: Determine the correlation between the newly added game attribute and the existing game attributes; wherein, the newly added game attribute refers to the game attribute corresponding to the newly added attribute information; The newly added game attribute is associated with the game attribute with the highest correlation.
6. A game attribute synchronization device, characterized in that, include: The first synchronization module is used to synchronize the attribute content of the first attribute in the engine layer based on the attribute content of the game attribute to be synchronized. The attribute lookup module is used to determine the attribute category identifier to which the first attribute belongs, and to find the attribute that matches the attribute identifier of the first attribute from multiple attributes in the attribute category identifier in the script layer, so as to obtain the second attribute; The second synchronization module is used to synchronize the attribute content of the second attribute based on the attribute content of the game attribute to be synchronized.
7. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the game attribute synchronization method according to any one of claims 1 to 5.
8. An electronic device, characterized in that, include: processor; as well as Memory for storing the executable instructions of the processor; The processor is configured to execute the game attribute synchronization method according to any one of claims 1 to 5 by executing the executable instructions.
Citation Information
Patent Citations
Data access method for game client, and client game system
CN106850650A
Game data synchronization method and device, storage medium and processor
CN110639207A