Virtual scene processing method and device, electronic equipment and storage medium
By establishing a dual-ended shared data area and a single-ended data area between electronic devices, the problem of low efficiency of collaborative processing of electronic devices in virtual scene processing is solved, and more efficient interaction and storage is achieved, while ensuring the flexibility of single-ended devices.
Patent Information
- Application Number
- CN202411761749.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-03
- Publication Date
- 2025-03-28
AI Technical Summary
In the prior art, during the processing of virtual scenes, the collaborative processing efficiency between electronic devices is low and it is difficult to effectively improve.
By establishing a dual-ended shared data area and a single-ended data area between the first electronic device and the second electronic device, and storing the shared logical data of the two-ended and unique logical data of the single-ended respectively, the coordinated processing of the virtual scene is realized.
It improves the interaction efficiency and collaborative processing efficiency between electronic devices, reduces data storage costs, and ensures the flexibility and adaptability of single-ended devices.
Smart Images

Figure CN119701346A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present disclosure relate to the field of data processing technology, and in particular to a method, device, electronic device and storage medium for processing a virtual scene. Background Art
[0002] A virtual scene refers to a three-dimensional environment that exists in the digital world and is created through computer technology. It can simulate the real world or be a purely imaginary space. A virtual scene usually contains one or more virtual objects. A virtual object is a three-dimensional object or entity that is simulated and generated through computer technology. It does not exist in the physical world, but in a virtual environment. Virtual objects can be simple geometric shapes or complex structures, such as buildings, vehicles, and people.
[0003] Virtual scenes can be widely used in various scenarios such as virtual reality (VR), augmented reality (AR), game development, education and training. For example, in a VR environment, users can enter the virtual world by wearing VR helmets and other devices, interact with virtual objects, and experience an immersive virtual environment. In AR applications, virtual objects are superimposed on images of the real world to provide users with an enhanced visual experience. For example, on a smartphone, users can use AR applications to view the placement of furniture in a room. In game development, virtual objects are an important element in game development, which constitute the main body of the game world, such as characters, props, scenes, etc.
[0004] In related technologies, the processing of a virtual scene usually involves at least two electronic devices. Therefore, how to improve the collaborative processing efficiency between electronic devices has become a technical problem that needs to be solved urgently. Summary of the invention
[0005] In view of the above problems, the present disclosure is proposed to provide a method, device, electronic device and storage medium for processing a virtual scene that overcomes the above problems or at least partially solves the above problems.
[0006] According to one aspect of an embodiment of the present disclosure, a method for processing a virtual scene is provided, which is applied to a first electronic device, where the first electronic device is used to perform two-end communication with a second electronic device to achieve collaborative processing of the virtual scene. The method includes:
[0007] Acquire first logic data of the virtual scene from a first data area, and generate a first processing result corresponding to the first logic data; wherein the first data area is a dual-end shared data area corresponding to the first electronic device and the second electronic device;
[0008] Acquire second logic data of the virtual scene from a second data area, and generate a second processing result corresponding to the second logic data; wherein the second data area is a single-end data area corresponding to the first electronic device;
[0009] A target processing result of the virtual scene is generated according to the first processing result and the second processing result.
[0010] In an optional implementation, the virtual scene is a game-type virtual scene, and before acquiring the first logical data of the virtual scene from the first data area, the method further includes:
[0011] Splitting the logic code corresponding to the game-like virtual scene into a homogeneous part shared by both ends and a heterogeneous part accessed by a single end;
[0012] The homogeneous part shared by both ends is stored in the first data area, and the heterogeneous part accessed by a single end is stored in the second data area.
[0013] In an optional implementation, when the first electronic device is a client device, the second electronic device is a server device; when the first electronic device is a server device, the second electronic device is a client device;
[0014] Among them, the first logical data of the virtual scene includes: the logical data of the action behavior type commonly used in the client device and the server device in the game virtual scene; and the first processing result includes: the scene state information of the virtual scene calculated according to the logical data of the action behavior type, and the second processing result corresponding to the second logical data is obtained according to the scene state information.
[0015] In an optional implementation, the target processing result of the virtual scene is generated by: acquiring a third processing result generated by the second electronic device, and obtaining the target processing result of the virtual scene according to the second processing result and the third processing result;
[0016] The third processing result generated by the second electronic device is generated in the following manner: the second electronic device obtains the third logical data of the virtual object from a third data area, and generates a third processing result corresponding to the third logical data; wherein the third data area is a single-ended data area corresponding to the second electronic device.
[0017] In an optional implementation, when the first electronic device is a client device and the second electronic device is a server device, the second data area is a client data area corresponding to the client device; and the second logical data of the virtual scene includes: logical data associated with a rendering operation; the third data area is a server data area corresponding to the server device; and the third logical data of the virtual object includes: logical data associated with a post-processing operation;
[0018] When the first electronic device is a server device and the second electronic device is a client device, the second data area is a server database corresponding to the server device; and the second logical data of the virtual object includes: logical data associated with post-processing operations; the third data area is a client data area corresponding to the client device; and the third logical data of the virtual object includes: logical data associated with rendering operations; wherein the post-processing operations include: arbitration operations, and / or determination operations.
[0019] In an optional implementation, the logic data of the action behavior type common to the client device and the server device is used to characterize the interactive action triggered by the virtual object in the game virtual scene on the interactive object;
[0020] The first electronic device is a client device, and the second electronic device is a server device, and the post-processing operation includes: an arbitration decision operation; the third processing result is used to characterize the arbitration decision result obtained by the server device for the interactive action, and the second processing result is used to characterize the rendering result obtained by the client device for the interactive action. In an optional implementation, the first data area and / or the second data area further includes: a component storage sub-area for storing attribute components of virtual objects in the virtual scene, and a logic storage sub-area for storing processing logic of the virtual objects;
[0021] Furthermore, the first logic data and / or the second logic data are obtained by:
[0022] For any virtual object to be processed in the virtual scene, obtain an attribute component corresponding to the object state of the virtual object from the multiple attribute components stored in the component storage sub-area; and obtain a processing logic corresponding to the object state of the virtual object from the multiple processing logics stored in the logic storage sub-area;
[0023] The acquired attribute components and processing logic are combined to obtain the first logic data and / or the second logic data for processing the virtual object.
[0024] In an optional implementation, when the first data area further includes a plurality of different types of processing logics, the acquiring the first logic data of the virtual scene from the first data area includes:
[0025] According to the device type of the first electronic device, selecting a pre-configured processing logic corresponding to the device type from the multiple different types of processing logics, and obtaining first logic data of the virtual scene according to the selected processing logic;
[0026] The device type is used to characterize that the first electronic device is a client device or a server device.
[0027] In an optional implementation, when the first data area further includes a plurality of different types of processing logics, the acquiring the first logic data of the virtual scene from the first data area includes:
[0028] Acquiring the scene state of the virtual scene;
[0029] A preconfigured processing logic corresponding to the scene state is selected from the multiple types of processing logics, and first logic data of the virtual scene is obtained according to the selected processing logic.
[0030] In an optional implementation, the second electronic device is used to obtain first logic data of the virtual scene from the first data area, and generate a first processing result corresponding to the first logic data;
[0031] After generating the first processing result corresponding to the first logical data, the method further includes:
[0032] Synchronous logic data is acquired from the first data area, and synchronous verification processing between a first processing result generated by the first electronic device and a first processing result generated by the second electronic device is implemented according to the synchronous logic data.
[0033] In an optional implementation, the synchronization logic data stored in the first data area includes: at least two types of pre-configured synchronization logic algorithms;
[0034] The acquiring of synchronization logic data from the first data area comprises:
[0035] Acquiring a scene state of the virtual scene, and selecting a synchronization logic algorithm corresponding to the scene state from the at least two types of pre-configured synchronization logic algorithms;
[0036] The at least two types of synchronization logic algorithms include: a frame synchronization algorithm and a state synchronization algorithm.
[0037] In an optional implementation, the virtual scene is a game-type virtual scene, and the scene state of the virtual scene is dynamically determined according to the game type and / or game running stage corresponding to the game-type virtual scene;
[0038] Furthermore, when the selected synchronization logic algorithm corresponding to the scene state is a frame synchronization algorithm, at least one of the following types of verification processing is further performed on the program code associated with the frame synchronization algorithm:
[0039] In the case where it is detected that the program code contains floating-point data, replacing the floating-point data with fixed-point data;
[0040] In case it is detected that the program code contains an unordered data structure, replacing the unordered data structure with an ordered data structure;
[0041] In the case where it is detected that the client device and the server device share a pseudo-random seed, verifying whether random results of the pseudo-random seed are consistent;
[0042] When it is detected that the data recording function is not enabled for the attribute component of the virtual object, the data recording function is enabled for the attribute component of the virtual object.
[0043] In an optional implementation, the first data area corresponds to a first project engineering file, the second data area corresponds to a second project engineering file, and the third data area corresponds to a third project engineering file;
[0044] The first project engineering file can be accessed by both the client device and the server device; and, when the second project engineering file can be accessed by the client device, the third project engineering file can be accessed by the server device; when the second project engineering file can be accessed by the server device, the third project engineering file can be accessed by the client device; and there is no function reference relationship between different project engineering files.
[0045] According to another aspect of the present disclosure, a virtual scene processing device is provided, which is applied to a first electronic device, the first electronic device is used to perform two-end communication with a second electronic device to achieve collaborative processing of the virtual scene, and the device includes:
[0046] A first processing module, adapted to obtain first logic data of the virtual scene from a first data area, and generate a first processing result corresponding to the first logic data; wherein the first data area is a dual-end shared data area corresponding to the first electronic device and the second electronic device;
[0047] A second processing module, adapted to obtain second logic data of the virtual scene from a second data area, and generate a second processing result corresponding to the second logic data; wherein the second data area is a single-end data area corresponding to the first electronic device;
[0048] A target processing result of the virtual scene is generated according to the first processing result and the second processing result.
[0049] According to another aspect of the present disclosure, a virtual scene processing system is provided, comprising: a client device implemented by the above-mentioned virtual scene processing apparatus, and a server device implemented by the above-mentioned virtual scene processing apparatus;
[0050] The processing system further includes: a first data area shared by the client device and the server device, a second data area accessed by the client device, and a third data area accessed by the server device.
[0051] According to another aspect of the present disclosure, there is provided an electronic device, comprising: a processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface communicate with each other via the communication bus;
[0052] The memory is used to store at least one executable instruction, and the executable instruction enables the processor to execute the virtual scene processing method as described above.
[0053] According to another aspect of the present disclosure, a computer storage medium is provided, wherein the storage medium stores at least one executable instruction, and the executable instruction enables a processor to execute the virtual scene processing method as described above.
[0054] According to another aspect of the present disclosure, a computer program product is provided, characterized in that it includes a computer-readable code, or a non-volatile computer-readable storage medium carrying the computer-readable code, and when the computer-readable code runs in a processor of an electronic device, the processor in the electronic device executes the virtual scene processing method as described above.
[0055] In the embodiment of the present disclosure, for the first electronic device and the second electronic device in two-way communication, two different data areas are configured at the same time, wherein the first data area is a two-way shared data area, which is used to store the logic data common to the first electronic device and the second electronic device, so that the two ends can share part of the data, avoiding the waste of storage space caused by redundant configuration of the data shared by the two ends, and the problem of low processing efficiency caused by this. In addition, the second data area is a single-end database used only by the first electronic device, which is used to store the logic data in the first electronic device that is different from the second electronic device. This part of the logic data is only run by the first electronic device. Therefore, by configuring the single-end data area corresponding to the first electronic device side, it is convenient to configure the logic data that is compatible with the business functions and logic characteristics of the first electronic device side in a targeted manner according to the logic characteristics of the first electronic device side. It can be seen that the present application can simultaneously configure a shared data area (i.e., the first data area) and a non-shared data area (i.e., the second data area) for one end of an electronic device communicating at both ends, thereby ensuring the reuse of the shared logic at both ends and reducing the data storage cost; and ensuring the flexibility of the unique logic at a single end, so as to flexibly configure a processing logic different from that at the other end according to the characteristics of the single-end device, thereby taking into account both storage cost and adaptation flexibility. In short, by dividing different data areas, the interaction efficiency between electronic devices is improved, thereby improving the collaborative processing efficiency between electronic devices.
[0056] The above description is only an overview of the technical solution of the present disclosure. In order to more clearly understand the technical means of the present disclosure, it can be implemented according to the contents of the specification. In order to make the above and other purposes, features and advantages of the present disclosure more obvious and easy to understand, the specific implementation methods of the present disclosure are listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0057] Various other advantages and benefits will become apparent to those of ordinary skill in the art by reading the detailed description of the preferred embodiments below. The accompanying drawings are only for the purpose of illustrating the preferred embodiments and are not to be considered as limiting the present disclosure. Also, the same reference symbols are used throughout the accompanying drawings to represent the same components. In the accompanying drawings:
[0058] Figure 1 A flowchart of a method for processing a virtual scene provided by an embodiment of the present disclosure is shown;
[0059] Figure 2 A schematic diagram showing the code modules included in the game system of this example;
[0060] Figure 3 The specific structural diagram of each code module is shown;
[0061] Figure 4A schematic diagram showing the structure of a virtual scene processing device provided by an embodiment of the present disclosure is shown;
[0062] Figure 5 A schematic structural diagram of an electronic device provided by yet another embodiment of the present disclosure is shown. DETAILED DESCRIPTION
[0063] The exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided to enable a more thorough understanding of the present disclosure and to fully convey the scope of the present disclosure to those skilled in the art.
[0064] Figure 1 A flowchart of a method for processing a virtual scene provided by an embodiment of the present disclosure is shown.
[0065] Wherein, the method is applied to a first electronic device, and the first electronic device is used for two-way communication with a second electronic device to realize collaborative processing of virtual scenes. Wherein, the first electronic device in the present disclosure can be either a client device or a server device, and this application does not limit this. It can be understood that when the first electronic device in the present application is a client device, the second electronic device can be a server device. Similarly, when the first electronic device in the present application is a server device, the second electronic device can be a client device.
[0066] like Figure 1 As shown, the method specifically comprises the following steps:
[0067] Step S110: Acquire first logic data of the virtual scene from the first data area, and generate a first processing result corresponding to the first logic data; wherein the first data area is a dual-end shared data area corresponding to the first electronic device and the second electronic device.
[0068] The first data area may be stored in the first database, or in the first data table or the first data document. In short, the present application does not limit the specific form of the data area, which may be a database, a data table, a data document, a data storage space, or other types. In addition, the first data area can be shared by the first electronic device and the second electronic device, and therefore, the first data area may be referred to as a dual-end shared data area corresponding to the first electronic device and the second electronic device.
[0069] Correspondingly, the logical data obtained from the first data area is called the first logical data. It can be seen that the first logical data can be accessed by the first electronic device and the second electronic device at the same time. Among them, the logical data of the virtual scene refers to: data used to perform preset logical processing on the virtual scene. For example, the preset logical processing may include various types such as jump logic processing and run and jump logic processing. Correspondingly, the first logical data of the virtual scene refers to: logical data for processing the virtual scene obtained from the first data area shared by both ends. Correspondingly, the corresponding first processing result can be obtained by performing corresponding logical processing on the virtual scene according to the first logical data. Among them, the result type of the first processing result depends on the logical type of the first logical data. For example, if the logical type of the first logical data is a jump logic type, the first processing result is used to implement a jump operation in the virtual scene; if the logical type of the first logical data is a run and jump logic type, the first processing result is used to implement a run and jump operation in the virtual scene. This application does not limit the logical type of the first logical data and the result type of the processing result, and those skilled in the art can flexibly set it according to the specific application scenario.
[0070] Since the first logic data is shared by the first electronic device and the second electronic device, it can be understood that, in fact, the second electronic device can also perform the operation described in step S110 in parallel with the first electronic device. In other words, in step S110, the first electronic device and the second electronic device respectively obtain the first logic data of the virtual scene from the first data area, and each generates a first processing result corresponding to the first logic data. Usually, the content of the first processing result generated by the first electronic device and the second electronic device is the same.
[0071] Step S120: Acquire second logic data of the virtual scene from the second data area, and generate a second processing result corresponding to the second logic data; wherein the second data area is a single-end data area corresponding to the first electronic device.
[0072] The second data area can be stored in the second database, or in a second data table or a second data document. Generally, the second data area only supports access by the first electronic device but not by the second electronic device. Therefore, the second data area can be referred to as a single-end data area corresponding to the first electronic device.
[0073] Correspondingly, the logical data obtained from the second data area is called the second logical data. It can be seen that the second logical data usually only supports access by the first electronic device. Correspondingly, the second logical data of the virtual scene refers to: logical data for processing the virtual scene obtained from the second data area exclusively used by a single end. Correspondingly, the corresponding second processing result can be obtained by performing corresponding logical processing on the virtual scene according to the second logical data. Among them, the result type of the second processing result depends on the logical type of the second logical data. For example, if the logical type of the second logical data is a rendering logical type, the second processing result is used to implement the rendering operation in the virtual scene; if the logical type of the second logical data is a display logical type, the second processing result is used to implement the display operation in the virtual scene. The present application does not limit the logical type of the second logical data and the result type of the processing result. Those skilled in the art can flexibly set it according to the specific application scenario.
[0074] Since the second logical data is only accessible to the first electronic device, the specific type of the second logical data can be flexibly configured according to the device characteristics and service functions of the first electronic device.
[0075] Generally, the processing performed by the second electronic device is similar to that performed by the first electronic device. For example, the second electronic device obtains the first logic data of the virtual scene from the first data area and generates a first processing result corresponding to the first logic data; and obtains the third logic data of the virtual scene from the third data area and generates a third processing result corresponding to the third logic data; wherein the third data area may be a single-end data area corresponding to the second electronic device. Accordingly, the first processing result, the second processing result, and the third processing result are used together to generate the target processing result of the virtual scene.
[0076] Step S130: Generate a target processing result of the virtual scene according to the first processing result and the second processing result.
[0077] The first processing result and the second processing result are used together to generate a target processing result of the virtual scene.
[0078] It can be seen that in the embodiment of the present disclosure, for the first electronic device and the second electronic device in two-way communication, two different data areas are configured at the same time, wherein the first data area is a two-way shared data area, which is used to store the logic data common to the first electronic device and the second electronic device, so that the two ends can share part of the data, avoiding the waste of storage space caused by redundant configuration of the data shared by the two ends, and the problem of low processing efficiency caused by this. In addition, the second data area is a single-end database used only by the first electronic device, which is used to store the logic data in the first electronic device that is different from the second electronic device. This part of the logic data is only run by the first electronic device. Therefore, by configuring the single-end data area corresponding to the first electronic device side, it is convenient to configure the logic data that is compatible with the business functions and logic characteristics of the first electronic device in a targeted manner according to the logic characteristics of the first electronic device side. It can be seen that the present application can simultaneously configure a shared data area (i.e., the first data area) and a non-shared data area (i.e., the second data area) for one end of an electronic device communicating at both ends, thereby ensuring the reuse of the shared logic at both ends and reducing the data storage cost; and ensuring the flexibility of the unique logic at a single end, so as to flexibly configure a processing logic different from that at the other end according to the characteristics of the single-end device, thereby taking into account both storage cost and adaptation flexibility. In short, by dividing different data areas, the interaction efficiency between electronic devices is improved, thereby improving the collaborative processing efficiency between electronic devices.
[0079] In addition, in order to achieve better technical effects, those skilled in the art may also make various changes and modifications to the above embodiments:
[0080] In an optional implementation, the virtual scene is a game-type virtual scene. Before obtaining the first logic data of the virtual scene from the first data area, the following operations are further performed: the logic code corresponding to the game-type virtual scene is split into a homogeneous part shared by both ends and a heterogeneous part accessed by a single end; the homogeneous part shared by both ends is stored in the first data area, and the heterogeneous part accessed by a single end is stored in the second data area. Among them, the homogeneous part shared by both ends can be shared by the client and the server, which is convenient for improving the reuse rate of the code; the heterogeneous part accessed by a single end is only accessible to the client or the server, so it can be flexibly configured according to the characteristics of the single-end device.
[0081] In an optional implementation, when the first electronic device is a client device, the second electronic device is a server device; when the first electronic device is a server device, the second electronic device is a client device. Among them, the first logical data of the virtual scene may include: logical data of action behavior types common to client devices and server devices in game-type virtual scenes; and the first processing result may include: scene state information of the virtual scene calculated according to the logical data of the action behavior type. Moreover, the second processing result corresponding to the second logical data is obtained according to the above-mentioned scene state information. Similarly, the third processing result corresponding to the third logical data mentioned above is also obtained according to the above-mentioned scene state information. It can be seen that the logical data of the action behavior type shared by both ends can be configured in the first data area. Accordingly, both ends jointly perform calculations on the logical data of the action behavior type to obtain the scene state information of the virtual scene. In addition, each of the two ends further processes the scene state information through the logical data in other data areas except the first data area, so as to obtain the final processing result.
[0082] In other words, in the above method, the client device performs the following operations: obtains the first logic data of the virtual scene from the first data area, and generates a first processing result corresponding to the first logic data on the client device side; obtains the second logic data of the virtual scene from the second data area, and generates a second processing result corresponding to the second logic data. The server device performs the following operations: obtains the first logic data of the virtual scene from the first data area, and generates a first processing result corresponding to the first logic data on the server device side; obtains the third logic data of the virtual scene from the third data area, and generates a third processing result corresponding to the third logic data.
[0083] The first data area mentioned above can also be called a shared data area, which is used to store the homogeneous part shared by both ends split out of the logic code, the first logic data can also be called shared logic data, and the first processing result can also be called a shared processing result. Similarly, the second data area and the third data area mentioned above can also be collectively referred to as non-shared data areas, which are used to store the heterogeneous part split out of the logic code and accessed by one end, the second logic data and the third logic data can also be collectively referred to as non-shared logic data, and the second processing result and the third processing result can also be collectively referred to as non-shared processing results.
[0084] In addition, considering that the shared data area is equivalent to providing data content with the same structure for the client side and the server side, and the non-shared data area is equivalent to providing data content with different structures for the client side and the server side. Therefore, the shared data area can also be called the homogeneous data area, the shared logical data can also be called the homogeneous logical data, and the shared processing result can also be called the homogeneous processing result. Similarly, the non-shared data area can also be called the heterogeneous data area, the non-shared logical data can also be called the heterogeneous logical data, and the non-shared processing result can also be called the heterogeneous processing result.
[0085] It can be seen that the client device and the server device respectively generate shared processing results locally according to the shared logical data stored in the shared data area. Under normal circumstances, the shared processing results generated by the client device are the same as those generated by the server device; under abnormal circumstances (such as synchronization abnormalities or network abnormalities), the shared processing results generated by the client device are different from those generated by the server device, and need to be further adjusted through synchronization operations. In addition, the client device and the server device respectively generate non-shared processing results according to the non-shared logical data stored in their corresponding non-shared data areas. This method can make the collaborative processing process between the server and the client more flexible and easy to implement through different division methods of isomorphic and heterogeneous.
[0086] In an optional implementation, the target processing result of the virtual scene can be generated in the following manner: obtain the third processing result generated by the second electronic device, and obtain the target processing result of the virtual scene according to the second processing result and the third processing result. For example, the second processing result and the third processing result can be collaboratively processed, and the target processing result of the virtual scene can be obtained according to the collaborative processing result. Among them, the collaborative processing may include: modifying the other processing result according to any processing result of the second processing result and the third processing result, and obtaining the target processing result according to the modified result; or, associating or fusing the second processing result and the third processing result to obtain the target processing result. For example, it is possible to determine whether the third processing result needs to be modified according to the second processing result, and obtain the target processing result according to the modified third processing result and the second processing result; or, it is possible to determine whether the second processing result needs to be modified according to the third processing result, and obtain the target processing result according to the modified second processing result and the third processing result. The present application does not limit the specific implementation of collaborative processing.
[0087] Among them, the third processing result generated by the second electronic device is obtained in the following manner: the second electronic device obtains the third logical data of the virtual object from the third data area, and generates the third processing result corresponding to the third logical data. For example, the third processing result can be obtained according to the third logical data and the scene state information mentioned above; wherein the third data area is the single-end data area corresponding to the second electronic device. It can be seen that this method can achieve the coordination between dual-end devices. Among them, the target processing result can be obtained by combining the second processing result and the third processing result. Alternatively, the second processing result can be further modified according to the third processing result. For example, assuming that the second processing result is the rendering operation result of the preset action behavior (such as shooting behavior) implemented by the client device, and the third processing result is the arbitration judgment result (such as whether it is hit, etc.) implemented by the server device for the preset action behavior, then the client device can further adjust the specific form of the rendering operation result according to the arbitration judgment result fed back by the server device.
[0088] In an optional implementation, when the first electronic device is a client device and the second electronic device is a server device, the second data area is a client data area corresponding to the client device; and the second logical data of the virtual scene includes: logical data associated with the rendering operation; the third data area is a server data area corresponding to the server device; and the third logical data of the virtual object includes: logical data associated with the post-processing operation.
[0089] Similarly, when the first electronic device is a server device and the second electronic device is a client device, the second data area is a server database corresponding to the server device; and the second logical data of the virtual object includes: logical data associated with post-processing operations; the third data area is a client data area corresponding to the client device; and the third logical data of the virtual object includes: logical data associated with rendering operations; wherein the post-processing operations include: arbitration operations, and / or determination operations.
[0090] In an optional implementation, the logic data of the action behavior types common to the client device and the server device are used to characterize the interactive actions triggered by the virtual objects in the game virtual scene for the interactive objects, and the post-processing operations include: arbitration judgment operations. Among them, the virtual objects can be various types of objects such as controlled objects in the game (such as the virtual characters corresponding to the players) or uncontrolled objects (such as virtual characters such as monsters), and the interactive objects can be character objects, or animals, plants, and scene objects, such as stones, hillsides, etc. The interactive actions can include various actions in the game such as running, jumping, and attacking. It can be seen that in the game scene, the logic codes corresponding to various interactive actions in the virtual scene can be used as the isomorphic partial codes shared by both ends mentioned above, so that they can be deployed on the client and the server at the same time to achieve dual-end sharing.
[0091] In addition, when the first electronic device is a client device and the second electronic device is a server device, the third processing result is used to characterize the arbitration judgment result obtained by the server device for the interactive action, and the second processing result is used to characterize the rendering result obtained by the client device for the interactive action. The arbitration judgment result is used to determine which virtual object triggers the final interactive result when multiple virtual objects simultaneously perform interactive actions on the same interactive object, and to determine the type and display method of the final interactive result (such as the level of attack, etc.). It can be seen that by splitting the logic code related to post-processing such as arbitration judgment into heterogeneous partial codes corresponding to the server, it is convenient to flexibly configure the content of the post-processing code according to the functions of the server; by splitting the logic code related to rendering into heterogeneous partial codes corresponding to the client, it is convenient to flexibly configure the functions of the rendering code according to the functions of the client, thereby meeting the actual business needs in the game scene.
[0092] It can be seen that the client device is mainly used to perform rendering-related operations on the scene state information of the virtual scene calculated above to achieve a specific display effect. The server device is mainly used to perform background processing type operations on the scene state information of the virtual scene calculated above. For example, when multiple users perform the same type of trigger operation on the same virtual object, the target user corresponding to the same type of trigger operation is determined from multiple users through arbitration operations and / or judgment operations.
[0093] In an optional implementation, the first data area and / or the second data area further includes: a component storage sub-area for storing attribute components of virtual objects in a virtual scene, and a logic storage sub-area for storing processing logic of virtual objects. Among them, the component storage sub-area is used to store various types of attribute components, such as attack components, mobile components, prop components, etc. in game scenes. The logic storage sub-area is used to store various types of processing logic, such as processing logic for various different attack methods or mobile methods. It can be seen that the attribute component is used to characterize the attribute characteristics of the virtual object, and the processing logic is used to characterize the specific processing method of the virtual object. By separating the attribute component and the processing logic, it is easy to realize a flexible combination between the attribute component and the processing logic. For example, for the same attribute component, different processing logics can be flexibly configured according to different application scenarios to achieve different processing effects. Accordingly, the first logic data and / or the second logic data can be obtained in the following manner: for any virtual object to be processed in the virtual scene, the attribute component corresponding to the object state of the virtual object is obtained from the multiple attribute components stored in the component storage sub-area; and the processing logic corresponding to the object state of the virtual object is obtained from the multiple processing logics stored in the logic storage sub-area; the obtained attribute components and processing logic are combined to obtain the first logic data and / or the second logic data for processing the virtual object. Wherein, the object state of the virtual object can be flexibly configured according to various situations such as the behavior type of the virtual object (such as running, jumping, swimming, etc.), the attribute type (such as divided according to different numerical ranges of the life value, etc.), and the medium (such as air medium, liquid medium or gas medium), and for the same virtual object, its different object states can correspond to different attribute components, such as having a swimming component in an underwater scene and a flying component in a sky scene. Similarly, for the same virtual object, its different object states can further correspond to different processing logics, such as corresponding to swimming implementation logic in an underwater scene and corresponding to flying implementation logic in a sky scene. It can be seen that through the flexible selection and free combination of attribute components and processing logic, richer and more complex processing logic can be implemented with less code.
[0094] In an optional implementation, when the first data area further includes a plurality of different types of processing logics, the first logic data of the virtual scene can be obtained from the first data area in the following manner: according to the device type of the first electronic device, a pre-configured processing logic corresponding to the device type is selected from a plurality of different types of processing logics, and the first logic data of the virtual scene is obtained according to the selected processing logic; wherein the device type is used to characterize the first electronic device as a client device or a server device. In this manner, a plurality of different types of processing logics can be configured in the shared data area for selection by the client or server. Accordingly, the client device or the server device can flexibly select one or more of the processing logics according to actual business needs. This manner can flexibly configure the processing logic according to the device type, thereby improving the flexibility of the processing logic.
[0095] In another optional implementation, when the first data area further includes a plurality of different types of processing logics, the first logic data of the virtual scene can be obtained from the first data area in the following manner: obtaining the scene state of the virtual scene; selecting a pre-configured processing logic corresponding to the scene state from a plurality of types of processing logics, and obtaining the first logic data of the virtual scene according to the selected processing logic. It can be seen that in this method, the scene state of the current virtual scene can be dynamically detected, so as to automatically switch to the corresponding processing logic according to the detected scene state. Among them, the scene state of the virtual scene includes the scene type of the virtual scene, such as an underwater type scene, a sky type scene, etc., and can also include the scene stage of the virtual scene, such as a game preparation stage, a game progress stage, etc. The present application does not limit the specific connotation of the scene state. In short, different processing logics can be pre-configured for different scene states. For example, when an underwater type virtual scene is detected, the underwater processing logic is executed, and when a sky type virtual scene is detected, the sky processing logic is executed, etc.
[0096] In an optional implementation, in order to ensure the data consistency of both ends, a synchronization operation may be further performed. Since the second electronic device is also used to obtain the first logic data of the virtual scene from the first data area and generate the first processing result corresponding to the first logic data. Therefore, after generating the first processing result corresponding to the first logic data, the following operations may be further performed: obtaining synchronization logic data from the first data area, and implementing synchronization verification processing between the first processing result generated by the first electronic device and the first processing result generated by the second electronic device according to the synchronization logic data. Among them, the synchronization logic data can be used to implement various types of synchronization verification algorithms, thereby realizing synchronization between dual-end devices. For example, after generating the first processing result corresponding to the first logic data, the following operations may be further performed: obtaining synchronization logic data from the first data area, and synchronizing the first processing result to the second electronic device according to the synchronization logic data, so that the second electronic device performs synchronization verification on the received first processing result. Since the first electronic device and the second electronic device generate the corresponding first processing results according to the first logic data respectively, the first processing result of the opposite end may be further synchronized with the first processing result of the local end to ensure the consistency of the data of both ends and avoid errors.
[0097] In an optional implementation, in order to facilitate flexible adaptation to various types of virtual scenes, the synchronization logic data stored in the first data area may include: pre-configured at least two different types of synchronization logic algorithms. Accordingly, the synchronization logic data can be obtained from the first data area in the following manner: obtaining the scene state of the virtual scene, and selecting a synchronization logic algorithm corresponding to the scene state from at least two pre-configured types of synchronization logic algorithms; wherein the at least two types of synchronization logic algorithms include: a first synchronization algorithm and a second synchronization algorithm, wherein the first synchronization algorithm has a higher certainty requirement than the second synchronization algorithm. In other words, the synchronization accuracy of the first synchronization algorithm is higher than that of the second synchronization algorithm. For example, the first synchronization algorithm is a frame synchronization algorithm, and the second synchronization algorithm is a state synchronization algorithm.
[0098] By dynamically detecting the scene state of the virtual scene, it is possible to automatically switch between two different synchronization logic algorithms according to the current scene state. Among them, in the virtual scene of the game type, the scene state can be dynamically determined according to the game type or the game running stage. For example, for game types with high synchronization requirements such as multiplayer online games, it is necessary to select a frame synchronization algorithm to achieve a strict synchronization effect; for game types with a small number of players and low synchronization requirements, a state synchronization algorithm can be selected to reduce processing overhead. For example, for different stages of the same game, a state synchronization algorithm can be selected in stages with low synchronization requirements such as the game preparation stage; and a frame synchronization algorithm can be selected in stages with high synchronization requirements such as the game running stage. It can be seen that by dynamically detecting the scene state and flexibly switching the synchronization algorithm, it is possible to dynamically adapt to virtual scenes with various requirements and improve the matching degree between the synchronization algorithm and the scene requirements.
[0099] In an optional implementation, the virtual scene is a game-type virtual scene, and the scene state of the virtual scene is dynamically determined according to the game type and / or the game running stage corresponding to the game-type virtual scene. In addition, when the selected synchronization logic algorithm corresponding to the scene state is a frame synchronization algorithm, in order to ensure the accuracy of the frame synchronization algorithm, the program code can be pre-set to ensure the certainty of the program running results. For example, when it is detected that the selected synchronization logic algorithm corresponding to the scene state is a frame synchronization algorithm, at least one of the following types of verification processing can be further performed on the program code associated with the frame synchronization algorithm:
[0100] (1) When it is detected that the program code contains floating-point data, the floating-point data is replaced with fixed-point data. It can be seen that in order to improve the certainty of program operation, it is necessary to avoid the use of floating-point numbers and replace them with fixed-point numbers.
[0101] (2) When it is detected that the program code contains an unordered data structure, replace the unordered data structure with an ordered data structure. An unordered data structure refers to a structure that lacks order in data storage, while an ordered data structure can effectively guarantee the order between multiple data. For example, try to avoid traversing some unordered data structures and try to use containers with deterministic order (such as ordered containers such as queues). For example, try not to use structures such as Dictionary and HashTable in C#. In addition, it is also necessary to avoid using some uncertain coroutines (for example: C#'s async mechanism).
[0102] (3) When it is detected that the client device and the server device share a pseudo-random seed, verify whether the random results of the pseudo-random seed are consistent. For example, when the client and the server share a pseudo-random seed, it is necessary to ensure that all random results are consistent, for example, it is necessary to confirm whether the traceability of all random seeds is consistent.
[0103] (4) When it is detected that the data recording function of the attribute component of the virtual object is not enabled, the data recording function is enabled for the attribute component of the virtual object. After the component data recording function is enabled, the component data of each frame will be recorded and archived to a local file. When multiple runs of a fixed input result in inconsistent results, the component data recording can be compared to determine which part of the data in which frame is abnormal, thereby quickly locating the problem and ensuring the smooth implementation of frame synchronization.
[0104] It can be seen that in the code generation process, the present application can add a code checking mechanism to perform syntax tree analysis on the code. Once the code that violates the deterministic paradigm is detected, a failure will be generated and a prompt message will be triggered. In addition, for games that do not have deterministic logic requirements, the code determinism checking function can be turned off to save code processing overhead. In short, the present application can integrate at least two different types of synchronization algorithms in the same project, and flexibly switch different synchronization algorithms according to the current scene status, thereby improving the overall adaptability and flexibility of the project.
[0105] In addition, it should be noted that, when the first electronic device is a client, various logics such as the rendering layer processing logic and the synchronization processing logic of the client device in the related technology are coupled together, and the rendering layer processing logic itself is uncertain. Therefore, the execution result of the entire project will not be certain, and the frame synchronization algorithm cannot be adopted. The present application splits the rendering layer into the second data area, so that there is no coupling relationship between the rendering layer and the synchronization algorithm in the first data area, thereby improving the certainty of the execution result and making it applicable to the frame synchronization algorithm and the state synchronization algorithm.
[0106] In an optional implementation, the first data area corresponds to the first project engineering file, the second data area corresponds to the second project engineering file, and the third data area corresponds to the third project engineering file. The first project engineering file can be accessed by both the client device and the server device. Moreover, when the second project engineering file can be accessed by the client device, the third project engineering file can be accessed by the server device; when the second project engineering file can be accessed by the server device, the third project engineering file can be accessed by the client device; and there is no function reference relationship between different project engineering files. It can be seen that by configuring the homogeneous data area and the heterogeneous data area as different projects, the mutual reference of functions between the homogeneous data area and the heterogeneous data area can be avoided, thereby affecting the problem of program determinism and ensuring the reliability of the synchronization algorithm.
[0107] To facilitate understanding, an example is used below to introduce the implementation of the above embodiment.
[0108] The following is an explanation of some of the relevant concepts that may be involved in this example:
[0109] ECS: It is an architectural pattern commonly used in game development and real-time simulation systems. Entities are objects in the game, components contain data, and systems are responsible for processing logic. By separating data from behavior, ECS provides a flexible modular design that facilitates performance optimization and parallel computing.
[0110] Code isomorphism: Using the same code in different environments. For example, in a front-end and back-end isomorphic application, the client and server use the same code base, making development and maintenance easier.
[0111] Code heterogeneity: different codes are used in different environments to implement the same function. For example, the client and server use different programming languages or frameworks to complete specific tasks.
[0112] Unreal DS, Unreal Engine Dedicated Server: Mainly used to build a dedicated server for multiplayer online, usually responsible for key business, such as: player collision decisions, hit detection, player data management, etc.
[0113] Deterministic logic calculations: Determinism means that given the same input conditions, the system will always produce the same output results. For multiplayer games, deterministic logic is a way to ensure that all clients are running in the same game state.
[0114] State synchronization: It is a network synchronization mechanism where the client and server periodically synchronize the entire game state to ensure that the game view of all players remains consistent. This method is suitable for small-scale or low-frequency update scenarios.
[0115] Frame synchronization: It is a network synchronization technology used for multiplayer games. Each client sends and receives operation instructions at a fixed frame rate. The server synchronizes the instructions of all clients to ensure the consistency of the game status.
[0116] This example is mainly used in the field of games. In online games such as multiplayer online games, it is usually necessary to configure an online server to coordinate the communication between all player clients, as well as to be responsible for the operation of game-related logic and the behavior judgment and arbitration between different players. Among them, some logic modules can be run by the client, and some logic modules can be run by the server. Alternatively, some logic modules can also be run on both ends at the same time. For example, under normal circumstances, the logic modules that require the server to be responsible for operation and decision-making may include: AI entity logic module, level logic module, coarse-grained physical logic module, hit judgment logic module, damage calculation logic module, player-to-player interaction behavior and other logic modules. The logic modules that need to be run on the client may include: animation logic module, fine-grained physical operation logic module, and logic modules related to the consistency and determinism of performance between different player clients. In addition, relevant synchronization algorithms are required to ensure the online experience. The most common synchronization algorithms can be divided into two categories: state synchronization and frame synchronization.
[0117] In the related art, the Unreal Engine method can be used to implement the processing of game logic. Among them, the Unreal Engine (Unreal) dedicated server (Dedicated Server / DS) is a dedicated server for multiple players to use online synchronously. Unreal DS can be understood as the headless mode of the Unreal Engine itself, that is, the independent process related to rendering performance is removed. Usually, a DS process represents a game room / world. Players join the game as clients. The real game state is managed and simulated by the server, and each player remotely controls the corresponding character through an autonomous agent. The server synchronizes the changes to each connected client so that all players can experience a state very close to the game on the server.
[0118] In the solution based on Unreal Engine, the client and server adopt code isomorphism architecture. In the client-server isomorphism architecture, the client and server share all game codes and game resources (configuration, scene, NavMesh, level, model, logic, etc.). For the iteration of the same function, only the same code needs to be modified, and most functions are shared by the client and server. For some core logic, only one code needs to be modified to ensure that the client and server can apply it at the same time.
[0119] In addition, in the multiplayer online synchronization mechanism of Unreal Engine, the network online synchronization of DS can only be achieved based on state synchronization. Specifically, DS will regularly synchronize the data on the entity component to the relevant players according to the priority rules (frequency, priority, relevance, etc.).
[0120] It can be seen that the relevant technology has at least the following defects:
[0121] (1) DS has completely homogeneous code and does not support heterogeneous code:
[0122] In the code isomorphism solution, you need to first use an if statement to determine whether the current environment is a client environment or a server environment, and then execute the logic required by different environments. The advantage of this method is that both ends can reuse the code, which greatly reduces the development cost and reduces the functional problems caused by inconsistent code.
[0123] However, for relatively complex logic modules, the linear structure of the entire logic will be destroyed. For example, in some shared code blocks, the correctness and performance impact of running on both the client and server environments must be considered at the same time: for example, for a function that is executed every frame, it may not cause performance impacts such as reduced frame rate on the client machine, but since the server needs to host multiple rooms (server processes), the overall server carrying capacity will be reduced. For another example, for the code that needs to use the memory pool, there may not be obvious negative problems on the client side, but if the utilization rate of this memory pool is too low, and the number of memory pools is proportional to the number of rooms, it may cause a large amount of unused free memory on the server, resulting in excessive memory usage on the server host. It can be seen that due to the large differences between the client and the server (for example, the server has to process more rooms, so the same logic will have a serious impact on the server performance), developers need to be highly familiar with the details of dual-end operation. Game development usually divides developers into client engineers and server engineers. The engineering rigor considered by both parties is different, and the sensitivity to different business scenarios is also different. A completely isomorphic code environment is tantamount to increasing the thinking cost of developers and increasing potential risk points.
[0124] It can be seen from this that in a completely isomorphic implementation, it is not convenient to flexibly deploy targeted code logic according to the differences between the client and the server, which leads to poor versatility of the isomorphic code.
[0125] (2) Data and logic are coupled, resulting in difficulty in heterogeneity:
[0126] Among them, in the implementation of Unreal Engine, Unreal is based on the Actor mode, so the data and logic are coupled, resulting in great difficulty in heterogeneity. Since the data and logic of the Actor mode are mixed inside the Actor, it is more difficult to separate the data and logic, which also means that the difficulty of dual-end code heterogeneity is increased.
[0127] (3) Single synchronization method:
[0128] Specifically, DS only provides a single online synchronization algorithm, namely the state synchronization algorithm. Therefore, all network synchronization operations of DS must be implemented based on state synchronization. However, some types of games are more suitable for using frame synchronization algorithms. For example, multiplayer online battle arena (MOBA) games have higher requirements for consistency, and the state synchronization algorithm cannot meet the consistency requirements.
[0129] It can be seen that the execution premise of games based on the frame synchronization algorithm requires that the logic must be completely deterministic, but the calculation results of DS are not deterministic. For example, many DS modules are non-deterministic, such as movement, physics, animation, etc. The specific reason is that in addition to the internal floating-point operations, there may also be some data structures with unstable execution order. Therefore, the implementation based on Unreal Engine cannot support the frame synchronization algorithm.
[0130] In addition, the game rendering layer and logic layer of the Unreal engine itself are not strictly separated, so it is difficult for the client to implement some frame synchronization algorithms based on frame rollback. It can be seen that since the frame synchronization algorithm requires precise logic frame synchronization, the coupling between the rendering layer and the logic layer may cause the execution of the logic frame to be affected by the rendering process, thereby increasing the difficulty of synchronization.
[0131] In short, based on the architecture of Unreal Engine, it is impossible to support frame synchronization algorithm.
[0132] (4) DS operating costs are high:
[0133] The operating cost of DS can be understood as a headless Unreal engine, which only removes the rendering and sound related performance modules. Other heavy calculation logics such as physics, AI, and pathfinding (NavMesh) need to be run on the server side. For the game online server, some modules do not need to be run on the server. For example, the server of some games does not have strong requirements for physical calculations of entities. Running physical calculations on DS will cause a lot of computing power resources to be wasted. It can be seen that DS runs the entire logical process of a complete world, resulting in excessively high operating costs.
[0134] (5) The training cost of reinforcement learning is high:
[0135] On-Policy-based reinforcement learning algorithms (such as the PPO algorithm) require the game environment to be able to return results (state, action, reward, next state) in real time according to the current strategy of the AI agent. In order to improve training efficiency, a distributed training environment is usually set up in the training environment to speed up the training process, such as deploying multiple DS processes, communicating with the training framework in real time, and iterating the AI model. However, due to the high operating cost of DS, all logical processes in the complete world must be run. Therefore, in order to realize the operation of all logical processes, more DS processes and machines need to be deployed, resulting in very high training costs.
[0136] In order to solve the above problems, this example proposes the following improvements:
[0137] (1) Split all logic in the game into isomorphic and heterogeneous parts, so that the game supports both isomorphic and heterogeneous code methods, thereby solving the problem mentioned in point (1) that "DS is fully code isomorphic and does not support heterogeneous code methods."
[0138] Among them, the code logic shared by both the client and the server can be implemented in a code isomorphic manner to facilitate sharing between the two ends; the code logic unique to the client and the server can be implemented in a code heterogeneous manner to facilitate flexible code adaptation according to the characteristics of each end. Among them, the boundary division between isomorphism and heterogeneity can be set according to the following rules: For logic modules with relatively low logic overlap between the front-end and back-end (or no overlap), full heterogeneity can be selected so that the client and the server can implement their own independent logic systems respectively. For example: the client can heterogeneously configure rendering-related components, and the server can heterogeneously configure the back-end archive data components, etc. In addition, for logic modules that need to be shared by the front-end and back-end, full isomorphism can be selected. For example: the character's movement position data can be used as isomorphic data for sharing by the front-end and back-end.
[0139] Figure 2FIG. 4 is a schematic diagram showing a code module included in the game system of this example. Figure 2 As shown, there are three code modules in the game system, namely, isomorphic code module, client heterogeneous code module and server heterogeneous code module. Among them, the client can access the isomorphic code module and the client heterogeneous code module, and the server can access the isomorphic code module and the server heterogeneous code module. It can be seen that the isomorphic code module is a module shared by the front and back ends. The server heterogeneous code module is a heterogeneous module of the back end, and the client heterogeneous code module is a heterogeneous module of the front end. Specifically, the action logic that needs to be executed at both ends, such as running, jumping, flying, shooting, swimming, etc., can be configured to the isomorphic code module, the rendering performance logic related to the action logic can be configured to the client heterogeneous code module, and the post-processing operation (such as arbitration, judgment, etc.) logic related to the action logic can be configured to the server heterogeneous code module.
[0140] It should be noted that the homogeneous code module is a specific implementation form of the first data area mentioned above, and the client heterogeneous code module and the server heterogeneous code module are a specific implementation form of the second data area or the third data area mentioned above.
[0141] In specific implementation, the rendering logic layer and data logic layer of the client can be split. In traditional game clients, the rendering logic layer and the related data logic layer are mixed in the same project, so only a completely homogeneous approach or a completely heterogeneous approach can be used. This example splits the rendering logic layer and data logic layer of the client into two different project projects, which has at least the following advantages:
[0142] First, isomorphic data and code are uniformly stored in the isomorphic data logic layer. Therefore, the server will not reference any code resources related to rendering and presentation, avoiding problems such as uncertain results caused by referencing the rendering logic layer.
[0143] Secondly, the online framework has a pre-condition for frame rollback. Frame rollback is usually used when there are inconsistencies between multiple terminals during the online process. The rendering logic layer is usually non-deterministic logic, and frame rollback requires that all logic layers corresponding to the rollback operation have complete determinism. For this reason, since this example splits the rendering logic layer and the data logic layer, it only needs to ensure that the data logic layer is completely deterministic logic to ensure the consistency of multi-terminal operation, thus providing a prerequisite for the implementation of the frame synchronization algorithm.
[0144] Thirdly, it can run independently as a headless process (only loading the data logic layer project), each process can perform high frame rate training, and supports multi-process concurrent deployment, seamlessly connecting to the machine learning environment. It can be seen that by configuring isomorphic code modules and heterogeneous code modules, the code architecture can be made more flexible.
[0145] (2) Data and logic are completely separated, supporting modular heterogeneity, thus solving the problem mentioned in point (2) that "data and logic are coupled, resulting in difficulty in heterogeneity."
[0146] This example can use the ECS mode to process data and logic independently. Data can be stored in components and mounted on entities, and multiple logical systems are completely decoupled. Based on such a structural design, the dependency between data modules is greatly reduced (the same is true for logical modules), which is more conducive to the development of heterogeneous code. Based on certain boundaries, the codes of different modules can be divided into isomorphic and heterogeneous, reducing the cost of dual-end development (isomorphism means less redundancy in front-end and back-end code), and making dual-end heterogeneity simpler.
[0147] It can be seen that based on the ECS paradigm, data and logic can be decoupled. Specifically, data and logic are implemented based on the ECS paradigm, so that game data and logic are completely decoupled, and different logic systems are also completely decoupled, making the logic system more flexible and independent, so that it can run on multiple terminals (client, server, or both terminals at the same time) according to the configuration, and it is easy to perform dual-terminal code heterogeneity. Moreover, more aggregated data also facilitates subsequent real-time machine learning. In addition, the decoupled and split data structure makes the memory form more aggregated and the CPU hardware efficiency is higher. For example, Figure 3 The specific structural diagram of each code module is shown, such as Figure 3 As shown, each code module can be further divided into two parts: a component storage area and a logic storage area, thereby realizing separate storage and flexible combination of components and logic.
[0148] (3) Provide at least two synchronization methods to solve the problem of "single synchronization method" mentioned in point (3).
[0149] Specifically, the componentized configuration of the online synchronization algorithm can be realized. For example, both state synchronization and frame synchronization can be provided at the same time, and provided to users in the form of components. The business logic layer is unaware of the implementation of the synchronization algorithm layer, and only the corresponding synchronization algorithm components need to be configured. Among them, suitable synchronization algorithms can be selected for different game types. For example, fighting games can use frame synchronization algorithms, and other games that do not require high consistency can use state synchronization algorithms. In addition, an online synchronization solution based on frame rollback can be used to ensure multi-terminal consistency and quickly realize online functions.
[0150] Since this example has achieved the decoupling between the rendering logic layer and the data logic layer, it can ensure the consistency of the game running results, thereby providing the implementation conditions for different synchronization algorithms.
[0151] Specifically, in the synchronization algorithm, it can be implemented through the following two synchronization strategies:
[0152] The first synchronization strategy is attribute replication, also called network replication, which involves concepts such as actor replication, attribute replication, and replication function to ensure that the game state is consistent between the server and the client. Specifically, you can identify which attributes need to be synchronized by annotating data. When the values of these attributes change, these changes will be automatically synchronized to other network nodes.
[0153] The second synchronization strategy is RPC call, also known as remote procedure call mechanism, which includes client RPC, server RPC and multicast RPC, allowing the client and server to execute each other's functions to implement the control flow of game logic. Specifically, remote functions can be explicitly called for communication. Developers can define functions and call these functions to interact with other nodes when needed, providing a more flexible and controllable synchronization mechanism that can accurately specify when and how to call remote functions. This example can choose the appropriate synchronization method as needed: if higher controllability and flexibility are required, consider using RPC calls; if only simple data synchronization is required, attribute replication can be used.
[0154] Normally, when the above two synchronization strategies are used at the same time, the bottom layers of the two strategies are implemented using different channels. Although the order of multiple messages within each channel can be guaranteed, the order of all messages between the two channels cannot be guaranteed. In addition, attribute replication can only be performed sequentially according to the declaration order of the attributes (memory layout order) and network replication for cross-frame modifications. The atomicity of the message received by the (specified) peer cannot be guaranteed. In addition, the network synchronization of attribute replication is not performed in the same frame. Unreal will decide whether synchronization is required based on the attribute-related priority, synchronization frequency, and current network status. The controllability of attribute replication is limited for developers. Therefore, conventional synchronization strategies have certain freedom restrictions, and some places that require high customization are not flexible enough.
[0155] In order to solve the above problems, in this example, when the above two synchronization strategies are used at the same time, the bottom layers of the two strategies can share the same channel, thereby effectively ensuring the orderliness of all messages. In addition, this example can also provide a semi-automatic attribute network synchronization strategy. Specifically, the data can be explicitly labeled with component ID as the granularity to represent the data that needs to be synchronized, and then when the data needs to be synchronized to the other end, it is explicitly specified which data the RPC synchronizes, or only the modified dirty data is synchronized. Compared with the annotation method with attribute as the granularity, it can provide higher flexibility. The specific reason is that: the atomicity and sequentiality of data messages can be controlled at will. In addition to specifying which data can be synchronized, the rest can be flexibly controlled according to business conditions. In short, the semi-automatic attribute network synchronization strategy is equivalent to a compromise implementation solution of attribute replication and RPC call. It can flexibly specify the synchronization strategy through remote functions with component ID as the granularity.
[0156] (4) Set up a configurable logic system to solve the problem of "high DS operating cost" mentioned in point (4).
[0157] Each logical system in this example is highly decoupled and independent of each other. Therefore, the client and server can configure the logical systems they need to run according to their respective scenarios. For example, a logical system can be configured to run only on the client, or only on the server, or on both the client and the server. In short, this example does not require hard coding. For example, the isomorphic part contains two logical systems (mobile logical system and AI logical system). The client can choose to use only the mobile logical system, while the server can use both, so it is more flexible. In short, each logical system is configured in the code file in the form of a plug-in, which can be flexibly selected in the subsequent process.
[0158] (5) An integrated reinforcement learning framework is configured to reduce the training cost of reinforcement learning.
[0159] Among them, an embedded machine learning environment can be provided. Since the data layer is implemented based on EC (Entity-Component), the framework can automatically export metafiles in Protobuf format. Among them, Protocol Buffers is an efficient, platform-independent serialized data format with a compact binary format, supports multiple programming languages, and is easy to integrate with different transmission protocols (such as HTTP, TCP). The reinforcement learning framework can seamlessly integrate game-related data. In addition, since the logical systems are completely decoupled, it is possible to freely configure which systems the server runs, thereby minimizing the operating cost of the server and improving training efficiency. Moreover, it is also convenient to adopt a distributed training method: the server supports AI training mode, can start multiple game scene processes in batches, automatically connect to the machine learning framework, enter the training scene, train the AI model, and can integrate pre-trained AI models based on the onnx format on multiple terminals, providing richer and more vivid behavioral feedback than traditional rule-based AI.
[0160] In summary, this example can at least achieve the following technical effects:
[0161] (1) Based on the ECS paradigm, key data structures can be shared. The client, server, and machine learning framework can share the same set of data descriptions, reducing the conversion of handwritten data formats and improving development efficiency.
[0162] (2) The rendering logic layer and data logic layer of the client are split, which makes it easier to ensure determinism, facilitates the division of isomorphism and heterogeneity, and facilitates the implementation of frame synchronization algorithms. Among them, fighting games based on frame synchronization can be implemented using synchronization algorithms based on frame rollback types (for example: GGPO). The frame rollback synchronization type algorithm requires the logic layer to support rollback, which means that the logic layer must be separated from the rendering layer (not dependent on each other). Based on the natural separation of the framework rendering layer and the logic layer, the fighting game can naturally integrate the frame rollback synchronization algorithm. In addition, when performing reinforcement learning training, headless processes can be seamlessly implemented based on the logic layer separated from the presentation layer to perform reinforcement learning. In addition, from the perspective of deterministic computing, an independent logic layer can also make it easier to ensure determinism.
[0163] (3) Data and logic are completely separated, which facilitates the support of modular heterogeneity. In some multiplayer PVP games, both the client and the server need to simulate the player movement logic. The underlying logic of movement is roughly the same, for example, the speed is updated according to the direction of the entity's movement. For this function, an isomorphic movement module can be implemented, which consists of several movement-related logic systems and data components. However, some alienated logic is also involved: for example, when the client entity moves and collides with a prop, only the performance logic (for example, special effects) needs to be performed; when the server entity moves and collides with a prop, functional logic (for example, bonus points) needs to be performed. Therefore, a heterogeneous design method is allowed, so that the client and the server can freely rewrite the logic in their respective modules. For example, in the above example, the client and the server respectively rewrite the method CollideWithItem to implement their respective functional requirements (no need to write code such as if IsServer). This way of implementing each method on different ends makes the code neater and more maintainable. It also allows both ends to reuse the same code logic to the greatest extent, reducing the logical inconsistency of the development of both ends, improving development efficiency, and providing flexibility for the development of both ends.
[0164] (4) Through the componentization of online synchronization algorithms, multiple synchronization methods are provided. The current program framework can provide two network synchronization components, and different synchronization components can be used according to project requirements. For example, the synchronization components include state synchronization components and frame rollback synchronization components. The two synchronization components are roughly the same in the use of algorithms. Two different games can be implemented based on different synchronization algorithms. For example: a RougeLike game uses state synchronization components for multiplayer development because this type of game does not require high-precision synchronization of actions. A fighting game uses frame rollback synchronization components for multiplayer development because this game requires high-precision synchronization and consistency of actions.
[0165] (5) The integrated reinforcement learning framework reduces the cost of learning and training. The machine learning model supports dual-end operation, and the pre-trained machine learning model can be configured to run on the client side or the server side as needed. Since the logic layer and rendering layer of the program framework are naturally separated, a game only needs to run the logic layer alone to start a headless process. After turning on the reinforcement learning switch, the network synchronized component will be synchronized to the machine learning framework. Each game writes its own reward mechanism and model parameters, and then performs data sampling and training. After the training expectations are met, the machine learning framework automatically exports the model configuration in onnx format and integrates it into the real-time game process to provide pre-trained model decisions.
[0166] In addition, in the conventional way, the learned file can only run on one end of the server or the client. However, since the isomorphic code part in this example can be shared by the client and the server, during the training and operation stages, the different logical systems in the synchronous code part can be configured on the client or the server respectively to improve the efficiency of training and operation. For example, for very sensitive, fast, and low-latency logical systems, they are configured on the client for training, which can save network communication time and improve real-time performance. For logical systems that require server arbitration (such as AI models), they can be configured for server training.
[0167] Figure 4 A schematic diagram of a virtual scene processing device 40 provided by another embodiment of the present disclosure is shown. The virtual scene processing device is applied to a first electronic device, and the first electronic device is used to perform two-end communication with a second electronic device to achieve collaborative processing of the virtual scene. The device includes:
[0168] A first processing module 41 is adapted to obtain first logic data of the virtual scene from a first data area, and generate a first processing result corresponding to the first logic data; wherein the first data area is a dual-end shared data area corresponding to the first electronic device and the second electronic device;
[0169] A second processing module 42 is adapted to obtain second logic data of the virtual scene from a second data area, and generate a second processing result corresponding to the second logic data; wherein the second data area is a single-end data area corresponding to the first electronic device;
[0170] The result generating module 43 is adapted to generate a target processing result of the virtual scene according to the first processing result and the second processing result.
[0171] In an optional implementation, the virtual scene is a game-type virtual scene, and before acquiring the first logical data of the virtual scene from the first data area, the method further includes:
[0172] Splitting the logic code corresponding to the game-like virtual scene into a homogeneous part shared by both ends and a heterogeneous part accessed by a single end;
[0173] The homogeneous part shared by both ends is stored in the first data area, and the heterogeneous part accessed by a single end is stored in the second data area.
[0174] In an optional implementation, when the first electronic device is a client device, the second electronic device is a server device; when the first electronic device is a server device, the second electronic device is a client device;
[0175] Among them, the first logical data of the virtual scene includes: logical data of action behavior types common to the client device and the server device; and the first processing result includes: scene state information of the virtual scene calculated according to the logical data of the action behavior type, and the second processing result corresponding to the second logical data is obtained according to the scene state information.
[0176] In an optional implementation, the target processing result of the virtual scene is generated by: acquiring a third processing result generated by the second electronic device, and obtaining the target processing result of the virtual scene according to the second processing result and the third processing result;
[0177] The third processing result generated by the second electronic device is generated in the following manner: the second electronic device obtains the third logical data of the virtual object from a third data area, and generates a third processing result corresponding to the third logical data; wherein the third data area is a single-ended data area corresponding to the second electronic device.
[0178] In an optional implementation, when the first electronic device is a client device and the second electronic device is a server device, the second data area is a client data area corresponding to the client device; and the second logical data of the virtual scene includes: logical data associated with a rendering operation; the third data area is a server data area corresponding to the server device; and the third logical data of the virtual object includes: logical data associated with a post-processing operation;
[0179] When the first electronic device is a server device and the second electronic device is a client device, the second data area is a server database corresponding to the server device; and the second logical data of the virtual object includes: logical data associated with post-processing operations; the third data area is a client data area corresponding to the client device; and the third logical data of the virtual object includes: logical data associated with rendering operations; wherein the post-processing operations include: arbitration operations, and / or determination operations.
[0180] In an optional implementation, the logic data of the action behavior type common to the client device and the server device is used to characterize the interactive action triggered by the virtual object in the game virtual scene for the interactive object; the post-processing operation includes: arbitration determination operation;
[0181] Furthermore, the first electronic device is a client device, and the second electronic device is a server device, the third processing result is used to represent the arbitration result obtained by the server device for the interactive action, and the second processing result is used to represent the rendering result obtained by the client device for the interactive action.
[0182] In an optional implementation, the first data area and / or the second data area further includes: a component storage sub-area for storing attribute components of virtual objects in the virtual scene, and a logic storage sub-area for storing processing logic of the virtual objects;
[0183] Furthermore, the first logic data and / or the second logic data are obtained by:
[0184] For any virtual object to be processed in the virtual scene, obtain an attribute component corresponding to the object state of the virtual object from the multiple attribute components stored in the component storage sub-area; and obtain a processing logic corresponding to the object state of the virtual object from the multiple processing logics stored in the logic storage sub-area;
[0185] The acquired attribute components and processing logic are combined to obtain the first logic data and / or the second logic data for processing the virtual object.
[0186] In an optional implementation, when the first data area further includes a plurality of different types of processing logics, the acquiring the first logic data of the virtual scene from the first data area includes:
[0187] According to the device type of the first electronic device, selecting a pre-configured processing logic corresponding to the device type from the multiple different types of processing logics, and obtaining first logic data of the virtual scene according to the selected processing logic;
[0188] The device type is used to characterize that the first electronic device is a client device or a server device.
[0189] In an optional implementation, when the first data area further includes a plurality of different types of processing logics, the first processing module is specifically adapted to:
[0190] Acquiring the scene state of the virtual scene;
[0191] A preconfigured processing logic corresponding to the scene state is selected from the multiple types of processing logics, and first logic data of the virtual scene is obtained according to the selected processing logic.
[0192] In an optional implementation, the second electronic device is used to obtain first logic data of the virtual scene from the first data area, and generate a first processing result corresponding to the first logic data;
[0193] Then the first processing module is also suitable for:
[0194] Synchronous logic data is acquired from the first data area, and synchronous verification processing between a first processing result generated by the first electronic device and a first processing result generated by the second electronic device is implemented according to the synchronous logic data.
[0195] In an optional implementation, the synchronization logic data stored in the first data area includes: at least two types of pre-configured synchronization logic algorithms;
[0196] The first processing module is specifically suitable for:
[0197] Acquiring a scene state of the virtual scene, and selecting a synchronization logic algorithm corresponding to the scene state from the at least two types of pre-configured synchronization logic algorithms;
[0198] The at least two types of synchronization logic algorithms include: a frame synchronization algorithm and a state synchronization algorithm.
[0199] In an optional implementation, the virtual scene is a game-type virtual scene, and the scene state of the virtual scene is dynamically determined according to the game type and / or game running stage corresponding to the game-type virtual scene;
[0200] Furthermore, when the selected synchronization logic algorithm corresponding to the scene state is a frame synchronization algorithm, at least one of the following types of verification processing is further performed on the program code associated with the frame synchronization algorithm:
[0201] In the case where it is detected that the program code contains floating-point data, replacing the floating-point data with fixed-point data;
[0202] In case it is detected that the program code contains an unordered data structure, replacing the unordered data structure with an ordered data structure;
[0203] In the case where it is detected that the client device and the server device share a pseudo-random seed, verifying whether random results of the pseudo-random seed are consistent;
[0204] When it is detected that the data recording function is not enabled for the attribute component of the virtual object, the data recording function is enabled for the attribute component of the virtual object.
[0205] In an optional implementation, the first data area corresponds to a first project engineering file, the second data area corresponds to a second project engineering file, and the third data area corresponds to a third project engineering file;
[0206] The first project engineering file can be accessed by both the client device and the server device; and, when the second project engineering file can be accessed by the client device, the third project engineering file can be accessed by the server device; when the second project engineering file can be accessed by the server device, the third project engineering file can be accessed by the client device; and there is no function reference relationship between different project engineering files.
[0207] In addition, another embodiment of the present disclosure further provides a virtual scene processing system, comprising: a client device implemented by the above-mentioned virtual scene processing apparatus, and a server device implemented by the above-mentioned virtual scene processing apparatus;
[0208] The processing system further includes: a first data area shared by the client device and the server device, a second data area accessed by the client device, and a third data area accessed by the server device.
[0209] Figure 5 A schematic structural diagram of an electronic device according to another embodiment of the present disclosure is shown. The specific embodiment of the present disclosure does not limit the specific implementation of the electronic device.
[0210] like Figure 5 As shown, the electronic device may include: a processor (processor) 502 , a communication interface (Communications Interface) 504 , a memory (memory) 506 , and a communication bus 508 .
[0211] in:
[0212] The processor 502 , the communication interface 504 , and the memory 506 communicate with each other via a communication bus 508 .
[0213] The communication interface 504 is used to communicate with other devices such as clients or other servers.
[0214] The processor 502 is used to execute the program 510, and specifically can execute the relevant steps in the above-mentioned video image detection method embodiment.
[0215] Specifically, the program 510 may include program codes, which include computer operation instructions.
[0216] The processor 502 may be a central processing unit (CPU), or an application-specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of the present disclosure. The one or more processors included in the electronic device may be processors of the same type, such as one or more CPUs. They may also be processors of different types, such as one or more CPUs and one or more ASICs.
[0217] The memory 506 is used to store the program 510. The memory 506 may include a high-speed RAM memory, and may also include a non-volatile memory (non-volatile memory), such as at least one disk memory.
[0218] The program 510 can be specifically used to enable the processor 502 to execute the corresponding operations in the above-mentioned video image detection method embodiment.
[0219] The algorithms and displays provided herein are not inherently related to any particular computer, virtual device or other device. Various general purpose devices may also be used together with the teachings based thereon. According to the above description, it is apparent that the structure required for constructing such devices is. In addition, the present disclosure is not directed to any particular programming language either. It should be understood that various programming languages may be utilized to implement the disclosure described herein, and the description of the specific languages above is intended to disclose the best mode of implementation of the present disclosure.
[0220] In the description provided herein, a large number of specific details are described. However, it is understood that the embodiments of the present disclosure can be practiced without these specific details. In some instances, well-known methods, structures and techniques are not shown in detail so as not to obscure the understanding of this description.
[0221] Similarly, it should be understood that in order to streamline the present disclosure and aid in understanding one or more of the various disclosed aspects, in the above description of exemplary embodiments of the present disclosure, various features of the present disclosure are sometimes grouped together into a single embodiment, figure, or description thereof. However, this method of disclosure should not be interpreted as reflecting an intention that the claimed disclosure requires more features than are expressly recited in each claim.
[0222] Those skilled in the art will appreciate that the modules in the devices in the embodiments may be adaptively changed and arranged in one or more devices different from the embodiments. The modules or units or components in the embodiments may be combined into one module or unit or component, and in addition they may be divided into a plurality of submodules or subunits or subcomponents. Except that at least some of such features and / or processes or units are mutually exclusive, all features disclosed in this specification (including the accompanying claims, abstracts and drawings) and all processes or units of any method or device disclosed in this manner may be combined in any combination. Unless otherwise expressly stated, each feature disclosed in this specification (including the accompanying claims, abstracts and drawings) may be replaced by an alternative feature providing the same, equivalent or similar purpose.
[0223] In addition, those skilled in the art will appreciate that, although some embodiments herein include certain features included in other embodiments but not other features, the combination of features of different embodiments is meant to be within the scope of the present disclosure and form different embodiments. For example, any one of the claimed embodiments may be used in any combination.
[0224] The various component embodiments of the present disclosure may be implemented in hardware, or in software modules running on one or more processors, or in a combination thereof. It should be understood by those skilled in the art that a microprocessor or digital signal processor (DSP) may be used in practice to implement some or all of the functions of some or all of the components in the device according to the embodiments of the present disclosure. The present disclosure may also be implemented as a device or device program (e.g., a computer program and a computer program product) for executing part or all of the methods described herein. Such a program implementing the present disclosure may be stored on a computer-readable medium, or may have the form of one or more signals. Such a signal may be downloaded from an Internet website, or provided on a carrier signal, or provided in any other form.
[0225] It should be noted that the above embodiments illustrate the present disclosure rather than limit the present disclosure, and that those skilled in the art may design alternative embodiments without departing from the scope of the appended claims. In the claims, any reference symbol between brackets should not be constructed as a limitation to the claims. The word "comprising" does not exclude the presence of elements or steps not listed in the claims. The word "one" or "an" preceding an element does not exclude the presence of multiple such elements. The present disclosure may be implemented by means of hardware including several different elements and by means of appropriately programmed computers. In a unit claim that lists several devices, several of these devices may be embodied by the same hardware item. The use of the words first, second, and third, etc. does not indicate any order. These words may be interpreted as names.
Claims
1. A method for processing a virtual scene, applied to a first electronic device, the first electronic device being used for two-way communication with a second electronic device to achieve collaborative processing of the virtual scene, the method comprising: Acquire first logic data of the virtual scene from a first data area, and generate a first processing result corresponding to the first logic data; wherein the first data area is a dual-end shared data area corresponding to the first electronic device and the second electronic device; Acquire second logic data of the virtual scene from a second data area, and generate a second processing result corresponding to the second logic data; wherein the second data area is a single-end data area corresponding to the first electronic device; A target processing result of the virtual scene is generated according to the first processing result and the second processing result.
2. The method according to claim 1, wherein: The virtual scene is a game-type virtual scene, and before acquiring the first logical data of the virtual scene from the first data area, the method further includes: Splitting the logic code corresponding to the game-like virtual scene into a homogeneous part shared by both ends and a heterogeneous part accessed by a single end; The homogeneous part shared by both ends is stored in the first data area, and the heterogeneous part accessed by a single end is stored in the second data area.
3. The method according to claim 2, wherein: When the first electronic device is a client device, the second electronic device is a server device; when the first electronic device is a server device, the second electronic device is a client device; Among them, the first logical data of the virtual scene includes: the logical data of the action behavior type commonly used in the client device and the server device in the game virtual scene; and the first processing result includes: the scene state information of the virtual scene calculated according to the logical data of the action behavior type, and the second processing result corresponding to the second logical data is obtained according to the scene state information.
4. The method according to any one of claims 1 to 3, wherein: Generating a target processing result of the virtual scene according to the first processing result and the second processing result includes: Acquire a third processing result generated by the second electronic device, perform collaborative processing on the second processing result and the third processing result, and obtain a target processing result of the virtual scene according to the collaborative processing result; The third processing result generated by the second electronic device is generated in the following manner: the second electronic device obtains the third logical data of the virtual object from a third data area, and generates a third processing result corresponding to the third logical data; wherein the third data area is a single-ended data area corresponding to the second electronic device.
5. The method according to claim 4, wherein: In the case where the first electronic device is a client device and the second electronic device is a server device, the second data area is a client data area corresponding to the client device; Furthermore, the second logic data of the virtual scene includes: logic data associated with rendering operations; the third data area is a server data area corresponding to the server device; and the third logic data of the virtual object includes: logic data associated with post-processing operations; When the first electronic device is a server device and the second electronic device is a client device, the second data area is a server database corresponding to the server device; and the second logical data of the virtual object includes: logical data associated with post-processing operations; the third data area is a client data area corresponding to the client device; and the third logical data of the virtual object includes: logical data associated with rendering operations.
6. The method according to claim 5, wherein: The logic data of action behavior types commonly used in the client device and the server device is used to characterize the interactive actions triggered by the virtual objects in the game virtual scene for the interactive objects; the post-processing operation includes: arbitration judgment operation; Furthermore, the first electronic device is a client device, and the second electronic device is a server device, the third processing result is used to represent the arbitration result obtained by the server device for the interactive action, and the second processing result is used to represent the rendering result obtained by the client device for the interactive action.
7. The method according to any one of claims 1 to 6, wherein: The first data area and / or the second data area further comprises: a component storage sub-area for storing attribute components of virtual objects in the virtual scene, and a logic storage sub-area for storing processing logic of the virtual objects; Furthermore, the first logic data and / or the second logic data are obtained by: For any virtual object to be processed in the virtual scene, obtain an attribute component corresponding to the object state of the virtual object from the multiple attribute components stored in the component storage sub-area; and obtain a processing logic corresponding to the object state of the virtual object from the multiple processing logics stored in the logic storage sub-area; The acquired attribute components and processing logic are combined to obtain the first logic data and / or the second logic data for processing the virtual object.
8. The method according to any one of claims 1 to 7, wherein: In the case where the first data area further includes a plurality of different types of processing logics, the acquiring the first logic data of the virtual scene from the first data area includes: According to the device type of the first electronic device, selecting a pre-configured processing logic corresponding to the device type from the multiple different types of processing logics, and obtaining first logic data of the virtual scene according to the selected processing logic; The device type is used to characterize that the first electronic device is a client device or a server device.
9. The method according to any one of claims 1 to 8, wherein: In the case where the first data area further includes a plurality of different types of processing logics, the acquiring the first logic data of the virtual scene from the first data area includes: Acquiring a scene state of the virtual scene; A preconfigured processing logic corresponding to the scene state is selected from the multiple types of processing logics, and first logic data of the virtual scene is obtained according to the selected processing logic.
10. The method according to any one of claims 1 to 9, wherein: The second electronic device is used to obtain first logic data of the virtual scene from the first data area, and generate a first processing result corresponding to the first logic data; After generating the first processing result corresponding to the first logical data, the method further includes: Synchronous logic data is acquired from the first data area, and synchronous verification processing between a first processing result generated by the first electronic device and a first processing result generated by the second electronic device is implemented according to the synchronous logic data.
11. The method according to claim 10, wherein: The synchronization logic data stored in the first data area includes: at least two types of pre-configured synchronization logic algorithms; The acquiring of synchronization logic data from the first data area comprises: Acquiring a scene state of the virtual scene, and selecting a synchronization logic algorithm corresponding to the scene state from the at least two types of pre-configured synchronization logic algorithms; The at least two types of synchronization logic algorithms include: a frame synchronization algorithm and a state synchronization algorithm.
12. The method according to claim 11, wherein: If the virtual scene is a game-type virtual scene, the scene state of the virtual scene is dynamically determined according to the game type and / or game running stage corresponding to the game-type virtual scene; Furthermore, when the selected synchronization logic algorithm corresponding to the scene state is a frame synchronization algorithm, at least one of the following types of verification processing is further performed on the program code associated with the frame synchronization algorithm: In the case where it is detected that the program code contains floating-point data, replacing the floating-point data with fixed-point data; In case it is detected that the program code contains an unordered data structure, replacing the unordered data structure with an ordered data structure; In the case where it is detected that the client device and the server device share a pseudo-random seed, verifying whether random results of the pseudo-random seed are consistent; When it is detected that the data recording function is not enabled for the attribute component of the virtual object, the data recording function is enabled for the attribute component of the virtual object.
13. The method according to any one of claims 1 to 12, wherein: The first data area corresponds to a first project engineering file, the second data area corresponds to a second project engineering file, and the third data area corresponds to a third project engineering file; The first project engineering file can be accessed by both the client device and the server device; and, when the second project engineering file can be accessed by the client device, the third project engineering file can be accessed by the server device; when the second project engineering file can be accessed by the server device, the third project engineering file can be accessed by the client device; and there is no function reference relationship between different project engineering files.
14. A virtual scene processing device, applied to a first electronic device, the first electronic device is used to perform two-end communication with a second electronic device to achieve collaborative processing of the virtual scene, the device comprising: A first processing module, adapted to obtain first logic data of the virtual scene from a first data area, and generate a first processing result corresponding to the first logic data; wherein the first data area is a dual-end shared data area corresponding to the first electronic device and the second electronic device; A second processing module, adapted to obtain second logic data of the virtual scene from a second data area, and generate a second processing result corresponding to the second logic data; wherein the second data area is a single-end data area corresponding to the first electronic device; A target processing result of the virtual scene is generated according to the first processing result and the second processing result.
15. A virtual scene processing system, comprising: A client device implemented by the virtual scene processing device of claim 14, and a server device implemented by the virtual scene processing device of claim 14; The processing system further includes: a first data area shared by the client device and the server device, a second data area accessed by the client device, and a third data area accessed by the server device.
16. An electronic device, comprising: A processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface communicate with each other via the communication bus; The memory is used to store at least one executable instruction, and the executable instruction enables the processor to execute the virtual scene processing method according to any one of claims 1-13.
17. A computer storage medium, wherein at least one executable instruction is stored in the storage medium, and the executable instruction enables a processor to execute the virtual scene processing method according to any one of claims 1 to 13.
18. A computer program product, characterized in that It includes a computer-readable code, or a non-volatile computer-readable storage medium carrying the computer-readable code. When the computer-readable code runs in a processor of an electronic device, the processor in the electronic device executes the virtual scene processing method as described in any one of claims 1-13.
Citation Information
Cited By
Code execution method and device, equipment, medium and product
CN122450544A