CN108540454B - Collision synchronization method, client and storage medium - Google Patents

Collision synchronization method, client and storage medium Download PDF

Info

Publication number
CN108540454B
CN108540454B CN201810222258.4A CN201810222258A CN108540454B CN 108540454 B CN108540454 B CN 108540454B CN 201810222258 A CN201810222258 A CN 201810222258A CN 108540454 B CN108540454 B CN 108540454B
Authority
CN
China
Prior art keywords
current object
objects
collision
initial speed
synchronization
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
CN201810222258.4A
Other languages
Chinese (zh)
Other versions
CN108540454A (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.)
Wuhan Weipai Network Technology Co ltd
Original Assignee
Wuhan Weipai Network 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 Wuhan Weipai Network Technology Co ltd filed Critical Wuhan Weipai Network Technology Co ltd
Priority to CN201810222258.4A priority Critical patent/CN108540454B/en
Publication of CN108540454A publication Critical patent/CN108540454A/en
Application granted granted Critical
Publication of CN108540454B publication Critical patent/CN108540454B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/131Protocols for games, networked simulations or virtual reality
    • AHUMAN NECESSITIES
    • A63SPORTS; GAMES; AMUSEMENTS
    • A63FCARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
    • A63F13/00Video games, i.e. games using an electronically generated display having two or more dimensions
    • A63F13/40Processing input control signals of video game devices, e.g. signals generated by the player or derived from the environment
    • A63F13/42Processing input control signals of video game devices, e.g. signals generated by the player or derived from the environment by mapping the input signals into game commands, e.g. mapping the displacement of a stylus on a touch screen to the steering angle of a virtual vehicle
    • A63F13/426Processing input control signals of video game devices, e.g. signals generated by the player or derived from the environment by mapping the input signals into game commands, e.g. mapping the displacement of a stylus on a touch screen to the steering angle of a virtual vehicle involving on-screen location information, e.g. screen coordinates of an area at which the player is aiming with a light gun
    • AHUMAN NECESSITIES
    • A63SPORTS; GAMES; AMUSEMENTS
    • A63FCARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
    • A63F13/00Video games, i.e. games using an electronically generated display having two or more dimensions
    • A63F13/40Processing input control signals of video game devices, e.g. signals generated by the player or derived from the environment
    • A63F13/42Processing input control signals of video game devices, e.g. signals generated by the player or derived from the environment by mapping the input signals into game commands, e.g. mapping the displacement of a stylus on a touch screen to the steering angle of a virtual vehicle
    • A63F13/428Processing input control signals of video game devices, e.g. signals generated by the player or derived from the environment by mapping the input signals into game commands, e.g. mapping the displacement of a stylus on a touch screen to the steering angle of a virtual vehicle involving motion or position input signals, e.g. signals representing the rotation of an input controller or a player's arm motions sensed by accelerometers or gyroscopes
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/56Provisioning of proxy services
    • H04L67/565Conversion or adaptation of application format or content
    • H04L67/5651Reducing the amount or size of exchanged application data

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Human Computer Interaction (AREA)
  • Processing Or Creating Images (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The invention discloses a collision synchronization method, a client and a storage medium, comprising the following steps: acquiring the initial speed of a corresponding current object, and uploading the initial speed to a server; determining the motion track of the current object according to the initial speed, and judging whether the current object and other objects collide according to the motion track; when collision occurs, updating the initial speeds of the current object and other objects, and recording the target position information of the current object and other objects until the updated initial speeds of the current object and other objects are preset speeds; and drawing the current object and other objects according to the target position information so as to realize collision synchronization. According to the method and the device, the initial speed of the current object is obtained through the client side, the actual motion track of the current object is judged according to the initial speed through a preset rule, and the current object is drawn through the motion track, so that the collision synchronization of all objects in the current scene is realized, and the data interaction between the client side and the server is reduced.

Description

Collision synchronization method, client and storage medium
Technical Field
The invention relates to the technical field of online game collision, in particular to a collision synchronization method, a client and a storage medium.
Background
In the prior art, the Cocos Creator editor is currently popular cross-platform 2-dimensional game design and production software, and comprises a set of relatively perfect physical collision mechanism. When a game is made, a physical component is added to an object to be collided and a physical engine is started, so that a realistic collision effect can be experienced in the game, but due to the difference of devices, the effects of collision effects designed and realized in a Cocos Creator editor on different devices are different due to the difference of performances of processors such as a Central Processing Unit (CPU) and a Graphics Processing Unit (GPU). The difference is larger or smaller, but the accumulated error becomes larger after the results of multiple collisions, the effects seen by different clients are completely inconsistent, and the game experience is seriously influenced.
Disclosure of Invention
The invention mainly aims to provide a collision synchronization method, a client and a storage medium, and aims to solve the technical problem of collision asynchronism in the prior art.
In order to achieve the above object, the present invention provides a collision synchronization method, including the steps of:
the method comprises the steps that a current client side obtains an initial speed of a corresponding current object, and the initial speed is uploaded to a server, so that the server sends the initial speed to other client sides corresponding to other objects of which the current object is in the same game scene;
determining the motion track of the current object according to the initial speed, and judging whether the current object and other objects collide according to the motion track;
when collision occurs, updating the initial speed of the current object and other objects, and recording the target position information of the current object and other objects until the updated initial speed of the current object and other objects is a preset speed;
and drawing the current object and other objects according to the target position information so as to realize collision synchronization.
Preferably, the obtaining, by the current client, an initial speed of a corresponding current object, and uploading the initial speed to a server, so that the server sends the initial speed to other clients corresponding to other objects of the current object in the same game scene, specifically includes:
the method comprises the steps of obtaining the initial speed of a corresponding current object, and uploading the initial speed to a server, so that the server sends the initial speed to other clients corresponding to other objects of the current object in the same game scene through transparent transmission.
Preferably, before determining the motion trajectory of the current object according to the initial speed and determining whether the current object and other objects collide with each other according to the motion trajectory, the method further includes:
and judging whether the initial speed is legal or not, and determining the motion track of the current object according to the initial speed when the judgment result is legal.
Preferably, before determining the motion trajectory of the current object according to the initial speed and determining whether the current object and other objects collide with each other according to the motion trajectory, the method further includes:
and judging whether the state of the current object meets a preset condition, determining the motion track of the current object according to the initial speed when the state of the current object meets the preset condition, and judging whether the current object and other objects collide according to the motion track.
Preferably, when a collision occurs, after updating the initial speed of the current object and the other objects until the updated initial speed of the current object and the other objects is a preset speed and recording the target position information of the current object and the other objects, the method further includes:
storing the target position information of the current object and other objects in a preset storage area in a snapshot mode;
correspondingly, drawing the current object and other objects according to the target position information to realize collision synchronization, specifically comprising:
and extracting the position information of the snapshot record in the preset storage area to draw the current object and other objects so as to realize collision synchronization.
Preferably, the extracting the position information of the snapshot record in the preset storage area to draw the current object and the other objects to realize collision synchronization specifically includes:
acquiring preset time information, and searching two frames of picture information adjacent to the preset time in the preset storage area according to the preset time information;
calculating a motion proportion according to the preset time and the time information in the two adjacent frames of picture information;
and calculating target position information according to the motion proportion and the reference position information in the two adjacent frames of picture information, and drawing the current object and other objects according to the target position information so as to realize collision synchronization.
Preferably, the drawing the current object and the other objects according to the target position information to achieve collision synchronization specifically includes:
and drawing the current object and other objects through interpolation according to the target position information so as to realize collision synchronization.
Preferably, the current client obtains an initial speed of the corresponding current object, and uploads the initial speed to the server, so that before the server sends the initial speed to other clients corresponding to other objects of the current object in the same game scene, the method further includes:
receiving data information sent by a server, extracting a feature tag in the data information, and searching for other objects corresponding to the feature tag in a preset relational mapping table according to the feature tag.
In addition, to achieve the above object, the present invention further provides a client, including: a memory, a processor and a crash synchronization program stored on the memory and executable on the processor, the crash synchronization program configured to implement the steps of the crash synchronization method as described above.
Furthermore, to achieve the above object, the present invention also proposes a storage medium having stored thereon a crash synchronization program which, when executed by a processor, implements the steps of the crash synchronization method as described above.
According to the collision synchronization method provided by the invention, the initial speed of the corresponding current object is obtained through the current client, the actual motion track of each object is judged through the initial speed according to the preset rule, and each object is drawn through the motion track, so that collision synchronization of each object in the current scene of each client is realized, and data interaction between the client and the server is reduced.
Drawings
FIG. 1 is a schematic diagram of a client architecture of a hardware operating environment according to an embodiment of the present invention;
FIG. 2 is a schematic flow chart of a first embodiment of a collision synchronization method according to the present invention;
FIG. 3 is a diagram illustrating a data structure of each object information according to the present invention;
FIG. 4 is a schematic flow chart of the calculation of the motion trajectory of each object according to the present invention;
FIG. 5 is a flow chart illustrating a second embodiment of the collision synchronization method according to the present invention;
FIG. 6 is a flow chart illustrating a third embodiment of the collision synchronization method according to the present invention;
FIG. 7 is a flowchart illustrating a fourth exemplary embodiment of a collision synchronization method according to the present invention;
FIG. 8 is a schematic flow chart of a fifth embodiment of the crash synchronization method according to the present invention;
FIG. 9 is a schematic drawing flow chart of the present invention;
fig. 10 is a flowchart illustrating a collision synchronization method according to a sixth embodiment of the present invention.
The implementation, functional features and advantages of the objects of the present invention will be further explained with reference to the accompanying drawings.
Detailed Description
It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
Referring to fig. 1, fig. 1 is a schematic diagram of a client-side structure of a hardware operating environment according to an embodiment of the present invention.
As shown in fig. 1, the client may include: a processor 1001, such as a CPU, a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005. Wherein a communication bus 1002 is used to enable connective communication between these components. The user interface 1003 may include a Display screen (Display), an input unit such as a Keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface, a wireless interface. The network interface 1004 may optionally include a standard wired interface, a wireless interface (e.g., a WIFI interface). The memory 1005 may be a high-speed RAM memory or a non-volatile memory (e.g., a magnetic disk memory). The memory 1005 may alternatively be a storage device separate from the processor 1001.
Those skilled in the art will appreciate that the client architecture shown in fig. 1 does not constitute a limitation of the client, and may include more or fewer components than shown, or some components in combination, or a different arrangement of components.
In the client shown in fig. 1, the network interface 1004 is mainly used for connecting to a network and communicating data with the network; the user interface 1003 is mainly used for connecting a terminal and performing data communication with the terminal; the client of the present invention calls the collision synchronization program stored in the memory 1005 through the processor 1001, and performs the following operations:
acquiring an initial speed of a corresponding current object, and uploading the initial speed to a server so that the server sends the initial speed to other clients corresponding to other objects of which the current object is in the same game scene;
determining the motion track of the current object according to the initial speed, and judging whether the current object and other objects collide according to the motion track;
when collision occurs, updating the initial speed of the current object and other objects, and recording the target position information of the current object and other objects until the updated initial speed of the current object and other objects is a preset speed;
and drawing the current object and other objects according to the target position information so as to realize collision synchronization.
Further, the processor 1001 may call the crash synchronization program stored in the memory 1005, and also perform the following operations:
the method comprises the steps of obtaining the initial speed of a corresponding current object, and uploading the initial speed to a server, so that the server sends the initial speed to other clients corresponding to other objects of the current object in the same game scene through transparent transmission.
Further, the processor 1001 may call the crash synchronization program stored in the memory 1005, and also perform the following operations:
and judging whether the initial speed is legal or not, and determining the motion track of the current object according to the initial speed when the judgment result is legal.
Further, the processor 1001 may call the crash synchronization program stored in the memory 1005, and also perform the following operations:
and judging whether the state of the current object meets a preset condition, determining the motion track of the current object according to the initial speed when the state of the current object meets the preset condition, and judging whether the current object and other objects collide according to the motion track.
Further, the processor 1001 may call the crash synchronization program stored in the memory 1005, and also perform the following operations:
and extracting the position information of the snapshot record in the preset storage area to draw the current object and other objects so as to realize collision synchronization.
Further, the processor 1001 may call the crash synchronization program stored in the memory 1005, and also perform the following operations:
acquiring preset time information, and searching two frames of picture information adjacent to the preset time in the preset storage area according to the preset time information;
calculating a motion proportion according to the preset time and the time information in the two adjacent frames of picture information;
and calculating target position information according to the motion proportion and the reference position information in the two adjacent frames of picture information, and drawing the current object and other objects according to the target position information so as to realize collision synchronization.
Further, the processor 1001 may call the crash synchronization program stored in the memory 1005, and also perform the following operations:
and drawing the current object and other objects through interpolation according to the target position information so as to realize collision synchronization.
Further, the processor 1001 may call the crash synchronization program stored in the memory 1005, and also perform the following operations:
receiving data information sent by a server, extracting a feature tag in the data information, and searching for other objects corresponding to the feature tag in a preset relational mapping table according to the feature tag.
In the collision synchronization method provided by this embodiment, the initial speed of the corresponding current object is obtained by the current client, the actual motion trajectory of each object is determined according to the initial speed and a preset rule, and each object is drawn according to the motion trajectory, so that collision synchronization of each object in the current scene of each client is realized, and data interaction between the client and the server is reduced.
Based on the hardware structure of fig. 1, an embodiment of the collision synchronization method of the present invention is provided.
Referring to fig. 2, fig. 2 is a flowchart illustrating a first embodiment of the collision synchronization method according to the present invention.
In a first embodiment, the collision synchronization method includes the steps of:
step S10, the current client acquires an initial speed of the corresponding current object, and uploads the initial speed to the server, so that the server sends the initial speed to other clients corresponding to other objects of the current object in the same game scene.
It should be noted that the current scene includes objects in the same game scene, and each object corresponds to one client, and each object is identified by a feature tag, so as to distinguish from other client players.
It can be understood that, because the same collision effect needs to be displayed on the interfaces of the respective clients, most manufacturers currently adopt a synchronization scheme that is a scheme of state synchronization and data compression, that is, calculation is performed at one client, data is compressed after the calculation of other clients completes the effect, and then the data is transmitted to the server, the server is distributed to other clients, and the other clients perform interpolation processing on some effects and then display the result. However, even if compression processing is performed, when multiple collision objects exist, the position change of each different object needs to be synchronized to other clients through the server, and therefore a problem arises that the synchronized data volume is too large, and game experience is seriously affected in an environment with a poor network.
In this embodiment, the initial speed includes an initial acceleration of a current operation object in a current scene, that is, a current acceleration magnitude and a current direction, the initial speed includes initial accelerations of other objects in the current scene, and a motion trajectory of each object may be calculated according to the acceleration magnitude, so that each object may be drawn according to the motion trajectory.
In a specific implementation, each client may receive each object information corresponding to another client sent by the server, find each corresponding object through each object information, for example, may obtain Identification (ID) information of each current object, identify each object through the ID information, that is, extract a feature tag in the data information by receiving the data information sent by the server, and find each object corresponding to the feature tag in a preset relationship mapping table according to the feature tag.
And step S20, determining the motion track of the current object according to the initial speed, and judging whether the current object and other objects collide according to the motion track.
It should be noted that, in this embodiment, the running track information may be recorded through a snapshot, and the position information of the running track may also be recorded through other forms.
In the embodiment, the whole motion track and the state of the ball are calculated according to data in a scene, the calculation result is stored in a snapshot, the position information and the time information of the motion track are recorded through the snapshot, and the ball is drawn through the motion track, so that a client does not need to send updated position information to a server in real time, the server sends the position information to other clients, information interaction between the client and the server is reduced, and synchronous flow is reduced.
To facilitate the management of the respective object information, in the present embodiment, the position information of the respective objects may be stored by the data structure of the respective object frames, and the time information of the current scene may be stored by the data structure of the scene frames, for example, when the respective objects are balls, the data structure of the respective object information as shown in fig. 3 stores the positions of all balls in the scene, discriminates by IDs, and records the relative times of all ball snapshots and the current snapshot by the snapshot frame, wherein the relative times are relative to the time of the first frame. The frame of the ball only needs to store the ID and the position information in a preset area, other information is stored in other storage areas, the label information and the position information are recorded through each object frame, and the relative time information is recorded through the scene frame.
Step S30, when a collision occurs, updating the initial speed of the current object and the other objects, and recording the target position information of the current object and the other objects until the updated initial speed of the current object and the other objects is a preset speed.
It should be noted that, when the preset speed is zero, that is, each object in the scene is in a static state, where the collision includes whether each object collides with the prop and whether each object collides with each object, which is described by taking a ball as an example, in order to determine whether two or more balls collide, in this embodiment, it may be determined whether a distance between two centers of the ball is smaller than a sum of radii of the two balls, and when the distance between the two centers of the ball is smaller than the sum of radii of the two balls, it is determined that the two balls collide, and correspondingly, when the distance between the two centers of the ball is larger than the sum of radii of the two balls, it is determined that the two balls do not collide. When judging whether each object collides with the prop, the distance between the ball and the wall body can be judged, when the distance between the center of the ball and the wall body is smaller than the radius of the ball, the collision between the ball and the wall body is judged, and correspondingly, when the distance between the center of the ball and the wall body is larger than the radius of the ball, the collision between the ball and the wall body is judged.
It can be understood that whether each object collides is judged, so that the acceleration vector of each object is updated, the position information of each object is updated through the updated acceleration vector, and the current position information is saved in a snapshot form.
As shown in the flow diagram of the calculation of the motion trajectory of each object shown in fig. 4, firstly, whether a ball is in motion is checked, when a ball is in motion, whether each ball collides with a wall is calculated and the check result is stored, whether each ball collides with the wall is detected and the detection result of each ball is stored, the ball speed is updated according to the collision result, the ball speed is attenuated according to the friction force, the frame time and other related factors, the updated position information of the ball is calculated according to the updated ball speed, and the current position information and the current time information are recorded through snapshot.
It can be understood that, before recording the updated position information of the ball in a snapshot manner, it is determined whether a collision occurs, and in case of a collision, the updated position information is recorded by snapshot, and in case of no collision and in case of statistics of preset continuous frames, the position information of each object may also be recorded by snapshot in case that no collision occurs to each object in the current frame, so as to reduce the position information of the ball whose recording position has not changed, save memory space, for example, in case of no collision occurs to 10 continuous frames of the ball a, record the position of the ball a, thereby preventing the ball a from being lost for too long time and failing to achieve the effect of continuous motion.
It should be noted that the recorded position information of each frame is the picture information of each frame recorded within a preset time, for example, 10ms, so as to accurately record the motion state of each frame. The collision check is a loop iteration, the exit condition is that all the balls are static, and a simple game collision iteration process is realized. After acquiring the state of one frame, the collision condition is processed by one snapshot here. The storage condition of the snapshot is that collision occurs or the snapshot is not stored for a preset number of frames, the iteration time of each frame is a self-defined preset time, and the preset time and the preset number can be set when the engine is initialized.
And step S40, drawing the current object and other objects according to the target position information to realize collision synchronization.
In the collision synchronization method provided by this embodiment, the initial speed of the corresponding current object is obtained by the current client, the actual motion trajectory of each object is determined according to the initial speed and a preset rule, and each object is drawn according to the motion trajectory, so that collision synchronization of each object in the current scene of each client is realized, and data interaction between the client and the server is reduced.
Further, as shown in fig. 5, a second embodiment of the collision synchronization method according to the present invention is proposed based on the first embodiment, and in this embodiment, the step S10 specifically includes:
step S101, obtaining an initial speed of a corresponding current object, and uploading the initial speed to a server, so that the server sends the initial speed to other clients corresponding to other objects of the current object in the same game scene through transparent transmission.
It should be noted that the data of the initial speed synchronization is the initial speed of the ball manipulated by the client, that is, after the client sends the initial speed to the server, the server transparently transmits the data to all clients in the same game.
In order to ensure the quality of data, in this embodiment, the server transparently transmits the synchronous data to other clients, so as to reduce the loss of the synchronous data, and since the server transmits the synchronous data through transparent transmission, the transmitted service does not need to be processed, and in the transmission process of the data, the synchronous data is not changed in any form, i.e., is not truncated, is not grouped, is not encoded, is not encrypted, is not confused, and the like, so that the efficiency of data transmission is ensured, the condition that the data is not transmitted synchronously in the transmission process is avoided, and the game experience is improved.
In the embodiment, the server transparently transmits the synchronous data to each client, so that the transmission synchronization of the data is ensured and the game experience of the user is improved on the basis of improving the transmission efficiency.
Further, as shown in fig. 6, a third embodiment of the collision synchronization method according to the present invention is proposed based on the first embodiment, and in this embodiment, before the step S20, the method further includes:
step S201, judging whether the initial speed is legal or not, and determining the motion track of the current object according to the initial speed when the judgment result is legal.
It should be noted that, since the initial speed may be synchronous data transmitted through the server, and the security of the synchronous data cannot be guaranteed, in this embodiment, before the synchronous data is processed, the validity of the synchronous data is determined, so that the security of the data is guaranteed.
It can be understood that the determining of the initial speed mainly includes two aspects, one is determining a format of the initial speed, and the other is determining a magnitude of the initial speed, and other ways of determining validity may also be included, which is not limited in this embodiment.
In a specific implementation, a data format and a speed size of the initial speed are obtained, and whether the data format is a preset format and whether the speed size is within a preset range are judged. Namely, judging whether the data format of the initial speed meets the requirement of a preset format, if not, indicating that the data of the initial speed is illegal data, not performing processing, and if so, indicating that the data of the initial speed is legal data, and then performing the next step.
Correspondingly, whether the initial speed is within a preset range or not can be judged, if the initial speed exceeds the preset range or does not meet the preset range, the data of the initial speed is represented as illegal data, the data are not processed, and if the initial speed meets the preset range, the data of the initial speed are represented as legal data, and the next step is executed. For example, if the detected acceleration data is 0, it indicates that the acceleration data is not valid data, and the processing is not performed.
In this embodiment, the synchronous data transparently transmitted by the server is processed, and the validity of the synchronous data is determined, so that the security of data transmission is ensured on the basis of improving the data transmission efficiency.
Further, as shown in fig. 7, a fourth embodiment of the collision synchronization method according to the present invention is proposed based on the first embodiment, the second embodiment and the third embodiment to explain based on the first embodiment, and in this embodiment, before the step S20, the method further includes:
step S202, judging whether the state of the current object meets a preset condition, when the state meets the preset condition, determining the motion track of the current object according to the initial speed, and judging whether the current object and other objects collide according to the motion track.
It should be noted that the meeting of the preset condition may be determining whether the current object is in a motion state, if not, recording is not required, and if the current object is in the motion state, calculating a motion trajectory of the current object, thereby improving calculation efficiency and calculation effectiveness.
In a specific implementation, speed information of a current object in a motion state is found out through data information sent by a server, a motion track of the current object is calculated through track calculation of the current object through the speed information, position information corresponding to corresponding time can be obtained through the motion track, and the current object is drawn through the position information.
The embodiment judges the current object in the current scene, judges each object in motion, and draws each object in motion through the initial speed, thereby reducing the calculation of the motion track of each object without position change and improving the system processing efficiency.
Further, as shown in fig. 8, a fifth embodiment of the collision synchronization method according to the present invention is proposed based on the first embodiment, the second embodiment and the third embodiment, so as to perform the description based on the first embodiment, and in this embodiment, after the step S30, the method further includes:
step S301, storing the target location information of the current object and the other objects in a preset storage area in a snapshot manner.
Further, the step S40 specifically includes:
step S401, extracting the position information of the snapshot record in the preset storage area to draw the current object and other objects, so as to implement collision synchronization.
Further, step S401 specifically includes:
step S402, acquiring preset time information, and searching two frames of picture information adjacent to the preset time in the preset storage area according to the preset time information.
It should be noted that, when the Cocos Creator editor updates the interface, the timed rendering can be performed through the Update function, and the time relative to the previous frame is introduced as a parameter. And updating the current timestamp for the relative time transmitted by the Update function according to the preset time information, and searching previous snapshot information and next snapshot information adjacent to the current timestamp in a preset storage area according to the updated current timestamp.
A schematic drawing flow diagram is shown in fig. 9. Wherein the time stamp refers to a relative time to a time when the drawing is initially started, calculates position information of a current time with respect to the time, and draws the scene according to the position information.
Step S403, calculating a motion ratio according to the preset time and the time information in the two adjacent frames of picture information.
In the present embodiment, the motion ratio is calculated by the formula: rate ═ where rate denotes the motion scale, frame1.timeoffset denotes the relative time of the frame before the current timestamp, and frame2.timeoffset denotes the relative time of the frame after the current timestamp.
Step S404, calculating target position information according to the motion proportion and the reference position information in the two adjacent frames of picture information, and drawing the current object and other objects according to the target position information to realize collision synchronization.
Target position information of the small ball is obtained by calculating x-axis and y-axis information of the ball by the formula (frame2.ball [ i ]. x-frame1.ball [ i ]. x) rate + frame1.ball [ i ]. x, ball [ i ]. y ═ (frame2.ball [ i ]. y-frame1.ball [ i ]. y) rate + frame1.ball [ i ]. y, where ball [ i ]. x represents x-axis coordinate information of the ith ball, ball [ i ]. y represents y-axis coordinate information of the ith ball, frame1.ball [ i ]. x represents x-axis coordinate information of a frame preceding the ith ball, and frame1.ball [ i ]. y represents y-axis coordinate information of a frame following the ith ball.
According to the embodiment, the position information corresponding to the current timestamp is calculated through the time ratio of the relative time to the current time and the position information corresponding to the relative time, so that each object in the current scene is drawn according to the current position information, and therefore collision synchronization is achieved.
Further, as shown in fig. 10, a sixth embodiment of the collision synchronization method according to the present invention is proposed based on the first embodiment, the second embodiment and the third embodiment, so as to be explained based on the first embodiment, in this embodiment, the step S40 specifically includes:
step S405, drawing the current object and other objects through interpolation according to the recorded position information so as to realize collision synchronization.
It should be noted that the recorded position information is only the position information after collision, and is not the entire motion trajectory, in this embodiment, the entire motion trajectory is not required to be recorded, but the position information when the state changes is recorded, the initial state information and the position information when the state changes are recorded, and the position information missing in the middle is filled in by interpolation, so as to implement the continuity of the motion trajectory.
According to the embodiment, the motion trail is drawn in an interpolation mode, so that a large amount of position information generated under a large amount of collision conditions is reduced, and the system processing pressure is reduced.
Furthermore, an embodiment of the present invention further provides a storage medium, where the storage medium stores a collision synchronization program, and the collision synchronization program, when executed by a processor, implements the following operations:
acquiring an initial speed of a corresponding current object, and uploading the initial speed to a server so that the server sends the initial speed to other clients corresponding to other objects of which the current object is in the same game scene;
determining the motion track of the current object according to the initial speed, and judging whether the current object and other objects collide according to the motion track;
when collision occurs, updating the initial speed of the current object and other objects, and recording the target position information of the current object and other objects until the updated initial speed of the current object and other objects is a preset speed;
and drawing the current object and other objects according to the target position information so as to realize collision synchronization.
Further, the collision synchronization program when executed by the processor further performs the following operations:
the method comprises the steps of obtaining the initial speed of a corresponding current object, and uploading the initial speed to a server, so that the server sends the initial speed to other clients corresponding to other objects of the current object in the same game scene through transparent transmission.
Further, the collision synchronization program when executed by the processor further performs the following operations:
and judging whether the initial speed is legal or not, and determining the motion track of the current object according to the initial speed when the judgment result is legal.
Further, the collision synchronization program when executed by the processor further performs the following operations:
and judging whether the state of the current object meets a preset condition, determining the motion track of the current object according to the initial speed when the state of the current object meets the preset condition, and judging whether the current object and other objects collide according to the motion track.
Further, the collision synchronization program when executed by the processor further performs the following operations:
and extracting the position information of the snapshot record in the preset storage area to draw the current object and other objects so as to realize collision synchronization.
Further, the collision synchronization program when executed by the processor further performs the following operations:
acquiring preset time information, and searching two frames of picture information adjacent to the preset time in the preset storage area according to the preset time information;
calculating a motion proportion according to the preset time and the time information in the two adjacent frames of picture information;
and calculating target position information according to the motion proportion and the reference position information in the two adjacent frames of picture information, and drawing the current object and other objects according to the target position information so as to realize collision synchronization.
Further, the collision synchronization program when executed by the processor further performs the following operations:
and drawing the current object and other objects through interpolation according to the target position information so as to realize collision synchronization.
Further, the collision synchronization program when executed by the processor further performs the following operations:
receiving data information sent by a server, extracting a feature tag in the data information, and searching for other objects corresponding to the feature tag in a preset relational mapping table according to the feature tag.
According to the scheme, the initial speed of the corresponding current object is obtained through the current client, the actual motion track of each object is judged according to the initial speed and the preset rule, and each object is drawn according to the motion track, so that the collision synchronization of each object in the current scene of each client is realized, and the data interaction between the client and the server is reduced.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or system. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or system that comprises the element.
The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments.
In the unit claims enumerating several means, several of these means may be embodied by one and the same item of hardware. The usage of the words first, second and third, etcetera do not indicate any ordering. These words may be interpreted as names.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium (e.g., ROM/RAM, magnetic disk, optical disk) as described above and includes instructions for enabling a terminal device (e.g., a mobile phone, a computer, a terminal device, an air conditioner, or a network device) to execute the method according to the embodiments of the present invention.
The above description is only a preferred embodiment of the present invention, and not intended to limit the scope of the present invention, and all modifications of equivalent structures and equivalent processes, which are made by using the contents of the present specification and the accompanying drawings, or directly or indirectly applied to other related technical fields, are included in the scope of the present invention.
Equivalent structures or equivalent processes performed by the contents of the specification and the drawings are directly or indirectly applied to other related technical fields, and the same principle is included in the scope of the invention.

Claims (10)

1. A collision synchronization method, characterized by comprising the steps of:
the method comprises the steps that a current client side obtains an initial speed of a corresponding current object, and the initial speed is uploaded to a server, so that the server sends the initial speed to other client sides corresponding to other objects of which the current object is in the same game scene;
determining the motion track of the current object according to the initial speed, and judging whether the current object and other objects collide according to the motion track;
when collision occurs, updating the initial speed of the current object and other objects, and recording the target position information of the current object and other objects until the updated initial speed of the current object and other objects is a preset speed;
drawing the current object and other objects according to the target position information to realize collision synchronization;
wherein the initial velocity comprises an initial acceleration vector;
the determining the motion trajectory of the current object according to the initial speed includes:
and determining the motion trail of the current object according to the initial acceleration vector.
2. The collision synchronization method according to claim 1, wherein the current client obtains an initial speed of a corresponding current object, and uploads the initial speed to a server, so that the server sends the initial speed to other clients corresponding to other objects of the current object in the same game scene, specifically including:
the method comprises the steps of obtaining the initial speed of a corresponding current object, and uploading the initial speed to a server, so that the server sends the initial speed to other clients corresponding to other objects of the current object in the same game scene through transparent transmission.
3. The collision synchronization method according to claim 1, wherein before determining the motion trajectory of the current object based on the initial velocity and determining whether the current object and the other object collide based on the motion trajectory, the method further comprises:
and judging whether the initial speed is legal or not, and determining the motion track of the current object according to the initial speed when the judgment result is legal.
4. The collision synchronization method according to any one of claims 1 to 3, wherein the determining of the motion trajectory of the current object according to the initial velocity and the determining of whether the current object and the other object collide before the determining of the motion trajectory further comprises:
and judging whether the state of the current object meets a preset condition, determining the motion track of the current object according to the initial speed when the state of the current object meets the preset condition, and judging whether the current object and other objects collide according to the motion track.
5. The collision synchronization method according to any one of claims 1 to 3, wherein the method further comprises, after updating the initial velocity of the current object and the other objects when the collision occurs until the updated initial velocity of the current object and the other objects is a preset velocity and recording target position information of the current object and the other objects, the method further comprising:
storing the target position information of the current object and other objects in a preset storage area in a snapshot mode;
correspondingly, drawing the current object and other objects according to the target position information to realize collision synchronization, specifically comprising:
and extracting the position information of the snapshot record in the preset storage area to draw the current object and other objects so as to realize collision synchronization.
6. The collision synchronization method according to claim 5, wherein the extracting of the position information of the snapshot record in the preset storage area draws the current object and the other objects to achieve collision synchronization, specifically includes:
acquiring preset time information, and searching two frames of picture information adjacent to the preset time in the preset storage area according to the preset time information;
calculating a motion proportion according to the preset time and the time information in the two adjacent frames of picture information;
and calculating target position information according to the motion proportion and the reference position information in the two adjacent frames of picture information, and drawing the current object and other objects according to the target position information so as to realize collision synchronization.
7. The collision synchronization method according to any one of claims 1 to 3, wherein the drawing the current object and the other objects according to the target position information to achieve collision synchronization specifically includes:
and drawing the current object and other objects through interpolation according to the target position information so as to realize collision synchronization.
8. The collision synchronization method according to any one of claims 1 to 3, wherein the current client acquires an initial velocity of a corresponding current object, and uploads the initial velocity to a server so that the server sends the initial velocity to other clients corresponding to other objects of the current object in the same game scene, and the method further comprises:
receiving data information sent by a server, extracting a feature tag in the data information, and searching for other objects corresponding to the feature tag in a preset relational mapping table according to the feature tag.
9. A client, the client comprising: memory, a processor and a crash synchronization program stored on the memory and executable on the processor, the crash synchronization program being configured to implement the steps of the crash synchronization method as claimed in any one of claims 1 to 8.
10. A storage medium, characterized in that the storage medium has stored thereon a crash synchronization program which, when executed by a processor, implements the steps of the crash synchronization method according to any one of claims 1 to 8.
CN201810222258.4A 2018-03-16 2018-03-16 Collision synchronization method, client and storage medium Active CN108540454B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810222258.4A CN108540454B (en) 2018-03-16 2018-03-16 Collision synchronization method, client and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810222258.4A CN108540454B (en) 2018-03-16 2018-03-16 Collision synchronization method, client and storage medium

Publications (2)

Publication Number Publication Date
CN108540454A CN108540454A (en) 2018-09-14
CN108540454B true CN108540454B (en) 2020-09-15

Family

ID=63484733

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810222258.4A Active CN108540454B (en) 2018-03-16 2018-03-16 Collision synchronization method, client and storage medium

Country Status (1)

Country Link
CN (1) CN108540454B (en)

Families Citing this family (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109381858B (en) * 2018-10-22 2021-10-15 竞技世界(北京)网络技术有限公司 Position synchronization method in online game
CN111249719B (en) * 2020-01-20 2021-09-24 腾讯科技(深圳)有限公司 Track prompting method and device, storage medium and electronic device
CN111467796B (en) * 2020-04-02 2023-05-02 北京代码乾坤科技有限公司 Distributed physical settlement method and device
CN111475573B (en) 2020-04-08 2023-02-28 腾讯科技(深圳)有限公司 Data synchronization method and device, electronic equipment and storage medium
CN111514587B (en) * 2020-04-27 2021-05-11 网易(杭州)网络有限公司 Information processing method, device, equipment and storage medium
CN112044075A (en) * 2020-09-18 2020-12-08 网易(杭州)网络有限公司 Method and device for generating motion trail
CN114797106A (en) * 2022-03-29 2022-07-29 北京字跳网络技术有限公司 Image processing method, device, equipment and storage medium
CN115089961A (en) * 2022-06-24 2022-09-23 北京字跳网络技术有限公司 Video processing method and device, electronic equipment and storage medium

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101420347A (en) * 2008-03-18 2009-04-29 王睿斌 Method for synchronously running Flash single-machine double-player game on dual hosts
CN101841538A (en) * 2010-04-16 2010-09-22 上海亚图软件有限公司 Network synchronization method of physical computing based on CS architecture
CN102122204A (en) * 2011-01-17 2011-07-13 北京邮电大学 Distributed force sense synchronous sensing method and system
CN105879391A (en) * 2016-04-08 2016-08-24 腾讯科技(深圳)有限公司 Movement control method for role in game, server, and client
CN106559426A (en) * 2016-11-24 2017-04-05 腾讯科技(深圳)有限公司 A kind of data processing method and server and client based on frame synchronization
CN107222510A (en) * 2017-07-21 2017-09-29 腾讯科技(深圳)有限公司 A kind of game synchronization method, system and relevant device
CN107273008A (en) * 2017-05-23 2017-10-20 武汉秀宝软件有限公司 Collision processing method, client, server and system in a kind of virtual environment

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9893974B2 (en) * 2015-10-11 2018-02-13 Microsoft Technology Licensing, Llc Synchronization of data for colliding bodies

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101420347A (en) * 2008-03-18 2009-04-29 王睿斌 Method for synchronously running Flash single-machine double-player game on dual hosts
CN101841538A (en) * 2010-04-16 2010-09-22 上海亚图软件有限公司 Network synchronization method of physical computing based on CS architecture
CN102122204A (en) * 2011-01-17 2011-07-13 北京邮电大学 Distributed force sense synchronous sensing method and system
CN105879391A (en) * 2016-04-08 2016-08-24 腾讯科技(深圳)有限公司 Movement control method for role in game, server, and client
CN106559426A (en) * 2016-11-24 2017-04-05 腾讯科技(深圳)有限公司 A kind of data processing method and server and client based on frame synchronization
CN107273008A (en) * 2017-05-23 2017-10-20 武汉秀宝软件有限公司 Collision processing method, client, server and system in a kind of virtual environment
CN107222510A (en) * 2017-07-21 2017-09-29 腾讯科技(深圳)有限公司 A kind of game synchronization method, system and relevant device

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
MMOG游戏引擎同步策略的研究与实现;钟瑛;《中国优秀硕士学位论文全文数据信息科技辑库》;20130315(第3期);全文 *
网络游戏引擎中同步技术研究综述;邱航;《计算机应用研究》;20070101(第1期);全文 *

Also Published As

Publication number Publication date
CN108540454A (en) 2018-09-14

Similar Documents

Publication Publication Date Title
CN108540454B (en) Collision synchronization method, client and storage medium
US11816853B2 (en) Systems and methods for simultaneous localization and mapping
US10499002B2 (en) Information processing apparatus and information processing method
CN107168532B (en) Virtual synchronous display method and system based on augmented reality
EP3855400A1 (en) Data processing method and device for virtual scene
KR20210121182A (en) augmented reality system
JP2019121362A (en) Connection of physical object and virtual object in augmented reality
US9773335B2 (en) Display control device and method
US9418292B2 (en) Methods, apparatuses, and computer program products for restricting overlay of an augmentation
US20120058801A1 (en) Methods, apparatuses, and computer program products for enhancing activation of an augmented reality mode
JP6609640B2 (en) Managing feature data for environment mapping on electronic devices
US20120092370A1 (en) Apparatus and method for amalgamating markers and markerless objects
US10338879B2 (en) Synchronization object determining method, apparatus, and system
CN112933597A (en) Image processing method, image processing device, computer equipment and storage medium
CN110764614A (en) Augmented reality data presentation method, device, equipment and storage medium
WO2014124062A1 (en) Aligning virtual camera with real camera
US20210118236A1 (en) Method and apparatus for presenting augmented reality data, device and storage medium
CN104143074A (en) Method and equipment for generating motion feature codes on the basis of motion feature information
JPWO2021076748A5 (en)
CN109766006B (en) Virtual reality scene display method, device and equipment
CN112752119A (en) Time delay error correction method, terminal equipment, server and storage medium
KR101740213B1 (en) Device for playing responsive augmented reality card game
CN116208623B (en) Information synchronization method, device, engine server and storage medium
KR101697041B1 (en) Method for data processing for responsive augmented reality card game by collision detection for virtual objects and device for playing responsive augmented reality card game
CN111603773A (en) Object synchronization method, device, equipment and storage medium based on UE4 engine

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