Metacosmic role state synchronization method and electronic equipment
By utilizing time difference judgment and encoding bitmap technology in the Metaverse project, the status synchronization of Metaverse characters has been optimized, which has solved the problem of network bandwidth pressure caused by frequent synchronization and improved system performance and user experience.
Patent Information
- Application Number
- CN202410901765.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-05
- Publication Date
- 2024-10-29
AI Technical Summary
In the Metaverse project, frequent synchronization of the position and orientation data of Metaverse characters results in heavy pressure on network bandwidth, which may lead to network delays and high server load.
By obtaining the time difference between the current time node and the previous calibration synchronization time node, it is judged whether the preset time difference threshold is reached. If it is not reached, the relative value is obtained to generate a status update identification, and the identification and time difference are filled into the encoded bitmap and status data. Relative values form data packets for status synchronization.
It reduces the amount of data for status synchronization, reduces network bandwidth pressure, improves user experience, and reduces server load.
Smart Images

Figure CN118869601A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of metaverse technology, and specifically relates to a metaverse role status synchronization method, a metaverse role status synchronization device, a computer-readable medium, an electronic device, and a computer program product. Background Art
[0002] In the Metaverse project, users' characters can interact, cooperate or confront each other. In order to ensure that users see the same situation in the same Metaverse space, it is necessary to synchronize the position and orientation of the Metaverse characters to ensure that the interaction between users is real-time and accurate. A large amount of position and orientation data needs to be frequently transmitted between the client and the server, which may increase network latency, cause freezes and delays in the program, and affect the user experience. At the same time, it will also consume a lot of bandwidth. If there are a large number of users, the network traffic will become very large, which may cause problems such as excessive server load or insufficient bandwidth. Summary of the invention
[0003] The purpose of the present application is to provide a state synchronization method for a metaverse character, a state synchronization device for a metaverse character, a computer-readable medium, an electronic device, and a computer program product to solve the problem of high network bandwidth pressure caused by the need to frequently synchronize state data.
[0004] According to one aspect of an embodiment of the present application, a state synchronization method for a metaverse character is provided, the method comprising: obtaining state data of the metaverse character at a current time node, the state data comprising position information and orientation information of the metaverse character in the metaverse space; obtaining a time difference between the current time node and a previous calibration synchronization time node, the calibration synchronization time node being a time node for calibrating and updating an absolute value of the state data; if the time difference is less than a preset time difference threshold, obtaining a relative value of the state data of the current time node relative to a previous time node; generating a state update flag according to the relative value of the state data, the state update flag being used to indicate whether to synchronously update the state data of the current time node; filling a coding bitmap with a specified number of bytes with the state update flag and the time difference, and forming a data packet for state synchronization of the metaverse character with the coding bitmap and the relative value of the state data.
[0005] According to one aspect of an embodiment of the present application, a state synchronization device for a metaverse role is provided, the device comprising:
[0006] A first acquisition module is configured to acquire state data of a Metaverse character at a current time node, wherein the state data includes position information and orientation information of the Metaverse character in the Metaverse space;
[0007] A second acquisition module is configured to acquire a time difference between the current time node and a previous calibration synchronization time node, where the calibration synchronization time node is a time node for calibrating and updating an absolute value of the status data;
[0008] A third acquisition module is configured to acquire a relative value of the status data of the current time node relative to the previous time node if the time difference is less than a preset time difference threshold;
[0009] A generating module, configured to generate a state update identifier according to a relative value of the state data, wherein the state update identifier is used to indicate whether to synchronously update the state data of the current time node;
[0010] The filling module is configured to fill the status update identifier and the time difference into a coding bitmap with a specified number of bytes, and to form a data packet for synchronizing the status of the metaverse character with the relative numerical values of the coding bitmap and the status data.
[0011] In some embodiments of the present application, based on the above technical solution, the filling module includes:
[0012] A duration interval acquisition module is configured to acquire a duration interval where the time difference threshold is located, wherein the duration interval is used to represent different duration ranges;
[0013] A coding bitmap generation module is configured to generate a coding bitmap with a specified number of bytes according to the duration interval, wherein the coding bitmap includes a high-order segment distributed in the front and a low-order segment distributed in the back;
[0014] The data filling module is configured to fill the status update identifier into the high-order segment and fill the time difference into the low-order segment.
[0015] In some embodiments of the present application, based on the above technical solution, the coding bitmap generation module is further configured to: obtain the bit length corresponding to the duration interval, and the bit length is positively correlated with the maximum value in the duration interval; generate a coding bitmap with a specified number of bytes according to the bit length, and the length of the low-bit segment in the coding bitmap is equal to the bit length.
[0016] In some embodiments of the present application, based on the above technical solution, the data filling module is further configured to: determine the length of the high-order segment according to the specified number of bytes and the length of the low-order segment; and fill the status update identifier into the high-order segment according to the length of the high-order segment.
[0017] In some embodiments of the present application, based on the above technical solution, the position information includes three coordinate values in a three-dimensional coordinate system, and the orientation information includes a pitch angle and a yaw angle; the data filling module is further configured to: when the length of the high-order segment is two, fill the high-order segment with two of the status update identifiers; wherein, one status update identifier is used to indicate whether to synchronously update the position information of the current time node, and the other status update identifier is used to indicate whether to synchronously update the orientation information of the current time node; when the length of the high-order segment is three, fill the high-order segment with three of the status update identifiers; wherein, one status update identifier is used to indicate whether to synchronously update the position information of the current time node, and the other two status update identifiers are used to indicate whether to synchronously update the orientation information of the current time node. They are respectively used to indicate whether the pitch angle or yaw angle of the current time node is synchronously updated; when the length of the high-order segment is four, the high-order segment is filled with four status update identifiers; wherein, one status update identifier is used to indicate whether the orientation information of the current time node is synchronously updated, and the other three status update identifiers are respectively used to indicate whether the three coordinate values in the three-dimensional coordinate system are synchronously updated; when the length of the high-order segment is greater than or equal to five, the high-order segment is filled with five status update identifiers; wherein, two status update identifiers are respectively used to indicate whether the pitch angle or yaw angle of the current time node is synchronously updated, and the other three status update identifiers are respectively used to indicate whether the three coordinate values in the three-dimensional coordinate system are synchronously updated.
[0018] In some embodiments of the present application, based on the above technical solution, the generation module includes:
[0019] A first generating module is configured to generate a state update identifier with a first value as the value when the relative value of the state data is greater than a preset threshold, wherein the state update identifier with the first value as the value is used to indicate that the state data of the current time node is synchronously updated;
[0020] The second generating module is configured to generate a state update identifier with a second value when the relative value of the state data is less than a preset threshold, and the state update identifier with the second value is used to indicate to abandon the synchronous update of the state data of the current time node.
[0021] In some embodiments of the present application, based on the above technical solution, the device further includes:
[0022] A mapping module is configured to determine the numerical variation range of the status data according to the time difference threshold; determine a mapping ratio according to the numerical variation range and a preset byte length, the mapping ratio being used to map a floating-point number corresponding to the numerical variation range to a short integer corresponding to the byte length; and map the relative numerical value of the status data from a floating-point number to a short integer according to the mapping ratio.
[0023] In some embodiments of the present application, based on the above technical solution, the mapping ratio is calculated by the following formula:
[0024]
[0025] Among them, P is the mapping ratio, ByteNum is the byte length, MaxValue is the maximum value in the numerical variation range, and MinValue is the minimum value in the numerical variation range.
[0026] In some embodiments of the present application, based on the above technical solution, the mapping module is further configured to perform mapping processing on the status data according to the following formula:
[0027] Value=[(Input-MinValue)×P+0.5]
[0028] Among them, Input is the relative value of the status data in floating point format, and Value is the relative value of the status data in short integer format.
[0029] According to one aspect of an embodiment of the present application, a computer-readable medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the method in the above technical solution is implemented.
[0030] According to one aspect of an embodiment of the present application, an electronic device is provided, comprising: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to execute the executable instructions to implement the method in the above technical solution.
[0031] According to one aspect of an embodiment of the present application, a computer program product is provided, including a computer program, and when the computer program is executed by a processor, the method in the above technical solution is implemented.
[0032] In the technical solution provided in the embodiment of the present application, by obtaining the time difference between the current time node and the previous calibration synchronization time node, the relationship between the time difference and the preset time difference threshold can be determined. If the time difference threshold is not reached, the relative value of the state data of the current time node relative to the previous time node is obtained, and then the state update identifier is generated according to the relative value of the state data. Then, the state update identifier and the time difference are filled into a coding bitmap with a specified number of bytes, and the coding bitmap and the relative value of the state data are used to form a data packet for state synchronization of the metaverse character. In the case where the time difference threshold is not reached, it is only necessary to obtain the relative value of the state data without having to synchronize the absolute value in full, thereby reducing the amount of data for state synchronization. Moreover, the state update identifier and the time difference share a coding bitmap, which can reduce the occupation of the identifier bit, shorten the length of the data encoding, further compress the amount of data of the synchronization state data, and reduce the pressure on network bandwidth.
[0033] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] The drawings herein are incorporated into the specification and constitute a part of the specification, illustrate embodiments consistent with the present application, and together with the specification are used to explain the principles of the present application. Obviously, the drawings described below are only some embodiments of the present application, and for ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0035] Figure 1 An exemplary system architecture block diagram applying the technical solution of the present application is shown.
[0036] Figure 2 The diagram shows an interactive flow chart of state data synchronization between different clients in an application scenario.
[0037] Figure 3 A two-dimensional space region division scheme in an application scenario is shown.
[0038] Figure 4 A flowchart of a method for synchronizing the status of a metaverse role in one embodiment of the present application is shown.
[0039] Figure 5 The time distribution of calibration synchronization and incremental synchronization in an application scenario of an embodiment of the present application is shown.
[0040] Figure 6 The embodiment of the present application shows a coding bitmap including two identification bits in an application scenario.
[0041] Figure 7The embodiment of the present application shows a coding bitmap including five identification bits in an application scenario.
[0042] Figure 8 The embodiment of the present application shows a coding bitmap including six identification bits in an application scenario.
[0043] Fig. 9 The structural block diagram of the state synchronization device of the metaverse role provided in an embodiment of the present application is schematically shown.
[0044] Fig.10 The structure block diagram of a computer system suitable for implementing an electronic device of an embodiment of the present application is schematically shown. DETAILED DESCRIPTION
[0045] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in a variety of forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this application will be more comprehensive and complete and fully convey the concept of the example embodiments to those skilled in the art.
[0046] In addition, described feature, structure or characteristic can be combined in one or more embodiments in any suitable manner. In the following description, many specific details are provided to provide a full understanding of the embodiments of the present application. However, those skilled in the art will appreciate that the technical scheme of the present application can be put into practice without one or more of the specific details, or other methods, components, devices, steps, etc. can be adopted. In other cases, known methods, devices, realizations or operations are not shown or described in detail to avoid blurring the various aspects of the application.
[0047] In the embodiments of the present application, the term "module" or "unit" refers to a computer program or a part of a computer program with a predetermined function, and works together with other related parts to achieve a predetermined goal, and can be implemented in whole or in part by using software, hardware (such as processing circuits or memories) or a combination thereof. Similarly, a processor (or multiple processors or memories) can be used to implement one or more modules or units. In addition, each module or unit can be part of an overall module or unit that includes the function of the module or unit.
[0048] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities may be implemented in software form, or in one or more hardware modules or integrated circuits, or in different networks and / or processor devices and / or microcontroller devices.
[0049] The flowcharts shown in the accompanying drawings are only exemplary and do not necessarily include all the contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps can be decomposed, and some operations / steps can be combined or partially combined, so the actual execution order may change according to actual conditions.
[0050] The relevant technical terms involved in this application are explained as follows.
[0051] 3D: three dimensional, that is, three-dimensional graphics. In the field of computer graphics, the computer creates a visual illusion through the difference in color grayscale on the screen, and the two-dimensional computer screen is perceived as a three-dimensional image.
[0052] Yaw, Pitch: In computer graphics, Yaw and Pitch are commonly used terms to describe the rotation direction of an object or camera. Yaw is usually used to describe the angle of rotation of an object around the vertical axis (usually the Y axis). Yaw is usually used to control the left and right turn of a character or camera, affecting the direction it is facing. For example, by changing the Yaw value, you can control the left and right turn of a metaverse character, thereby changing the direction it is facing. Pitch is usually used to describe the angle of rotation of an object around the horizontal axis (usually the X axis). In the metaverse space, Pitch is usually used to control the up and down angles of a metaverse character or camera, affecting the angle of its direction. For example, in a metaverse scene that simulates an aircraft, the up and down angles of the aircraft can be controlled by changing the Pitch value, thereby changing its flight attitude.
[0053] Byte: Byte is one of the basic units of computer storage, usually used to indicate the size or capacity of data. A byte is equal to 8 bits, each bit can represent 0 or 1, so a byte can represent 256 (2 to the 8th power) different combinations of values.
[0054] float: is a data type used to represent floating-point numbers, usually used to store single-precision floating-point numbers. The float type usually occupies 4 bytes (32 bits) of storage space, part of which is used to represent the decimal part and part of which is used to represent the exponent part.
[0055] long: used to represent long integers in the C++ programming language, usually occupies 8 bytes (64-bit operating system). Its value range is larger than that of the int type, and its value range is -9223372036854775808 to 9223372036854775807.
[0056] int: Usually used to represent integers. In the C++ programming language, it is used to represent general integers. It usually occupies 4 bytes. Its value range is -2147483648 to 2147483647.
[0057] short: Used in the C++ programming language to represent a short integer, which is smaller than the int data type, occupies 2 bytes, and has a value range of -32768 to +32767.
[0058] Timestamp: Timestamp refers to the total number of seconds from 00:00:00 Greenwich time on January 1, 1970 (08:00:00 Beijing time on January 1, 1970) to the present. In the computer field, timestamp is usually a long integer number, which is very commonly used in recording the time of event occurrence, performing time calculations, and sorting data, because it provides a unified time standard and avoids problems such as time zone and format.
[0059] Figure 1 An exemplary system architecture block diagram applying the technical solution of the present application is shown.
[0060] like Figure 1 As shown, the system architecture 100 may include a terminal device 110, a network 120 and a server 130. The terminal device 110 may include various electronic devices such as smart phones, computers, smart speakers, smart wearable devices, smart vehicle-mounted devices, and smart payment terminals. The server 130 may be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms. The network 120 may be a communication medium of various connection types that can provide a communication link between the terminal device 110 and the server 130, such as a wired communication link or a wireless communication link.
[0061] According to the implementation requirements, the system architecture in the embodiment of the present application can have any number of terminal devices, networks and servers. For example, the server 130 can be a server group composed of multiple server devices. In addition, the technical solution provided in the embodiment of the present application can be applied to the terminal device 110, can also be applied to the server 130, or can be implemented by the terminal device 110 and the server 130 together, and the present application does not make any special restrictions on this.
[0062] Figure 2The interactive flow chart of state data synchronization between different clients in an application scenario is shown. The server architecture adopts the traditional C / S architecture. Each client sends its position and orientation information to the server 20 times per second. The server forwards the received synchronization information to other users. The user client reads the synchronization information and applies it to the position and orientation performance of the corresponding character.
[0063] Due to network latency, the positions of other users that users see are usually not real-time. This is because it takes time for data packets to travel between the client and the server, and different players may face different degrees of latency. In order to provide a smooth and coherent experience, an interpolation method is usually used on the client side to handle this latency and synchronize player positions. That is, when the client receives new server data, if it finds that there is a difference between the character's current position and the actual position, the client uses a linear interpolation algorithm to smoothly transition from one position to another. Linear interpolation is the simplest and most direct interpolation method. It assumes that the change between the original value and the target value is linear, that is, the speed is constant. The formula for interpolation is:
[0064] Lerp(a,b,t)=(1-t)·a+t·b
[0065] Among them, a represents the original value, b represents the target value, and t is the interpolation parameter between 0 and 1. As t increases from 0 to 1, the result smoothly transitions from a to b.
[0066] In the related art of the present application, the status data that the metaverse character needs to synchronize usually includes location information, orientation information and timestamp.
[0067] Position information: The data format is 3 float data, representing the x, y, and z coordinate values in the 3D space.
[0068] Orientation information: The data format is 2 float data, representing the Yaw value of the body orientation and the Pitch value representing the head pitch angle.
[0069] Timestamp: The data format is a long data, which represents the current moment when the position information and orientation information are sent. The reason for transmitting timestamps is to ensure that all user states seen by all users at the same time point are basically consistent. In addition, in order to reduce the impact of network latency on character synchronization, interpolation and prediction techniques are usually used. Interpolation can smoothly handle changes in position and orientation, and prediction can predict the character's movement trajectory in advance while waiting for the server to update. Both technologies require timestamps for calculation.
[0070] The number of bytes of synchronous data is calculated as follows.
[0071] Timestamp: long type data, occupies 8 bytes.
[0072] Position: 3 float type data, occupying 3*4=12 bytes.
[0073] Direction: 2 float type data, occupying 2*4=8 bytes.
[0074] Total: 8+3*4+2*4=28 bytes.
[0075] In order to reduce the amount of synchronized state data, an optional solution is to synchronize location information based on region division, that is, by dividing the entire metaverse space into regions and generating region numbers for each region.
[0076] Taking a 1000*1000 meter map as an example, with S meters as the side length, the map is divided into multiple sub-areas of S*S meters. The number of sub-areas is: (1000*1000) / (S*S).
[0077] Each sub-area has an index, which is calculated as follows:
[0078] Index_X = Pos.x / S;
[0079] Index_Y = Pos.y / S;
[0080] Index = Index_x*S+Index_y;
[0081] When synchronizing data, the area number is calculated based on the character's position. The synchronized position value only contains the relative value relative to the origin of the area, and the sub-area number (Index) is added.
[0082] Figure 3 The following figure shows a two-dimensional space area division scheme in an application scenario. As shown in the figure, assuming that the S value is 100, the character's position Pos (such as x=110, y=259), calculate the area number where the character is located (such as (x=1, y=2)). When synchronizing data, the area number is calculated based on the character's position, so the synchronized position value only contains the relative value relative to the origin of the area, and the sub-area number (Index) is added.
[0083] When the character moves within the area (Index_X=1, Index_Y=2), the single dimension of the position changes within the range of [0, S] meters; when leaving the current area and entering a new area, the area number (Index) is updated to the new area, and the single dimension of the position also remains within the range of [0, S] meters. The data structure synchronized to other clients is as follows
[0084] Timestamp: long type data, occupies 8 bytes.
[0085] Area number (Index): short type data, occupying 2 bytes.
[0086] Position: 3 short data, occupying 3*2=6 bytes.
[0087] Direction: 2 float type data, occupying 2*4=8 bytes.
[0088] Total: 2+3*2+2*4=24 bytes.
[0089] This solution does not save many bytes, and the space saved is closely related to the value of S. If S is large, the area number (Index) will be smaller, but the amount of position data may exceed the maximum value of short type data; if S is small, the number of bytes occupied by the position data value can be smaller, but the range of the area number (Index) will increase, and it may exceed the maximum value of short type data.
[0090] It can be seen that in a metaverse world with a large number of characters, how to efficiently reduce the amount of data for synchronizing the character's position and orientation to reduce the network pressure on the server and client is a problem that needs to be solved urgently.
[0091] Whether sending the location orientation information directly or dividing the location data into sub-areas to reduce the amount of location data, there are several problems:
[0092] (1) Data such as location, orientation, and timestamp occupy a large number of bytes, which puts pressure on the network bandwidth of users and servers.
[0093] (2) Although the method of dividing the sub-regions can reduce the number of bytes of the location, the data volume reduction rate is not high and depends on the value of the region side length, the optimization rate is highly uncertain.
[0094] To address the above issues, the present application proposes a time-based optimization solution that compresses synchronization data based on seconds as the basic synchronization unit, and downgrades the floating-point data of position and orientation without sacrificing user experience. The main innovations of one implementation are as follows.
[0095] (1) Based on 1 second as the basic unit, the entire data is synchronized once every 1 second, including the absolute position, orientation, and timestamp. This synchronization is called calibration synchronization. The advantage of this method is that even if there is an error in incremental synchronization, it will be controlled within the error range of 1 second, which is almost negligible from the user's perspective.
[0096] (2) The synchronization between two calibration synchronizations (2 seconds) is incremental synchronization. The number of synchronizations within 1 second is unlimited, generally 20 times, and can be more or less, mainly depending on the requirements for user experience. The more synchronizations, the less delay the character moves, and the smoother it is. When calibration synchronization is used, the synchronized data may include the absolute position, absolute orientation, and standard timestamp of the Metaverse character, where the standard timestamp generally occupies 8 bytes. When incremental synchronization is used, the synchronized data may include the relative position, relative orientation, and time difference of the Metaverse character, where the time difference generally occupies 2 bytes.
[0097] Since incremental synchronization is synchronized within 1 second intervals, the time increment cannot exceed 1 second. The timestamp value range of incremental synchronization is [0, 1000] (i.e. 0-1000 milliseconds), and the value range of 10 bits is [0, 1023], so using two bytes (16 bits) can meet the timestamp variable range. On this basis, 6 positions in the high position of the timestamp byte are free, which can be used as an identification bit to indicate whether the status data is synchronized. Using 1 second as the calibration synchronization interval can not only reduce the number of bytes of the timestamp variable, but also free up 6 bits to store other data, thereby reducing the overall number of bytes.
[0098] (3) Compressed data format: defines a data structure that approximates the float type to the short type. This data structure is used to convert the float data of position and orientation to the short type.
[0099] (4) A variable is defined based on whether the five values of the xyz coordinates of the position and the Yaw and Pitch of the orientation exceed the threshold (for example, whether the absolute value is greater than 0.0001). This variable has only two values, 0 and 1, so it can be stored in 1 bit, and these 5 bits of data are written to the high bit of the timestamp variable.
[0100] The following is a detailed description of the technical solutions such as the state synchronization method of a Metaverse role, the state synchronization device of a Metaverse role, the computer-readable medium, the electronic device, and the computer program product provided by the present application in combination with the specific implementation methods.
[0101] Figure 4 FIG. 1 is a flow chart showing a method for synchronizing the status of a metaverse role in one embodiment of the present application. Figure 4 As shown, the state synchronization method of the metaverse role may include the following steps S410 to S450.
[0102] S410: Obtaining status data of the Metaverse character at the current time node, where the status data includes position information and orientation information of the Metaverse character in the Metaverse space.
[0103] Position information: The data format is 3 float data, representing the x, y, and z coordinate values in the 3D space.
[0104] Orientation information: The data format is 2 float data, representing the Yaw value of the body orientation and the Pitch value representing the head pitch angle.
[0105] Timestamp: The data format is a long type data, which represents the current time node when the location information and orientation information are sent.
[0106] S420: Obtain the time difference between the current time node and the previous calibration synchronization time node, where the calibration synchronization time node is a time node for calibrating and updating the absolute value of the status data.
[0107] Calibration synchronization means that a full synchronization is required every fixed time difference threshold (for example, 1 second), which contains the following information.
[0108] Timestamp: The timestamp of the current time node, long type data, occupies 8 bytes.
[0109] Position: xyz coordinate value, 3 float type data, occupying 3*4=12 bytes.
[0110] Direction: Yaw and Pitch values, 2 float data, occupying 2*4=8 bytes.
[0111] Total: 8+3*4+2*4=28 bytes.
[0112] The position and orientation are absolute data without error. When other clients receive the calibration synchronization package, they will use this data to directly set the target value of the interpolation operation to refresh the character's position and orientation performance.
[0113] S430: If the time difference is less than a preset time difference threshold, a relative value of the status data of the current time node relative to the previous time node is obtained.
[0114] If the time difference has not reached the preset time difference threshold, the state data is synchronized using incremental synchronization.
[0115] Incremental synchronization refers to the synchronization of incremental changes within two calibration synchronizations (usually 1 second). This synchronization will only synchronize the change value of the position, the change value of the orientation, and the incremental value of the timestamp. In other words, the value of the last calibration synchronization will be used to continuously accumulate the value of the incremental synchronization to set the target value of the interpolation operation.
[0116] Figure 5The time distribution of calibration synchronization and incremental synchronization in an application scenario of an embodiment of the present application is shown. Taking 20 frames synchronized in 1 second as an example, calibration synchronization is performed every 1 second, and incremental synchronization is used for data frames between 2 seconds.
[0117] Since incremental synchronization is performed at 1-second intervals, the value range of the timestamp variable is 0 to 1000 milliseconds. A byte has 8 bits, and each bit can represent 0 and 1. Therefore, the number of bits that can cover [0, 1000] is 10 bits. The calculation formula is as follows:
[0118] n = ceil(log2(N+1))
[0119] Where (N=1000) is the maximum integer value and (n) is the number of bits required. In this case, the calculation is as follows:
[0120] n = ceil(log2(1001))
[0121] n=ceil(9.97)
[0122] n=10
[0123] Therefore, to cover the integer range from 0 to 1000, at least 10 bits, or 2 bytes, are required. Therefore, the 8 bytes (long data type) of the timestamp variable can be reduced to 2 bytes (short type). The incremental synchronization packet data is as follows:
[0124] Timestamp: short data type, occupies 2 bytes.
[0125] Position: 3 float type data, occupying 3*4=12 bytes.
[0126] Direction: 2 float type data, occupying 2*4=8 bytes.
[0127] Total: 2+3*4+2*4=22 bytes.
[0128] In one embodiment of the present application, the numerical variation range of the status data is determined according to a time difference threshold; a mapping ratio is determined according to the numerical variation range and a preset byte length, and the mapping ratio is used to map a floating-point number corresponding to the numerical variation range to a short integer corresponding to the byte length; and the relative numerical value of the status data is mapped from a floating-point number to a short integer according to the mapping ratio.
[0129] The 4 bytes occupied by the float type are still a lot. The sensitivity of the position and orientation information in the 3D coordinates of the metaverse to the decimal places of the floating point number decreases as the number of decimal places increases, so it can be approximately converted into an integer by retaining X decimal places.
[0130] At the same time, the character's movement speed is within a controllable range. The movement speed of characters in most Metaverse products will not exceed 10 meters per second. The maximum value of the single-dimensional change range of the character's position within 1 second is [-10, 10] meters. Under the scheme of retaining 3 decimal places of the floating-point number, the value of [-10, 10] can be mapped to a 2-byte expression value range through mapping.
[0131] In one embodiment of the present application, the mapping ratio is calculated by the following formula:
[0132]
[0133] Among them, P is the mapping ratio, ByteNum is the byte length, MaxValue is the maximum value in the value range, and MinValue is the minimum value in the value range.
[0134] In one embodiment of the present application, the relative value of the state data is mapped from a floating point number to a short integer according to the mapping ratio, including mapping the state data according to the following formula:
[0135] Value=[(Input-MinValue)×P+0.5]
[0136] Among them, Input is the relative value of the status data in floating point format, and Value is the relative value of the status data in short integer format.
[0137] Taking the input value Input equal to 3 as an example, MinValue is -10, MaxValue is 10, ByteNum is 2, and the output result can be calculated as Value equal to 42598 by substituting it into the above formula.
[0138] On the receiving side, it can be converted into the real value InputEx through the corresponding formula, calculated as follows:
[0139] InputEx=Value / P+MinValue
[0140] Similarly, for Yaw and Pitch in the heading information, the range of their values is [-3.1415, 3.1415]. The above calculation formula can also be used to convert the floating point numbers of Yaw and Pitch into short integers. When parsing the synchronization packet at the receiving end, the short type also needs to be converted to the float type.
[0141] Based on the above data format conversion, the incremental synchronization package data is as follows.
[0142] Timestamp: short data type, occupies 2 bytes.
[0143] Position: 3 short data, occupying 3*2=6 bytes.
[0144] Direction: 2 short data, occupying 2*2=4 bytes.
[0145] Total: 2+3*2+2*2=12 bytes.
[0146] So far, through the incremental synchronization and data compression scheme within time, the basic number of bytes of the synchronization package has been effectively reduced, with a reduction rate of 50%.
[0147] S440: Generate a state update flag according to the relative value of the state data, where the state update flag is used to indicate whether to synchronously update the state data of the current time node.
[0148] In one embodiment of the present application, a state update identifier is generated based on the relative value of the state data, including: when the relative value of the state data is greater than a preset threshold, a state update identifier with a first value is generated, and the state update identifier with the first value is used to indicate that the state data of the current time node is synchronously updated; when the relative value of the state data is less than the preset threshold, a state update identifier with a second value is generated, and the state update identifier with the second value is used to indicate that the state data of the current time node is abandoned.
[0149] In actual operation, the position and orientation do not change in every frame, so when synchronizing, you can first calculate the xyz coordinate value, Yaw, and Pitch of the current position and compare them with the previous synchronization. If it exceeds the update threshold, it will be synchronized. If it does not exceed, the update will not be synchronized this time. The value of the threshold is based on the numerical accuracy requirements of the specific project. For example, the distance represented by 0.1 meters in the Metaverse project is already very small, so the threshold of the position xyz coordinate value can be set to 0.1. For example, the position of the character in the Nth frame is (x=100.00, y=100.00, z=100.00), and the position of the character in the N+1 frame is (x=100.20, y=100.01, z=100.00). The z value between the two frames has not changed, so there is no need to synchronize and update; although the y value has changed, the change is less than the threshold of 0.1, so there is no need to synchronize and update; the x value has changed, and the change is greater than the threshold, so it needs to be synchronized and updated. Based on numerical comparison, at the current time node, only the x value in the position information can be synchronously updated, and the y value and the z value can be abandoned to synchronously update, so that the amount of synchronous data can be reduced.
[0150] In one embodiment of the present application, the status update identifier includes multiple identification bits, and each identification bit is used to indicate whether to synchronously update one or more status data of the current time node. For example, the xyz coordinate value can be indicated by one identification bit or by three identification bits. When one identification bit is used for indication, if the value of the identification bit is 1, it means that the xyz coordinate value needs to be synchronously updated; if the value of the identification bit is 0, it means that the synchronous update of the xyz coordinate value is abandoned. When three identification bits are used for indication, each identification bit is used to indicate whether to synchronously update a corresponding coordinate value; for example, when the status update identifier is 111, it indicates that all three xyz coordinate values need to be synchronously updated; when the status update identifier is 110, it indicates that the xy coordinate values need to be synchronously updated, and the z coordinate value is abandoned.
[0151] S450: Fill the status update identifier and the time difference into a coding bitmap with a specified number of bytes, and form a data packet for status synchronization of the metaverse role with relative numerical values of the coding bitmap and the status data.
[0152] In one embodiment of the present application, filling the status update identifier and the time difference into a coding bitmap with a specified number of bytes may further include: obtaining a duration interval where the time difference threshold is located, the duration interval is used to represent different duration ranges; generating a coding bitmap with a specified number of bytes according to the duration interval, the coding bitmap including a high-order segment distributed in the front and a low-order segment distributed in the back; filling the status update identifier into the high-order segment, and filling the time difference into the low-order segment.
[0153] The coding bitmap of the specified number of bytes has a fixed coding length. Corresponding to different duration intervals, the high-order segments and low-order segments in the coding bitmap have different distribution states. Taking the specified number of bytes as 2 bytes as an example, the corresponding generated coding bitmap includes 16 bits. The duration interval where the smaller time difference is located needs to occupy a shorter coding bit. At this time, a coding bitmap with a shorter low-order segment can be generated for it, for example, the low-order segment length is 10 bits and the high-order segment length is 6 bits. The duration interval where the larger time difference is located needs to occupy a longer coding bit. At this time, a coding bitmap with a longer low-order segment can be generated for it, for example, the low-order segment length is 14 bits and the high-order segment length is 2 bits.
[0154] In one embodiment of the present application, a coded bitmap with a specified number of bytes is generated according to a duration interval, including: obtaining a bit length corresponding to the duration interval, the bit length being positively correlated with a maximum value in the duration interval; generating a coded bitmap with a specified number of bytes according to the bit length, the length of a low-order segment in the coded bitmap being equal to the bit length.
[0155] For example, the duration intervals in the embodiment of the present application include multiple intervals such as 0 to 1 second, 1 to 2 seconds, 2 to 4 seconds, 4 to 8 seconds, 8 to 16 seconds, etc. Each duration interval corresponds to a bit length, and the bit length is positively correlated with the maximum value in the duration interval.
[0156] For example, the duration interval is 0 to 1 second, and the maximum time difference is 1 second, that is, 0 to 1000 milliseconds. Converting it into binary code requires a maximum of 10 bits, so it can be determined that the bit length corresponding to the duration interval is 10. When the specified number of bytes is 2, the generated encoding bitmap includes 16 bits, of which the low-order segment length is 10 and the high-order segment length is 6.
[0157] Taking the duration interval of 1 to 2 seconds as an example, the maximum time difference is 2 seconds, that is, 1000 to 2000 milliseconds. Converting it into binary code requires a maximum of 11 bits, so it can be determined that the bit length corresponding to the duration interval is 11. When the specified number of bytes is 2, the generated encoding bitmap includes 16 bits, of which the low-order segment length is 11 and the high-order segment length is 5.
[0158] In one embodiment of the present application, filling the status update identifier into the high segment includes: determining the length of the high segment according to the specified number of bytes and the length of the low segment; and filling the status update identifier into the high segment according to the length of the high segment.
[0159] The length of the high-order segment determines the number of identification bits of the status update identifier, and different identification bits are used to indicate different status data.
[0160] In one embodiment of the present application, the position information includes three coordinate values in a three-dimensional coordinate system, and the orientation information includes a pitch angle and a yaw angle.
[0161] When the length of the high-order segment is two, two status update identifiers are filled into the high-order segment; one status update identifier is used to indicate whether to synchronously update the position information of the current time node, and the other status update identifier is used to indicate whether to synchronously update the orientation information of the current time node.
[0162] Figure 6 The embodiment of the present application shows a coding bitmap including two identification bits in an application scenario. As shown in the figure, the position xyz identification bit is unified into one. When this identification bit is 1, the position xyz is synchronized, and when it is 0, it is not synchronized; the yaw angle Yaw and the pitch angle Pitch are combined into one identification bit. When this identification bit is 1, Yaw and Pitch are synchronized, and when it is 0, they are not synchronized. The case with the least number of identification bits only requires 2, and the timestamp variable has 14 bits. The maximum number of milliseconds that can be expressed can be expanded to 16383 (=2^14-1), and the corresponding recorded time interval is 8 to 16 seconds.
[0163] For example, when the time difference threshold is 12 seconds, the corresponding maximum time difference is 12000 milliseconds, and the binary code can be represented as 0011001001100000. The first two flags are used to fill the state update flag with a length of 2.
[0164] When the length of the high-order segment is three, three status update flags are filled into the high-order segment; one status update flag is used to indicate whether to synchronize the position information of the current time node, and the other two status update flags are used to indicate whether to synchronize the pitch angle or yaw angle of the current time node. The number of flag bits is 3, the timestamp variable has 13 bits, and the corresponding recorded time interval is 4 to 8 seconds.
[0165] When the length of the high-order segment is four, four status update flags are filled into the high-order segment; one status update flag is used to indicate whether to synchronously update the orientation information of the current time node, and the other three status update flags are used to indicate whether to synchronously update the three coordinate values in the three-dimensional coordinate system. The number of flag bits is 4, and the timestamp variable has 12 bits, corresponding to the recorded time interval of 2 to 4 seconds.
[0166] When the length of the high-order segment is greater than or equal to five, five status update flags are filled into the high-order segment; two status update flags are used to indicate whether to synchronize the pitch angle or yaw angle of the current time node, and the other three status update flags are used to indicate whether to synchronize the three coordinate values in the three-dimensional coordinate system. The number of flag bits is 5, and the timestamp variable has 11 bits, corresponding to the recorded time interval of 0 to 2 seconds.
[0167] Figure 7 The embodiment of the present application shows a coding bitmap including five identification bits in an application scenario. As shown in the figure, the identification bit only occupies 5 bits, so the remaining 11 bits can be used to store the timestamp, and the range of numbers that can be expressed is 0-2047 (2^11-1), that is, the maximum value of the synchronization timestamp can be expanded to 2047 milliseconds.
[0168] For example, assuming that the time change value is 2000 milliseconds (full data is synchronized once every 2 seconds), the binary number is 0000011111010000, where the first five coded bits correspond to the status update identifiers of position X, position Y, position Z, yaw angle Yaw, and pitch angle Pitch, respectively.
[0169] Figure 8The embodiment of the present application shows a coding bitmap including six identification bits in an application scenario. As shown in the figure, the identification bits occupy 6 bits, and the remaining 10 bits are used to store the timestamp. Among them, the first 5 identification bits are used to indicate that the data for selective synchronization are the XYZ coordinate values in the position information and the yaw angle Yaw and pitch angle Pitch in the orientation information.
[0170] For example, assuming the time change value is 300 milliseconds, the binary value is 0000000100101100. If you need to pass the XYZ coordinates, Yaw, and Pitch of the position, the binary value of the timestamp variable is 1111100100101100; if the X coordinate and Pitch value of the position are passed this time, the binary value of the timestamp variable is 1000100100101100.
[0171] The synchronous packet contains the most data, that is, all data needs to be sent, including the following data.
[0172] Timestamp: short data type, occupies 2 bytes.
[0173] Position: 3 short data, occupying 3*2=6 bytes.
[0174] Direction: 2 short data, occupying 2*2=4 bytes.
[0175] Total: 2+3*2+2*2=12 bytes.
[0176] In the case where the synchronization package contains the least data, for example, only one dimension value of one location needs to be sent, the data included is as follows.
[0177] Timestamp: short data type, occupies 2 bytes.
[0178] Position: 1 short data, occupying 1*2=2 bytes.
[0179] Direction: No change, out of sync.
[0180] Total: 2+1*2=4 bytes.
[0181] In actual situations, the range of dimension values that need to be synchronized is [1, 5], and the range of bytes in the synchronization package is [4, 12]. The calculation formula is as follows:
[0182] B=2+n*2, where n represents the number of synchronization dimension values and B represents the number of bytes.
[0183] In summary, in a stable environment with 20 synchronizations per second, the size of the data packet that needs to be synchronized before the optimization scheme is 20*28=560 bytes, with 1 second as the unit. However, the maximum size of the data packet that needs to be synchronized using this scheme is 1*28+19*12=256 bytes (1 calibration synchronization, 19 incremental synchronizations), and the minimum is only 1*28+19*4=104 bytes (1 calibration synchronization, 19 incremental synchronizations), which greatly reduces the size of the synchronization data packet.
[0184] The embodiment of the present application is based on an incremental synchronization algorithm within 1 second, which reduces the range of changes in the synchronization data, and converts float type data into short type through a downgrading mapping algorithm, which greatly reduces the amount of synchronization data. Adding a threshold for the synchronization field can eliminate some unchanged or slightly changed data, and using the bytes occupied by the timestamp variable to split the high-order placement flag bit can further reduce the amount of synchronization data.
[0185] It should be noted that although the steps of the method in the present application are described in a specific order in the drawings, this does not require or imply that the steps must be performed in this specific order, or that all the steps shown must be performed to achieve the desired results. Additionally or alternatively, some steps may be omitted, multiple steps may be combined into one step, and / or one step may be decomposed into multiple steps, etc.
[0186] The following introduces an apparatus embodiment of the present application, which can be used to execute the state synchronization method of the metaverse role in the above-mentioned embodiment of the present application. Fig. 9 The structure block diagram of the state synchronization device of the metaverse role provided in the embodiment of the present application is schematically shown. Fig. 9 As shown, the state synchronization device 900 of the metaverse role includes:
[0187] A first acquisition module 910 is configured to acquire state data of a Metaverse character at a current time node, wherein the state data includes position information and orientation information of the Metaverse character in the Metaverse space;
[0188] A second acquisition module 920 is configured to acquire a time difference between the current time node and a previous calibration synchronization time node, where the calibration synchronization time node is a time node for calibrating and updating an absolute value of the status data;
[0189] The third acquisition module 930 is configured to acquire a relative value of the status data of the current time node relative to the previous time node if the time difference is less than a preset time difference threshold;
[0190] A generating module 940 is configured to generate a state update identifier according to the relative value of the state data, wherein the state update identifier is used to indicate whether to synchronously update the state data of the current time node;
[0191] The filling module 950 is configured to fill the status update identifier and the time difference into a coding bitmap with a specified number of bytes, and to form a data packet for synchronizing the status of the metaverse role with the relative numerical values of the coding bitmap and the status data.
[0192] In some embodiments of the present application, based on the above technical solution, the filling module 950 includes:
[0193] A duration interval acquisition module is configured to acquire a duration interval where the time difference threshold is located, wherein the duration interval is used to represent different duration ranges;
[0194] A coding bitmap generation module is configured to generate a coding bitmap with a specified number of bytes according to the duration interval, wherein the coding bitmap includes a high-order segment distributed in the front and a low-order segment distributed in the back;
[0195] The data filling module is configured to fill the status update identifier into the high-order segment and fill the time difference into the low-order segment.
[0196] In some embodiments of the present application, based on the above technical solution, the coding bitmap generation module is further configured to: obtain the bit length corresponding to the duration interval, and the bit length is positively correlated with the maximum value in the duration interval; generate a coding bitmap with a specified number of bytes according to the bit length, and the length of the low-bit segment in the coding bitmap is equal to the bit length.
[0197] In some embodiments of the present application, based on the above technical solution, the data filling module is further configured to: determine the length of the high-order segment according to the specified number of bytes and the length of the low-order segment; and fill the status update identifier into the high-order segment according to the length of the high-order segment.
[0198] In some embodiments of the present application, based on the above technical solution, the position information includes three coordinate values in a three-dimensional coordinate system, and the orientation information includes a pitch angle and a yaw angle; the data filling module is further configured to: when the length of the high-order segment is two, fill the high-order segment with two of the status update identifiers; wherein, one status update identifier is used to indicate whether to synchronously update the position information of the current time node, and the other status update identifier is used to indicate whether to synchronously update the orientation information of the current time node; when the length of the high-order segment is three, fill the high-order segment with three of the status update identifiers; wherein, one status update identifier is used to indicate whether to synchronously update the position information of the current time node, and the other two status update identifiers are used to indicate whether to synchronously update the orientation information of the current time node. They are respectively used to indicate whether the pitch angle or yaw angle of the current time node is synchronously updated; when the length of the high-order segment is four, the high-order segment is filled with four status update identifiers; wherein, one status update identifier is used to indicate whether the orientation information of the current time node is synchronously updated, and the other three status update identifiers are respectively used to indicate whether the three coordinate values in the three-dimensional coordinate system are synchronously updated; when the length of the high-order segment is greater than or equal to five, the high-order segment is filled with five status update identifiers; wherein, two status update identifiers are respectively used to indicate whether the pitch angle or yaw angle of the current time node is synchronously updated, and the other three status update identifiers are respectively used to indicate whether the three coordinate values in the three-dimensional coordinate system are synchronously updated.
[0199] In some embodiments of the present application, based on the above technical solution, the generation module includes:
[0200] A first generating module is configured to generate a state update identifier with a first value as the value when the relative value of the state data is greater than a preset threshold, wherein the state update identifier with the first value as the value is used to indicate that the state data of the current time node is synchronously updated;
[0201] The second generating module is configured to generate a state update identifier with a second value when the relative value of the state data is less than a preset threshold, and the state update identifier with the second value is used to indicate to abandon the synchronous update of the state data of the current time node.
[0202] In some embodiments of the present application, based on the above technical solution, the device further includes:
[0203] A mapping module is configured to determine the numerical variation range of the status data according to the time difference threshold; determine a mapping ratio according to the numerical variation range and a preset byte length, the mapping ratio being used to map a floating-point number corresponding to the numerical variation range to a short integer corresponding to the byte length; and map the relative numerical value of the status data from a floating-point number to a short integer according to the mapping ratio.
[0204] In some embodiments of the present application, based on the above technical solution, the mapping ratio is calculated by the following formula:
[0205]
[0206] Among them, P is the mapping ratio, ByteNum is the byte length, MaxValue is the maximum value in the numerical variation range, and MinValue is the minimum value in the numerical variation range.
[0207] In some embodiments of the present application, based on the above technical solution, the mapping module is further configured to perform mapping processing on the status data according to the following formula:
[0208] Value=[(Input-MinValue)×P+0.5]
[0209] Among them, Input is the relative value of the status data in floating point format, and Value is the relative value of the status data in short integer format.
[0210] The specific details of the state synchronization device of the metaverse role provided in each embodiment of the present application have been described in detail in the corresponding method embodiments and will not be repeated here.
[0211] Fig.10 The structure block diagram of a computer system for implementing an electronic device according to an embodiment of the present application is schematically shown.
[0212] It should be noted that Fig.10 The computer system 1000 of the electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0213] like Fig.10As shown, the computer system 1000 includes a central processing unit 1001 (CPU), which can perform various appropriate actions and processes according to the program stored in the read-only memory 1002 (ROM) or the program loaded from the storage part 1008 to the random access memory 1003 (RAM). Various programs and data required for system operation are also stored in the random access memory 1003. The central processing unit 1001, the read-only memory 1002 and the random access memory 1003 are connected to each other through a bus 1004. The input / output interface 1005 (Input / Output interface, i.e., I / O interface) is also connected to the bus 1004.
[0214] The following components are connected to the input / output interface 1005: an input section 1006 including a keyboard, a mouse, etc.; an output section 1007 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 1008 including a hard disk, etc.; and a communication section 1009 including a network interface card such as a LAN card, a modem, etc. The communication section 1009 performs communication processing via a network such as the Internet. A drive 1010 is also connected to the input / output interface 1005 as needed. A removable medium 1011, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 1010 as needed, so that a computer program read therefrom is installed into the storage section 1008 as needed.
[0215] In particular, according to an embodiment of the present application, the process described in each method flow chart can be implemented as a computer software program. For example, an embodiment of the present application includes a computer program product, which includes a computer program carried on a computer readable medium, and the computer program contains a program code for executing the method shown in the flow chart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 1009, and / or installed from the removable medium 1011. When the computer program is executed by the central processor 1001, various functions defined in the system of the present application are executed.
[0216] It should be noted that the computer-readable medium shown in the embodiment of the present application may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, a system, device or device of electricity, magnetism, light, electromagnetic, infrared, or semiconductor, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a flash memory, an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, a computer-readable storage medium may be any tangible medium containing or storing a program, which may be used by an instruction execution system, device or device or used in combination with it. In the present application, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, wherein a computer-readable program code is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer readable signal media may also be any computer readable medium other than computer readable storage media, which may send, propagate, or transmit programs for use by or in conjunction with an instruction execution system, apparatus, or device. The program code contained on the computer readable medium may be transmitted using any suitable medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.
[0217] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the above-mentioned module, program segment or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0218] It should be noted that, although several modules or units of the equipment for action execution are mentioned in the above detailed description, this division is not mandatory. In fact, according to the embodiments of the present application, the features and functions of two or more modules or units described above can be embodied in one module or unit. On the contrary, the features and functions of one module or unit described above can be further divided into being embodied by multiple modules or units.
[0219] Through the description of the above implementation methods, it is easy for those skilled in the art to understand that the example implementation methods described here can be implemented by software or by combining software with necessary hardware. Therefore, the technical solution according to the implementation methods of the present application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which can be a personal computer, a server, a touch terminal, or a network device, etc.) to execute the method according to the implementation methods of the present application.
[0220] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the invention disclosed herein. The present application is intended to cover any modification, use or adaptation of the present application, which follows the general principles of the present application and includes common knowledge or customary technical means in the art that are not disclosed in the present application.
[0221] It should be understood that the present application is not limited to the precise structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.
Claims
1. A method for synchronizing the status of a metaverse role. It is characterized in that include: Obtaining state data of a Metaverse character at a current time node, wherein the state data includes position information and orientation information of the Metaverse character in the Metaverse space; Obtaining a time difference between the current time node and a previous calibration synchronization time node, wherein the calibration synchronization time node is a time node for calibrating and updating an absolute value of the status data; If the time difference is less than a preset time difference threshold, obtaining a relative value of the status data of the current time node relative to the previous time node; Generate a status update identifier according to the relative value of the status data, wherein the status update identifier is used to indicate whether to synchronously update the status data of the current time node; The state update identifier and the time difference are filled into a coding bitmap with a specified number of bytes, and the relative numerical values of the coding bitmap and the state data are combined into a data packet for synchronizing the state of the metaverse character.
2. The method according to claim 1, It is characterized in that Filling the status update identifier and the time difference into a coding bitmap having a specified number of bytes includes: Obtain a duration interval where the time difference threshold is located, where the duration interval is used to represent different duration ranges; Generate a coding bitmap with a specified number of bytes according to the duration interval, wherein the coding bitmap includes a high-order segment distributed in the front and a low-order segment distributed in the back; The status update identifier is filled into the high-order segment, and the time difference is filled into the low-order segment.
3. The method according to claim 2, It is characterized in that Generating a coding bitmap with a specified number of bytes according to the duration interval, including: Acquire a bit length corresponding to the duration interval, wherein the bit length is positively correlated with a maximum value in the duration interval; A coding bitmap with a specified number of bytes is generated according to the bit length, and the length of the low-order segment in the coding bitmap is equal to the bit length.
4. The method according to claim 3, It is characterized in that Filling the status update flag into the high bit segment includes: Determine the length of the high-order segment according to the specified number of bytes and the length of the low-order segment; The state update flag is filled into the high-order segment according to the length of the high-order segment.
5. The method according to claim 4, It is characterized in that The position information includes three coordinate values in a three-dimensional coordinate system, and the orientation information includes a pitch angle and a yaw angle; and filling the status update flag into the high segment according to the length of the high segment, including: When the length of the high-order segment is two, two state update identifiers are filled into the high-order segment; wherein one state update identifier is used to indicate whether to synchronously update the position information of the current time node, and the other state update identifier is used to indicate whether to synchronously update the orientation information of the current time node; When the length of the high-order segment is three, three state update identifiers are filled into the high-order segment; wherein one state update identifier is used to indicate whether to synchronously update the position information of the current time node, and the other two state update identifiers are used to indicate whether to synchronously update the pitch angle or the yaw angle of the current time node; When the length of the high-order segment is four, four state update identifiers are filled into the high-order segment; wherein one state update identifier is used to indicate whether to synchronously update the orientation information of the current time node, and the other three state update identifiers are respectively used to indicate whether to synchronously update the three coordinate values in the three-dimensional coordinate system; When the length of the high-order segment is greater than or equal to five, five status update identifiers are filled into the high-order segment; wherein, two status update identifiers are respectively used to indicate whether the pitch angle or yaw angle of the current time node is synchronously updated, and the other three status update identifiers are respectively used to indicate whether the three coordinate values in the three-dimensional coordinate system are synchronously updated.
6. The method according to any one of claims 1 to 5, It is characterized in that Generating a state update identifier according to the relative value of the state data includes: When the relative value of the state data is greater than a preset threshold, a state update identifier with a value of a first value is generated, and the state update identifier with a value of the first value is used to indicate that the state data of the current time node is synchronously updated; When the relative value of the state data is less than a preset threshold, a state update identifier with a second value is generated, and the state update identifier with the second value is used to indicate to abandon the synchronous update of the state data of the current time node.
7. The method according to any one of claims 1 to 5, It is characterized in that Before generating a status update identifier according to the relative value of the status data, the method further includes: Determine a value variation range of the status data according to the time difference threshold; Determining a mapping ratio according to the numerical variation range and a preset byte length, the mapping ratio being used to map a floating-point number corresponding to the numerical variation range into a short integer corresponding to the byte length; The relative numerical value of the state data is mapped from a floating point number to a short integer according to the mapping ratio.
8. The method according to claim 7, It is characterized in that The mapping ratio is calculated by the following formula: Among them, P is the mapping ratio, ByteNum is the byte length, MaxValue is the maximum value in the numerical variation range, and MinValue is the minimum value in the numerical variation range.
9. The method according to claim 8, It is characterized in that Mapping the relative value of the state data from a floating point number to a short integer according to the mapping ratio includes mapping the state data according to the following formula: Value=[(Input-MinValue)×P+0.5] Among them, Input is the relative value of the status data in floating point format, and Value is the relative value of the status data in short integer format.
10. An electronic device, It is characterized in that include: processor; as well as A memory, configured to store executable instructions of the processor; The processor is configured to execute the executable instructions to implement the method according to any one of claims 1 to 9.
Citation Information
Cited By
Data synchronization method, electronic equipment, computer storage medium and program product
CN120763255A
