A method and device for controlling a game
By responding to touch operations in mobile games, controlling the independent movement of virtual characters and virtual cameras, the visual burden and performance consumption caused by the camera following movement when the character moves is solved, and the operation efficiency and game performance are improved.
Patent Information
- Application Number
- CN202111288726.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-02
- Publication Date
- 2024-11-12
- Estimated Expiration
- 2041-11-02
AI Technical Summary
In existing mobile games, the camera follows the movement when the characters move, weakening the player's sense of space for the screen area scene and increasing the visual burden. At the same time, new scene content needs to be loaded every time they move, increasing the game performance consumption.
By responding to touch operations in the graphical user interface, determining the acting position and target coordinates, and controlling the movement of virtual characters and virtual cameras independently, the virtual camera remains stationary or moves a small distance in a specific area, reducing frequent changes in the scene's viewing angle and reducing vision Burden and reduce resource loading.
It improves players' recognition efficiency of target positions of interactive elements in the scene, reduces the visual burden caused by scene perspective movement, reduces unnecessary performance consumption, and optimizes game performance.
Smart Images

Figure CN114011058B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of game technology, and in particular to a game control method and a game control device. Background Art
[0002] At present, the scene perspectives in mobile games are basically locked. By fixing the camera on the character, the camera will move with the character when it moves. Figure 1 As shown, at this time, due to the continuous movement of the camera, the scene perspective seen by the player will also keep moving, which will weaken the player's sense of space for the scene in the screen area. Especially for action games, it will make it difficult for players to judge relative distances and control character movement, increasing the visual burden caused by the movement of the scene perspective. Moreover, each time the character moves, new scene content needs to be loaded, which consumes a lot of game performance. Summary of the invention
[0003] In view of the problem that in the above-mentioned prior art the camera will follow the character when it moves, which will weaken the player's sense of space for the scene in the screen area, and that new scene content needs to be loaded each time the character moves, which consumes a lot of game performance, an embodiment of the present invention is proposed to provide a game control method and a corresponding game control device that overcome the above-mentioned problems or at least partially solve the above-mentioned problems.
[0004] The embodiment of the present invention discloses a method for controlling a game, wherein a graphical user interface is provided through a terminal device, wherein the graphical user interface includes a scene image of a game scene captured by a virtual camera, and a virtual character located in the game scene, wherein the virtual character is a virtual object controlled by the terminal device, and the method comprises:
[0005] In response to a touch operation applied to the scene image, determining an action position of the touch operation and target coordinates in the game scene corresponding to the action position;
[0006] Determining a target direction and a first target distance for the virtual character to move according to the target coordinates and the current position of the virtual character;
[0007] When the action position is located in a first area in the scene image, the virtual character is controlled to move the first target distance toward the target direction, and the virtual camera is controlled to move a second target distance toward the target direction or the virtual camera is controlled to remain stationary, wherein the second target distance is smaller than the first target distance.
[0008] Optionally, the method further comprises:
[0009] A second target distance to which the virtual camera is to be moved is determined according to a product of the first target distance and a preset movement coefficient, wherein the preset movement coefficient is a positive number less than 1.
[0010] Optionally, the method further comprises:
[0011] When the action position is located in the second area in the scene image, the virtual camera is controlled to follow the virtual character to move toward the target direction until the virtual character reaches the position corresponding to the target coordinates.
[0012] Optionally, the first area is an area around the virtual character in the scene image, and the second area is an area in the scene image other than the first area.
[0013] Optionally, the method further comprises:
[0014] Obtaining the resolution of the terminal device;
[0015] The first area is determined according to the resolution of the terminal device and the current location of the virtual character.
[0016] Optionally, controlling the virtual camera to follow the virtual character to move toward the target direction until the virtual character reaches a position corresponding to the target coordinates includes:
[0017] Determine whether the current position of the virtual character and the current position of the virtual camera are in a default position relationship;
[0018] If so, the virtual camera is controlled to follow the virtual character and move toward the target direction at the same speed until the virtual character reaches the position corresponding to the target coordinates.
[0019] Optionally, controlling the virtual camera to follow the virtual character to move toward the target direction until the virtual character reaches a position corresponding to the target coordinates includes:
[0020] Determine whether the current position of the virtual character and the current position of the virtual camera are in a default position relationship;
[0021] If not, the virtual character is controlled to move the first target distance toward the target direction at a preset first speed, and the virtual camera is controlled to move toward the target direction at a second speed. When the position of the virtual camera and the position of the virtual character are in a default positional relationship, the virtual camera is controlled to follow the virtual character at the first speed until the virtual character reaches the position corresponding to the target coordinates.
[0022] Optionally, the default position relationship includes: the virtual character is located at the center of the field of view of the virtual camera.
[0023] Optionally, controlling the virtual camera to move toward the target direction at a second speed comprises:
[0024] Taking the target direction as a reference, when the virtual character is located in front of the virtual camera, calculating a third target distance between a current position of the virtual camera and a current position of the virtual character;
[0025] Calculate a second speed of the virtual camera according to the third target distance;
[0026] The virtual camera is controlled to move toward the target direction at the second speed.
[0027] Optionally, calculating the second speed of the virtual camera according to the third target distance includes:
[0028] The second speed of the virtual camera is calculated according to the third target distance and the following formula:
[0029]
[0030] Among them, v represents the first speed, R1 represents the first preset time for the virtual camera to catch up with the virtual character, L3 represents the third target distance, and v1 represents the second speed.
[0031] Optionally, controlling the virtual camera to move toward the target direction at a second speed comprises:
[0032] Taking the target direction as a reference, when the virtual character is located behind the virtual camera, calculating a fourth target distance between a current position of the virtual camera and a current position of the virtual character;
[0033] Calculate a second speed of the virtual camera according to the fourth target distance;
[0034] The virtual camera is controlled to move toward the target direction at the second speed.
[0035] Optionally, calculating the second speed of the camera according to the fourth target distance includes:
[0036] The second speed of the virtual camera is calculated according to the fourth target distance and the following formula:
[0037]
[0038] Among them, v represents the first speed, R2 represents the second preset time for the virtual camera to catch up with the virtual character, L4 represents the fourth target distance, and v2 represents the second speed.
[0039] The embodiment of the present invention further discloses a game control device, which provides a graphical user interface through a terminal device, wherein the graphical user interface includes a scene image of a game scene captured by a virtual camera, and a virtual character located in the game scene, wherein the virtual character is a virtual object controlled by the terminal device, and the device includes:
[0040] A first determination module, configured to respond to a touch operation applied to the scene image, determine an action position of the touch operation, and target coordinates in the game scene corresponding to the action position;
[0041] A second determination module, configured to determine a target direction and a first target distance for the virtual character to move according to the target coordinates and the current position of the virtual character;
[0042] A control module is used to control the virtual character to move the first target distance toward the target direction when the action position is located in the first area in the scene image, and to control the virtual camera to move a second target distance toward the target direction or to control the virtual camera to remain stationary, wherein the second target distance is smaller than the first target distance.
[0043] The embodiment of the present invention further discloses an electronic device, including:
[0044] A processor and a storage medium, wherein the storage medium stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor executes the machine-readable instructions to perform the method as described in any one of the embodiments of the present invention.
[0045] An embodiment of the present invention further discloses a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the method described in any one of the embodiments of the present invention is executed.
[0046] The embodiments of the present invention include the following advantages:
[0047] In an embodiment of the present invention, by responding to a touch operation on the scene image, the action position of the touch operation and the target coordinates in the game scene corresponding to the action position are determined; according to the target coordinates and the current position of the virtual character, the target direction and the first target distance to be moved by the virtual character are determined; when the action position is located in the first area of the scene image, the virtual character is controlled to move the first target distance in the target direction, and the virtual camera is controlled to move the second target distance in the target direction or the virtual camera is controlled to remain stationary, wherein the second target distance is less than the first target distance. Therefore, when the action position of the touch operation is located in the first area, the virtual camera is no longer controlled to follow the movement of the virtual character, but the virtual camera is controlled separately to control the virtual camera to remain stationary or move a relatively small distance, so that the frequency of scene perspective movement is reduced, the visual burden of the player caused by the scene perspective movement is reduced, the target position of the interactive elements in the current scene is strengthened, and the operation efficiency is improved. In addition, the frequency of scene resource loading can be reduced to avoid unnecessary performance consumption of the game. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] In order to more clearly illustrate the technical solution of the present invention, the accompanying drawings required for use in the description of the present invention will be briefly introduced below. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative labor.
[0049] Figure 1 It is a schematic diagram of binding a camera and a character in the prior art;
[0050] Figure 2 is a flowchart of a method for controlling a game provided by an embodiment of the present invention;
[0051] Figure 3 is a schematic diagram of a region division provided by an embodiment of the present invention;
[0052] Figure 4 is a schematic diagram of a click event provided by an embodiment of the present invention;
[0053] Figure 5 is a schematic diagram of a position where a virtual camera needs to move provided by an embodiment of the present invention;
[0054] Figure 6 is a schematic diagram of a default position relationship between a virtual camera and a virtual character provided by an embodiment of the present invention;
[0055] Figure 7is a schematic diagram of a virtual character located in front of a virtual camera provided by an embodiment of the present invention;
[0056] Figure 8 is a schematic diagram of a virtual character located behind a virtual camera provided by an embodiment of the present invention;
[0057] Fig. 9 is a structural block diagram of a game control device provided by an embodiment of the present invention;
[0058] Fig.10 is a structural block diagram of an electronic device of the present invention;
[0059] Fig.11 It is a structural block diagram of a computer-readable storage medium of the present invention. DETAILED DESCRIPTION
[0060] In order to make the above-mentioned purposes, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below in conjunction with the accompanying drawings and specific embodiments. Obviously, the described embodiments are part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0061] In order to solve the problem in the prior art that when the character moves, the camera follows the movement, which weakens the player's sense of space for the scene in the screen area, and each time the character moves, new scene content needs to be loaded, which consumes a lot of game performance, a game control method is provided in an embodiment of the present invention. By dividing the graphical user interface into areas, when the target position that the virtual character needs to move to is within the area around the virtual character, the camera is controlled separately instead of controlling the camera to follow the virtual character; when the target position that the virtual character needs to move to is not within the area around the virtual character, the camera is controlled to follow the virtual character to the target position.
[0062] Specifically, by responding to the touch operation acting on the scene image, the action position of the touch operation and the target coordinates in the game scene corresponding to the action position are determined; according to the target coordinates and the current position of the virtual character, the target direction and the first target distance to be moved by the virtual character are determined; when the action position is located in the first area of the scene image, the virtual character is controlled to move the first target distance in the target direction, and the virtual camera is controlled to move the second target distance in the target direction or the virtual camera is controlled to remain stationary, wherein the second target distance is less than the first target distance. Therefore, when the action position of the touch operation is located in the first area, the virtual camera is no longer controlled to follow the movement of the virtual character, but the virtual camera is controlled separately to control the virtual camera to remain stationary or move a relatively small distance, so that the frequency of scene perspective movement is reduced, the visual burden of the player caused by the scene perspective movement is reduced, the target position of the interactive elements in the current scene is strengthened, and the operation efficiency is improved. In addition, the frequency of scene resource loading can be reduced to avoid unnecessary performance consumption of the game.
[0063] In one embodiment of the present invention, the method for controlling a game may be run on a terminal device or a server. The terminal device may be a local terminal device. When the method for controlling a game is run on a server, the method for controlling a game may be implemented and executed based on a cloud interaction system, wherein the cloud interaction system includes a server and a client device.
[0064] In an optional implementation, various cloud applications can be run under the cloud interaction system, such as cloud games. Taking cloud games as an example, cloud games refer to a game method based on cloud computing. In the operation mode of cloud games, the operating body of the game program and the main body of the game screen presentation are separated. The storage and operation of the game control method are completed on the cloud game server. The role of the client device is used for receiving and sending data and presenting the game screen. For example, the client device can be a display device with a data transmission function close to the user side, such as a first terminal device, a TV, a computer, a handheld computer, etc.; but the terminal device for the game control method is a cloud game server in the cloud. When playing the game, the player operates the client device to send an operation instruction to the cloud game server. The cloud game server runs the game according to the operation instruction, encodes and compresses the game screen and other data, and returns it to the client device through the network. Finally, the client device decodes and outputs the game screen.
[0065] In an optional embodiment, the terminal device may be a local terminal device. Taking a game as an example, the local terminal device stores a game program and is used to present a game screen. The local terminal device is used to interact with the player through a graphical user interface, that is, the game program is downloaded and installed by an electronic device and run conventionally. The local terminal device may provide the graphical user interface to the player in a variety of ways, for example, it may be rendered and displayed on a display screen of the terminal, or provided to the player through a holographic projection. For example, the local terminal device may include a display screen and a processor, the display screen is used to present a graphical user interface, the graphical user interface includes a game screen, and the processor is used to run the game, generate a graphical user interface, and control the display of the graphical user interface on the display screen.
[0066] Reference Figure 2 , shows a flowchart of a method for controlling a game provided by an embodiment of the present invention, wherein a graphical user interface is provided by a terminal device, wherein the graphical user interface includes a scene image of a game scene captured by a virtual camera, and a virtual character located in the game scene, wherein the virtual character is a virtual object controlled by the terminal device, and the method may specifically include the following steps:
[0067] Step 201, in response to a touch operation applied to the scene image, determining an action position of the touch operation and target coordinates in the game scene corresponding to the action position;
[0068] The game of the embodiment of the present invention can be run in a terminal device, which can be a portable mobile terminal, such as a smart phone, a wearable device, a personal digital assistant (PDA), a point of sales (POS), a car computer, etc., or an electronic device such as a laptop, a tablet computer, and an IPAD. The terminal device can have a touch screen, and for the convenience of operation, the touch screen is used to replace the mouse or keyboard. The touch screen is composed of a touch detection component and a touch screen controller. The touch detection component is installed in front of the display screen to detect the user's touch position and then transmit the relevant information to the touch screen controller. The main function of the touch screen controller is to receive touch information from the touch point detection device, convert it into touch point coordinates, and then transmit it to the central processing unit (CPU); it can also receive commands sent by the CPU and execute them. When a finger, a stylus or other operating medium applies pressure (or force) to the touch screen installed at the front end of the display, the touched position is detected by the touch screen controller and sent to the CPU through an interface (such as an RS-232 serial port, USB, etc.).
[0069] In an embodiment of the present invention, a game application is run on a terminal device and a graphical user interface is rendered on a touch screen of the terminal device. The content displayed by the graphical user interface includes a scene image of a game scene captured by a virtual camera, and a virtual character located in the game scene. The virtual character can be a virtual object controlled by a player through the terminal device. The content presented in the graphical user interface can include all of the virtual character or a portion of the virtual character.
[0070] When the player needs to control the movement of the virtual character in the game scene, a touch operation can be performed on the scene image in the graphical user interface. The touch operation may include a click operation, a double-click operation, or a long press operation, etc., which is not limited by the embodiment of the present invention. The terminal device may have a data acquisition module for collecting user operations and reporting the collected user operations to the game application. When the game application receives a touch operation acting on the scene image, it can determine the action position of the touch operation and the target coordinates in the game scene corresponding to the action position. In a specific implementation, by determining the mapping relationship between the coordinate system corresponding to the scene image and the coordinate system corresponding to the game scene, the target coordinates in the game scene corresponding to the action position of the touch operation can be determined based on the mapping relationship.
[0071] Step 202, determining a target direction and a first target distance for the virtual character to move according to the target coordinates and the current position of the virtual character;
[0072] Specifically, the target direction is the direction from the current position of the virtual character in the game scene to the position corresponding to the target coordinates. The first target distance is the distance from the current position of the virtual character to the position corresponding to the target coordinates. In specific implementation, the distance between the virtual character and the position corresponding to the target coordinates can be calculated by the distance formula between two points.
[0073] Step 202, when the action position is located in the first area in the scene image, control the virtual character to move the first target distance toward the target direction, and control the virtual camera to move a second target distance toward the target direction or control the virtual camera to remain stationary, wherein the second target distance is smaller than the first target distance.
[0074] The first area is a pre-set area of a certain size in the scene image. In the embodiment of the present invention, when the action position is located in the first area, the virtual camera needs to be controlled separately, and the virtual camera is no longer controlled to follow the movement of the virtual character.
[0075] Specifically, by judging whether the action position is located in the first area of the scene image, when the action position is located in the first area of the scene image, the virtual character is controlled to move the first target distance in the target direction. At the same time, the virtual camera can be controlled to remain stationary, that is, the virtual character is controlled to move to the position corresponding to the target coordinates alone, while the perspective of the scene remains unchanged; or, by determining the second target distance according to the first target distance, wherein the second target distance is smaller than the first target distance, after determining the second target distance, the virtual camera is controlled to move the second target distance in the target direction, that is, the virtual camera is controlled to move a relatively small distance, so that the perspective of the scene is no longer centered on the virtual character, which is convenient for the player to observe the situation corresponding to the target coordinates.
[0076] In a preferred embodiment of the present invention, the method further comprises:
[0077] When the action position is located in the second area in the scene image, the virtual camera is controlled to follow the virtual character to move toward the target direction until the virtual character reaches the position corresponding to the target coordinates.
[0078] In an embodiment of the present invention, when the action position is located in the second area in the scene image, the virtual camera is controlled to follow the virtual character to move in the target direction until the virtual character reaches the position corresponding to the target coordinates. At this time, the perspective of the game scene moves with the movement of the virtual character.
[0079] In a preferred embodiment of the present invention, the first area is an area around the virtual character in the scene image, and the second area is an area in the scene image other than the first area.
[0080] As an example, Figure 3 As shown, the first area corresponds to A2, and the second area corresponds to A1. In a specific implementation, the area touched by the player can be monitored. When the player touches the screen of the terminal device, a click event will be generated. Clicking different areas will generate different click events, such as Figure 4 As shown, when the click is within the range of A1, a click event T2 is generated; when the click is within the range of A2, a click event T1 is generated. When event T1 is generated, the virtual camera is controlled separately, and when event T2 is generated, the virtual camera is controlled to follow the movement of the virtual character.
[0081] In a preferred embodiment of the present invention, the method further comprises:
[0082] A second target distance to which the virtual camera is to be moved is determined according to a product of the first target distance and a preset movement coefficient, wherein the preset movement coefficient is a positive number less than 1.
[0083] The preset movement coefficient is a pre-set coefficient used to determine the distance the virtual camera needs to move. The second target distance to be moved by the virtual camera can be calculated by multiplying the first target distance by the preset movement coefficient, that is, the second target distance = the first target distance * the preset movement coefficient.
[0084] As an example, Figure 5 As shown, when the player clicks within the range A2, a click event T1 is generated. The click position corresponds to the scene coordinate P1 in the game. When the game application receives the click event T1, the first target distance L1 can be calculated based on P1 and the current position of the virtual character. The second target distance L2 is obtained by multiplying L1 by a preset movement coefficient. The current position of the virtual camera is regarded as the origin. According to the target direction of the virtual character's movement and the length of L2, the position of the virtual camera after moving can be determined to be P3.
[0085] In a preferred embodiment of the present invention, the method further comprises:
[0086] Obtaining a resolution of the terminal device; and determining the first area according to the resolution of the terminal device and the current location of the virtual character.
[0087] In the embodiment of the present invention, the scene image is divided into regions so as to control the virtual camera according to different regions where the target position is located. Specifically, the resolution of the terminal device can be obtained, and then the resolution can be multiplied by a preset coefficient to obtain a region size, and then the first region in the scene image is determined according to the obtained region size with the virtual character as the center, and the region other than the first region in the scene image is further determined as the second region.
[0088] In a specific implementation, the value range of the preset coefficient can be between 0 and 0.3. In this way, the first area determined by the preset coefficient is small, which can ensure that when the position corresponding to the target coordinates to which the virtual character needs to move is close, the virtual camera is no longer controlled to follow the movement of the virtual character, which is conducive to controlling the virtual camera separately when the player wants to do some more delicate operations or actions, so that the player can observe the position corresponding to the target coordinates more clearly. It should be noted that the preset coefficient can be set according to actual needs, for example, the preset coefficient is 0.2, etc., and the embodiment of the present invention does not limit this.
[0089] In a preferred embodiment of the present invention, controlling the virtual camera to follow the virtual character and move toward the target direction until the virtual character reaches a position corresponding to the target coordinates includes:
[0090] Determine whether the current position of the virtual character and the current position of the virtual camera are in a default position relationship; if so, control the virtual camera to follow the virtual character and move toward the target direction at the same speed until the virtual character reaches the position corresponding to the target coordinates.
[0091] The default position relationship is that the virtual character is located at the center of the field of view of the virtual camera, that is, when the virtual camera captures a scene image of the game scene from the current position, the virtual character is located at the center of the scene image.
[0092] By determining whether the current position of the virtual character and the current position of the virtual camera are in a default position relationship, when the current position of the virtual character and the current position of the virtual camera are in a default position relationship, the virtual camera can be directly controlled to follow the virtual character and move toward the target direction at the same speed until the virtual character reaches the position corresponding to the target coordinates. Figure 6 As shown, the virtual camera follows the virtual character and moves toward the target direction at the same speed. The speed of the virtual camera and the virtual character moving simultaneously can be set as needed, which is not limited in the embodiment of the present invention.
[0093] In a preferred embodiment of the present invention, controlling the virtual camera to follow the virtual character and move toward the target direction until the virtual character reaches a position corresponding to the target coordinates includes:
[0094] Determine whether the current position of the virtual character and the current position of the virtual camera are in a default position relationship; if not, control the virtual character to move the first target distance toward the target direction at a preset first speed, and control the virtual camera to move toward the target direction at a second speed, and when the position of the virtual camera and the position of the virtual character are in a default position relationship, control the virtual camera to follow the virtual character at the first speed until the virtual character reaches the position corresponding to the target coordinates.
[0095] By judging whether the current position of the virtual character and the current position of the virtual camera are in the default position relationship, when the current position of the virtual character and the current position of the virtual camera are not in the default position relationship, it is necessary to first adjust the position of the virtual camera so that after the adjustment, the position of the virtual camera and the position of the virtual character are in the default position relationship, and then control the virtual camera to move with the virtual character. Because the movement state of the virtual character is not fixed, the player may change the position where the virtual character needs to go at any time. In this case, in order to prevent the movement of the virtual camera and the virtual character from not matching, the design first controls the virtual camera and the virtual character to move to the same position before performing subsequent movements.
[0096] Specifically, the virtual character is controlled to move a first target distance toward a target direction at a preset first speed, and at the same time, the virtual camera is controlled to move toward the target direction at a second speed, and the relationship between the position of the virtual camera and the position of the virtual character is determined in real time. When the position of the virtual camera and the position of the virtual character are in a default positional relationship, the virtual camera is controlled to follow the virtual character at the first speed until the virtual character reaches the position corresponding to the target coordinates.
[0097] In a preferred embodiment of the present invention, controlling the virtual camera to move toward the target direction at a second speed comprises:
[0098] Taking the target direction as a reference, when the virtual character is located in front of the virtual camera, a third target distance between the current position of the virtual camera and the current position of the virtual character is calculated; a second speed of the virtual camera is calculated according to the third target distance; and the virtual camera is controlled to move toward the target direction at the second speed.
[0099] Specifically, the relative position relationship between the virtual character and the virtual camera is determined based on the target direction. When the virtual character is located in front of the virtual camera, a third target distance between the current position of the virtual camera and the current position of the virtual character is calculated; a second speed of the virtual camera is calculated based on the third target distance; and the virtual camera is controlled to move toward the target direction at the second speed.
[0100] In a preferred embodiment of the present invention, the step of calculating the second speed of the virtual camera according to the third target distance includes:
[0101] The second speed of the virtual camera is calculated according to the third target distance and the following formula:
[0102]
[0103] Among them, v represents the first speed, R1 represents the first preset time for the virtual camera to catch up with the virtual character, L3 represents the third target distance, and v1 represents the second speed.
[0104] In the specific implementation, Figure 7 As shown, it is assumed that the virtual camera moves within a fixed time R1 to a position where the captured scene image satisfies the virtual character as the center of the field of view. According to the existing coordinates, the third target distance between the virtual camera and the virtual character can be calculated as L3, and the distance between the virtual character and the position corresponding to the target coordinates is L2. The virtual character movement time R=L2 / v can be calculated by the L2 distance and the fixed speed v of the virtual character. According to L3, L2, R, R1, v, the second speed v1=(v*R1-v*R+L2+L3) / R1 of the virtual camera can be calculated. Substituting R=L2 / v, v1=(v*R1+L3) / R1 can be obtained, which is the above calculation formula.
[0105] In a preferred embodiment of the present invention, controlling the virtual camera to move toward the target direction at a second speed comprises:
[0106] Taking the target direction as a reference, when the virtual character is located behind the virtual camera, a fourth target distance between the current position of the virtual camera and the current position of the virtual character is calculated; a second speed of the virtual camera is calculated according to the fourth target distance; and the virtual camera is controlled to move toward the target direction at the second speed.
[0107] Specifically, when the relative position is that the virtual character is behind the virtual camera, the fourth target distance between the current position of the virtual camera and the current position of the virtual character is calculated, the second speed of the virtual camera is calculated according to the fourth target distance, and the virtual camera is controlled to move toward the target direction at the second speed.
[0108] In a preferred embodiment of the present invention, the step of calculating the second speed of the virtual camera according to the fourth target distance includes:
[0109] The second speed of the virtual camera is calculated according to the fourth target distance and the following formula:
[0110]
[0111] Among them, v represents the first speed, R2 represents the second preset time for the virtual camera to catch up with the virtual character, L4 represents the fourth target distance, and v2 represents the second speed.
[0112] In the specific implementation, Figure 8As shown, it is assumed that the virtual character moves within a fixed time R2 to a position where the scene image captured by the virtual camera satisfies the virtual character as the center of the field of view. According to the existing coordinates, the fourth target distance between the virtual camera and the virtual character can be calculated as L4, and the distance between the virtual character and the position corresponding to the target coordinates is L3. The character movement time R=L3 / v can be calculated by the L3 distance and the fixed speed v of the virtual character. According to L3, L4, R, R2, v, the second speed of the virtual camera v2=(v*R2+L3-L4-vR) / R2 can be calculated. Substituting R=L3 / v, v2=v-(L4 / R2) can be obtained, which is the above calculation formula.
[0113] It should be noted that, for the sake of simplicity, the method embodiments are described as a series of action combinations, but those skilled in the art should be aware that the embodiments of the present invention are not limited by the order of the actions described, because according to the embodiments of the present invention, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required by the embodiments of the present invention.
[0114] Reference Fig. 9 , shows a structural block diagram of a game control device provided by an embodiment of the present invention, wherein a graphical user interface is provided through a terminal device, wherein the graphical user interface includes a scene image of a game scene captured by a virtual camera, and a virtual character located in the game scene, wherein the virtual character is a virtual object controlled by the terminal device, and the device may specifically include the following modules:
[0115] A first determination module 901 is used to respond to a touch operation applied to the scene image, determine an action position of the touch operation, and target coordinates in the game scene corresponding to the action position;
[0116] A second determination module 902 is used to determine a target direction and a first target distance for the virtual character to move according to the target coordinates and the current position of the virtual character;
[0117] The control module 903 is used to control the virtual character to move the first target distance in the target direction when the action position is located in the first area in the scene image, and to control the virtual camera to move the second target distance in the target direction or to control the virtual camera to remain stationary, wherein the second target distance is smaller than the first target distance.
[0118] In a preferred embodiment of the present invention, the device further comprises:
[0119] The second target distance determination module is used to determine the second target distance to be moved by the virtual camera according to the product of the first target distance and a preset movement coefficient, wherein the preset movement coefficient is a positive number less than 1.
[0120] In a preferred embodiment of the present invention, the device further comprises:
[0121] The second control module is used for controlling the virtual camera to follow the virtual character and move toward the target direction when the action position is located in a second area in the scene image, until the virtual character reaches the position corresponding to the target coordinates.
[0122] In a preferred embodiment of the present invention, the first area is an area around the virtual character in the scene image, and the second area is an area in the scene image other than the first area.
[0123] In a preferred embodiment of the present invention, the device further comprises:
[0124] A resolution acquisition module, used to acquire the resolution of the terminal device;
[0125] The first area determination module is used to determine the first area according to the resolution of the terminal device and the current location of the virtual character.
[0126] In a preferred embodiment of the present invention, the second control module includes:
[0127] A position relationship determination submodule, used to determine whether the current position of the virtual character and the current position of the virtual camera are in a default position relationship;
[0128] The first control submodule is used to control the virtual camera to follow the virtual character and move toward the target direction at the same speed until the virtual character reaches the position corresponding to the target coordinates.
[0129] In a preferred embodiment of the present invention, the second control module includes:
[0130] A position relationship determination submodule, used to determine whether the current position of the virtual character and the current position of the virtual camera are in a default position relationship;
[0131] The second control submodule is used for, if not, controlling the virtual character to move the first target distance at a preset first speed toward the target direction, and controlling the virtual camera to move at a second speed toward the target direction, and when the position of the virtual camera and the position of the virtual character are in a default positional relationship, controlling the virtual camera to follow the virtual character at the first speed until the virtual character reaches the position corresponding to the target coordinates.
[0132] In a preferred embodiment of the present invention, the default position relationship includes: the virtual character is located at the center of the field of view of the virtual camera.
[0133] In a preferred embodiment of the present invention, the second control submodule includes:
[0134] a third target distance determining unit, configured to calculate a third target distance between a current position of the virtual camera and a current position of the virtual character, based on the target direction, when the virtual character is located in front of the virtual camera;
[0135] A first determining unit, configured to calculate a second speed of the virtual camera according to the third target distance;
[0136] The first control unit is used to control the virtual camera to move toward the target direction at the second speed.
[0137] In a preferred embodiment of the present invention, the first determining unit includes:
[0138] The speed calculation subunit is used to calculate the second speed of the virtual camera according to the third target distance and the following formula:
[0139]
[0140] Among them, v represents the first speed, R1 represents the first preset time for the virtual camera to catch up with the virtual character, L3 represents the third target distance, and v1 represents the second speed.
[0141] In a preferred embodiment of the present invention, the second control submodule further includes:
[0142] a fourth target distance determining unit, configured to calculate, based on the target direction, a fourth target distance between a current position of the virtual camera and a current position of the virtual character when the virtual character is located behind the virtual camera;
[0143] A second determining unit, configured to calculate a second speed of the virtual camera according to the fourth target distance;
[0144] The second control unit is used to control the virtual camera to move toward the target direction at the second speed.
[0145] In a preferred embodiment of the present invention, the second determining unit includes:
[0146] The speed calculation subunit is used to calculate the second speed of the virtual camera according to the fourth target distance and the following formula:
[0147]
[0148] Among them, v represents the first speed, R2 represents the second preset time for the virtual camera to catch up with the virtual character, L4 represents the fourth target distance, and v2 represents the second speed.
[0149] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0150] The embodiment of the present invention further provides an electronic device, such as Fig.10 As shown, including:
[0151] Processor 1001 and storage medium 1002, the storage medium 1002 stores machine-readable instructions executable by the processor 1001, and when the electronic device is running, the processor 1001 executes the machine-readable instructions to perform the method as described in any one of the embodiments of the present invention. The specific implementation method and technical effect are similar and will not be repeated here.
[0152] The embodiment of the present invention also provides a computer readable storage medium, such as Fig.11 As shown, the storage medium stores a computer program 1101, and the computer program 1101 is executed by a processor to execute a method as described in any one of the embodiments of the present invention. The specific implementation method and technical effect are similar and will not be described here.
[0153] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.
[0154] It will be appreciated by those skilled in the art that the embodiments of the present invention may be provided as methods, devices, or computer program products. Therefore, the embodiments of the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the embodiments of the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.
[0155] The embodiments of the present invention are described with reference to the flowcharts and / or block diagrams of the methods, terminal devices (systems), and computer program products according to the embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of the processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing terminal device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0156] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing terminal device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0157] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device so that a series of operating steps are executed on the computer or other programmable terminal device to produce a computer-implemented process, thereby providing instructions for executing on the computer or other programmable terminal device to implement the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0158] Although the preferred embodiments of the present invention have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the embodiments of the present invention.
[0159] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or terminal device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or terminal device including the elements.
[0160] The game control method and the game control device provided by the present invention are introduced in detail above. The principle and implementation mode of the present invention are explained in this article by using specific examples. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. At the same time, for those skilled in the art, according to the idea of the present invention, there will be changes in the specific implementation mode and the scope of application. In summary, the content of this specification should not be understood as limiting the present invention.
Claims
1. A method for controlling a game, characterized in that: A graphical user interface is provided through a terminal device, wherein the graphical user interface includes a scene image of a game scene captured by a virtual camera, and a virtual character located in the game scene, wherein the virtual character is a virtual object controlled by the terminal device, and the method includes: In response to a touch operation applied to the scene image, determining an action position of the touch operation and target coordinates in the game scene corresponding to the action position; Determining a target direction and a first target distance for the virtual character to move according to the target coordinates and the current position of the virtual character; Obtaining the resolution of the terminal device, and determining a first area in the scene image according to the resolution of the terminal device and the current position of the virtual character; wherein the first area is an area around the virtual character in the scene image, and an area in the scene image other than the first area is a second area in the scene image; When the action position is located in the first area, controlling the virtual character to move the first target distance toward the target direction, and controlling the virtual camera to move a second target distance toward the target direction or controlling the virtual camera to remain stationary, wherein the second target distance is smaller than the first target distance; When the action position is located in the second area, the virtual camera is controlled to follow the virtual character to move toward the target direction until the virtual character reaches the position corresponding to the target coordinates.
2. The method according to claim 1, characterized in that: The method further comprises: A second target distance to which the virtual camera is to be moved is determined according to a product of the first target distance and a preset movement coefficient, wherein the preset movement coefficient is a positive number less than 1.
3. The method according to claim 1, characterized in that The controlling the virtual camera to follow the virtual character and move toward the target direction until the virtual character reaches a position corresponding to the target coordinates includes: Determine whether the current position of the virtual character and the current position of the virtual camera are in a default position relationship; If so, the virtual camera is controlled to follow the virtual character and move toward the target direction at the same speed until the virtual character reaches the position corresponding to the target coordinates.
4. The method according to claim 1, characterized in that: The controlling the virtual camera to follow the virtual character and move toward the target direction until the virtual character reaches a position corresponding to the target coordinates includes: Determine whether the current position of the virtual character and the current position of the virtual camera are in a default position relationship; If not, the virtual character is controlled to move the first target distance toward the target direction at a preset first speed, and the virtual camera is controlled to move toward the target direction at a second speed. When the position of the virtual camera and the position of the virtual character are in a default positional relationship, the virtual camera is controlled to follow the virtual character at the first speed until the virtual character reaches the position corresponding to the target coordinates.
5. The method according to claim 3 or 4, characterized in that: The default position relationship includes: the virtual character is located at the center of the field of view of the virtual camera.
6. The method according to claim 4, characterized in that The controlling the virtual camera to move toward the target direction at a second speed comprises: Taking the target direction as a reference, when the virtual character is located in front of the virtual camera, calculating a third target distance between a current position of the virtual camera and a current position of the virtual character; Calculate a second speed of the virtual camera according to the third target distance; The virtual camera is controlled to move toward the target direction at the second speed.
7. The method according to claim 6, characterized in that The calculating the second speed of the virtual camera according to the third target distance includes: The second speed of the virtual camera is calculated according to the third target distance and the following formula: Among them, v represents the first speed, R1 represents the first preset time for the virtual camera to catch up with the virtual character, L3 represents the third target distance, and v1 represents the second speed.
8. The method according to claim 4, characterized in that The controlling the virtual camera to move toward the target direction at a second speed comprises: Taking the target direction as a reference, when the virtual character is located behind the virtual camera, calculating a fourth target distance between a current position of the virtual camera and a current position of the virtual character; Calculate a second speed of the virtual camera according to the fourth target distance; The virtual camera is controlled to move toward the target direction at the second speed.
9. The method according to claim 8, characterized in that The calculating the second speed of the camera according to the fourth target distance includes: The second speed of the virtual camera is calculated according to the fourth target distance and the following formula: Among them, v represents the first speed, R2 represents the second preset time for the virtual camera to catch up with the virtual character, L4 represents the fourth target distance, and v2 represents the second speed.
10. A game control device, characterized in that: A graphical user interface is provided through a terminal device, wherein the graphical user interface includes a scene image of a game scene captured by a virtual camera, and a virtual character located in the game scene, wherein the virtual character is a virtual object controlled by the terminal device, and the apparatus comprises: A first determination module, configured to respond to a touch operation applied to the scene image, determine an action position of the touch operation, and target coordinates in the game scene corresponding to the action position; A second determination module, configured to determine a target direction and a first target distance of the virtual character to be moved according to the target coordinates and the current position of the virtual character; A first region determination module, used to obtain the resolution of the terminal device, and determine a first region in the scene image according to the resolution of the terminal device and the current position of the virtual character; wherein the first region is the region around the virtual character in the scene image, and the region in the scene image other than the first region is the second region in the scene image; a control module, configured to control the virtual character to move the first target distance toward the target direction, and control the virtual camera to move the second target distance toward the target direction or control the virtual camera to remain stationary when the action position is located in a first area in the scene image, wherein the second target distance is smaller than the first target distance; The second control module is used for controlling the virtual camera to follow the virtual character and move toward the target direction when the action position is located in a second area in the scene image, until the virtual character reaches the position corresponding to the target coordinates.
11. An electronic device, characterized in that: include: A processor and a storage medium, wherein the storage medium stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor executes the machine-readable instructions to perform the method according to any one of claims 1 to 9.
12. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 9 is executed.
