Data communication method, apparatus, device, and storage medium

CN116755898BActive Publication Date: 2026-09-25NETEASE (HANGZHOU) NETWORK CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310591429.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-05-22
Publication Date
2026-09-25
Estimated Expiration
2043-05-22

AI Technical Summary

Technical Problem

[0004]然而,额外的消息队列服务需要消耗较多的软件支持资源,对于较少的消息传输的场景而言并不合适

Benefits of technology

[0021]本申请实施例提供的一种数据通信方法、装置、设备及存储介质中,可以基于预先创建的游戏引擎的子线程接收目标制作软件所发送的目标消息;由游戏引擎的子线程将目标消息存储于游戏引擎的执行队列中;由游戏引擎的主进程确定当前数据交换帧的执行时长是否满足第一时长需求;若是,由游戏引擎的主进程从执行队列中的读取目标消息。其中,通过在游戏引擎中建立执行队列的方式,可以更加稳定、快速地实现游戏引擎对制作软件所传输消息的接收,并且无需额外进行消息服务的创建,节约了软件资源,在消息传输的过程中,也可以保证游戏引擎的正常工作。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116755898B_ABST
    Figure CN116755898B_ABST
Patent Text Reader

Abstract

The application provides a data communication method, device and equipment and a storage medium, and belongs to the technical field of program communication. The method is applied to a game engine, and comprises the following steps: receiving a target message sent by a target production software based on a pre-created sub-thread of the game engine; storing the target message in an execution queue of the game engine by the sub-thread of the game engine; determining whether the execution duration of a current data exchange frame meets a first duration requirement by a main process of the game engine; and if yes, reading the target message from the execution queue by the main process of the game engine. The application can realize non-blocking communication between the game engine and the target production software, and reduce the consumption of software support resources.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of program communication technology, and more specifically, to a data communication method, apparatus, device, and storage medium. Background Technology

[0002] In the process of transmitting information between different software, it is usually necessary to ensure non-blocking communication of messages, such as the communication between game engines and model making software.

[0003] In existing technologies, the technical means used to achieve information transmission between the two is usually to establish a dedicated message queue service for message transmission, and to use sub-threads in the processes of the two software programs to jointly listen to the message queue service, thereby achieving communication.

[0004] However, additional message queue services require significant software support resources, making them unsuitable for scenarios with limited message transmission. Summary of the Invention

[0005] The purpose of this application is to provide a data communication method, apparatus, device, and storage medium that enables non-blocking communication between a game engine and target creation software, thereby reducing the consumption of software support resources.

[0006] The embodiments of this application are implemented as follows:

[0007] One aspect of this application provides a data communication method applied to a game engine, the method comprising:

[0008] A sub-thread based on a pre-created game engine receives target messages sent by the target creation software.

[0009] The target message is stored in the game engine's execution queue by a child thread of the game engine;

[0010] The main process of the game engine determines whether the execution duration of the current data exchange frame meets the first duration requirement;

[0011] If so, the game engine's main process reads the target message from the execution queue.

[0012] In another aspect of this application, a data communication device is provided, which is applied to a game engine. The device includes: a transmission module, a storage module, a determination module, and an execution module.

[0013] The transmission module is used to receive target messages sent by the target creation software based on a sub-thread of a pre-created game engine;

[0014] The storage module is used by the game engine's sub-threads to store target messages in the game engine's execution queue;

[0015] The determination module is used by the main process of the game engine to determine whether the execution duration of the current data exchange frame meets the first duration requirement.

[0016] If so, the execution module is used by the game engine's main process to read target messages from the execution queue.

[0017] In one aspect of this application, a computer device is provided, including: a memory and a processor. The memory stores a computer program that can run on the processor. When the processor executes the computer program, it implements the steps of a data communication method.

[0018] One aspect of this application provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of a data communication method.

[0019] In another aspect of this application, a computer program product is provided, which includes a computer program / instructions that, when executed by a processor, implement the steps of a data communication method.

[0020] The beneficial effects of the embodiments of this application include:

[0021] This application provides a data communication method, apparatus, device, and storage medium in which target messages sent by target creation software can be received based on a pre-created sub-thread of a game engine; the sub-thread of the game engine stores the target messages in the execution queue of the game engine; the main process of the game engine determines whether the execution duration of the current data exchange frame meets a first duration requirement; if so, the main process of the game engine reads the target messages from the execution queue. By establishing an execution queue in the game engine, the reception of messages transmitted by the creation software by the game engine can be achieved more stably and quickly, without the need for additional message service creation, saving software resources and ensuring the normal operation of the game engine during message transmission. Attached Figure Description

[0022] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of this application and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.

[0023] Figure 1This is a structural diagram illustrating an application scenario provided in an embodiment of this application.

[0024] Figure 2 A flowchart illustrating the data communication method provided in an embodiment of this application;

[0025] Figure 3 Another schematic diagram of the data communication method provided in the embodiments of this application;

[0026] Figure 4 Another schematic diagram of the data communication method provided in the embodiments of this application;

[0027] Figure 5 Another schematic diagram of the data communication method provided in the embodiments of this application;

[0028] Figure 6 A schematic diagram illustrating the data communication method provided in the embodiments of this application;

[0029] Figure 7 A schematic diagram of the communication device for a game engine provided in this application embodiment;

[0030] Figure 8 A schematic diagram of the structure of a computer device provided in an embodiment of this application. Detailed Implementation

[0031] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. The components of the embodiments of this application described and shown in the accompanying drawings can generally be arranged and designed in various different configurations.

[0032] Therefore, the following detailed description of the embodiments of this application provided in the accompanying drawings is not intended to limit the scope of the claimed application, but merely to illustrate selected embodiments of the application. All other embodiments obtained by those skilled in the art based on the embodiments of this application without inventive effort are within the scope of protection of this application.

[0033] It should be noted that similar labels and letters in the following figures indicate similar items. Therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures.

[0034] In the description of this application, it should be noted that the terms "first," "second," "third," etc., are used only to distinguish descriptions and should not be construed as indicating or implying relative importance.

[0035] To more clearly explain a real-world scenario to which the data communication method provided in this application is applicable, a specific scenario example is given below.

[0036] Figure 1 Please refer to the structural diagram of the application scenario provided in the embodiments of this application. Figure 1 Specifically, this scenario can be a computer system, which can be in the same computer device, in a cluster of computer devices, or in an architecture of multiple computers and servers, without any specific restrictions.

[0037] The computer system may include: a game engine 110 and target creation software 120.

[0038] Among them, game engine 110 can be a real-time running game engine, specifically a 3D game rendering engine, such as Unreal Engine or Unity Engine; target production software 120 can be an offline production software, specifically a 3D model making software, such as Maya or C4D software, etc., without specific restrictions.

[0039] In actual use, it is usually necessary to send messages from the target creation software 120 to the game engine 110 to achieve message transmission, that is, to enable non-blocking communication.

[0040] Non-blocking message synchronization is a common topic during program execution. Some time-consuming or frequently executed functions are often prioritized for placement in background threads to avoid main thread lag and ensure a smooth overall user experience. However, threads cannot be completely non-blocking between different software programs because this involves communication between the main processes of the two programs. If software A simply uses a background thread to handle non-blocking information, the main process of software B on the other end might be blocked by software A's background thread while waiting for messages from software A. Therefore, it is necessary to implement non-blocking communication between the game engine 110 and the target creation software 120.

[0041] It should be noted that the game engine 110 and the target creation software 120 can be two software programs running on the same computer device, or multiple software programs running on different devices, etc., without specific restrictions.

[0042] In existing technologies, the common approach to enabling communication between these two types of software is to establish a dedicated message queue service for message transmission, and then use sub-threads in the processes of both software to jointly listen to the message queue service, thereby achieving communication.

[0043] Alternatively, in existing technologies, there is also a way to program both main processes into child processes of a new process, thereby sharing a thread pool.

[0044] However, additional message queue services or shared thread pools consume significant software resources, making them unsuitable for scenarios with limited message transmission. To address these issues in the prior art, this application provides a data communication method, the execution steps of which are explained below.

[0045] Figure 2 Please refer to the flowchart illustrating the data communication method provided in this application embodiment. Figure 2 The method includes:

[0046] S210: A sub-thread based on a pre-created game engine receives target messages sent by the target creation software.

[0047] The execution entity of this method can be the game engine in the above application scenario.

[0048] Optionally, the target message can be a message that needs to be sent to the game engine by the target creation software. Specifically, the target message can be generated by the target creation software and sent to a sub-thread of the game engine.

[0049] It should be noted that a game engine can include a main process and multiple child threads, and one of the child threads can be used as a dedicated thread to receive messages sent by the target software.

[0050] S220: The target message is stored in the game engine's execution queue by a child thread of the game engine.

[0051] Optionally, after receiving a target message, the game engine's sub-thread can store the target message in the game engine's execution queue. Specifically, the execution queue can be a queue created within the game engine's sub-thread, and multiple target messages can be stored in the queue.

[0052] For example, if a child thread of the game engine receives two or more target messages, these target messages can be stored in the execution queue.

[0053] S230: The main process of the game engine determines whether the execution duration of the current data exchange frame meets the first duration requirement.

[0054] Optionally, during the operation of the game engine's main process, resource rendering and other related tasks can be performed in each data exchange frame. The execution duration of each data exchange frame can be determined, which is the aforementioned execution duration. After obtaining the execution duration, it can be determined whether the execution duration meets the first duration requirement.

[0055] It should be noted that a data exchange frame (tick) can specifically refer to the refresh frequency of the game engine during its operation. Each refresh can be considered a frame, and data exchange can take place within each frame, as well as the execution of corresponding tasks, such as computational tasks.

[0056] S240: If so, the game engine's main process reads the target message from the execution queue.

[0057] Optionally, when it is determined that the execution duration meets the first duration requirement, the main process of the game engine can read the target message from the execution queue. If there is more than one target message in the execution queue, the above-mentioned S230 judgment can be performed after each reading until all target messages in the execution queue have been read, thereby completing the message transmission.

[0058] Conversely, if it is determined that the execution time does not meet the first time requirement, then we can wait until the execution time meets the first time requirement.

[0059] In a data communication method provided in this application embodiment, a target message sent by the target creation software can be received based on a pre-created sub-thread of a game engine; the sub-thread of the game engine stores the target message in the execution queue of the game engine; the main process of the game engine determines whether the execution duration of the current data exchange frame meets a first duration requirement; if so, the main process of the game engine reads the target message from the execution queue. By establishing an execution queue in the game engine, the reception of messages transmitted by the creation software by the game engine can be achieved more stably and quickly, without the need for additional message service creation, saving software resources and ensuring the normal operation of the game engine during message transmission.

[0060] The following is a detailed explanation of another specific implementation process of the data communication method in the embodiments of this application.

[0061] Figure 3 For another flowchart illustrating the data communication method provided in this application embodiment, please refer to... Figure 3 After the game engine's main process reads the target message from the execution queue, the method also includes:

[0062] S310: The main process of the game engine determines whether the execution duration of the current data exchange frame meets the second duration requirement.

[0063] Optionally, after reading the target message in the aforementioned step S240, the main process of the game engine can execute the target message and obtain a result message, which can be the result obtained after executing the target message.

[0064] The second duration requirement can be the same as the first duration requirement. The determination principle of S310 is similar to that of S230 above, and will not be explained again here.

[0065] S320: If so, the main process of the game engine sends the result message obtained based on the target message to the child thread of the game engine.

[0066] Optionally, when it is determined that the execution duration meets the second duration requirement, the main process of the game engine can send the result message obtained based on the target message to the child thread of the game engine. If there is more than one result message to be sent, the above S310 judgment can be performed before each sending until all result messages are transmitted to the child thread of the game engine.

[0067] Conversely, if it is determined that the execution time does not meet the second time requirement, we can wait until the execution time meets the second time requirement.

[0068] S330: Sends the result message to the target software via a sub-thread of the game engine.

[0069] Optionally, after the game engine's child thread receives the aforementioned result message, it can send the result message back to the target software, thereby implementing a message callback.

[0070] It should be noted that different implementation processes can be adopted for different target messages. For example, if only one target message needs to be transmitted to the game engine, then the above steps S210-S240 can be executed. If multiple target messages need to be transmitted, or if a feedback result for the target message needs to be received after transmitting a target message, then after executing the above steps S210-S240, the above steps S310-S330 can also be executed.

[0071] In a data communication method provided in this application embodiment, the main process of the game engine can determine whether the execution duration of the current data exchange frame meets a second duration requirement. If so, the main process of the game engine sends the result message obtained based on the target message to a sub-thread of the game engine. The sub-thread of the game engine then sends the result message to the target production software. By determining the second duration requirement, message callbacks can be implemented without affecting the normal execution of the main process, thereby enabling a more stable and faster callback of the production software to the game engine's result message. During message transmission, the high-performance operation of the game engine can also be guaranteed.

[0072] Optionally, the sub-thread of the game engine includes: a result queue; the main process of the game engine sends the result message obtained based on the target message to the sub-thread of the game engine, including: the main process of the game engine sends the result message obtained based on the target message to the result queue of the sub-thread of the game engine.

[0073] The result queue, similar to the execution queue, is a task queue set up in a child thread of the game engine. Whenever a child thread of the game engine receives a result message sent by the main process of the game engine, it can store the result message in the result queue.

[0074] It should be noted that the result queue can store multiple result messages. During the message callback process, any number of result messages in the result queue can be returned to the target software.

[0075] Optionally, the result messages are sent to the target production software through a sub-thread of the game engine, including: if the number of result messages in the result queue reaches the target number, the result messages in the result queue are sent to the target production software by a sub-thread of the game engine.

[0076] During message callback, the target number can be set according to actual needs. For example, it can be that a result message is called back for each received result message, or N result messages are called back together. There is no specific restriction here. You can choose the appropriate callback method for message transmission according to actual needs.

[0077] It should be noted that in a sub-thread of the game engine, a client and a server can be set up. Specifically, the client and server can be virtual devices with RPC (Remote Procedure Call) functionality. The RPC server can receive target messages sent by the target creation software, and the RPC client can send result messages to the target creation software.

[0078] Optionally, the target creation software includes: the main process of the target creation software and the sub-threads of the target creation software; the sub-threads of the game engine send the result messages in the result queue to the target creation software, including:

[0079] The game engine's child thread sends the result messages in the result queue to the target software's child thread, so that the target software's main process can call back the result messages from the target software's child thread to the target software's main process.

[0080] It should be noted that, similar to game engines, target creation software can also be divided into a main process and multiple sub-threads. One of these sub-threads can be used specifically to send messages to the game engine.

[0081] Optionally, the game engine's sub-thread can send result messages from the result queue to the target software's sub-thread. The target software's sub-thread can also include a client and a server. Specifically, the client and server can be virtual devices with RPC functionality. The RPC server can receive result messages from the game engine, and the RPC client can send target messages to the game engine.

[0082] Optionally, the main process of the target creation software can use a pre-configured callback function to send the result message received by the child thread back to the main process of the target creation software, thereby completing the callback processing of the result message by the entire target creation software.

[0083] In the data communication method provided in this embodiment, the game engine's sub-thread can send the result message in the result queue to the target software's sub-thread; the target software's main process then calls back the result message from the sub-thread to the main process. By dividing the target software into a main process and sub-threads, communication can be avoided during the target software's normal operation, thus improving the stability of the message callback process.

[0084] Optionally, the target message is a message generated by the main process of the target software and transmitted to a child thread of the target software.

[0085] Optionally, the target message may be generated by the main process of the target creation software. For example, it may be automatically generated or manually selected during the main process.

[0086] Once the target message is obtained, it can be transmitted to a sub-thread of the target creation software through the message transmission function of the main process.

[0087] Optionally, after receiving the target message, the target creation software's sub-thread can send the target message through the target creation software's sub-thread's RPC client and receive the target message through the game engine's sub-thread's RPC server.

[0088] In the data communication method provided in this embodiment, the main process of the target creation software can generate a target message and transmit it to a sub-thread of the target creation software; the sub-thread of the target creation software then sends the target message to a sub-thread of the game engine. By sending the target message to the sub-thread of the game engine through the sub-thread of the target creation software, the situation where the target creation software is occupied by communication during normal operation can be avoided, thereby improving the stability of the target message transmission process.

[0089] The following explains in detail the specific implementation steps of the main process execution of the game engine in the data communication method provided in the embodiments of this application.

[0090] Figure 4 For another flowchart illustrating the data communication method provided in this application embodiment, please refer to... Figure 4 The game engine's main process determines whether the execution duration of the current data exchange frame meets the first duration requirement, including:

[0091] S410: The execution duration of the current data exchange frame is determined by the main process of the game engine when performing frame rendering work in each data exchange frame.

[0092] Optionally, the main process of the game engine refreshes according to the data exchange frame during normal operation. Each data exchange frame can attempt to retrieve the target message from the execution queue when performing frame rendering work. Specifically, it can determine whether to retrieve the target message immediately based on the execution time of the current data exchange frame.

[0093] It should be noted that when the target message is stored in the execution queue, it can be stored as instantiated data and related parameters.

[0094] S420: If the execution time is less than or equal to the target execution time, determine that the execution time meets the first time requirement.

[0095] It should be noted that the target execution time can be set according to actual needs. For example, it can be set to 33.3ms based on the minimum frame rate requirement of 30 FPS.

[0096] When the execution duration is less than or equal to the target execution duration, it can be determined that no complex calculations are being performed under the current data exchange frame, and additional tasks can be executed, that is, the reading of the target message can be performed, and it can be determined that the execution duration meets the first duration requirement.

[0097] S430: If the execution time is longer than the target execution time, it is determined that the execution time does not meet the first time requirement.

[0098] Conversely, when the execution duration exceeds the target execution duration, it can be determined that there are complex calculations in the current data exchange frame, and no additional tasks can be executed. In other words, the reading of the target message cannot be performed at the current time. It can be determined that the execution duration does not meet the first duration requirement. If the target message is to be read from the execution queue, it is necessary to continue waiting until the next data exchange frame to re-evaluate.

[0099] Similarly, the principle for determining the second duration requirement is similar to the above determination process. When the execution duration is less than or equal to the target execution duration, it can be determined that no complex calculations are being performed in the current data exchange frame, and additional tasks can be executed, that is, the return of the result message can be executed. It can be determined that the execution duration meets the second duration requirement. When the execution duration is longer than the target execution duration, it can be determined that complex calculations are being performed in the current data exchange frame, and additional tasks cannot be executed, that is, the return of the result message cannot be executed. It can be determined that the execution duration does not meet the second duration requirement. If the result message is to be placed in the result queue, it is necessary to continue waiting until the next data exchange frame for re-determination.

[0100] In the data communication method provided in this application embodiment, the main process of the game engine can determine the execution duration of the current data exchange frame when performing frame rendering work in each data exchange frame. If the execution duration is less than or equal to the target execution duration, it is determined that the execution duration meets the first duration requirement; if the execution duration is greater than the target execution duration, it is determined that the execution duration does not meet the first duration requirement. By determining the execution duration of each data exchange frame, it is possible to more accurately determine whether the current data exchange frame can perform additional message transmission, thereby avoiding process occupancy during message transmission.

[0101] The following is a detailed explanation of another feasible implementation process of the data communication method provided in the embodiments of this application.

[0102] Figure 5 For another flowchart illustrating the data communication method provided in this application embodiment, please refer to... Figure 5 After the game engine's main process reads the target message from the execution queue, the method also includes:

[0103] S510: Generates an empty message in a child thread of the game engine.

[0104] Optionally, after the main process of the game engine reads the target message, it can return a message to the target creation software to indicate that the target message has been received by the main process of the game engine, or it can return an empty message to the target creation software.

[0105] Specifically, after the main process of the game engine starts executing the target message, an empty message can be generated in a child thread of the game engine. This message does not contain any specific content.

[0106] S520: Sends an empty message to the target software via a sub-thread of the game engine.

[0107] Optionally, after generating an empty message in a child thread, the child thread of the game engine can send the empty message to the child thread of the target software, and then the main process of the target software can receive the empty message through a callback, thereby enabling the entire target software to determine that the target message has been received and executed by the game engine.

[0108] In the data communication method provided in this embodiment, an empty message can be generated in a sub-thread of the game engine; the empty message is then sent to the target software through the sub-thread of the game engine. By returning an empty message, the target software can more quickly and accurately determine that the game engine has received the target message, thereby improving the interaction efficiency between the game engine and the target software.

[0109] The following diagram illustrates the complete communication transmission process of the target message and the result message.

[0110] Figure 6 Please refer to the communication illustration diagram of the data communication method provided in the embodiments of this application. Figure 6 The target creation software includes: the main process of the target creation software and the sub-threads of the target creation software. The main process of the target creation software can send target messages to the RPC client in the sub-threads of the target creation software through message transmission function. The RPC client can send the target messages to the game engine. The sub-threads of the target creation software also include an RPC server. The RPC server can receive the result messages sent by the game engine and return the result messages to the main process of the target creation software through the callback function of the main process of the target creation software.

[0111] A game engine can include a main process and sub-threads. The sub-threads can include an RPC server, an RPC client, an execution queue, and a result queue. The RPC server in the sub-threads can receive target messages sent by the target software's RPC client and store them in the execution queue. The result queue stores result messages obtained by the main process and transmits them to the RPC client in the sub-threads. The RPC client in the sub-threads can also return the result messages to the target software's RPC server. The main process can read target messages from the execution queue, execute them to obtain result messages, and can generate an empty message when the target message execution begins.

[0112] In a data communication method provided in this embodiment, target creation software can send target messages to a sub-thread of a game engine; the sub-thread of the game engine stores the target messages in the execution queue of the game engine; the main process of the game engine determines whether the execution duration of the current data exchange frame meets a first duration requirement; if so, the main process of the game engine reads the target message from the execution queue; the main process of the game engine determines whether the execution duration of the current data exchange frame meets a second duration requirement; if so, the main process of the game engine sends the result message obtained based on the target message to the sub-thread of the game engine; and the sub-thread of the game engine sends the result message to the target creation software. By establishing an execution queue in the game engine, the game engine can receive messages transmitted by the target creation software more stably and quickly, without needing to create an additional message service, saving software resources and ensuring the normal operation of the game engine during message transmission; by determining the second duration requirement, message callbacks can be implemented without affecting the normal execution of the main process, thereby achieving more stable and faster callbacks of result messages from the target creation software to the game engine, and ensuring high-performance operation of the game engine during message transmission.

[0113] The following describes the apparatus, device, and storage medium used to implement the data communication method provided in this application. The specific implementation process and technical effects are described above and will not be repeated here.

[0114] Figure 7 Please refer to the schematic diagram of the communication device of the game engine provided in the embodiments of this application. Figure 7 A data communication device for use in a game engine, comprising: a transmission module 910, a storage module 920, a determination module 930, and an execution module 940;

[0115] The transmission module 910 is used to receive target messages sent by the target creation software based on a sub-thread of a pre-created game engine;

[0116] Storage module 920 is used for storing target messages in the execution queue of the game engine by a sub-thread of the game engine;

[0117] The determination module 930 is used by the main process of the game engine to determine whether the execution duration of the current data exchange frame meets the first duration requirement;

[0118] If so, the execution module 940 is used by the game engine's main process to read target messages from the execution queue.

[0119] Optionally, the determination module 930 is further configured to determine whether the execution duration of the current data exchange frame meets the second duration requirement by the main process of the game engine; if so, the execution module 940 is further configured to send the result message obtained based on the target message to the sub-thread of the game engine by the main process of the game engine; the transmission module 910 is further configured to send the result message to the target production software through the sub-thread of the game engine.

[0120] Optionally, the game engine's sub-thread includes: a result queue; and an execution module 940, specifically used by the game engine's main process to send the result message obtained based on the target message to the result queue of the game engine's sub-thread.

[0121] Optionally, the transmission module 910 is specifically used to send the result messages in the result queue to the target production software by a sub-thread of the game engine if the number of result messages in the result queue reaches the target number.

[0122] Optionally, the target creation software includes: the main process of the target creation software and the sub-threads of the target creation software; the transmission module 910 is specifically used to send the result message in the result queue from the sub-thread of the game engine to the sub-thread of the target creation software, so that the main process of the target creation software can call back the result message from the sub-thread of the target creation software to the main process of the target creation software.

[0123] Optionally, in this device, the target message is a message generated by the main process of the target creation software and transmitted to the sub-threads of the target creation software.

[0124] Optionally, the determination module 930 is specifically used to determine the execution duration of the current data exchange frame when the main process of the game engine performs frame rendering work in each data exchange frame; if the execution duration is less than or equal to the target execution duration, it is determined that the execution duration meets the first duration requirement; if the execution duration is greater than the target execution duration, it is determined that the execution duration does not meet the first duration requirement.

[0125] Optionally, the execution module 940 is also configured to generate an empty message in a sub-thread of the game engine and send the empty message to the target production software via the sub-thread of the game engine.

[0126] In a data communication device provided in this application embodiment, a target message sent by target creation software can be received based on a pre-created sub-thread of a game engine; the sub-thread of the game engine stores the target message in the execution queue of the game engine; the main process of the game engine determines whether the execution duration of the current data exchange frame meets a first duration requirement; if so, the main process of the game engine reads the target message from the execution queue. By establishing an execution queue in the game engine, the reception of messages transmitted by the target creation software by the game engine can be achieved more stably and quickly, without the need for additional message service creation, saving software resources and ensuring the normal operation of the game engine during message transmission.

[0127] The above-described device is used to execute the method provided in the foregoing embodiments, and its implementation principle and technical effect are similar, so they will not be described again here.

[0128] These modules can be one or more integrated circuits configured to implement the above methods, such as one or more Application Specific Integrated Circuits (ASICs), one or more microprocessors, or one or more Field Programmable Gate Arrays (FPGAs). Alternatively, when a module is implemented using processing element scheduler code, the processing element can be a general-purpose processor, such as a Central Processing Unit (CPU) or other processor capable of calling program code. Furthermore, these modules can be integrated together as a system-on-a-chip (SOC).

[0129] Figure 8 Please refer to the schematic diagram of the computer device provided in the embodiments of this application. Figure 8 A computer device, including: a memory 950 and a processor 960, wherein the memory 950 stores a computer program that can run on the processor 960, and the processor 960 executes the computer program to implement the steps of a data communication method.

[0130] Specifically, this computer device can enable a sub-thread of a pre-created game engine to receive target messages sent by the target creation software; the sub-thread of the game engine to store the target messages in the execution queue of the game engine; the main process of the game engine to determine whether the execution duration of the current data exchange frame meets the first duration requirement; if so, the main process of the game engine to read the target messages from the execution queue.

[0131] Optionally, the computer device can specifically enable the main process of the game engine to determine whether the execution duration of the current data exchange frame meets the second duration requirement; if so, the main process of the game engine sends the result message obtained based on the target message to the sub-thread of the game engine; and the sub-thread of the game engine sends the result message to the target production software.

[0132] Optionally, the game engine's sub-thread includes: a result queue; specifically, the computer device can enable the main process of the game engine to send result messages obtained based on the target message to the result queue of the game engine's sub-thread.

[0133] Optionally, the computer device can specifically enable the game engine's sub-thread to send the result messages in the result queue to the target production software if the number of result messages in the result queue reaches the target number.

[0134] Optionally, the target creation software includes: a main process of the target creation software and a sub-thread of the target creation software; specifically, the computer device can enable the sub-thread of the game engine to send the result message in the result queue to the sub-thread of the target creation software, so that the main process of the target creation software can call back the result message from the sub-thread of the target creation software to the main process of the target creation software.

[0135] Optionally, the computer device can specifically enable the main process of the game engine to determine the execution duration of the current data exchange frame when performing frame rendering work in each data exchange frame; if the execution duration is less than or equal to the target execution duration, it is determined that the execution duration meets the first duration requirement; if the execution duration is greater than the target execution duration, it is determined that the execution duration does not meet the first duration requirement.

[0136] Optionally, the computer device can specifically generate an empty message in a sub-thread of the game engine; and send the empty message to the target production software through the sub-thread of the game engine.

[0137] This application provides a computer device that can receive target messages sent by target creation software based on a pre-created sub-thread of a game engine; the sub-thread of the game engine stores the target messages in the execution queue of the game engine; the main process of the game engine determines whether the execution duration of the current data exchange frame meets a first duration requirement; if so, the main process of the game engine reads the target messages from the execution queue. By establishing an execution queue in the game engine, the reception of messages transmitted by the target creation software can be achieved more stably and quickly, without the need for additional message service creation, saving software resources and ensuring the normal operation of the game engine during message transmission.

[0138] In one aspect of this application, a computer-readable storage medium is also provided, on which a computer program is stored, which, when executed by a processor, implements the steps of a data communication method.

[0139] The computer-readable storage medium can specifically enable a sub-thread of a pre-created game engine to receive target messages sent by target creation software; the sub-thread of the game engine to store the target messages in the execution queue of the game engine; the main process of the game engine to determine whether the execution duration of the current data exchange frame meets the first duration requirement; if so, the main process of the game engine to read the target messages from the execution queue.

[0140] Optionally, the computer-readable storage medium can specifically enable the main process of the game engine to determine whether the execution duration of the current data exchange frame meets the second duration requirement; if so, the main process of the game engine sends the result message obtained based on the target message to the sub-thread of the game engine; and the sub-thread of the game engine sends the result message to the target production software.

[0141] Optionally, the game engine's sub-thread includes: a result queue; specifically, the computer-readable storage medium can enable the main process of the game engine to send result messages obtained based on the target message to the result queue of the game engine's sub-thread.

[0142] Optionally, the computer-readable storage medium can specifically enable the game engine's sub-thread to send the result messages in the result queue to the target production software if the number of result messages in the result queue reaches a target number.

[0143] Optionally, the target creation software includes: a main process of the target creation software and sub-threads of the target creation software; specifically, the computer-readable storage medium can enable the sub-threads of the game engine to send result messages in the result queue to the sub-threads of the target creation software, so that the main process of the target creation software can call back the result messages from the sub-threads of the target creation software to the main process of the target creation software.

[0144] Optionally, the computer-readable storage medium can specifically enable the main process of the game engine to determine the execution duration of the current data exchange frame when performing frame rendering work in each data exchange frame; if the execution duration is less than or equal to the target execution duration, it is determined that the execution duration meets the first duration requirement; if the execution duration is greater than the target execution duration, it is determined that the execution duration does not meet the first duration requirement.

[0145] Optionally, the computer-readable storage medium can specifically enable the generation of an empty message in a sub-thread of the game engine; and the sending of the empty message to the target production software via the sub-thread of the game engine.

[0146] This application provides a computer-readable storage medium that can receive target messages sent by target creation software based on a pre-created sub-thread of a game engine; the sub-thread of the game engine stores the target messages in the execution queue of the game engine; the main process of the game engine determines whether the execution duration of the current data exchange frame meets a first duration requirement; if so, the main process of the game engine reads the target messages from the execution queue. By establishing an execution queue within the game engine, the reception of messages transmitted by the target creation software can be achieved more stably and quickly, without the need for additional message service creation, saving software resources and ensuring the normal operation of the game engine during message transmission.

[0147] Another aspect of the embodiments of this application also provides a computer program product, which includes a computer program / instructions that, when executed by a processor, implement the steps of a data communication method.

[0148] In the several embodiments provided by this invention, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.

[0149] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0150] Furthermore, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or in the form of hardware plus software functional units.

[0151] The integrated units implemented as software functional units described above can be stored in a computer-readable storage medium. These software functional units, stored in a storage medium, include several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) or processor to execute certain steps of the methods of the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0152] The above are merely specific embodiments of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

[0153] The above description is merely a preferred embodiment of this application and is not intended to limit this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.

Claims

1. A data communication method, characterized in that, The method is applied to a game engine, and the method includes: A sub-thread based on a pre-created game engine receives target messages sent by the target creation software. The target message is stored in the execution queue of the game engine by a sub-thread of the game engine; The main process of the game engine determines whether the execution duration of the current data exchange frame meets the first duration requirement; If so, the main process of the game engine reads the target message from the execution queue; The step of determining whether the execution duration of the current data exchange frame meets the first duration requirement by the main process of the game engine includes: The execution duration of the current data exchange frame is determined by the main process of the game engine when performing frame rendering work in each data exchange frame; If the execution time is less than or equal to the target execution time, it is determined that the execution time meets the first time requirement. If the execution time is longer than the target execution time, it is determined that the execution time does not meet the first duration requirement.

2. The data communication method as described in claim 1, characterized in that, After the main process of the game engine reads the target message from the execution queue, the method further includes: The main process of the game engine determines whether the execution duration of the current data exchange frame meets the second duration requirement; If so, the main process of the game engine will send the result message obtained based on the target message to the child thread of the game engine; The result message is sent to the target production software via a sub-thread of the game engine.

3. The data communication method as described in claim 2, characterized in that, The game engine's sub-thread includes: a result queue; the process of the game engine's main process sending the result message obtained based on the target message to the game engine's sub-thread includes: The main process of the game engine sends the result message obtained based on the target message to the result queue of the child thread of the game engine.

4. The data communication method as described in claim 3, characterized in that, Sending the result message to the target production software via a sub-thread of the game engine includes: If the number of result messages in the result queue reaches the target number, the game engine's sub-thread will send the result messages in the result queue to the target production software.

5. The data communication method as described in claim 4, characterized in that, The target creation software includes: a main process of the target creation software and sub-threads of the target creation software; the step of sending the result messages in the result queue to the target creation software by the sub-threads of the game engine includes: The game engine's child thread sends the result message in the result queue to the target software's child thread, so that the target software's main process can call back the result message from the target software's child thread to the target software's main process.

6. The data communication method as described in claim 5, characterized in that, The target message is a message generated by the main process of the target creation software and transmitted to the sub-thread of the target creation software.

7. The data communication method as described in claim 1, characterized in that, After the main process of the game engine reads the target message from the execution queue, the method further includes: An empty message is generated in a sub-thread of the game engine; The empty message is sent to the target production software via a sub-thread of the game engine.

8. A data communication device, characterized in that, The device is used in a game engine and includes: a transmission module, a storage module, a judgment module, and an execution module; The transmission module is used to receive target messages sent by the target creation software based on a sub-thread of a pre-created game engine; The storage module is used to store the target message in the execution queue of the game engine by a sub-thread of the game engine; The determination module is used by the main process of the game engine to determine whether the execution duration of the current data exchange frame meets the first duration requirement. If so, the execution module is used by the main process of the game engine to read the target message from the execution queue; The determination module is specifically used to determine the execution duration of the current data exchange frame when the main process of the game engine performs frame rendering work in each data exchange frame; if the execution duration is less than or equal to the target execution duration, it is determined that the execution duration meets the first duration requirement; if the execution duration is greater than the target execution duration, it is determined that the execution duration does not meet the first duration requirement.

9. A computer device, characterized in that, include: A memory and a processor, wherein the memory stores a computer program that can run on the processor, and when the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that, The storage medium stores a computer program that, when executed by a processor, implements the steps of the method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Multithread parallelization based 3D (three dimensional) engine system

    CN104102488A

  • Threat scene analysis method and system based on big data

    CN115587357A