Water pressure determination method and device in virtual world, electronic device and storage medium

By determining the target area based on the location of the virtual character in the virtual world and updating the water pressure value of the block in real time, the problem of large computational load and high performance consumption in the existing technology is solved, and efficient water pressure determination is achieved.

CN116020123BActive Publication Date: 2026-07-14MINI CREATIVE TECH (SHENZHEN) CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
MINI CREATIVE TECH (SHENZHEN) CO LTD
Filing Date
2022-12-01
Publication Date
2026-07-14

AI Technical Summary

Technical Problem

In the virtual world, current technology determines water pressure by calculating the depth difference at each location, resulting in a huge amount of computation on the server and enormous performance consumption.

Method used

Based on the virtual character's location information, the target area is determined, and the water pressure value of each block is calculated through frame-by-frame processing. The three-dimensional position coordinates and water pressure values ​​of the blocks are cached, and the water pressure values ​​are updated in real time to reduce the amount of calculation.

Benefits of technology

By reducing the computational load on the server, performance consumption is reduced, and the efficiency of water pressure determination in the virtual world is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116020123B_ABST
    Figure CN116020123B_ABST
Patent Text Reader

Abstract

The application provides a water pressure determination method and device in a virtual world, electronic equipment and a storage medium. The method comprises the following steps: determining a target area according to position information of a virtual role in the virtual world; calculating water pressure values of each block in the target area through frame division processing; caching a first array, the first array comprising three-dimensional position coordinates and corresponding water pressure values of each block; obtaining a position change amount of the virtual role in real time; and updating the three-dimensional position coordinates and corresponding water pressure values of each block in the first array in real time according to the position change amount. After the three-dimensional position coordinates and corresponding water pressure values of each block in a surrounding area of the virtual role are calculated according to the position information of the virtual role in the virtual world, the three-dimensional position coordinates and corresponding water pressure values of each block can be updated in real time according to the position change amount of the virtual role obtained in real time, so that the calculation amount of the server can be greatly reduced, and the performance consumption can be reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular to a method, apparatus, electronic device and storage medium for determining water pressure in a virtual world. Background Technology

[0002] In virtual world applications, the virtual world includes virtual models. Virtual models are used to simulate the real world, such as car models, mountain models, house models, lake models, etc. Taking sandbox world applications as an example, the sandbox world is composed of various blocks of the same size, including water blocks, earth blocks, etc. In related technologies, the water pressure value at a certain location can be described by calculating the depth difference from a predetermined height. However, this method of determining water pressure requires the server to obtain the depth difference of each location in order to determine the water pressure value at the corresponding location, which involves a huge amount of computation and consumes a lot of performance. Summary of the Invention

[0003] The main objective of this application is to provide a method, apparatus, electronic device, and storage medium for determining water pressure in a virtual world. The aim is to adjust the water pressure value around a virtual character based on changes in the character's position within the virtual world, thereby significantly reducing server computation and performance consumption.

[0004] To achieve the above objectives, a first aspect of this application proposes a method for determining water pressure in a virtual world, wherein the virtual world is composed of various blocks of the same size, the method comprising:

[0005] The target area is determined based on the location information of the virtual characters in the virtual world;

[0006] The water pressure value of each block in the target area is calculated by frame segmentation processing;

[0007] The first array is cached, which includes the three-dimensional position coordinates of each block and the corresponding water pressure value;

[0008] Real-time acquisition of the virtual character's position change;

[0009] Based on the change in position, the three-dimensional position coordinates and corresponding water pressure values ​​of each block in the first array are updated in real time.

[0010] In some embodiments, determining the target area based on the location information of the virtual character in the virtual world includes:

[0011] Obtain the position coordinates of the virtual character in the virtual world;

[0012] The target area is selected based on the position coordinates of the virtual character and a preset size.

[0013] In some embodiments, the step of calculating the water pressure value of each block in the target area through frame-by-frame processing includes:

[0014] The target region is divided into several planes by frame segmentation, and each plane includes several squares.

[0015] The water pressure value of each block in the first plane is calculated based on the maximum height reached by connecting each block upwards in the first plane. The first plane is any plane in the target area.

[0016] Based on the water pressure value of each block in the first plane, the water pressure value of each block in the target area other than the first plane is calculated.

[0017] In some embodiments, the cache first array includes:

[0018] Obtain the three-dimensional position coordinates of each block in the target area;

[0019] The three-dimensional position coordinates and corresponding water pressure values ​​of each block are cached into a first array.

[0020] In some embodiments, after updating the three-dimensional position coordinates and corresponding water pressure values ​​of each block in the first array in real time based on the position change, the method includes:

[0021] The three-dimensional position coordinates and corresponding water pressure values ​​of each block in the first array are verified at preset time intervals.

[0022] When the verification error exceeds the preset range, the actual three-dimensional position coordinates and the corresponding actual water pressure value of each block obtained from the verification calculation are replaced in the first array.

[0023] In some embodiments, the step of verifying the three-dimensional position coordinates and corresponding water pressure values ​​of each block in the first array at preset time intervals includes:

[0024] The first position is obtained at preset time intervals, and the first position is the current position of the virtual character;

[0025] A first region is obtained by selecting a region with the first position as the center and according to a preset size;

[0026] The three-dimensional position coordinates of each block in the first region are obtained as the actual three-dimensional position coordinates;

[0027] By using frame segmentation processing, the water pressure value corresponding to each block in the first region is calculated as the actual water pressure value;

[0028] The second array is cached, and the second array includes the actual three-dimensional position coordinates of each of the blocks in the first region and the corresponding actual water pressure value;

[0029] Based on the second array, the three-dimensional position coordinates and corresponding water pressure values ​​of each block in the first array are verified.

[0030] In some embodiments, when the verification error exceeds a preset range, replacing the actual three-dimensional position coordinates and corresponding actual water pressure values ​​of each of the blocks obtained from the verification calculation into the first array includes:

[0031] When the difference between the three-dimensional position coordinates of each block in the first array and the actual three-dimensional position coordinates of each block in the second array exceeds a first preset range, or when the difference between the water pressure value corresponding to each block in the first array and the actual water pressure value corresponding to each block in the second array exceeds a second preset range, it is determined that the verification error exceeds the preset range.

[0032] Replace the data in the second array with the data in the first array.

[0033] To achieve the above objectives, a second aspect of this application provides a water pressure determination device in a virtual world, the device comprising:

[0034] The determination module is used to determine the target area based on the location information of the virtual characters in the virtual world;

[0035] The calculation module is used to calculate the water pressure value of each block in the target area through frame-by-frame processing;

[0036] A caching module is used to cache a first array, which includes the three-dimensional position coordinates of each block and the corresponding water pressure value.

[0037] The acquisition module is used to acquire the position change of the virtual character in real time;

[0038] The update module is used to update the three-dimensional position coordinates and corresponding water pressure value of each block in the first array in real time according to the position change.

[0039] To achieve the above objectives, a third aspect of this application provides an electronic device, which includes a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the method described in the first aspect.

[0040] To achieve the above objectives, a fourth aspect of the present application provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the method described in the first aspect.

[0041] This application proposes a method, apparatus, electronic device, and storage medium for determining water pressure in a virtual world. The method includes: determining a target area based on the position information of a virtual character in the virtual world; calculating the water pressure value of each block in the target area through frame-by-frame processing; caching a first array, which includes the three-dimensional position coordinates and corresponding water pressure value of each block; acquiring the position change of the virtual character in real time; and updating the three-dimensional position coordinates and corresponding water pressure value of each block in the first array in real time based on the position change. After calculating the three-dimensional position coordinates and corresponding water pressure value of each block in the area surrounding the virtual character based on the position information of the virtual character in the virtual world, the three-dimensional position coordinates and corresponding water pressure value of each block can be updated in real time based on the acquired position change of the virtual character, which can greatly reduce the computational load of the server and reduce performance consumption. Attached Figure Description

[0042] Figure 1 This is a flowchart illustrating the steps of a method for determining water pressure in a virtual world, as provided in an embodiment of this application.

[0043] Figure 2 This is a flowchart of the steps for determining a target area based on the location information of a virtual character in a virtual world, provided in an embodiment of this application.

[0044] Figure 3 This is an example diagram of the target area provided in the embodiments of this application;

[0045] Figure 4 This is a flowchart of the steps for calculating the water pressure value of each block in the target area through frame processing, as provided in the embodiments of this application.

[0046] Figure 5 This is an example diagram of the 31st plane provided in the embodiments of this application;

[0047] Figure 6 This is a planar representation of the target area moving along with the virtual character, as provided in the embodiments of this application.

[0048] Figure 7 This is a flowchart of the steps performed after updating the three-dimensional position coordinates and corresponding water pressure values ​​of each block in the first array in real time according to the position change, as provided in the embodiments of this application.

[0049] Figure 8This is a flowchart illustrating the steps of verifying the three-dimensional position coordinates and corresponding water pressure values ​​of each block in the first array at preset time intervals, as provided in this application embodiment.

[0050] Figure 9 This is a schematic diagram of the structure of the water pressure determination device in the virtual world provided in the embodiments of this application;

[0051] Figure 10 This is a schematic diagram of the hardware structure of the electronic device provided in the embodiments of this application. Detailed Implementation

[0052] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0053] It should be noted that although functional modules are divided in the device schematic diagram and a logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in a different order than the module division in the device or the order in the flowchart. The terms "first," "second," etc., in the specification, claims, and the aforementioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence.

[0054] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing embodiments of this application only and is not intended to limit this application.

[0055] Virtual world: A virtual world displayed (or provided) by an application when it runs on a terminal. This virtual world can be a simulation of the real world, a semi-simulated / semi-fictional world, or a purely fictional world. A virtual world can be any of a two-dimensional virtual world, a 2.5-dimensional virtual world, or a three-dimensional virtual world; this application does not limit it in this regard. The following embodiments illustrate this using a three-dimensional virtual world as an example.

[0056] Virtual models are models used in a virtual world to mimic the real world. For example, a virtual model occupies a certain volume in the virtual world. Exemplary virtual models include: terrain models, building models, plant and animal models, virtual prop models, virtual vehicle models, and virtual character models. For instance, terrain models include: ground, mountains, rivers, rocks, steps, etc.; building models include: houses, walls, containers, and fixed facilities inside buildings: tables, chairs, cabinets, beds, etc.; plant and animal models include: trees, flowers, birds, etc.; virtual prop models include: guns, first-aid kits, airdrops, etc.; virtual vehicle models include: cars, ships, helicopters, etc.; and virtual character models include: people, animals, anime characters, etc.

[0057] Virtual characters: These are movable objects in a virtual world. These movable objects can be virtual characters, virtual animals, anime characters, etc., such as people, animals, plants, oil drums, walls, and rocks displayed in a 3D virtual world. Optionally, virtual characters are 3D models created based on animation skeletal technology. Each virtual character has its own shape and volume in the 3D virtual world, occupying a portion of the space within that world.

[0058] The method provided in this application can be applied to applications that support virtual worlds. For example, an application that supports virtual worlds is one in which a user can control a virtual character to move within a virtual world. For example, the method provided in this application can be applied to any of the following applications: virtual reality applications, augmented reality (AR) applications, 3D mapping applications, military simulation applications, virtual reality games, augmented reality games, first-person shooter (FPS) games, third-person shooter (TPS) games, and multiplayer online battle arena (MOBA) games.

[0059] For example, a game in a virtual world consists of maps of one or more game worlds. The virtual world in the game simulates scenes from the real world. Users can control virtual characters in the game to perform actions such as walking, running, jumping, shooting, fighting, driving, using virtual weapons to attack other virtual characters, and charging up virtual weapons to attack other virtual characters. The game is highly interactive, and multiple users can team up online to play competitive games.

[0060] In some embodiments, the aforementioned application may be a shooting game, racing game, role-playing game, adventure game, sandbox game, tactical competitive game, military simulation program, etc. The client can support at least one of the following operating systems: Windows, macOS, Android, iOS, and Linux, and clients on different operating systems can communicate with each other. In some embodiments, the aforementioned client is a program suitable for mobile terminals with touchscreens.

[0061] In some embodiments, the client described above is an application developed based on a 3D engine, such as the Unity engine.

[0062] The terminal in this application can be a desktop computer, a laptop computer, a mobile phone, a tablet computer, an e-book reader, an MP3 (Moving Picture Experts Group Audio Layer III) player, an MP4 (Moving Picture Experts Group Audio Layer IV) player, etc. This terminal has an application installed and running that supports virtual worlds, such as an application supporting 3D virtual worlds. This application can be any of the following: a battle royale (BR) game, a virtual reality application, an augmented reality application, a 3D map application, a military simulation application, a third-person shooter game, a first-person shooter game, or a multiplayer online battle royale game. Optionally, the application can be a standalone application, such as a standalone 3D game application, or an online multiplayer application.

[0063] This application takes a sandbox world application as an example. The sandbox world is composed of various blocks of the same size, including water blocks, earth blocks, etc. In related technologies, the water pressure value at a certain location can be described by calculating the depth difference between a certain location and the predetermined height. However, in this way of determining water pressure, the server needs to obtain the depth difference of each location in order to determine the water pressure value at the corresponding location. The amount of calculation is huge and the performance consumption is enormous.

[0064] To solve the above technical problems, refer to Figure 1 , Figure 1 This is a flowchart of a method for determining water pressure in a virtual world provided in an embodiment of this application, including but not limited to steps S101 to S105.

[0065] Step S101: Determine the target area based on the location information of the virtual character in the virtual world.

[0066] In this embodiment, the location information of the virtual character is first obtained, and then a certain range is determined as the target area based on the location information of the virtual character. That is, the selected target area is related to the location of the virtual character, rather than directly selecting rivers, lakes, etc., in the virtual world and then directly calculating the water pressure of the rivers and lakes. The reason is that during gameplay, the rendering of creatures and the calculation of weather or water pressure should revolve around the virtual character in the game; otherwise, it would be some invalid calculation and rendering. For example, directly selecting a lake on the map and then calculating the water pressure value of that lake is meaningless if the virtual character is not necessarily located at or around that lake. Conversely, by calculating the water pressure value of the area surrounding the virtual character based on the location information of the virtual character in the virtual world, it is possible to understand the rate at which the virtual character consumes stamina and oxygen under different water pressure values. It can also guide the use of appropriate equipment to cross the area under different water pressure values.

[0067] It should be noted that when there is no water flow within a certain range of the location of a virtual character in the virtual world, such as no river or lake, the water pressure value of each block in the target area is determined to be 0.

[0068] Reference Figure 2 , Figure 2 This is a flowchart of steps for determining a target area based on the location information of a virtual character in a virtual world, provided in an embodiment of this application, including but not limited to steps S201 to S202.

[0069] Step S201: Obtain the position coordinates of the virtual character in the virtual world;

[0070] Step S202: Using the virtual character's position coordinates as the center, select the target area according to the preset size.

[0071] In this embodiment, the server can first obtain the location coordinates of the virtual character in the virtual world, and then select the target area with the location coordinates as the center according to the preset size.

[0072] For example, refer to Figure 3 , Figure 3 This is an example diagram of the target area provided in the embodiment of this application. In this embodiment, the virtual character's position is taken as the center, and the preset size is set to 32*32*32. The selected 32*32*32 cube is the target area, and the virtual character is located at the center of this 32*32*32 cube.

[0073] It is understood that, in the embodiments of this application, the preset size is generally a cube for ease of calculation, but the embodiments of this application do not specifically limit the preset size. The preset size can be adjusted according to specific circumstances and actual needs. For example, the preset size can also be set to 64*64*64. However, the range of preset size settings should not be too large.

[0074] Step S102: Calculate the water pressure value of each block in the target area through frame segmentation.

[0075] In this embodiment of the application, after selecting the target area, the target area can be further divided into several planes through frame processing, and the water pressure value of each block in each plane can be calculated to obtain the water pressure value of each block in the target area.

[0076] Reference Figure 4 , Figure 4 This is a flowchart of the steps for calculating the water pressure value of each block in the target area through frame processing, provided in the embodiments of this application, including but not limited to steps S401 to S403.

[0077] Step S401: The target area is processed by frame segmentation to obtain several planes, each plane including several squares;

[0078] Step S402: Calculate the water pressure value of each block in the first plane based on the maximum height reached by connecting each block upwards. The first plane is any plane in the target area.

[0079] Step S403: Using the water pressure value of each block in the first plane as a reference, calculate the water pressure value of each block in the target area other than the first plane.

[0080] In this embodiment, the target area is first divided into several planes through frame segmentation. Taking a target area as a 32*32*32 cube as an example, frame segmentation can divide the target area into 32 planes from 0 to 31, each containing 32*32 cubes. If the bottom plane of the target area is designated as plane 0, then the plane where the virtual character is located is plane 15, and the top plane of the target area is plane 31. (Refer to...) Figure 5 , Figure 5 This is an example diagram of the 31st plane provided in an embodiment of this application, which contains 32*32 squares. The other planes are the same as the 31st plane, also containing 32*32 squares.

[0081] It should be noted that all 32*32*32 blocks in the target area can be water blocks, some can be water blocks, or none of them can be water blocks. When the calculated water pressure value corresponding to each block in the target area is 0, it means that there are no water blocks in the target area, that is, there is no water flow within a certain range of the virtual character's location.

[0082] It's important to note that in the virtual world, water pressure is related to depth, not flow rate. Therefore, only the water depth needs to be calculated. The water depth is related to the connection between water blocks; the depth increases with each subsequent connection to a water block, but the depth does not increase with connections to water blocks at the same height.

[0083] Next, calculate the water pressure value for each square in any plane within the target area. For example, select plane 31, which is the topmost plane in the target area. Calculate the water pressure value for each square in plane 31.

[0084] Since the sandbox world is composed of blocks, when calculating the water pressure value of a single block, a large area is defined centered on that block. The maximum height that can be reached by connecting water blocks is then found; that is, the highest water block connected to this plane is identified. The vertical distance from this highest water block to the plane is calculated as the depth, and the water pressure value is then calculated based on this depth. In this embodiment, considering that traversing excessively large block planes may not meet performance requirements, a standard size can be pre-set, such as 5*5. That is, when calculating the water pressure value of a certain block, a 5*5 plane is first selected centered on that block, then the maximum height that can be reached by connecting water blocks is found, and the water pressure value of that block is calculated based on this maximum height. It should be noted that the height value is positively correlated with the water pressure value; that is, the higher the height, the greater the water pressure value.

[0085] Based on the method for calculating the water pressure value of a single block, the water pressure value of each block in plane 31 can be calculated. Then, using the water pressure value of each block in plane 31 as a reference, the water pressure value of each block from plane 0 to plane 30 is calculated. For example, when calculating the water pressure value of each block in plane 30, first determine that the water pressure value corresponding to block P in plane 31 is A. If the block P′ in plane 30 corresponding to block P in plane 31 is a water block, then the water pressure value corresponding to block P′ in plane 30 is A+1. That is, add 1 to the water pressure value of the block corresponding to the above upper plane. If the block P′ in plane 30 is not a water block, then the water pressure value corresponding to block P′ in plane 30 is recorded as 0. In this way, the water pressure value of each block corresponding to plane 30 can be determined based on the water pressure value corresponding to each block in plane 31.

[0086] It's important to note that during the calculation, if the water pressure value corresponding to block P in plane 31 is 0 (meaning block P in plane 31 is not a water block), but block P′ in plane 30 (the plane below block P in plane 31) is a water block, the water pressure value corresponding to block P′ cannot be obtained solely from the water pressure value corresponding to block P in the upper plane. In this case, it's necessary to further obtain the water pressure values ​​of the adjacent left and right blocks of block P′ in plane 30 to determine the water pressure value corresponding to block P′. Specifically, if the water pressure values ​​of the adjacent left and right blocks of block P′ are both 0, then block P′ is taken as the initial water block, and its water pressure value is recorded as 1. If the water pressure values ​​of the adjacent left and right blocks of block P′ are not 0, for example, if the water pressure value of the adjacent left block of block P′ is 8 and the water pressure value of the adjacent right block of block P′ is 9, then the water pressure value corresponding to block P′ is determined to be the larger water pressure value, 9. If either the water pressure value of the adjacent left-hand block or the adjacent right-hand block of block P′ is not zero, for example, if the water pressure value of the adjacent left-hand block of block P′ is 8 and the water pressure value of the adjacent right-hand block of block P′ is 0, then the water pressure value corresponding to block P′ is determined to be 8. Following this method, the water pressure value of each block corresponding to the 30th plane can be calculated.

[0087] After calculating the water pressure value for each block corresponding to plane 30, the same method is used to calculate the water pressure value for each block corresponding to plane 29. This process is repeated for each block from plane 30 to plane 0, ultimately yielding the water pressure value for each block in the target area.

[0088] It should be noted that when the selected first plane is not the topmost plane in the target area, for example, when the 15th plane, i.e., the plane where the virtual character is located, is selected, the water pressure value corresponding to each block in the 15th plane is calculated first using the same method as for a single block. Then, using the water pressure value of each block in the 15th plane as a base, the water pressure value corresponding to each block in the 14th plane is calculated first, and then the water pressure value corresponding to each block in the 13th plane is derived from the water pressure value of each block in the 14th plane. The same method is used to calculate the water pressure value corresponding to each block in the 14th to 0th planes. Next, using the water pressure value of each block in the 15th plane as a base, the water pressure value of each block in the 16th plane is derived upwards. For example, if the water pressure value of block D in the 15th plane is B, then if the block D′ in the 16th plane corresponding to block D in the 15th plane is a water block, then the water pressure value of block P′ in the 16th plane is B-1. That is, subtract 1 from the water pressure value of the block corresponding to the lower plane. If block D′ in plane 16 is not a water block, then the water pressure value corresponding to block D′ in plane 16 is recorded as 0. In this way, the water pressure value of each block corresponding to plane 16 can be determined based on the water pressure value of each block in plane 15. Then, by deducing upwards, the water pressure value of each block in planes 16 to 31 can be obtained.

[0089] Step S103: Cache the first array, which includes the three-dimensional position coordinates of each block and the corresponding water pressure value.

[0090] In this embodiment, after calculating the water pressure value of each block in the target area, the three-dimensional position coordinates of each water block in the target area are obtained. Then, the three-dimensional position coordinates and the corresponding water pressure value of each block in the target area are stored as a first array.

[0091] For example, if the target area is a 32*32*32 cube, then the first array includes the three-dimensional position coordinates of these 32*32*32 cubes and the corresponding water pressure values.

[0092] Step S104: Real-time acquisition of the virtual character's position change.

[0093] In this embodiment, since the virtual character is constantly moving in the virtual world, its position changes in real time. When the position of the virtual character changes, if a new target area is determined based on the changed position of the virtual character, and then the water pressure value corresponding to each block in the new target area is calculated, the amount of computation will be very large, and the corresponding server performance consumption will also be very high.

[0094] In this embodiment of the application, in order to reduce the amount of computation, when the position of the virtual character changes, it is only necessary to obtain the change in the position of the virtual character, and then adjust the three-dimensional position coordinates and the corresponding water pressure value of each block in the target area according to the position variable.

[0095] Step S105: Based on the change in position, update the three-dimensional position coordinates and corresponding water pressure value of each block in the first array in real time.

[0096] In this embodiment, the original position coordinates of the virtual character are (X, Y, Z). The current position coordinates of the virtual character after movement are obtained, for example, (X+D, Y, Z). It can be seen that the virtual character has moved a distance D in the X direction. At this time, the change in the virtual character's position is (D, 0, 0). At this time, the three-dimensional coordinates and corresponding water pressure values ​​of each block in the first array will also change accordingly. Specifically, the three-dimensional coordinates of each block in the first array and the coordinate system defining each block will move along with the virtual character's movement, thus manifesting as the target area and its coordinate system moving along with the virtual character. Since the coordinate system also moves, the actual three-dimensional coordinates of each block in the target area remain unchanged. However, the world coordinate system remains fixed. That is, although the three-dimensional position coordinates of each block in the cached target area remain unchanged, from the perspective of the world coordinate system, the three-dimensional position coordinates of each block in the target area will actually move along with the virtual character's movement.

[0097] For example, refer to Figure 6 , Figure 6 This is a planar representation of the target area moving along with the virtual character, as provided in this embodiment of the application. When the virtual character moves a distance of 3 blocks in the X direction, i.e., the position change is (3, 0, 0), the entire 32*32*32 cube of the target area, along with its coordinate system, will also move a distance of 3 blocks in the X direction. For the first array, this essentially involves inserting 3 columns of 32*32 cubes to the left of the target area and deleting the 3 columns of 32*32 cubes on the far right of the target area. At this time, the water pressure value of the 3 columns of 32*32 cubes inserted on the left needs to be recalculated. Specifically, the water pressure value of each cube on the top plane of these 3 columns of 32*32 cubes can be calculated first, according to the calculation method for the water pressure value of a single cube, i.e., the water pressure value of each cube on the 31st plane. Then, the water pressure value of each cube on each plane of these 3 columns of 32*32 cubes can be calculated sequentially downwards, thus obtaining the water pressure value corresponding to each cube in these 3 columns of 32*32 cubes. The specific calculation method is the same as the method for calculating the water pressure value corresponding to each block in the target area, and will not be repeated here.

[0098] Similarly, when a virtual character moves in the Y and Z directions, the processing method is the same as when it moves in the X direction, so it will not be repeated here.

[0099] It should be noted that when calculating the water pressure value corresponding to the three columns of 32*32 squares inserted on the left, it can also be calculated column by column. For example, the water pressure value of each square on the top plane of the first column of 32*32 squares adjacent to the target area is first calculated using the method for calculating the water pressure value of a single square. Then, the water pressure value of each square on the next plane is derived in the same way. In this way, the water pressure value corresponding to each square in these three columns of 32*32 squares can be calculated.

[0100] It's important to note that after inserting three columns of 32x32 blocks, you only need to calculate the water pressure value of each block on the top plane of these three columns using the same method as calculating the water pressure value of a single block. All other water pressure values ​​can be derived from the water pressure value of each block on the top plane. This eliminates the need to calculate the water pressure value for each individual block within the three columns of 32x32 blocks, significantly reducing the computational workload.

[0101] It should be noted that although the 3D coordinates and corresponding water pressure values ​​of each block in the first array can be updated according to the real-time changes in the virtual character's position, if the virtual character's position changes drastically, such as when the player uses an item to teleport, it is necessary to re-determine the target area based on the virtual character's location and recalculate the 3D coordinates and corresponding water pressure values ​​of each block in the target area.

[0102] Reference Figure 7 , Figure 7 This is a flowchart of the steps performed after updating the three-dimensional position coordinates and corresponding water pressure values ​​of each block in the first array in real time according to the position change, provided in the embodiments of this application, including but not limited to steps S701 to S702.

[0103] Step S701: Verify the three-dimensional position coordinates and corresponding water pressure value of each block in the first array at preset time intervals;

[0104] Step S702: When the verification error exceeds the preset range, replace and cache the actual three-dimensional position coordinates and corresponding actual water pressure values ​​of each block obtained from the verification calculation in the first array.

[0105] In this embodiment, the three-dimensional position coordinates and corresponding water pressure value of each block in the cached first array can be updated according to the change of the virtual character's position. To further ensure the accuracy of the updated data, this embodiment verifies the three-dimensional position coordinates and corresponding water pressure value of each block in the first array at preset time intervals. When the verification error exceeds a preset range, the actual three-dimensional position coordinates and corresponding actual water pressure value of each block obtained from the verification calculation are replaced and cached in the first array.

[0106] Reference Figure 8 , Figure 8 This is a flowchart of the steps for verifying the three-dimensional position coordinates and corresponding water pressure values ​​of each block in the first array at preset time intervals, as provided in the embodiments of this application, including but not limited to steps S801 to S806.

[0107] Step S801: Obtain the first position at preset intervals, where the first position is the current position of the virtual character;

[0108] Step S802: Using the first position as the center, select the first area according to the preset size to obtain the first region;

[0109] Step S803: Obtain the three-dimensional position coordinates of each block in the first region as the actual three-dimensional position coordinates;

[0110] Step S804: Through frame segmentation processing, the water pressure value corresponding to each block in the first region is calculated as the actual water pressure value.

[0111] Step S805: Cache the second array, which includes the actual three-dimensional position coordinates of each block in the first region and the corresponding actual water pressure value;

[0112] Step S806 verifies the three-dimensional position coordinates and corresponding water pressure values ​​of each block in the first array based on the second array.

[0113] In this embodiment, the server re-acquires the current position of the virtual character at preset intervals as the first position. Then, a first region is selected centered on the first position according to a preset size. For example, a 32*32*32 cube is selected as the first region, also centered on the first position. Similarly, through frame-by-frame processing, the water pressure value corresponding to each cube in the first region is calculated as the actual water pressure value, and the three-dimensional position coordinates of each cube in the first region are obtained as the actual three-dimensional position coordinates. Next, the actual three-dimensional position coordinates and actual water pressure values ​​of each cube in the first region are cached as a second array. Finally, the actual three-dimensional position coordinates of each cube in the second array are compared with the updated three-dimensional position coordinates of each cube in the first array, and the actual water pressure values ​​of each cube in the second array are compared with the updated water pressure values ​​of each cube in the first array. If the comparison results are all within a preset error range, the updated data is determined to be relatively accurate, and it is not necessary to replace the data in the first array with the data in the second array. If any of the comparison results exceeds the error range, it is necessary to replace the data in the first array with the data in the second array. Specifically, when the difference between the three-dimensional position coordinates of each block in the first array and the actual three-dimensional position coordinates of each block in the second array exceeds the first preset range, or when the difference between the water pressure value corresponding to each block in the first array and the actual water pressure value corresponding to each block in the second array exceeds the second preset range, it is determined that the verification error exceeds the preset range; the data in the second array is replaced in the first array.

[0114] It should be noted that the preset duration, the first preset range, and the second preset range can all be set and adjusted based on prior knowledge and specific circumstances. This application embodiment does not specifically limit the preset duration, the first preset range, and the second preset range.

[0115] Please see Figure 9 This application embodiment also provides a water pressure determination device 90 in a virtual world, which can implement the above-described water pressure determination method in a virtual world. The device includes:

[0116] The determination module 901 is used to determine the target area based on the location information of the virtual character in the virtual world;

[0117] The calculation module 902 is used to calculate the water pressure value of each block in the target area through frame processing;

[0118] The cache module 903 is used to cache the first array, which includes the three-dimensional position coordinates of each block and the corresponding water pressure value;

[0119] Module 904 is used to acquire the position change of the virtual character in real time;

[0120] The update module 905 is used to update the three-dimensional position coordinates and corresponding water pressure value of each block in the first array in real time based on the position change.

[0121] The specific implementation of the water pressure determination device in the virtual world is basically the same as the specific implementation of the water pressure determination method in the virtual world described above, and will not be repeated here.

[0122] This application also provides an electronic device, which includes a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the water pressure determination method in the virtual world described above. This electronic device can be any smart terminal, including tablet computers, in-vehicle computers, etc.

[0123] Please see Figure 10 , Figure 10 The hardware structure of an electronic device according to another embodiment is illustrated. The electronic device includes:

[0124] The processor 1001 can be implemented using a general-purpose CPU (Central Processing Unit), microprocessor, application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of this application.

[0125] The memory 1002 can be implemented as a read-only memory (ROM), static storage device, dynamic storage device, or random access memory (RAM). The memory 1002 can store the operating system and other applications. When the technical solutions provided in the embodiments of this specification are implemented through software or firmware, the relevant program code is stored in the memory 1002 and is called and executed by the processor 1001 to execute the water pressure determination method in the virtual world of this application embodiment.

[0126] Input / output interface 1003 is used to implement information input and output;

[0127] The communication interface 1004 is used to enable communication and interaction between this device and other devices. Communication can be achieved through wired means (such as USB, network cable, etc.) or wireless means (such as mobile network, WIFI, Bluetooth, etc.).

[0128] Bus 1005 transmits information between various components of the device (e.g., processor 1001, memory 1002, input / output interface 1003, and communication interface 1004);

[0129] The processor 1001, memory 1002, input / output interface 1003 and communication interface 1004 are connected to each other within the device via bus 1005.

[0130] This application embodiment also provides a storage medium, which is a computer-readable storage medium, storing a computer program that, when executed by a processor, implements the water pressure determination method in the virtual world described above.

[0131] Memory, as a non-transitory computer-readable storage medium, can be used to store non-transitory software programs and non-transitory computer-executable programs. Furthermore, memory may include high-speed random access memory, and may also include non-transitory memory, such as at least one disk storage device, flash memory device, or other non-transitory solid-state storage device. In some embodiments, memory may optionally include memory remotely located relative to the processor, and these remote memories can be connected to the processor via a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.

[0132] The embodiments described in this application are for the purpose of more clearly illustrating the technical solutions of the embodiments of this application, and do not constitute a limitation on the technical solutions provided by the embodiments of this application. As those skilled in the art will know, with the evolution of technology and the emergence of new application scenarios, the technical solutions provided by the embodiments of this application are also applicable to similar technical problems.

[0133] Those skilled in the art will understand that the technical solutions shown in the figures do not constitute a limitation on the embodiments of this application, and may include more or fewer steps than shown, or combine certain steps, or different steps.

[0134] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.

[0135] Those skilled in the art will understand that all or some of the steps in the methods disclosed above, as well as the functional modules / units in the systems and devices, can be implemented as software, firmware, hardware, or suitable combinations thereof.

[0136] The terms “first,” “second,” “third,” “fourth,” etc. (if present) in the specification and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms “comprising” and “having,” and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0137] It should be understood that in this application, "at least one (item)" means one or more, and "more than" means two or more. "And / or" is used to describe the relationship between related objects, indicating that three relationships can exist. For example, "A and / or B" can represent three cases: only A exists, only B exists, and both A and B exist simultaneously, where A and B can be singular or plural. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. "At least one (item) of the following" or similar expressions refer to any combination of these items, including any combination of single or plural items. For example, at least one (item) of a, b, or c can represent: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, and c can be single or multiple.

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

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

[0140] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0141] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes multiple instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned storage medium includes various media capable of storing programs, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0142] The preferred embodiments of the present application have been described above with reference to the accompanying drawings, but this does not limit the scope of the claims of the present application. Any modifications, equivalent substitutions, and improvements made by those skilled in the art without departing from the scope and substance of the embodiments of the present application shall be within the scope of the claims of the present application.

Claims

1. A method for determining water pressure in a virtual world, characterized in that, The virtual world is composed of various blocks of the same size, and the method includes: The target area is determined based on the location information of the virtual characters in the virtual world; The water pressure value of each block in the target area is calculated by frame segmentation processing; The first array is cached, which includes the three-dimensional position coordinates of each block and the corresponding water pressure value; Real-time acquisition of the virtual character's position change; Based on the change in position, the three-dimensional position coordinates and corresponding water pressure values ​​of each block in the first array are updated in real time. The update includes: shifting the target area as a whole with the change in the position of the virtual character; inserting a corresponding number of block columns on the shifted side; deleting block columns that are out of range in the target area; for the newly inserted block columns, calculating the water pressure value of each block in its uppermost plane; then, using the water pressure value of the uppermost plane as a reference, recursively obtaining the water pressure values ​​of the remaining planes in the newly inserted block columns; supplementing the three-dimensional position coordinates and corresponding water pressure values ​​of the newly inserted block columns into the first array; and simultaneously deleting the data of block columns that are out of range in the target area from the first array. The step of calculating the water pressure value of each block in the target area through frame segmentation processing includes: The target region is divided into several planes by frame segmentation, and each plane includes several squares. The water pressure value of each block in the first plane is calculated based on the maximum height reached by connecting each block upwards in the first plane. The first plane is any plane in the target area. Based on the water pressure value of each block in the first plane, the water pressure value of each block in the target area other than the first plane is calculated.

2. The method according to claim 1, characterized in that, The step of determining the target area based on the location information of the virtual character in the virtual world includes: Obtain the position coordinates of the virtual character in the virtual world; The target area is selected based on the position coordinates of the virtual character and a preset size.

3. The method according to claim 1, characterized in that, The first cache array includes: Obtain the three-dimensional position coordinates of each block in the target area; The three-dimensional position coordinates and corresponding water pressure values ​​of each block are cached into a first array.

4. The method according to claim 1, characterized in that, After updating the three-dimensional position coordinates and corresponding water pressure value of each block in the first array in real time according to the position change, the method includes: The three-dimensional position coordinates and corresponding water pressure values ​​of each block in the first array are verified at preset time intervals. When the verification error exceeds the preset range, the actual three-dimensional position coordinates and the corresponding actual water pressure value of each block obtained from the verification calculation are replaced in the first array.

5. The method according to claim 4, characterized in that, The step of verifying the three-dimensional position coordinates and corresponding water pressure value of each block in the first array at preset time intervals includes: The first position is obtained at preset time intervals, and the first position is the current position of the virtual character; A first region is obtained by selecting a region with the first position as the center and according to a preset size; The three-dimensional position coordinates of each block in the first region are obtained as the actual three-dimensional position coordinates; By using frame segmentation processing, the water pressure value corresponding to each block in the first region is calculated as the actual water pressure value; The second array is cached, and the second array includes the actual three-dimensional position coordinates of each of the blocks in the first region and the corresponding actual water pressure value; Based on the second array, the three-dimensional position coordinates and corresponding water pressure values ​​of each block in the first array are verified.

6. The method according to claim 5, characterized in that, When the verification error exceeds a preset range, the actual three-dimensional position coordinates and corresponding actual water pressure values ​​of each block obtained from the verification calculation are replaced in the first array, including: When the difference between the three-dimensional position coordinates of each block in the first array and the actual three-dimensional position coordinates of each block in the second array exceeds a first preset range, or when the difference between the water pressure value corresponding to each block in the first array and the actual water pressure value corresponding to each block in the second array exceeds a second preset range, it is determined that the verification error exceeds the preset range. Replace the data in the second array with the data in the first array.

7. A water pressure determining device in a virtual world, characterized in that, The device includes: The determination module is used to determine the target area based on the location information of the virtual characters in the virtual world; The calculation module is used to calculate the water pressure value of each block in the target area through frame-by-frame processing; A caching module is used to cache a first array, which includes the three-dimensional position coordinates of each block and the corresponding water pressure value. The acquisition module is used to acquire the position change of the virtual character in real time; An update module is used to update the three-dimensional position coordinates and corresponding water pressure values ​​of each block in the first array in real time according to the position change. The update includes: shifting the target area as a whole with the position change of the virtual character, inserting a corresponding number of block columns on the shifted side, and deleting block columns that are out of range in the target area; for the newly inserted block columns, calculating the water pressure value of each block in its uppermost plane, and then using the water pressure value of the uppermost plane as a reference, recursively obtaining the water pressure values ​​of the remaining planes in the newly inserted block columns, supplementing the three-dimensional position coordinates and corresponding water pressure values ​​of the newly inserted block columns into the first array, and at the same time deleting the data of block columns that are out of range in the target area from the first array; The calculation module is used to calculate the water pressure value of each block in the target area through frame-by-frame processing, including: The target region is divided into several planes by frame segmentation, and each plane includes several squares. The water pressure value of each block in the first plane is calculated based on the maximum height reached by connecting each block upwards in the first plane. The first plane is any plane in the target area. Based on the water pressure value of each block in the first plane, the water pressure value of each block in the target area other than the first plane is calculated.

8. An electronic device, characterized in that, The electronic device includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to implement the method according to any one of claims 1 to 6.

9. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by a processor, it implements the method of any one of claims 1 to 6.