Movement control method for virtual unit, electronic device and medium
By reducing the collision radius of virtual units in a multiplayer online strategy game, the problem of lack of blocking effect when unit movement is solved, and the smoothness of unit movement and computing power efficiency are improved.
Patent Information
- Application Number
- PCT/CN2023/109812
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Filing Date
- 2023-07-28
- Publication Date
- 2025-02-06
AI Technical Summary
In the existing multiplayer online strategy games, virtual combat units lack blocking effects when moving, resulting in overlapping units, poor user visual effects and limited gameplay design. At the same time, when the unit is congested, the system needs to recalculate the movement path, which consumes a lot of computing power.
By receiving a movement instruction, a second virtual unit within a predetermined range between the starting position and the target position is determined, a movement path is calculated, and the collision radius of the first virtual unit and the second virtual unit is reduced in a predetermined proportion to control the first virtual unit and the second virtual unit. A virtual unit moves toward the target position.
It reduces congestion in virtual units, improves movement smoothness, reduces computing power load, and improves user experience and game visual effects.
Smart Images

Figure CN2023109812_06022025_PF_FP_ABST
Abstract
Description
Virtual unit movement control method, electronic device and medium Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a method for controlling the movement of a virtual unit, an electronic device, and a medium. Background Art
[0002] In most multiplayer online strategy games currently on the market, movable combat units do not have blocking effects, and different combat units can pass through each other, which may cause a large number of combat units to overlap in the same position, affecting the user's visual effect. The design method without blocking effects has affected the gameplay design to a certain extent. For example, it is difficult to control the upper limit of the number of combat units that can attack a unit at the same time. Due to too many overlapping units, it is impossible to make detailed battle performances, and users cannot feel the delicate battle process. In other implementation schemes in this field, even if a blocking effect is designed at the cost of a lot of computing power, there is no effective solution for the obstruction of combat units during movement, which will cause congestion of combat units and lead to a poor user experience. In addition, if congestion of combat units occurs, the system has to recalculate the movement path, further consuming a lot of computing power resources.
[0003] Summary of the Invention
[0004] The main purpose of this application is to provide a virtual unit mobility control method, electronic device and medium, which can reduce congestion.
[0005] A first aspect of the present application discloses a method for controlling the movement of a virtual unit, for use in an electronic device, the method comprising: receiving a movement instruction, wherein the movement instruction instructs a first virtual unit to move from a starting position to a target position; determining a second virtual unit within a predetermined range between the starting position and the target position; calculating a path from the starting position to the target position; reducing the collision radius of the first virtual unit and the second virtual unit respectively according to a predetermined ratio; and controlling the first virtual unit to move toward the target position.
[0006] In a possible implementation of the first aspect, reducing the collision radius of the first virtual unit and the second virtual unit according to a predetermined ratio includes determining the predetermined ratio according to a motion state.
[0007] In a possible implementation of the first aspect, the motion state includes a moving state and a stationary state, and the predetermined proportion in the moving state is not less than the predetermined proportion in the stationary state.
[0008] In a possible implementation of the first aspect, reducing the collision radius of the first virtual unit and the second virtual unit according to a predetermined ratio includes determining the predetermined ratio according to the type of the virtual unit.
[0009] In a possible implementation of the first aspect above, the method further includes determining a location area of the first virtual unit.
[0010] In a possible implementation of the first aspect above, the method further includes adjusting the landing area based on a distance between the first virtual unit and the target position.
[0011] In a possible implementation of the first aspect above, when the distance between the first virtual unit and the target position is greater than a predetermined threshold, a first landing area is determined based on a first radius range of the target position.
[0012] In a possible implementation of the first aspect, the method further includes ignoring the obstruction of the second virtual unit in a moving state in the first landing area.
[0013] In a possible implementation of the first aspect, the method further includes determining a second landing area based on a second radius range of the target position when the distance between the first virtual unit and the target position is less than or equal to a predetermined threshold.
[0014] In a possible implementation of the first aspect above, the second landing area is an area that avoids an original collision radius of the second virtual unit.
[0015] In a possible implementation of the first aspect, when there is no landing position in the second landing area, the movement is terminated.
[0016] The second aspect of the present application discloses an electronic device, comprising a memory storing computer-executable instructions and a processor; when the instructions are executed by the processor, the device implements the method of the first aspect of the present application.
[0017] The third aspect of the present application discloses a computer-readable storage medium, which stores one or more computer programs. The one or more computer programs are executed by one or more processors, so that the processors execute the method of the first aspect of the present application.
[0018] The fourth aspect of the present application discloses a computer program product, comprising a computer program, which implements the method of the first aspect of the present application when executed by a processor.
[0019] According to the virtual unit movement control method, electronic device, and medium of the present application, after receiving an instruction instructing a first virtual unit to move from a starting position to a target position, a second virtual unit different from the first virtual unit is determined within a predetermined range between the starting position and the target position, and the collision radius of the first virtual unit and the second virtual unit within the predetermined range is reduced according to a predetermined ratio, and the movement path is calculated to control the first virtual unit to move toward the target position along the movement path. That is, after the first virtual unit receives the movement instruction, the collision radius of other virtual units that may be encountered on the movement path and the first virtual unit itself are reduced, so that the movement process of the first virtual unit is not blocked. In the game scene, a large number of virtual units can be moved smoothly, congestion can be reduced, and computing power can be saved. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] To more clearly illustrate the technical solution of the present invention, the following briefly introduces the drawings required for use in the embodiments or descriptions of the prior art. Obviously, the drawings described below are only some embodiments of the present invention, and those skilled in the art can derive other drawings based on these drawings without inventive effort.
[0021] FIG1 is a schematic diagram of an application scenario of an embodiment of the present application;
[0022] FIG2 is a flow chart of a method 200 for controlling movement of a virtual unit according to an embodiment of the present application;
[0023] FIG3 a is a schematic diagram of a virtual unit before movement according to an embodiment of the present application;
[0024] FIG3 b is a schematic diagram of a virtual unit moving according to an embodiment of the present application;
[0025] FIG4 is a schematic diagram of a virtual unit reducing a collision radius according to a predetermined ratio according to an embodiment of the present application;
[0026] 5a-5c are schematic diagrams of determining the location of a virtual unit according to an embodiment of the present application;
[0027] FIG6 is a flow chart of a method 600 for determining a location of a virtual unit according to an embodiment of the present application;
[0028] FIG7 is a schematic diagram of an electronic device 700 according to an embodiment of the present application. DETAILED DESCRIPTION
[0029] The present application is further described below with reference to specific embodiments and accompanying drawings. It should be understood that the illustrative embodiments of the present disclosure include, but are not limited to, methods for controlling the movement of virtual units, electronic devices, and media. The specific embodiments described herein are intended solely to illustrate the present application and are not intended to limit the present application. Furthermore, for ease of description, the accompanying drawings only illustrate some, but not all, structures or processes relevant to the present application.
[0030] In order to make the objectives, technical solutions and advantages of this application clearer, the implementation methods of this application will be further described in detail below with reference to the accompanying drawings.
[0031] FIG1 shows a schematic diagram of an application scenario of an embodiment of the present application. In this application scenario, at least one client device 101 and at least one game server 102 are included, and the client device 101 is connected to the game server 102 via a network 103. The client device 101 can be any device with computing hardware that can support and execute software application products corresponding to the game. The client device 101 can be, for example, a desktop computer, a laptop computer, a smart phone, a tablet computer, a handheld game console, etc. The network 103 can be a wireless network or a wired network, such as a wireless network such as a wireless local area network (WLAN), a local area network (LAN), a cellular network, a 2G network, a 3G network, a 4G network, a 5G network, etc. In addition, different terminals can also use their own Bluetooth network or hotspot network to connect to other terminals or to a server, etc.
[0032] Software application products corresponding to games include but are not limited to role-playing games (RPGs), simulation games (SLGs), and action games (ACTs). RPG games generally focus on the story of one or more characters played by the player, and the player needs to advance the game plot by completing tasks, adventures, exploration, etc. SLG games focus on strategy and simulation, and players need to achieve game goals through reasonable strategic arrangements. In SLG games, players need to manage resources, build buildings, formulate tactics, etc. to protect their territory or conquer other countries. ACT games focus on the player's actions, emphasizing the sense of attack, operation and timely feedback. Software application products corresponding to games are not limited to a single type of RPG games, SLG games, or ACT games, but can also be a combination of two or more of them.
[0033] In a virtual game scene, a user can control the movement of virtual units in the virtual game scene through the client device 101 to move from a starting position to a target position. Virtual units can be game characters with 3D or 2D models (such as walking human characters, pet characters, etc.), game props (such as vehicles, tanks, chariots, etc.). Virtual units participating in combat in the virtual game scene are also called combat units. Typically, in implementations of this field, there is no blocking effect designed for the movement of virtual units. That is, the same position may be occupied by different virtual units, and different virtual units can penetrate the model. This will cause multiple virtual units to overlap in the same position, which is poor for the user experience. In other implementations of this field, even if a blocking effect is designed at the cost of consuming a large amount of computing power, there is no effective solution for the blocking of virtual units during movement. Therefore, it will cause virtual unit congestion, resulting in a poor user experience. In addition, if virtual unit congestion occurs, the system has to recalculate the movement path, further consuming a large amount of computing power resources.
[0034] To solve the above problem, an embodiment of the present application provides a method 200 for controlling movement of a virtual unit, which is applied to an electronic device, as shown in FIG2 . The method 200 includes the following steps.
[0035] In S201 , a movement instruction is received, wherein the movement instruction instructs a first virtual unit to move from a starting position to a target position.
[0036] The first virtual unit is one or more minimum mobile units in the game scene, such as vehicles, tanks, ships, or airplanes. The first virtual unit can be a single minimum mobile unit or multiple minimum mobile units moving in conjunction, such as a tank or a tank army. In other examples, the first virtual unit can be a virtual game character, such as an infantryman or cavalryman. The movement command can come from a user input operation on the client device 101, such as a single click, swipe, or double click on the touch screen.
[0037] In S202 , a second virtual unit within a predetermined range between the starting position and the target position is determined.
[0038] The second virtual unit is one or more minimum mobile units in the game scene other than the first virtual unit. The second virtual unit can be a friendly unit or an enemy unit of the first virtual unit. In other examples, the second virtual unit can also be the minimum mobile unit of a non-player-controlled game character, such as a virtual unit controlled by an NPC or AI. In addition, the second virtual unit can be in a stationary state or a moving state, wherein if the second virtual unit is in a moving state, the moving direction of the second virtual unit includes but is not limited to being the same as or opposite to the moving direction of the first virtual unit. In some examples, the moving direction of the second virtual unit can also be a direction of any angle other than the same as or opposite to the moving direction of the first virtual unit.
[0039] The predetermined range between the starting position and the target position can be a range related to the movement path between the starting position and the target position, such as the range covered by the movement path itself, or can also include a range within a certain distance near the movement path, that is, a range covered by a distance extended in the normal direction of the movement path. The movement path can be a straight line, a curve, or a broken line. In some other examples, the predetermined range between the starting position and the target position is not limited to a range related to the movement path. For example, the predetermined range can include all coordinate positions within a rectangle with the starting position and the target position as the diagonally opposite corner vertices of the rectangle.
[0040] In S203 , a path from the starting position to the target position is calculated.
[0041] Calculate a movement path of the first virtual unit from the starting position to the target position, and control the first virtual unit to move toward the target position. The movement path can be calculated based on a pathfinding algorithm. In some examples, the pathfinding algorithm includes a relative obstacle view (RVO) algorithm, a DetourCrowd algorithm, or a Particle Swarm Optimization algorithm.
[0042] In S204 , the collision radius of the first virtual unit and the collision radius of the second virtual unit are reduced according to a predetermined ratio.
[0043] The collision radius of the first virtual unit and the second virtual unit is reduced according to a predetermined ratio. In the present invention, there can be multiple predetermined ratios, and the predetermined ratios for the first virtual unit and the second virtual unit can be different, or the predetermined ratios for different types of virtual units can also be different, or the predetermined ratios for virtual units in different motion states can also be different. Each virtual unit in the game can be of various shapes, and the collision volume can be an irregular volume. In some examples, in order to reduce the load on the server, the collision volume can be simplified to a sphere, a cuboid, or a circle in a two-dimensional plane. For example, a sphere or a circle can be used to represent the collision volume of a virtual unit, so that the collision radius can be used to measure the size of the virtual unit. In 3D games, the radius of the sphere can be used as the collision radius; in 2D games, the radius of the circle projected by the virtual unit on the two-dimensional plane can be used as the collision radius.
[0044] By reducing the collision radius of the first virtual unit and the collision radius of the second virtual unit by a predetermined ratio, the probability of the first virtual unit being blocked by the second virtual unit on the movement path between the starting position and the target position is greatly reduced, thus reducing congestion. The reduction ratio of the collision radius of the first virtual unit and the collision radius of the second virtual unit can be the same or different.
[0045] In some embodiments, the predetermined ratio for reducing the size of the virtual unit can be determined based on the type of the virtual unit. In some examples, corresponding predetermined ratios can be set for different types of virtual units. For example, different predetermined ratios can be set for two different types, vehicles and tanks. For virtual units of a type with a larger collision radius, a smaller predetermined ratio can be set. For example, there are type A and type B virtual units, and the collision radius of type B virtual units is larger (twice the collision radius of type A virtual units). Then, the predetermined ratio of type B virtual units can be set to 30%, that is, the collision radius after reduction is 70% of the original; the predetermined ratio of type A virtual units can be set to 50%, that is, the collision radius after reduction is 50% of the original.
[0046] In S205 , the first virtual unit is controlled to move toward the target position.
[0047] The execution order of the above steps S201-S205 is not limited to the order of numbers. For example, S202 can occur before S203, that is, the second virtual unit within the predetermined range is determined first and then the moving path is calculated. Or S203 can occur before S202, that is, the path is calculated first and then the predetermined range is determined based on the moving path, and then the second virtual unit is determined, or the path is calculated first and then the second virtual unit within the predetermined range is directly determined. For another example, S204 can occur before S205 or S205 occurs before S204. In the case that S204 occurs before S205, before the first virtual unit moves from the starting position to the target position, the collision radius of the first virtual unit and the second virtual unit are respectively reduced, and the first virtual unit and the second virtual unit remain in a reduced state during the movement process, which can ensure that the movement process is not blocked. In the case that S205 occurs before S204, the first virtual unit is moved according to the path first. When blocked during the movement, the collision radius of the first virtual unit and the second virtual unit are reduced respectively to continue moving forward. The calculation of the reduction of the collision radius is real-time. When the blockage is removed, the first virtual unit and the second virtual unit restore their original collision radius.
[0048] In method 200, after receiving an instruction to move a first virtual unit from a starting position to a target position, a second virtual unit different from the first virtual unit is determined within a predetermined range between the starting position and the target position, the collision radius of the first virtual unit and the second virtual unit within the predetermined range is reduced according to a predetermined ratio, and a movement path is calculated to control the first virtual unit to move toward the target position along the movement path. That is, after the first virtual unit receives the instruction to move, the collision radius of other virtual units that may be encountered on the movement path and the first virtual unit itself are reduced, so that the movement process of the first virtual unit is not blocked. In the game scene, a large number of virtual units can be moved smoothly, congestion can be reduced, and the increase in computing power caused by congestion can be further reduced.
[0049] To better illustrate the method 200 , FIG3 a shows a schematic diagram of a virtual unit before movement according to an embodiment of the present application; and FIG3 b shows a schematic diagram of a virtual unit during movement according to an embodiment of the present application.
[0050] In the scenario of Figure 3a, there are multiple virtual units of type A and virtual units of type B. The original collision radius of the virtual units of type A is smaller than the original collision radius of the virtual units of type B. In addition, a virtual unit of type A, namely A0 (the first virtual unit) in the figure, plans to move from the current original position to the target position C. Because the space between the current position and the target position C is occupied by other virtual units (i.e., the second virtual unit), according to the prior art in this field, virtual unit A0 cannot move to the target position C due to the obstruction on the moving path. Other virtual units, such as the virtual units of type B located between virtual unit A0 and multiple other virtual units of type A, are also unable to move, which will cause congestion.
[0051] In Figure 3b, after the collision radius of all virtual units between the starting and target positions has been reduced proportionally, ample space for movement has emerged. The dashed line represents the original collision radius of the virtual units before the reduction, while the solid line represents the reduced collision radius. Virtual unit A0 can now pass through type B virtual units and multiple other type A virtual units to reach target position C, thus avoiding congestion.
[0052] In some embodiments, a predetermined ratio can be determined based on the motion state to reduce the collision radius of the first and second virtual units. Motion states include moving and staying. The moving state refers to the virtual unit moving at a certain speed, while the staying state refers to the virtual unit remaining stationary at its current location or hovering near its current location at a lower speed. Considering that the first virtual unit is always in a moving state, two predetermined ratios are generated based on the motion state of the second virtual unit. When the second virtual unit is in a staying state, the first virtual unit is reduced by a first predetermined ratio, and the second virtual unit is reduced by a second predetermined ratio. When the second virtual unit is in a moving state, the first virtual unit is reduced by a third predetermined ratio, and the second virtual unit is reduced by a fourth predetermined ratio. The first predetermined ratio can be the same as or different from the second predetermined ratio. Furthermore, the predetermined ratio in the moving state is not less than the predetermined ratio in the staying state. Specifically, when the second virtual unit is in a moving state, the corresponding predetermined ratios of the first and second virtual units are not less than the corresponding predetermined ratios of the first and second virtual units when the second virtual unit is in a staying state. In other words, the third predetermined ratio is not less than the first predetermined ratio, and the fourth predetermined ratio is not less than the second predetermined ratio.
[0053] Figure 4 shows a schematic diagram of a virtual unit in accordance with an embodiment of the present application, wherein the collision radius is reduced according to a predetermined ratio. In the scenario of Figure 4 , virtual unit A0 (i.e., the first virtual unit) needs to move from its current position to the target position indicated by the arrow. The scenario also includes a virtual unit B' in a stationary state, multiple virtual units A' in a stationary state, a virtual unit B0 in a moving state, and virtual units A1, A2, A3, and A4 in a moving state. The moving directions of virtual units A1-A4 and B0 may vary. Figure 4 also shows the size of the original collision radius of each virtual unit (dashed box) and the size of the reduced collision radius (solid box). It can be seen that the predetermined ratios for the same type of virtual unit are different in the moving state and the stationary state. Those skilled in the art will appreciate that the types and numbers of virtual units shown in Figure 4 are for illustrative purposes only. In some embodiments, other types of virtual units may be included, and the number of multiple virtual units of the same type in the same motion state may not be exactly equal.
[0054] Table 1 shows the ratio of the reduced collision radius to the original collision radius for each virtual unit in Figure 4 . This ratio is calculated by subtracting the predetermined ratio corresponding to each virtual unit from 1. From the perspective of A0, the reduced collision radius of the moving virtual units A1-A4 is 30% of the original collision radius, the reduced collision radius of the stationary virtual unit A' is 35% of the original collision radius, the reduced collision radius of the moving virtual unit B0 is 50% of the original collision radius, and the reduced collision radius of the stationary virtual unit B' is 70% of the original collision radius. In the example of Figure 4 , for virtual units of the same type A, the reduced collision radius of the moving virtual units A1-A4 is smaller than that of the stationary virtual unit A'; and for virtual units of the same type B, the reduced collision radius of the moving virtual unit B0 is smaller than that of the stationary virtual unit B'. In other words, for the same type of virtual unit, the predetermined ratio of reduction of the virtual unit in the moving state is not less than the predetermined ratio of reduction of the virtual unit in the stationary state.
[0055] Table 1 Ratio of the reduced collision radius to the original collision radius of each virtual unit in Figure 4
[0056] In FIG4 , the initial positions of the multiple virtual units A' and B' in the stationary state do not overlap, while the initial positions of the virtual units A1-A4 in the moving state and the multiple virtual units A' in the stationary state overlap. In this case, when the collision radius of the virtual unit is reduced, the position of the reduced virtual unit can be adjusted. For example, in FIG4 , the solid-line frame A1 can be adjusted to be located at any position within the original dotted frame, and the solid-line frame A' of the nearby stationary virtual unit can be adjusted to be located at any position within the original dotted frame, thus avoiding overlap. This adjustment can be implemented in the client device. After the client device calculates the adjusted positions of each virtual unit, it reports the relevant data to the server without the need for calculation by the server, thereby reducing the computing load of the server.
[0057] Table 2 shows the ratio of the reduced collision radius of each virtual unit to the original collision radius according to an embodiment of the present application. When a virtual unit A0 is in a moving state, assuming that there are other virtual units in the moving path between the starting position and the target position, namely A1 and B1 in the moving state, and A' and B' in the stationary state, these virtual units may collide or block A0. From the perspective of A0, that is, A0 is the first virtual unit and the other virtual units are the second virtual units, the ratio of the reduced collision radius of A1 in the moving state to the original collision radius is 30%, the ratio of the reduced collision radius of B1 in the moving state to the original collision radius is 50%, the ratio of the reduced collision radius of A' in the stationary state to the original collision radius is 35%, and the ratio of the reduced collision radius of B' in the stationary state is 70%.
[0058] Table 2 Ratio of the reduced collision radius to the original collision radius of each virtual unit
[0059] When a virtual unit B0 is moving, assume there are other virtual units between its starting and target positions: A1 and B1 in moving mode, and A' and B' in stationary mode. These virtual units may collide or block B0. From B0's perspective, B0 is the first virtual unit, and the other virtual units are the second virtual units. The reduced collision radius of B1 in moving mode is 40% of its original collision radius, the reduced collision radius of A1 in moving mode is 30%, the reduced collision radius of A' in stationary mode is 35%, and the reduced collision radius of B' in stationary mode is 40%. This shows that for different virtual unit types, each virtual unit shrinks according to a different predetermined ratio. Specifically, under the moving perspective of A0, the predetermined reduction ratio of B1 and B' is smaller than the predetermined reduction ratio of B1 and B' under the moving perspective of B0, that is, B0, B1 and B' are all virtual units with large collision radius, so when they collide with each other, the collision radius needs to be made smaller to avoid collision.
[0060] According to Table 2, for type A virtual units, regardless of viewing angles A0 or B0, the predetermined reduction ratio in the moving state (A1) (from 100% to 30%) is greater than the predetermined reduction ratio in the stationary state (A') (from 100% to 35%). For type B virtual units, in the moving A0 viewing angle, the predetermined reduction ratio in the moving state (B1) (from 100% to 50%) is greater than the predetermined reduction ratio in the stationary state (B') (from 100% to 70%). In the moving B0 viewing angle, the predetermined reduction ratio in the moving state (B1) is equal to the predetermined reduction ratio in the stationary state (B') (both from 100% to 40%). Therefore, it can be seen that, from the perspective of different first virtual units, for the same type of second virtual unit, the predetermined reduction ratio in the moving state can be set to be greater than or equal to (i.e. not less than) the predetermined reduction ratio in the stationary state. That is to say, when two virtual units in the moving state block each other, their collision radius becomes smaller, so that they can pass through the moving path more calmly and avoid congestion.
[0061] Table 2 shows the scale of the other virtual units after they are reduced from the perspective of the moving virtual units A0 and B0. When the virtual units A0 and B0 are stationary, the other virtual units can maintain their original collision radius.
[0062] In some embodiments, the virtual unit movement control method of the present application further includes determining a landing area for the first virtual unit. Because the movement state of each virtual unit in the game scene can change dynamically, other virtual units may be obstructing the target location, resulting in insufficient space to accommodate the collision radius of the first virtual unit and making it impossible to land. Therefore, it is necessary to find a suitable landing position within a certain range near the target location. This range is referred to as the landing area. The landing position is the position of the first virtual unit within the landing area that can accommodate the original collision radius. To conserve computing resources, the landing area can be adjusted after the first virtual unit receives a movement command or during the movement process. This is because the computational complexity required to find the landing position varies for landing areas of different sizes. In some examples, the landing area can be adjusted upon receiving a movement command or when the distance between the first virtual unit and the target location is less than or equal to a predetermined threshold during the movement process. The landing position can be adjusted in real time and at high frequency based on the distance between the first virtual unit and the target location. Alternatively, multiple predetermined threshold distances can be set based on the distance between the first virtual unit and the target location, and the landing position is only adjusted when the distance meets each threshold distance, thereby avoiding high-frequency server corrections and reducing computational complexity.
[0063] 5a-5c are schematic diagrams showing a method of determining the landing position of a virtual unit according to an embodiment of the present application. The virtual unit D1 receives a movement instruction and needs to move to the target position C.
[0064] Figure 5a shows a schematic diagram of determining the landing position after receiving a movement instruction or during the movement process. In the example of Figure 5a, the virtual unit D1 is far away from the target position C, for example, 100 meters. Near the target position C are virtual units D2 and D3 in a stationary state and virtual unit D4 in a moving state. Since virtual unit D4 is in a moving state, the obstruction of virtual state D4 can be ignored, so the landing position can overlap with D4. In addition, since virtual units D2 and D3 are in a stationary state, virtual units D2 and D3 can be regarded as obstructions, so the landing position does not overlap with D2 and D3. The consideration at this stage is that the first virtual unit is still far from the target position, and the virtual units in a moving state near the target position may leave, so their blocking effect is not considered to reduce the computing power burden.
[0065] When determining the drop zone, in addition to considering obstructions near the target location, the target location's circular radius (centered on the target location) can also be considered. This means that only available drop locations within this radius are searched for, reducing the server's computational workload. If no available drop locations are found within this radius due to obstructions, a message indicating that the target location is inaccessible is sent to virtual unit D1, and movement is terminated, with virtual unit D1 remaining in place.
[0066] In Figure 5a, near target location C (e.g., within a 30-meter radius), the initial landing position is determined as D1', ignoring the obstruction of the moving virtual unit D4. The target location is updated to D1'. Determining the initial landing position facilitates path calculation and subsequent confirmation of the final landing position.
[0067] FIG5b shows a schematic diagram of determining the landing position in the process of moving to the updated target position D1'. In the example of FIG5b, the virtual unit D1 is closer to the target position, for example, 30 meters. At this time, there are virtual units D2, D3, D5 in a stationary state and virtual unit D4 in a moving state near the target position. Since the virtual unit D4 is in a moving state, the obstruction of the virtual state D4 can be ignored, so the landing position can overlap with D4. In addition, since the virtual units D2, D3, and D5 are in a stationary state, the virtual units D2, D3, and D5 can be regarded as obstructions, so the landing position does not overlap with D2, D3, and D5. Determining the first landing area can facilitate path calculation, so as to facilitate the subsequent confirmation of the final landing point.
[0068] In FIG5b , near the target position (for example, within a landing area with a landing radius of 30 meters), ignoring the obstruction of the moving virtual unit D4, the current landing position is determined to be D1". The target position is synchronously updated to the coordinates of D1".
[0069] FIG5c is a schematic diagram showing the process of determining the landing position during the movement toward the updated target position D1". In the example of FIG5c, the virtual unit D1 is closer to the target position, for example, 5 meters. Near the updated target position are the virtual units D2, D3, and D5 in the stationary state and the virtual unit D4 in the moving state. Although the virtual unit D4 is in the moving state, it is also regarded as an obstruction at this time, so the landing position does not overlap with D4. In addition, since the virtual units D2, D3, and D5 are in the stationary state, the virtual units D2, D3, and D5 can be regarded as obstructions, so the landing position does not overlap with D2, D3, and D5. The consideration at this stage is that the first virtual unit is about to approach the target position, and the blocking effect of the virtual units in the moving state near the target position needs to be considered.
[0070] In FIG5 c , near the updated target position (eg, a landing radius of 10 meters), all moving or stationary virtual units are considered as obstacles, and the final landing position is determined as D1 ′″.
[0071] It is worth noting that the sizes of the various virtual units in the moving state in Figures 5a-5b are for reference only. In the process of determining the landing position, in some examples, the landing position can be calculated based on the original collision radius of each virtual unit. In other examples, when the first virtual unit is far away from the target position (such as Figures 5a-5b), the landing position can be determined based on the reduced collision radius of each virtual unit to update the target position and facilitate the calculation and correction of the moving path; when the first virtual unit is close to the target position (such as Figure 5c), the final landing position can be determined based on the original collision radius of each virtual unit.
[0072] 6 shows a flow chart of a method 600 for determining the location of a virtual unit according to an embodiment of the present application. The method 600 includes the following steps.
[0073] In S601 , it is determined whether the target position has a landing position.
[0074] After receiving the movement instruction, it is determined whether there is a suitable landing location within the landing radius of the target location. If no suitable landing location is found within this range, for example, if all the virtual units within the landing radius of the target location are occupied by virtual units in a stationary state, the process proceeds to S602. In S602, an instruction is sent to the first virtual unit stating that the target location is unreachable, and the movement of the first virtual unit is terminated, causing the first virtual unit to remain in place.
[0075] If a landing position can be found within this range, the process proceeds to S603 .
[0076] At S603, it is determined whether the distance between the first virtual unit and the target location is greater than a predetermined threshold. If so, the process proceeds to S604. In S604, a first landing area is determined based on the first radius of the target location. The first landing area is the area including the possible landing locations of the first virtual unit determined in S604. The predetermined threshold can be flexibly set according to actual circumstances, for example, 5 meters or 10 meters.
[0077] In calculating the first landing area, the moving virtual unit can be considered unobstructed. After determining the second first landing area, a position in the first landing area can be set as the updated target position. In some examples, a position other than the position occupied by the virtual unit in the stationary state in the first landing area can be set as the updated target position.
[0078] As the first virtual unit moves, the distance between the current position of the first virtual unit and the updated target position may be compared again with a predetermined threshold value based on the change in movement distance or movement time, until the distance between the two is less than or equal to the predetermined threshold value, and then the process proceeds to S605. For example, the first landing area may be updated based on the status of each virtual unit near the updated target position when the distance between the first virtual unit and the updated target position is 50 meters, 30 meters, or at a predetermined time interval (e.g., 10 seconds).
[0079] If the distance between the first virtual unit and the target position is not greater than the predetermined threshold, proceed to S605. If the distance between the first virtual unit and the target position is less than or equal to the predetermined threshold, it means that the starting position of the first virtual unit is closer to the target position, or the first virtual unit is closer to the target position after receiving the movement instruction. In S605, the second landing area is determined. The second landing area can be determined based on the second radius range of the current target position. The second landing area is an area including the possible landing positions of the first virtual unit determined based on S605. In calculating the second landing area, both the moving virtual unit and the stationary virtual unit are considered as blocked.
[0080] During the movement of the first virtual unit, the movement path can be calculated based on the reduced collision radius of each virtual unit. During the process of preparing for landing, the first landing area can be an area within a circle or volume within a first radius range that avoids the reduced collision radius or original collision radius of each virtual unit considered to be blocked; the second landing area can be an area within a circle or volume within a second radius range that avoids the reduced collision radius or original collision radius of each virtual unit considered to be blocked.
[0081] The second landing area is determined based on the original collision radius of the second virtual unit.
[0082] In S606 , it is determined whether there is a landing position in the second landing area.
[0083] In some embodiments, if the second landing area is a circle or volume within a second radius range and avoids the original collision radius of each virtual unit considered to be blocked, it is directly checked whether there is a landing position in the second landing area. As mentioned above, in the second landing area, other moving virtual units and stationary virtual units are regarded as blocks, and then it is determined whether the space other than the blocks is sufficient for the first virtual unit to stay. If so, enter S607. In S607, sufficient space to avoid the blockage is determined as the final landing area. The first virtual unit can be located at any position in the final landing area. Otherwise, enter S602 and terminate the movement of the first virtual unit. The first virtual unit can stay at the current position. In some other examples, if there is no landing position in the second landing area, the second radius range can be increased so that the first virtual unit searches for a landing position in an area farther away from the target position.
[0084] In some embodiments, if the second landing area is a circle or volume within a second radius that avoids the reduced collision radius of each virtual unit considered to be blocked, after determining the second radius, it is necessary to restore the collision radius of each virtual unit within the circle or sphere with the second radius as the radius. Based on this, it is then checked whether there is a landing position in the second landing area.
[0085] Referring now to FIG7 , a block diagram of an electronic device 700 according to one embodiment of the present application is shown. The device 700 may include one or more processors 702, system control logic 708 connected to at least one of the processors 702, system memory 704 connected to the system control logic 708, non-volatile memory (NVM) 706 connected to the system control logic 708, and a network interface 710 connected to the system control logic 708.
[0086] The processor 702 may include one or more single-core or multi-core processors. The processor 702 may include any combination of general-purpose processors and dedicated processors (e.g., graphics processors, application processors, baseband processors, etc.). In the embodiments herein, the processor 702 may be configured to execute the method for controlling the movement of a virtual unit according to one or more of the various embodiments shown in Figures 2-6.
[0087] In some embodiments, system control logic 708 may include any suitable interface controller to provide any suitable interface to at least one of processors 702 and / or any suitable device or component in communication with system control logic 708 .
[0088] In some embodiments, the system control logic 708 may include one or more memory controllers to provide an interface to the system memory 704. The system memory 704 may be used to load and store data and / or instructions. In some embodiments, the memory 704 of the device 700 may include any suitable volatile memory, such as a suitable dynamic random access memory (DRAM).
[0089] NVM / memory 706 may include one or more tangible, non-transitory computer-readable media for storing data and / or instructions. In some embodiments, NVM / memory 706 may include any suitable non-volatile memory such as flash memory and / or any suitable non-volatile storage device, such as at least one of an HDD (Hard Disk Drive), a CD (Compact Disc) drive, and a DVD (Digital Versatile Disc) drive.
[0090] NVM / storage 706 may include a portion of storage resources installed on a device of apparatus 700, or it may be accessible to the apparatus but not necessarily a part of the apparatus. For example, NVM / storage 706 may be accessed over a network via network interface 710.
[0091] In particular, system memory 704 and NVM / storage 706 may include, respectively, a temporary copy and a permanent copy of instructions 720. Instructions 720 may include instructions that, when executed by at least one of processors 702, cause device 700 to implement the methods illustrated in Figures 2 and 6. In some embodiments, instructions 720, hardware, firmware, and / or software components thereof may additionally or alternatively reside in system control logic 708, network interface 710, and / or processor 702.
[0092] The network interface 710 may include a transceiver for providing a radio interface for the device 700 to communicate with any other suitable devices (such as a front-end module, an antenna, etc.) via one or more networks. In some embodiments, the network interface 710 may be integrated with other components of the device 700. For example, the network interface 710 may be integrated with at least one of the processor 702, the system memory 704, the NVM / storage 706, and a firmware device (not shown) having instructions. When at least one of the processors 702 executes the instructions, the device 700 implements one or more of the various embodiments shown in Figures 2-6.
[0093] The network interface 710 may further include any suitable hardware and / or firmware to provide a multiple-input multiple-output radio interface. For example, the network interface 710 may be a network adapter, a wireless network adapter, a telephone modem, and / or a wireless modem.
[0094] In one embodiment, at least one of the processors 702 may be packaged together with logic for one or more controllers of the system control logic 708 to form a system-in-package (SiP). In one embodiment, at least one of the processors 702 may be integrated on the same die with logic for one or more controllers of the system control logic 708 to form a system-on-chip (SoC).
[0095] Device 700 may further include an input / output (I / O) device 712. I / O device 712 may include a user interface to enable a user to interact with device 700, and peripheral component interfaces to enable peripheral components to interact with device 700. In some embodiments, device 700 may also include a sensor for determining at least one of environmental conditions and location information related to device 700.
[0096] In some embodiments, the user interface may include, but is not limited to, a display (e.g., an LCD display, a touch screen display, etc.), a speaker, a microphone, one or more cameras (e.g., a still image camera and / or a video camera), a flashlight (e.g., an LED flash), and a keyboard.
[0097] In some embodiments, the peripheral component interface may include, but is not limited to, a non-volatile memory port, an audio jack, and a power interface.
[0098] In some embodiments, the sensors may include, but are not limited to, a gyroscope sensor, an accelerometer, a proximity sensor, an ambient light sensor, and a positioning unit. The positioning unit may also be part of or interact with the network interface 710 to communicate with components of a positioning network (e.g., Global Positioning System (GPS) satellites).
[0099] It should be understood that the structure illustrated in the embodiment of the present invention does not constitute a specific limitation on the Bluetooth communication device 700. In other embodiments of the present application, the Bluetooth communication device 700 may include more or fewer components than shown, or may combine or separate certain components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.
[0100] Program code can be applied to input instructions to perform the functions described herein and generate output information. The output information can be applied to one or more output devices in a known manner. For the purposes of this application, a processing system includes any system having a processor such as, for example, a digital signal processor (DSP), a microcontroller, an application specific integrated circuit (ASIC), or a microprocessor.
[0101] Program code can be implemented with a high-level programming language or an object-oriented programming language to communicate with the processing system. Where necessary, program code can also be implemented with assembly language or machine language. In fact, the mechanism described herein is not limited to the scope of any particular programming language. In either case, the language can be a compiled language or an interpreted language.
[0102] One or more aspects of at least one embodiment may be implemented as representative instructions stored on a computer-readable storage medium, which represent various logic within a processor and, when read by a machine, causes the machine to fabricate logic for performing the techniques described herein. These representations, known as "IP cores," may be stored on a tangible, computer-readable storage medium and supplied to various customers or manufacturing facilities to load into fabrication machines that actually manufacture the logic or processor.
[0103] The present invention also provides a computer-readable medium, which stores one or more programs. The one or more programs can be executed by one or more processors to implement the movement control method of the virtual unit in one or more of the above embodiments.
[0104] One embodiment of the present application discloses a computer program product, including a computer program, which implements the virtual unit movement control method in one or more of the above embodiments when executed by a processor.
[0105] The above describes the implementation mode of the present application by means of specific specific embodiments. Those skilled in the art can easily understand other advantages and effects of the present application from the contents disclosed in this specification. Although the description of the present application will be introduced in conjunction with the preferred embodiment, this does not mean that the features of this invention are limited to this implementation mode. On the contrary, the purpose of introducing the invention in conjunction with the implementation mode is to cover other options or modifications that may be extended based on the claims of the present application. In order to provide an in-depth understanding of the present application, the following description will contain many specific details. The present application can also be implemented without using these details. In addition, in order to avoid confusion or blurring the focus of the present application, some specific details will be omitted in the description. It should be noted that the embodiments in the present application and the features in the embodiments can be combined with each other unless there is a conflict.
[0106] Furthermore, various operations will be described as multiple discrete operations in a manner that is most helpful in understanding the illustrative embodiments; however, the order of description should not be construed as implying that these operations are necessarily order dependent. In particular, these operations do not need to be performed in the order presented.
[0107] Unless the context dictates otherwise, the terms "comprising," "having," and "including" are synonymous. The phrase "A / B" means "A or B." The phrase "A and / or B" means "(A and B) or (A or B)."
[0108] As used herein, the term "module" or "unit" may refer to, be or include: an application specific integrated circuit (ASIC), an electronic circuit, a (shared, dedicated or group) processor and / or memory that executes one or more software or firmware programs, a combinational logic circuit and / or other suitable components that provide the described functionality.
[0109] In some cases, the disclosed embodiments can be implemented in hardware, firmware, software or any combination thereof. The disclosed embodiments can also be implemented as instructions carried or stored on one or more temporary or non-temporary machine-readable (e.g., computer-readable) storage media, which can be read and executed by one or more processors. For example, instructions can be distributed over a network or through other computer-readable media. Therefore, machine-readable media may include any mechanism for storing or transmitting information in a form readable by a machine (e.g., a computer), including but not limited to a floppy disk, an optical disk, an optical disk, a read-only memory (CD-ROM), a magneto-optical disk, a read-only memory (ROM), a random access memory (RAM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), a magnetic card or an optical card, a flash memory, or a tangible machine-readable memory for transmitting information through the Internet via electrical, optical, acoustic or other forms of propagation signals (e.g., carrier waves, infrared signals, digital signals, etc.). Therefore, machine-readable media include any type of machine-readable media suitable for storing or transmitting electronic instructions or information in a form readable by a machine (e.g., a computer).
[0110] In the accompanying drawings, some structural or method features are shown in a specific arrangement and / or order. However, it should be understood that such specific arrangement and / or order may not be required. In some embodiments, these features may be arranged in a manner and / or order different from that shown in the illustrative drawings. In addition, the inclusion of structural or method features in a particular figure does not imply that such features are required in all embodiments, and in some embodiments, these features may not be included or may be combined with other features.
[0111] It should be understood that although the terms "first," "second," and the like may be used herein to describe various elements or data, these elements or data should not be limited by these terms. These terms are used only to distinguish one feature from another. For example, a first feature may be referred to as a second feature, and similarly, a second feature may be referred to as a first feature without departing from the scope of the exemplary embodiments.
[0112] It should be noted that in this specification, similar reference numerals and letters denote similar items in the following drawings, and therefore, once an item is defined in one drawing, it does not need to be further defined or explained in subsequent drawings.
[0113] While the present invention has been shown and described with reference to certain preferred embodiments thereof, it will be understood by those skilled in the art that various changes in form and details may be made therein without departing from the spirit and scope of the invention.
Claims
1. A method for controlling movement of a virtual unit, used in an electronic device, characterized in that: The method comprises: receiving a movement instruction, wherein the movement instruction instructs the first virtual unit to move from a starting position to a target position; determining a second virtual unit within a predetermined range between the starting position and the target position; Calculating a path from the starting position to the target position; reducing the collision radius of the first virtual unit and the second virtual unit respectively according to a predetermined ratio; and The first virtual unit is controlled to move toward the target position.
2. The method according to claim 1, characterized in that Reducing the collision radius of the first virtual unit and the second virtual unit respectively according to a predetermined ratio includes determining the predetermined ratio according to a motion state.
3. The method according to claim 2, characterized in that The motion state includes a moving state and a staying state, and the predetermined ratio in the moving state is not less than the predetermined ratio in the staying state.
4. The method according to claim 1, characterized in that Reducing the collision radius of the first virtual unit and the second virtual unit according to a predetermined ratio includes determining the predetermined ratio according to the type of the virtual unit.
5. The method according to claim 1, characterized in that The method further includes determining a location area of the first virtual unit.
6. The method according to claim 5, characterized in that The method further includes adjusting the landing area based on a distance between the first virtual unit and the target location.
7. The method according to claim 6, characterized in that When the distance between the first virtual unit and the target position is greater than a predetermined threshold, a first landing area is determined based on a first radius range of the target position.
8. The method according to claim 7, characterized in that The method further includes ignoring the obstruction of the second virtual unit in the moving state in the first landing area.
9. The method according to any one of claims 6 to 8, characterized in that The method further includes, when the distance between the first virtual unit and the target position is less than or equal to a predetermined threshold, determining a second landing area based on a second radius range of the target position.
10. The method according to claim 9, characterized in that The second landing area is an area that avoids the original collision radius of the second virtual unit.
11. The method according to claim 9, characterized in that When there is no landing position in the second landing area, the movement is terminated.
12. An electronic device, characterized in that: The device comprises a memory storing computer executable instructions and a processor; when the computer executable instructions are executed by the processor, the device implements the method according to any one of claims 1 to 11.
13. A computer readable medium, characterized in that The computer-readable medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the method according to any one of claims 1 to 11.
14. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the method according to any one of claims 1 to 11 is implemented.
Citation Information
Patent Citations
Collision detection method and device, storage medium and electronic device
CN110180182A
Game control method and device, electronic equipment and storage medium
CN112807681A
Virtual character path planning method and device, electronic equipment and storage medium
CN114404985A
Networked hybrid game
US20140171186A1
Systems and Methods for Improved Collision Detection in Video Games
US20220203237A1