CN114816803B - Distributed simulation communication message processing method and device - Google Patents

Distributed simulation communication message processing method and device Download PDF

Info

Publication number
CN114816803B
CN114816803B CN202210737910.2A CN202210737910A CN114816803B CN 114816803 B CN114816803 B CN 114816803B CN 202210737910 A CN202210737910 A CN 202210737910A CN 114816803 B CN114816803 B CN 114816803B
Authority
CN
China
Prior art keywords
entity
data
packet
thread
state
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202210737910.2A
Other languages
Chinese (zh)
Other versions
CN114816803A (en
Inventor
王宇翔
徐华勋
李宁
马海波
廖通逵
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Aerospace Hongtu Information Technology Co Ltd
Original Assignee
Aerospace Hongtu Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Aerospace Hongtu Information Technology Co Ltd filed Critical Aerospace Hongtu Information Technology Co Ltd
Priority to CN202210737910.2A priority Critical patent/CN114816803B/en
Publication of CN114816803A publication Critical patent/CN114816803A/en
Application granted granted Critical
Publication of CN114816803B publication Critical patent/CN114816803B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/546Message passing systems or structures, e.g. queues
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5061Partitioning or combining of resources
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/50Indexing scheme relating to G06F9/50
    • G06F2209/5011Pool
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/50Indexing scheme relating to G06F9/50
    • G06F2209/5018Thread allocation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/54Indexing scheme relating to G06F9/54
    • G06F2209/545Gui
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/54Indexing scheme relating to G06F9/54
    • G06F2209/548Queue
    • GPHYSICS
    • G09EDUCATION; CRYPTOGRAPHY; DISPLAY; ADVERTISING; SEALS
    • G09BEDUCATIONAL OR DEMONSTRATION APPLIANCES; APPLIANCES FOR TEACHING, OR COMMUNICATING WITH, THE BLIND, DEAF OR MUTE; MODELS; PLANETARIA; GLOBES; MAPS; DIAGRAMS
    • G09B9/00Simulators for teaching or training purposes
    • G09B9/003Simulators for teaching or training purposes for military purposes and tactics

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The application provides a distributed simulation communication message processing method and a device, which relate to the technical field of distributed simulation, and specifically comprise the following steps: receiving an entity state message sent by a server; analyzing the state information data packet of the entity state message by using the processing thread, putting the timestamp of the entity state message obtained by analysis and the state data of each entity into the entity packet, and putting the entity packet into an entity packet queue of a thread resource pool mapping dictionary corresponding to the processing thread; sequencing all entity packets of the entity packet queue according to the time stamps, and reading the sequenced first entity packet data; and acquiring the state data of each entity from the first entity package data, and rendering the entities in the scene according to the state data of each entity. The method and the device can effectively solve the problems of untimely scene updating, even program crash and the like caused by the analysis and blockage of the client message when the number of the simulation scene entities is large; and the entity message response speed and the scene rendering efficiency are improved.

Description

Distributed simulation communication message processing method and device
Technical Field
The present application relates to the field of distributed message processing technologies, and in particular, to a method and an apparatus for processing a distributed simulation communication message.
Background
The simulated training can realize the tactical confrontation training of people and man-machines (CGF) under a real virtual three-dimensional environment by utilizing a computer simulation technology and constructing a power and behavior simulation model of equipment. Moreover, the simulation training is not limited by conditions such as actual scenes, weather and the like, can intervene and control environmental conditions and equipment states at any time in the training process, is an effective complementary means of the real-installation training, and is an important form of daily training in related industries at present.
In the distributed simulation training process, the simulation engine is responsible for building the CGF model and updating the state of the CGF model according to the planned task. Training personnel log in the simulation system through the client, receive information pushed by the simulation engine, and perform real-time situation receiving and scene updating. And performing task execution such as command control, information processing, equipment operation and the like according to the battlefield situation of the current deduction process moment. Typically, the physical size of a simulation reaches hundreds or even thousands, and since human participation in the ring training requires real-time propulsion of the simulation, the simulation step size is typically tens of milliseconds.
The existing simulation engine platform generally utilizes the advantages of multi-core and multi-thread of a computer, the rapid parallel processing capability of a GPU is fully utilized when a client scene is updated, and the performance requirements of simulation real-time deduction can be met. However, in the process of receiving and processing the scene entity update message sent by the simulation engine through the message middleware at the client, because of the factors of a large number of simulation entities, slow message analysis and the like, the message analysis at the client is easy to be blocked, and the problems of untimely scene update, even program crash and the like are caused.
Disclosure of Invention
In view of this, the present application provides a distributed simulation communication message processing method and apparatus, so as to solve the above technical problem.
In a first aspect, an embodiment of the present application provides a method for processing a distributed simulation communication message, including:
receiving entity state information sent by a server, wherein the entity state information comprises a state information data packet, and the state information data packet comprises state data of all updated entities in the whole scene at each simulation moment;
analyzing the state information data packet of the entity state message by using the processing thread, putting the timestamp of the entity state message obtained by analysis and the state data of each entity into the entity packet, and putting the entity packet into an entity packet queue of a thread resource pool mapping dictionary corresponding to the processing thread;
sequencing all entity packets of the entity packet queue according to the time stamps, and reading the sequenced first entity packet data;
and acquiring the state data of each entity from the first entity packet data, and rendering the entities in the scene according to the state data of each entity.
Further, the method further comprises:
creating a thread pool, wherein the thread pool comprises a preset number of processing threads;
creating a thread resource pool mapping dictionary, and generating thread ID numbers for processing threads in a thread pool;
creating an entity package queue for the thread resource pool mapping dictionary for storing entity packages, wherein a data structure of the entity package comprises: a thread ID number, a timestamp and an entity data cache queue; the entity data buffer queue is used for storing state data of each entity, and the state data of each entity comprises: an entity ID number, a location, a pose, and a survival status, wherein the survival status indicates whether the entity has been destroyed.
Further, before analyzing the status information data packet of the entity status message by using the processing thread, the method comprises the following steps:
judging whether the number of the current active threads in the thread pool reaches a preset number, if not, creating a new thread as a processing thread, and generating a thread ID number for the processing thread by using a thread resource pool mapping dictionary; otherwise, selecting an idle thread from the thread pool as a processing thread.
Further, analyzing the state information data packet of the entity state information by using the processing thread, and putting the analyzed entity state information timestamp and the state data of each entity into the entity packet; the method comprises the following steps:
creating an entity package;
assigning the thread ID number of the processing thread to the thread ID number of the entity packet;
acquiring a timestamp of the entity state message from a state information data packet of the entity state message, and assigning the timestamp to the timestamp of the entity packet;
and acquiring the state data of each entity from the state information data packet of the entity state message, and putting the state data of all the entities into an entity data cache queue of the entity packet.
Further, acquiring the state data of each entity from the state information data packet of the entity state message, and putting the state data of all the entities into an entity data cache queue of the entity packet; the method comprises the following steps:
step S1: obtaining the data structure size of the state data of a single entity according to a communication protocol as the data size of the single entity;
step S2: reading data with the size of single entity data by taking the reading identification position of a state information data packet of the entity state information as an initial position to serve as the state data of the single entity;
step S3: judging whether the entity type in the single entity information data is an entity or not according to the communication protocol; if yes, the status data of the single entity is put into an entity data buffer queue of the entity packet, and the step S4 is entered; otherwise, terminating the current processing, prompting error information, and entering step S4;
step S4: judging whether the reading of the state information data packet is finished or not, if so, ending the processing; otherwise, the read identifier of the status information packet of the entity status message is shifted, the shift amount is the size of a single entity data, and the process returns to step S2.
Further, the method further comprises: and randomly generating state data of each entity, and initializing the scene.
Further, rendering the entities in the scene according to the state data of each entity, including:
for each entity, judging whether the entity is in the current scene or not according to the entity ID number, if not, adding the entity into the scene, and setting the position and the posture of the entity according to the state data of the entity; otherwise, judging whether the entity is destroyed or not according to the existence state of the entity, and if so, removing the entity from the scene; otherwise, updating the position and the posture of the entity in the scene according to the state data of the entity;
and rendering the entities in the scene according to the position and the posture of each entity.
In a second aspect, an embodiment of the present application provides a distributed simulation communication message processing apparatus, including:
the system comprises a receiving unit, a processing unit and a processing unit, wherein the receiving unit is used for receiving entity state information sent by a server, the entity state information comprises a state information data packet, and the state information data packet comprises state data of all updated entities in the whole scene at each simulation moment;
the analysis unit is used for analyzing the state information data packet of the message by using the processing thread and putting the analyzed state data of each entity into an entity packet queue of the thread resource pool mapping dictionary corresponding to the processing thread;
the sorting unit is used for sorting all the entity packet data of the entity packet queue according to the time stamps and reading the first entity packet data after sorting;
and the rendering unit is used for acquiring the state data of each entity from the first entity packet data and rendering the entities in the scene according to the state data of each entity.
In a third aspect, an embodiment of the present application provides an electronic device, including: the device comprises a memory, a processor and a computer program stored on the memory and capable of running on the processor, wherein the processor executes the computer program to realize the distributed simulation communication message processing method of the embodiment of the application.
In a fourth aspect, the present application provides a computer-readable storage medium storing computer instructions, which when executed by a processor, implement the distributed emulated communication message processing method of the present application.
The method and the device can effectively solve the problems of untimely scene updating, even program crash and the like caused by the analysis and blockage of the client message when the number of the simulation scene entities is large; and the entity message response speed and the scene rendering efficiency are improved.
Drawings
In order to more clearly illustrate the detailed description of the present application or the technical solutions in the prior art, the drawings needed to be used in the detailed description of the present application or the prior art description will be briefly introduced below, and it is obvious that the drawings in the following description are some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative efforts.
FIG. 1 is a schematic diagram of an overall solution provided by an embodiment of the present application;
FIG. 2 is a flow chart of a distributed simulation communication message processing method according to an embodiment of the present application;
fig. 3 is a schematic diagram of a message receiving processing flow provided in an embodiment of the present application;
fig. 4 is a functional block diagram of a distributed emulated communication message processing apparatus according to an embodiment of the present application;
fig. 5 is a block diagram of an electronic device according to an embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are some embodiments of the present application, but not all embodiments. The components of the embodiments of the present application, generally described and illustrated in the figures herein, can be arranged and designed in a wide variety of different configurations.
Thus, the following detailed description of the embodiments of the present application, presented in the accompanying drawings, is not intended to limit the scope of the claimed application, but is merely representative of selected embodiments of the application. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
First, the design idea of the embodiment of the present application is briefly introduced.
Aiming at the problem of blocking caused by untimely processing of client messages in the distributed simulation communication process, the application provides the distributed simulation communication message processing method, based on a technical system of thread pool background processing, after receiving messages pushed by a simulation engine, multi-thread messages are quickly processed through a background thread pool, and quick real-time processing of message receiving of a client is realized. Meanwhile, aiming at the problem of maintaining the parallel analysis time sequence of the message, the entity time stamp sorting problem in the process of message analysis multithread processing is solved by adopting the entity message integral packaging and time stamp sorting technology.
As shown in fig. 1, the technical solution of the present application includes three parts:
a first part: message reception triggers background thread processing:
in order to solve the problem that network communication data is sent and received too frequently to cause network problems when simulation entities are used as units for communication in the situation deduction process, entity state information is sent by using the situation as a whole, namely all updated entities in the whole scene in each simulation deduction time step are packaged into a state information packet to be sent.
Creating a thread resource pool mapping dictionary data structure for identifying the threads in the thread pool; an entity packet data queue data structure is created, which mainly comprises information such as an entity data cache queue, a corresponding thread ID, a timestamp and the like, and is used for analyzing entity information in a local message packet queue and mapping the entity information with a thread resource pool mapping dictionary.
And instantiating and creating a message receiving and processing class, and initializing class variables such as a local information packet queue and the like.
And after receiving the message, the client triggers the judgment of thread resources of the thread pool, and creates a new thread or adopts the existing thread for processing.
Judging whether the simulation operation is finished or not, if so, quitting the operation, and releasing the occupied resources of the message processing class; if not, the operation is continued.
A second part: multi-threaded background parsing
And instantiating the thread pool resource related management class, and distributing the manageable maximum thread number of the thread pool according to the resource calculation condition of the computer. Data buffer queue resources for message processing are allocated for each thread.
And judging whether the current active thread of the thread pool reaches the maximum thread number or not, and if not, creating a new thread. If so, selecting an idle thread in the thread pool. And if the thread is Threadn, adding the thread ID corresponding to the thread and the corresponding data buffer queue into the thread resource pool mapping dictionary.
The thread Threadn carries out entity analysis on the received information data, and stores the analyzed data into an entity packet data queue corresponding to the thread Threadn according to the mapping relation of the thread resource pool mapping dictionary data structure m _ dic
And a third part: and (5) updating the scene.
Scene initialization: the method mainly releases the computer generated force entity in the memory and manages and displays the related interface panel resources.
Scene entity updating: firstly, the entity packets of all the entity packet queues are sorted according to the time stamps, and a quick sorting algorithm is adopted in a sorting algorithm.
And reading the first entity packet of the sequenced entity packet data queue, and updating the scene according to the current state information of the entity. When the program operation is finished, the related resources are mainly released.
By adopting the technical scheme, the problems that the analysis of the client message is blocked when the number of the simulation scene entities is large, the scene is not updated timely, even the program is crashed and the like can be effectively solved. The method mainly utilizes the multithreading parallel processing capability to solve the problems that the client rapidly processes the message entity information pushed by the simulation engine in the distributed simulation operation process, the message information entity is timely processed, and the message blocking problem caused by slow processing of the client message is avoided.
After introducing the application scenario and the design concept of the embodiment of the present application, the following describes a technical solution provided by the embodiment of the present application.
As shown in fig. 2, an embodiment of the present application provides a distributed simulation communication message processing method, including the following steps:
step 101: receiving entity state information sent by a server, wherein the entity state information comprises a state information data packet, and the state information data packet comprises state data of all updated entities in the whole scene at each simulation moment;
step 102: analyzing the state information data packet of the entity state message by using the processing thread, putting the timestamp of the entity state message obtained by analysis and the state data of each entity into the entity packet, and putting the entity packet into an entity packet queue of a thread resource pool mapping dictionary corresponding to the processing thread;
in this embodiment, to implement multi-thread processing, as shown in fig. 3, a thread pool is first created, where the thread pool includes a preset number of processing threads, for example: thread0, Thread1, …, Threadn; then creating a thread resource pool mapping dictionary, and generating thread ID numbers for the processing threads in the thread pool: thread0, thread1, …, thread; and then an entity package queue is created for the thread resource pool mapping dictionary and used for storing entity packages, wherein the data structure of the entity packages comprises: thread ID number, timestamp (e.g., tstamp 0), and entity data cache queues (data1, data2, data3 …, dataN); the entity data buffer queue is used for storing state data of each entity, and the state data of each entity comprises: entity ID number, location, posture and survival status, wherein the survival status indicates whether the entity has been destroyed.
Judging whether the number of the current active threads in the thread pool reaches a preset number, if not, creating a new thread as a processing thread, and generating a thread ID number for the processing thread by using a thread resource pool mapping dictionary; otherwise, selecting an idle thread from the thread pool as a processing thread.
Specifically, a processing thread is utilized to analyze a state information data packet of the entity state information, and the analyzed entity state information timestamp and the state data of each entity are put into an entity packet; the method comprises the following steps:
creating an entity package;
assigning the thread ID number of the processing thread to the thread ID number of the entity packet;
acquiring a timestamp of the entity status message from a status information data packet of the entity status message, and assigning the timestamp to the timestamp of the entity packet;
acquiring the state data of each entity from the state information data packet of the entity state message, and putting the state data of all the entities into an entity data cache queue of the entity packet:
acquiring state data of each entity from a state information data packet of the entity state message, and putting the state data of all the entities into an entity data cache queue of the entity packet; the method comprises the following steps:
step S1: obtaining the data structure size of the state data of a single entity according to a communication protocol as the data size of the single entity;
step S2: reading data with the size of single entity data by taking the reading identification position of a state information data packet of the entity state message as an initial position to serve as the state data of the single entity;
step S3: judging whether the entity type in the single entity information data is an entity or not according to the communication protocol; if yes, the status data of the single entity is put into an entity data buffer queue of the entity packet, and the step S4 is entered; otherwise, terminating the current processing, prompting error information, and entering the step S4;
step S4: judging whether the reading of the state information data packet is finished or not, if so, ending the processing; otherwise, the read identifier of the status information packet of the entity status message is shifted, the shift amount is the size of a single entity data, and the process returns to step S2.
Step 103: sequencing all entity packets of the entity packet queue according to the time stamps, and reading the sequenced first entity packet data;
since the entity packets of the entity packet queue are obtained by different processing threads, when reading the entity packets in the entity packet queue, all the entity packets in the entity packet queue need to be sorted according to the time stamps.
Step 104: and acquiring the state data of each entity from the first entity package data, and rendering the entities in the scene according to the state data of each entity.
Firstly, state data of each entity is randomly generated, and a scene is initialized.
After a state information data packet sent by a server starts to be received, state data of each entity is obtained from first entity packet data, whether the entity is in a current scene or not is judged for each entity according to an entity ID number, if not, the entity is added into the scene, and the position and the posture of the entity are set according to the state data of the entity; otherwise, judging whether the entity is destroyed or not according to the existence state of the entity, and if so, removing the entity from the scene; otherwise, updating the position and the posture of the entity in the scene according to the state data of the entity; and rendering the entities in the scene according to the position and the posture of each entity.
Based on the foregoing embodiments, an embodiment of the present application provides a distributed simulated communication message processing apparatus, and referring to fig. 4, the distributed simulated communication message processing apparatus 200 according to the embodiment of the present application at least includes:
a receiving unit 201, configured to receive an entity status message sent by a server, where the entity status message includes a status information data packet, and the status information data packet includes status data of all updated entities in a whole scene at each simulation time;
the analysis unit 202 is used for analyzing the state information data packet of the message by using the processing thread, and putting the analyzed state data of each entity into an entity packet queue of the thread resource pool mapping dictionary corresponding to the processing thread;
a sorting unit 203, configured to sort all entity packet data of the entity packet queue according to the time stamp, and read the first entity packet data after sorting;
and the rendering unit 204 is configured to acquire status data of each entity from the first entity packet data, and render the entity in the scene according to the status data of each entity.
It should be noted that the principle for solving the technical problem of the distributed simulated communication message processing apparatus 200 provided in the embodiment of the present application is similar to that of the distributed simulated communication message processing method provided in the embodiment of the present application, and therefore, for implementation of the distributed simulated communication message processing apparatus 200 provided in the embodiment of the present application, reference may be made to implementation of the distributed simulated communication message processing method provided in the embodiment of the present application, and repeated parts are not described again.
As shown in fig. 5, an electronic device 300 provided in the embodiment of the present application at least includes: the processor 301, the memory 302 and the computer program stored on the memory 302 and capable of running on the processor 301, when the processor 301 executes the computer program, the distributed simulation communication message processing method provided by the embodiment of the application is realized.
The electronic device 300 provided by the embodiment of the present application may further include a bus 303 connecting different components (including the processor 301 and the memory 302). Bus 303 represents one or more of any of several types of bus structures, including a memory bus, a peripheral bus, a local bus, and so forth.
The Memory 302 may include readable media in the form of volatile Memory, such as Random Access Memory (RAM) 3021 and/or cache Memory 3022, and may further include Read Only Memory (ROM) 3023.
The memory 302 may also include a program tool 3024 having a set (at least one) of program modules 3025, the program modules 3025 including, but not limited to: an operating subsystem, one or more application programs, other program modules, and program data, each of which, or some combination thereof, may comprise an implementation of a network environment.
Electronic device 300 may also communicate with one or more external devices 304 (e.g., keyboard, remote control, etc.), with one or more devices that enable a user to interact with electronic device 300 (e.g., cell phone, computer, etc.), and/or with any device that enables electronic device 300 to communicate with one or more other electronic devices 300 (e.g., router, modem, etc.). Such communication may be through an Input/Output (I/O) interface 305. Also, the electronic device 300 may communicate with one or more networks (e.g., a Local Area Network (LAN), a Wide Area Network (WAN), and/or a public Network, such as the internet) via the Network adapter 306. As shown in FIG. 5, the network adapter 306 communicates with the other modules of the electronic device 300 over the bus 303. It should be understood that although not shown in FIG. 5, other hardware and/or software modules may be used in conjunction with electronic device 300, including but not limited to: microcode, device drivers, Redundant processors, external disk drive Arrays, disk array (RAID) subsystems, tape drives, and data backup storage subsystems, to name a few.
It should be noted that the electronic device 300 shown in fig. 5 is only an example, and should not bring any limitation to the functions and the scope of the application of the embodiments.
The embodiment of the present application further provides a computer-readable storage medium, where computer instructions are stored, and when the computer instructions are executed by a processor, the distributed simulation communication message processing method provided by the embodiment of the present application is implemented.
Further, while the operations of the methods of the present application are depicted in the drawings in a particular order, this does not require or imply that these operations must be performed in this particular order, or that all of the illustrated operations must be performed, to achieve desirable results. Additionally or alternatively, certain steps may be omitted, multiple steps combined into one step execution, and/or one step broken down into multiple step executions.
While the preferred embodiments of the present application have been described, additional variations and modifications in those embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. Therefore, it is intended that the appended claims be interpreted as including the preferred embodiment and all changes and modifications that fall within the scope of the present application.
Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the present application, and not to limit the same; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some or all of the technical features may be equivalently replaced; and the modifications or the substitutions do not make the essence of the corresponding technical solutions depart from the scope of the technical solutions of the embodiments of the present application.

Claims (9)

1. A distributed simulation communication message processing method is characterized by comprising the following steps:
receiving entity state information sent by a server, wherein the entity state information comprises a state information data packet, and the state information data packet comprises state data of all updated entities in the whole scene at each simulation moment;
analyzing the state information data packet of the entity state message by using the processing thread, putting the timestamp of the entity state message and the state data of each entity obtained by analyzing into the entity packet, and putting the entity packet into an entity packet queue of a thread resource pool mapping dictionary corresponding to the processing thread;
sequencing all entity packets of the entity packet queue according to the time stamps, and reading the sequenced first entity packet data;
acquiring state data of each entity from the first entity packet data, and rendering the entities in the scene according to the state data of each entity;
the method further comprises the following steps:
creating a thread pool, wherein the thread pool comprises a preset number of processing threads;
creating a thread resource pool mapping dictionary, and generating thread ID numbers for processing threads in a thread pool;
creating an entity packet queue for the thread resource pool mapping dictionary, wherein the entity packet queue is used for storing entity packets, and the data structure of the entity packets comprises: a thread ID number, a timestamp and an entity data cache queue; the entity data buffer queue is used for storing state data of each entity, and the state data of each entity comprises: an entity ID number, a location, a pose, and a survival status, wherein the survival status indicates whether the entity has been destroyed.
2. The method of claim 1, wherein the parsing the status information packet of the entity status message using the processing thread comprises:
judging whether the number of the current active threads in the thread pool reaches a preset number, if not, creating a new thread as a processing thread, and generating a thread ID number for the processing thread by using a thread resource pool mapping dictionary; otherwise, selecting an idle thread from the thread pool as a processing thread.
3. The distributed simulation communication message processing method of claim 2, wherein the state information data packet of the entity state message is parsed by a processing thread, and the parsed entity state message timestamp and the state data of each entity are put into the entity packet; the method comprises the following steps:
creating an entity package;
assigning the thread ID number of the processing thread to the thread ID number of the entity packet;
acquiring a timestamp of the entity state message from a state information data packet of the entity state message, and assigning the timestamp to the timestamp of the entity packet;
and acquiring the state data of each entity from the state information data packet of the entity state message, and putting the state data of all the entities into an entity data cache queue of the entity packet.
4. The distributed simulation communication message processing method of claim 3, wherein the status data of each entity is obtained from the status information data packet of the entity status message, and the status data of all entities is placed in the entity data buffer queue of the entity packet; the method comprises the following steps:
step S1: obtaining the data structure size of the state data of a single entity according to a communication protocol as the data size of the single entity;
step S2: reading data with the size of single entity data by taking the reading identification position of a state information data packet of the entity state information as an initial position to serve as the state data of the single entity;
step S3: judging whether the entity type in the single entity information data is an entity or not according to the communication protocol; if yes, the status data of the single entity is put into an entity data buffer queue of the entity packet, and the step S4 is entered; otherwise, terminating the current processing, prompting error information, and entering step S4;
step S4: judging whether the reading of the state information data packet is finished or not, if so, ending the processing; otherwise, the read identifier of the status information packet of the entity status message is shifted, the shift amount is the size of a single entity data, and the process returns to step S2.
5. The distributed simulated communications message processing method of claim 1, wherein said method further comprises: and randomly generating state data of each entity, and initializing the scene.
6. The distributed simulated communication message processing method of claim 5, wherein rendering the entities in the scene according to the state data of each entity comprises:
for each entity, judging whether the entity is in the current scene or not according to the entity ID number, if not, adding the entity into the scene, and setting the position and the posture of the entity according to the state data of the entity; otherwise, judging whether the entity is destroyed or not according to the existence state of the entity, and if so, removing the entity from the scene; otherwise, updating the position and the posture of the entity in the scene according to the state data of the entity;
and rendering the entities in the scene according to the positions and the postures of the entities.
7. A distributed emulated communication message processing apparatus, comprising:
the system comprises a receiving unit, a processing unit and a processing unit, wherein the receiving unit is used for receiving entity state information sent by a server, the entity state information comprises a state information data packet, and the state information data packet comprises state data of all updated entities in the whole scene at each simulation moment;
the analysis unit is used for analyzing the state information data packet of the message by using the processing thread and putting the analyzed state data of each entity into an entity packet queue of a thread resource pool mapping dictionary corresponding to the processing thread;
the sorting unit is used for sorting all the entity packet data of the entity packet queue according to the time stamps and reading the first entity packet data after sorting;
the rendering unit is used for acquiring the state data of each entity from the first entity packet data and rendering the entities in the scene according to the state data of each entity;
the apparatus is further configured to:
creating a thread pool, wherein the thread pool comprises a preset number of processing threads;
creating a thread resource pool mapping dictionary, and generating thread ID numbers for processing threads in a thread pool;
creating an entity package queue for the thread resource pool mapping dictionary for storing entity packages, wherein a data structure of the entity package comprises: a thread ID number, a timestamp and an entity data cache queue; the entity data buffer queue is used for storing state data of each entity, and the state data of each entity comprises: an entity ID number, a location, a pose, and a survival status, wherein the survival status indicates whether the entity has been destroyed.
8. An electronic device, comprising: memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the distributed emulated communication message processing method of any of claims 1-6 when executing the computer program.
9. A computer-readable storage medium storing computer instructions which, when executed by a processor, implement the distributed emulated communication message processing method of any of claims 1-6.
CN202210737910.2A 2022-06-28 2022-06-28 Distributed simulation communication message processing method and device Active CN114816803B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210737910.2A CN114816803B (en) 2022-06-28 2022-06-28 Distributed simulation communication message processing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210737910.2A CN114816803B (en) 2022-06-28 2022-06-28 Distributed simulation communication message processing method and device

Publications (2)

Publication Number Publication Date
CN114816803A CN114816803A (en) 2022-07-29
CN114816803B true CN114816803B (en) 2022-09-23

Family

ID=82523540

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210737910.2A Active CN114816803B (en) 2022-06-28 2022-06-28 Distributed simulation communication message processing method and device

Country Status (1)

Country Link
CN (1) CN114816803B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116841835B (en) * 2023-08-31 2023-11-07 安擎计算机信息股份有限公司 Running state monitoring method, device and server

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2005066778A2 (en) * 2003-12-31 2005-07-21 Intel Corporation Visual and graphical data processing using a multi-threaded architecture
CN101482828A (en) * 2009-02-24 2009-07-15 中国运载火箭技术研究院 Universal distributed vision simulation system based on HLA and its implementing method
CN113656963A (en) * 2021-08-16 2021-11-16 中国电子科技集团公司第五十四研究所 Distributed combat deduction simulation system capable of realizing real-time interactive control

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2005066778A2 (en) * 2003-12-31 2005-07-21 Intel Corporation Visual and graphical data processing using a multi-threaded architecture
CN101482828A (en) * 2009-02-24 2009-07-15 中国运载火箭技术研究院 Universal distributed vision simulation system based on HLA and its implementing method
CN113656963A (en) * 2021-08-16 2021-11-16 中国电子科技集团公司第五十四研究所 Distributed combat deduction simulation system capable of realizing real-time interactive control

Also Published As

Publication number Publication date
CN114816803A (en) 2022-07-29

Similar Documents

Publication Publication Date Title
CN107025205B (en) Method and equipment for training model in distributed system
Fagg et al. FT-MPI: Fault tolerant MPI, supporting dynamic applications in a dynamic world
EP1839152B1 (en) Predictive method for managing, logging or replaying non-deterministic operations within the execution of an application process
CN107508722B (en) Service monitoring method and device
CN103049332B (en) Virtual CPU scheduling method
CN114816803B (en) Distributed simulation communication message processing method and device
CN112153024B (en) Mimicry defense system based on SaaS platform
CN107678752B (en) Task processing method and device for heterogeneous cluster
Altaf et al. Auto-scaling a defence application across the cloud using docker and kubernetes
CN114237937A (en) Multithreading data transmission method and device
Zhou et al. FTCloudSim: support for cloud service reliability enhancement simulation
CN110266787B (en) Hybrid cloud management system and method and computer equipment
CN104951346A (en) Process management method for embedded system as well as system
Santoro et al. Transparent optimistic synchronization in the high-level architecture via time-management conversion
CN115391000A (en) Business resource monitoring method and device, electronic equipment and storage medium
González et al. HerdMonitor: monitoring live migrating containers in cloud environments
D’Angelo et al. Fault tolerant adaptive parallel and distributed simulation through functional replication
Viksnin et al. Approaches to communication organization within cyber-physical systems
Hybinette et al. Optimistic computations in virtual environments
Chen A service scheduler in a trustworthy system
CN114500344B (en) Data sniffing method, device, equipment and medium for collision early warning service platform
Chen et al. Scheduling simulation in a distributed wireless embedded system
Briot et al. Dynamic adaptation of replication strategies for reliable agents
Veas-Castillo et al. Experimental Framework to Simulate Rescue Operations after a Natural Disaster
Dang et al. State-control-limit-based rejuvenation modelling and optimisation of the virtualised cloud server

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant