A method and device for controlling movement of a virtual character
By switching the server and client first mode according to the network status in online games, the problem of inconsistent movement of virtual characters in weak network environments is solved, achieving a smooth game experience and virtual character stability under different network conditions.
Patent Information
- Application Number
- CN202210140565.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-02-16
- Publication Date
- 2024-10-11
- Estimated Expiration
- 2042-02-16
AI Technical Summary
In online games, not enabling client first will result in poor game response in a weak network environment, while enabling client first may lead to inconsistencies in the target areas of the client and server.
By detecting network status on the client and server, and controlling the movement of virtual characters in a server-first and client-first manner respectively, it ensures a smooth gaming experience under different network conditions. Specific methods include using server-side first when a good network is detected, enabling client-side first when the network is available, and keeping the virtual character's position unchanged when the network is unavailable.
It provides a better gaming experience under good network conditions, optimizes the player experience under poor network conditions, and ensures the movement of virtual characters in extremely weak network environments to avoid death in battle.
Smart Images

Figure CN114522416B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of game technology, and in particular to a method for controlling the movement of a virtual character and a device for controlling the movement of a virtual character. Background Art
[0002] The graphics and complexity of online mobile games are getting higher and higher. Being able to play anytime and anywhere is a major feature of mobile games. However, because it can be played anytime and anywhere, players may face extreme network conditions when they are far away from base stations, in tunnels, or in areas with poor subway signals. We collectively refer to this as "weak network." A weak network environment is a major problem facing online games. A weak network usually means a network with sudden high packet loss and high latency. In the prior art, for the movement control of virtual units in online games, two relatively different movement control schemes are formed based on whether the client is turned on first:
[0003] One is to not enable the client first. For example, in a game that uses a joystick to control character movement, the left joystick is usually used to control the player's movement. After the player moves the joystick, the logic layer receives the direction and distance the joystick is moved, moves it, and then notifies each client back for performance. This solution can ensure that all clients behave consistently, but if the network has a "weak network" problem during this process, it will lead to extremely poor game response.
[0004] Another option is to enable client first, so that the client can move relatively independently of the server, which will feel better in weak network conditions. However, in stable network conditions, because the client goes first, the client moves ahead of the server. When the player needs to select a target through the client, the target area displayed on the client may be inconsistent with the selectable area on the server, causing the player to fail to select the target. Summary of the invention
[0005] In view of the fact that not enabling client-first in the above-mentioned online game will result in poor game response when the network has a "weak network" problem, and enabling client-first will result in the area where the target displayed on the client is located being inconsistent with the area selectable on the server, an embodiment of the present invention is proposed to provide a virtual character movement control method and a corresponding virtual character movement control device that overcome the above-mentioned problems or at least partially solve the above-mentioned problems.
[0006] The embodiment of the present invention discloses a method for controlling movement of a virtual character, which is applied to a client, and displays at least part of a game scene on a graphical user interface of the client, wherein the game scene includes at least one virtual character, and the method comprises:
[0007] In response to a first operation for controlling the movement of the virtual character, determining a first position to which the virtual character is to move, and reporting the first operation and the first position to a server;
[0008] When it is detected that the network of the client is good, receiving the second position returned by the server according to the first operation, and controlling the virtual character to move to the second position;
[0009] When it is detected that the network of the client is available, controlling the virtual character to move to the first position, and when receiving a second position returned by the server according to the first operation, adjusting the position of the virtual character after the movement according to the second position;
[0010] When it is detected that the network of the client is unavailable, the virtual character is controlled to move to the first position.
[0011] Optionally, adjusting the position of the virtual character after moving according to the second position includes:
[0012] determining a distance between the first location and the second location;
[0013] When the distance is less than a preset distance threshold, controlling the virtual character to remain at the moved position;
[0014] When the distance is greater than or equal to a preset distance threshold, the virtual character is controlled to move to the second position.
[0015] Optionally, the graphical user interface further includes a virtual joystick control, and the virtual joystick control is used to control the movement of the virtual character, and the first operation includes a sliding operation acting on a joystick in the virtual joystick control.
[0016] Optionally, the first operation includes a sliding direction and a sliding distance, and the responding to the first operation for controlling the movement of the virtual character to determine a first position to be moved of the virtual character includes:
[0017] Obtaining the current position and orientation of the virtual character;
[0018] A first position to which the virtual character is to be moved is determined according to the current position and orientation, sliding direction and sliding distance of the virtual character.
[0019] Optionally, after the step of reporting the first operation and the first position to the server, the method further includes:
[0020] The network delay data of the client within a preset time period is obtained, and whether the network of the client is available is determined according to the network delay data.
[0021] The embodiment of the present invention further discloses a method for controlling movement of a virtual character, which is applied to a server side. The method comprises:
[0022] receiving a first operation and a first position for controlling the movement of a virtual character reported by a client, and determining a second position to be moved of the virtual character according to the first operation; wherein the first position is determined by the client according to the first operation;
[0023] When it is detected that the network of the client is good, the second position is sent to the client, so that the client controls the virtual character to move to the second position;
[0024] When it is detected that the network of the client is available, sending the second position to the client, so that the client adjusts the position of the virtual character after the move according to the second position;
[0025] When it is detected that the network of the client is unavailable, the stored position of the virtual character is updated according to the first position.
[0026] Optionally, the graphical user interface of the client includes a virtual joystick control, and the virtual joystick control is used to control the movement of the virtual character, and the first operation includes a sliding operation acting on a joystick in the virtual joystick control.
[0027] Optionally, the first operation includes a sliding direction and a sliding distance, and determining the second position to be moved of the virtual character according to the first operation includes:
[0028] Obtaining the current position and orientation of the virtual character;
[0029] A second position to which the virtual character is to move is determined according to the current position and orientation, sliding direction and sliding distance of the virtual character.
[0030] Optionally, after the step of determining the second position according to the first operation, the method further includes:
[0031] The network delay data of the client within a preset time period is obtained, and whether the network of the client is available is determined according to the network delay data.
[0032] The embodiment of the present invention further discloses a virtual character movement control device, which is applied to a client and displays at least part of a game scene on a graphical user interface of the client, wherein the game scene includes at least one virtual character, and the device comprises:
[0033] A first position determination module, configured to respond to a first operation for controlling the movement of the virtual character, determine a first position to be moved by the virtual character, and report the first operation and the first position to a server;
[0034] A first movement control module, configured to, when detecting that the network of the client is good, receive a second position returned by the server according to the first operation, and control the virtual character to move to the second position;
[0035] A second movement control module is used to control the virtual character to move to the first position when it is detected that the network of the client is available, and to adjust the position of the virtual character after the movement according to the second position when receiving the second position returned by the server according to the first operation;
[0036] The third movement control module is used to control the virtual character to move to the first position when it is detected that the network of the client is unavailable.
[0037] The embodiment of the present invention further discloses a virtual character movement control device, which is applied to a server side, and the device comprises:
[0038] A second position determination module is used to receive a first operation and a first position for controlling the movement of a virtual character reported by a client, and determine a second position to be moved by the virtual character according to the first operation; wherein the first position is determined by the client according to the first operation;
[0039] A first movement control module, configured to send the second position to the client when it is detected that the network of the client is good, so that the client controls the virtual character to move to the second position;
[0040] A second movement control module, configured to send the second position to the client when it is detected that the network of the client is available, so that the client adjusts the position of the virtual character after the movement according to the second position;
[0041] A location updating module is used to update the stored location of the virtual character according to the first location when it is detected that the network of the client is unavailable.
[0042] The embodiment of the present invention further discloses an electronic device, including:
[0043] 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.
[0044] 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.
[0045] The embodiments of the present invention include the following advantages:
[0046] In an embodiment of the present invention, by responding to a first operation for controlling the movement of the virtual character, a first position to be moved by the virtual character is determined, and the first operation and the first position are reported to the server; when it is detected that the network of the client is good, the second position returned by the server according to the first operation is received, and the virtual character is controlled to move to the second position; when it is detected that the network of the client is available, the virtual character is controlled to move to the first position, and when the second position returned by the server according to the first operation is received, the position of the virtual character after the movement is adjusted according to the second position; when it is detected that the network of the client is unavailable, the virtual character is controlled to move to the first position. The movement of the virtual character can be controlled according to different network states, and the control mode of client-first and non-first is balanced, so that when the network of the client is good, the client-first movement is not enabled so that the players with good network can get a better game experience, and when the network of the client is not good, the client-first movement is enabled to optimize the players with weak network, and when the network is extremely weak, it is ensured that the virtual character can move to avoid death in battle. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] 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.
[0048] Figure 1 is a flow chart of steps of a method for controlling movement of a virtual character provided by an embodiment of the present invention;
[0049] Figure 2 is a flowchart of another method for controlling movement of a virtual character provided by an embodiment of the present invention;
[0050] Figure 3 is a structural block diagram of a mobile control device for a virtual character provided by an embodiment of the present invention;
[0051] Figure 4 is a structural block diagram of another virtual character movement control device provided by an embodiment of the present invention;
[0052] Figure 5is a structural block diagram of an electronic device of the present invention;
[0053] Figure 6 It is a structural block diagram of a computer-readable storage medium of the present invention. DETAILED DESCRIPTION
[0054] 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.
[0055] In the prior art, when controlling the movement of a virtual character in an online game, if the client is not enabled first, the game response will be poor when a "weak network" problem occurs. If the client is enabled first, the area where the target is displayed on the client will be inconsistent with the area selectable on the server.
[0056] In order to solve the problems existing in the prior art, a method for controlling the movement of a virtual character is provided in an embodiment of the present invention. By grading the network status of the client, when it is necessary to control the movement of the virtual character in the game scene, the movement of the virtual character is controlled by the server first, or by the client first, according to the level of the network status of the client. Specifically, by responding to a first operation for controlling the movement of the virtual character, a first position to be moved of the virtual character is determined, and the first operation and the first position are reported to the server; when it is detected that the network of the client is good, the second position returned by the server according to the first operation is received, and the virtual character is controlled to move to the second position; when it is detected that the network of the client is available, the virtual character is controlled to move to the first position, and when the second position returned by the server according to the first operation is received, the position of the virtual character after the movement is adjusted according to the second position; when it is detected that the network of the client is unavailable, the virtual character is controlled to move to the first position. It allows the movement of virtual characters to be controlled according to different network conditions, balancing the client-first and non-client-first control methods. When the client's network is good, client-first movement is not enabled so that players with good networks can have a better gaming experience. When the client's network is poor, client-first movement is enabled to optimize players with weak networks. When the network is extremely weak, it ensures that the virtual character can move to avoid death in battle.
[0057] In one embodiment of the present invention, the method for controlling the movement of a virtual character can be run on a terminal device or a server. The terminal device can be a local terminal device. When the method for controlling the movement of a virtual character is run on a server, the method for controlling the movement of the virtual character can be implemented and executed based on a cloud interaction system, wherein the cloud interaction system includes a server and a client device.
[0058] 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 mode based on cloud computing. In the operation mode of cloud games, the operation subject of the game program and the game screen presentation subject are separated. The storage and operation of the mobile control method of the virtual character 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 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 performing the mobile control method of the virtual character 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.
[0059] 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.
[0060] Reference Figure 1 , shows a flowchart of a method for controlling movement of a virtual character provided by an embodiment of the present invention, which is applied to a client, and at least part of a game scene is displayed on a graphical user interface of the client, wherein the game scene includes at least one virtual character, and the method may specifically include the following steps:
[0061] Step 101, in response to a first operation for controlling the movement of the virtual character, determining a first position to be moved of the virtual character, and reporting the first operation and the first position to a server;
[0062] The client of the network 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.).
[0063] By running the client on the terminal device and rendering the client's graphical user interface on the touch screen of the terminal device, the content displayed by the graphical user interface includes at least part of the game scene, wherein the game scene can include at least one virtual character, and the virtual character can be a virtual game unit controlled by the player through the terminal device.
[0064] When the client receives a first operation from the user, the first operation is used to control the movement of the virtual character, and can respond to the first operation, determine a first position to be moved by the virtual character according to the first operation, and report the first operation and the first position to the server.
[0065] Step 102, when it is detected that the network of the client is good, receiving the second position returned by the server according to the first operation, and controlling the virtual character to move to the second position;
[0066] In an embodiment of the present invention, the network status of the client is graded into three levels, including good, available, and unavailable. When the network of the client is good, the client-side priority is not enabled, that is, the server-side priority scheme is implemented, and the client always controls the movement of the virtual character according to the movement instruction issued by the server. Specifically, when it is detected that the network of the client is good, the receiving server controls the virtual character to move to the second position according to the second position returned by the first operation, so as to ensure the fairness of the player's game by the server-side priority method when the player's network delay is extremely low.
[0067] Step 103, when it is detected that the network of the client is available, controlling the virtual character to move to the first position, and when receiving the second position returned by the server according to the first operation, adjusting the position of the virtual character after the movement according to the second position;
[0068] In the embodiment of the present invention, when the client network is available, if the server-side first mode is used, the client will have a more obvious "lag" feeling. Therefore, in order to achieve a better moving feel, some coordinate accuracy is sacrificed and the client-side first mode is enabled. The client first moves according to the first position calculated locally, and then adjusts the position of the virtual character according to the second position in the moving instruction when receiving the moving instruction sent by the server. Specifically, when it is detected that the client network is available, the virtual character is controlled to move to the first position, and when the second position returned by the server according to the first operation is received, the position of the virtual character after moving is adjusted according to the second position.
[0069] Step 104: When it is detected that the network of the client is unavailable, control the virtual character to move to the first position.
[0070] In the embodiment of the present invention, when the client network is unavailable, the client network is in a state of being disconnected but not disconnected, the channel packet loss rate and RTT (Round-Trip Time) are both very high, and it is sufficient to ensure that the virtual character controlled by the player can finally move and be available. Specifically, when it is detected that the client network is unavailable, the virtual character is controlled to move to the first position, and the position corresponding to the virtual character stored in the server is updated according to the position of the virtual character in the client.
[0071] In a preferred embodiment of the present invention, step 103 includes:
[0072] Determine the distance between the first position and the second position; when the distance is less than a preset distance threshold, control the virtual character to remain at the moved position; when the distance is greater than or equal to the preset distance threshold, control the virtual character to move to the second position.
[0073] The preset distance threshold is a pre-set distance critical value, which is used to correct the position of the virtual character to avoid excessive difference in the position of the virtual character between the client and the server.
[0074] In an embodiment of the present invention, the distance between the first position and the second position is determined; when the distance is less than a preset distance threshold, the virtual character is controlled to remain at the moved position; when the distance is greater than or equal to the preset distance threshold, the virtual character is controlled to move to the second position.
[0075] In a preferred embodiment of the present invention, the graphical user interface further includes a virtual joystick control, the virtual joystick control is used to control the movement of the virtual character, and the first operation includes a sliding operation acting on the joystick in the virtual joystick control.
[0076] In a preferred embodiment of the present invention, the first operation includes a sliding direction and a sliding distance, and the responding to the first operation for controlling the movement of the virtual character to determine the first position to be moved of the virtual character includes:
[0077] The current position and orientation of the virtual character are obtained; and a first position to be moved of the virtual character is determined according to the current position and orientation, sliding direction and sliding distance of the virtual character.
[0078] In the embodiment of the present invention, the current position and orientation of the virtual character are obtained through the client; and the first position to be moved of the virtual character is calculated according to the current position and orientation, sliding direction and sliding distance of the virtual character.
[0079] In a preferred embodiment of the present invention, after step 101, the method further includes:
[0080] The network delay data of the client within a preset time period is obtained, and whether the network of the client is available is determined according to the network delay data.
[0081] In an embodiment of the present invention, the network delay data of the client within a preset time period is obtained, and whether the network of the client is available is determined according to the network delay data. The preset time period is a pre-set time length, such as 2 seconds, and whether the network of the client is available is determined according to the network delay data within 2 seconds.
[0082] Specifically, the network status is first defined, such as the network is very good, the channel packet loss and RTT are extremely low; the network is available, the channel packet loss and RTT are moderate, and the ping for games is 100-420ms; the network is unavailable, the channel packet loss and RTT are high, and the ping for games is above 420ms. In a specific implementation, the network delay data can be Ping data, and the network status of the client is detected by the Ping command. When the Ping data is stable below 65ms within a continuous preset time (such as 2 seconds), the network is determined to be good; when the Ping data is stable within 65-250ms within a continuous preset time (such as 2 seconds), the network is determined to be available; when the Ping data is greater than 420ms within a preset time (such as 2 seconds) or is stable above 250ms within a continuous preset time (such as 2 seconds), the network is determined to be unavailable.
[0083] The following is an overall description of the mobile control scheme of the embodiment of the present invention, including three mobile control schemes:
[0084] 1. Server first: The client reports the player's first operation (such as the direction and distance of the joystick slide) to the server in each frame. The server calculates the position of the virtual character in the next frame stored in the server according to the first operation and the current orientation of the player's character, and then sends it to the client, which performs interpolation and smooth movement.
[0085] 2. Client first 1: The client will report the player's first operation (such as the sliding direction and distance of the joystick) to the server in each frame, and directly move in advance according to the first position calculated according to the first operation in the client. After the server calculates the second position of the virtual character, it sends it to the client. The client will interpolate a client position based on the first position calculated in advance by the client and the second position sent by the server. This can ensure that the gap between the client and the server is not too far.
[0086] 3. Client first 2: Due to extreme network conditions, the server cannot receive the data sent by the client in each frame, so this solution is quite special. The client uses the first operation (such as the direction and distance of the sliding joystick) to calculate the latest coordinate position in each frame, and then sends the latest coordinate position as the control position to the server. Because the server has a large delay after receiving the client message, what the server needs to do is to move the virtual character stored in the server to the position that the client has reached first. Under this solution, the position of the virtual character in the client's field of view and the real position of the virtual character stored in the server may be very different, but it can take into account the player's mobile experience under extreme networks and ensure the consistency of the final position.
[0087] Reference Figure 2, shows a flowchart of another method for controlling movement of a virtual character provided by an embodiment of the present invention, which is applied to a server side. The method may specifically include the following steps:
[0088] Step 201, receiving a first operation and a first position for controlling the movement of a virtual character reported by a client, and determining a second position to be moved of the virtual character according to the first operation; wherein the first position is determined by the client according to the first operation;
[0089] In an embodiment of the present invention, when the client receives a first operation from a user, it can determine a first position to be moved by the virtual character according to the first operation, and report the first operation and the first position to the server. The server receives the first operation and the first position for controlling the movement of the virtual character reported by the client, and determines a second position to be moved by the virtual character according to the first operation.
[0090] Step 202, when it is detected that the network of the client is good, sending the second position to the client, so that the client controls the virtual character to move to the second position;
[0091] In an embodiment of the present invention, when the server detects that the client's network is good, a server-first solution can be used. The client controls the movement of the virtual character according to the second position sent by the server, and the second position is sent to the client through the server, so that the client controls the virtual character to move to the second position.
[0092] Step 203, when it is detected that the network of the client is available, the second position is sent to the client, so that the client adjusts the position of the virtual character after the move according to the second position;
[0093] In an embodiment of the present invention, when the server detects that the client's network is available, a client-first solution can be used, where the client directly controls the virtual movement according to the first position. After the server calculates the second position based on the first operation, the server sends the second position to the client, so that the client adjusts the position of the virtual character after movement according to the second position.
[0094] Step 204: when it is detected that the network of the client is unavailable, update the stored position of the virtual character according to the first position.
[0095] In an embodiment of the present invention, when the server detects that the network of the client is unavailable, it only needs to ensure that the virtual character in the client can move, and the client directly controls the virtual movement according to the first position, and the server updates the stored position of the virtual character according to the received first position.
[0096] In a preferred embodiment of the present invention, the graphical user interface of the client includes a virtual joystick control, which is used to control the movement of the virtual character, and the first operation includes a sliding operation acting on the joystick in the virtual joystick control.
[0097] In a preferred embodiment of the present invention, the first operation includes a sliding direction and a sliding distance, and determining the second position to be moved of the virtual character according to the first operation includes:
[0098] The current position and orientation of the virtual character are obtained; and a second position to be moved of the virtual character is determined according to the current position and orientation, sliding direction and sliding distance of the virtual character.
[0099] In the embodiment of the present invention, the current position and orientation of the virtual character are obtained through the server; and the second position to be moved by the virtual character is determined according to the current position and orientation, sliding direction and sliding distance of the virtual character.
[0100] In a preferred embodiment of the present invention, after the step of determining the second position according to the first operation, the method further comprises:
[0101] The network delay data of the client within a preset time period is obtained, and whether the network of the client is available is determined according to the network delay data.
[0102] In an embodiment of the present invention, the network delay data of the client within a preset time period is obtained, and whether the network of the client is available is determined according to the network delay data. The preset time period is a pre-set time length, such as 2 seconds, and whether the network of the client is available is determined according to the network delay data within 2 seconds.
[0103] 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.
[0104] Reference Figure 3 , shows a structural block diagram of a mobile control device for a virtual character provided by an embodiment of the present invention, which is applied to a client and displays at least part of a game scene on a graphical user interface of the client, wherein the game scene includes at least one virtual character, and specifically may include the following modules:
[0105] A first position determination module 301 is used to respond to a first operation for controlling the movement of the virtual character, determine a first position to be moved by the virtual character, and report the first operation and the first position to a server;
[0106] A first movement control module 302 is configured to, when it is detected that the network of the client is good, receive a second position returned by the server according to the first operation, and control the virtual character to move to the second position;
[0107] A second movement control module 303 is used to control the virtual character to move to the first position when it is detected that the network of the client is available, and to adjust the position of the virtual character after the movement according to the second position when receiving the second position returned by the server according to the first operation;
[0108] The third movement control module 304 is configured to control the virtual character to move to the first position when it is detected that the network of the client is unavailable.
[0109] In a preferred embodiment of the present invention, the second movement control module 303 includes:
[0110] a distance determination submodule, configured to determine a distance between the first position and the second position;
[0111] A first control submodule, configured to control the virtual character to remain at the moved position when the distance is less than a preset distance threshold;
[0112] The second control submodule is used to control the virtual character to move to the second position when the distance is greater than or equal to a preset distance threshold.
[0113] In a preferred embodiment of the present invention, the graphical user interface further includes a virtual joystick control, and the virtual joystick control is used to control the movement of the virtual character, and the first operation includes a sliding operation acting on the joystick in the virtual joystick control.
[0114] In a preferred embodiment of the present invention, the first operation includes a sliding direction and a sliding distance, and the first position determination module 301 includes:
[0115] A direction acquisition submodule, used to acquire the current position and direction of the virtual character;
[0116] The first position determination submodule is used to determine a first position to be moved by the virtual character according to the current position and orientation, sliding direction and sliding distance of the virtual character.
[0117] In a preferred embodiment of the present invention, it also includes:
[0118] The network determination module is used to obtain the network delay data of the client within a preset time period, and determine whether the network of the client is available according to the network delay data.
[0119] Reference Figure 4 , shows a structural block diagram of another virtual character movement control device provided by an embodiment of the present invention, which is applied to a server side and may specifically include the following modules:
[0120] The second position determination module 401 is used to receive a first operation and a first position for controlling the movement of a virtual character reported by a client, and determine a second position to be moved by the virtual character according to the first operation; wherein the first position is determined by the client according to the first operation;
[0121] A first movement control module 402 is configured to send the second position to the client when it is detected that the network of the client is good, so that the client controls the virtual character to move to the second position;
[0122] A second movement control module 403 is configured to send the second position to the client when it is detected that the network of the client is available, so that the client adjusts the position of the virtual character after the movement according to the second position;
[0123] The location updating module 404 is configured to update the stored location of the virtual character according to the first location when it is detected that the network of the client is unavailable.
[0124] In a preferred embodiment of the present invention, the graphical user interface of the client includes a virtual joystick control, which is used to control the movement of the virtual character, and the first operation includes a sliding operation acting on the joystick in the virtual joystick control.
[0125] In a preferred embodiment of the present invention, the first operation includes a sliding direction and a sliding distance, and the second position determination module 401 includes:
[0126] A direction submodule, used to obtain the current position and direction of the virtual character;
[0127] The second position determination submodule is used to determine a second position to be moved by the virtual character according to the current position and orientation, sliding direction and sliding distance of the virtual character.
[0128] In a preferred embodiment of the present invention, it also includes:
[0129] The network determination module is used to obtain the network delay data of the client within a preset time period, and determine whether the network of the client is available according to the network delay data.
[0130] 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.
[0131] The embodiment of the present invention further provides an electronic device, such as Figure 5 As shown, including:
[0132] A processor 501 and a storage medium 502, wherein the storage medium 502 stores machine-readable instructions executable by the processor 501, and when the electronic device is running, the processor 501 executes the machine-readable instructions to execute 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.
[0133] The embodiment of the present invention also provides a computer readable storage medium, such as Figure 6 As shown, the storage medium stores a computer program 601, and the computer program 601 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.
[0134] 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.
[0135] 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.
[0136] 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.
[0137] 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.
[0138] 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.
[0139] 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.
[0140] 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.
[0141] The above is a detailed introduction to a method for controlling the movement of a virtual character and a device for controlling the movement of a virtual character provided by the present invention. Specific examples are used herein to illustrate the principles and implementation methods of the present invention. 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 methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.
Claims
1. A method for controlling movement of a virtual character, characterized in that: Applied to a client, displaying at least part of a game scene on a graphical user interface of the client, wherein the game scene includes at least one virtual character, the method comprising: In response to a first operation for controlling the movement of the virtual character, determining a first position to which the virtual character is to move, and reporting the first operation and the first position to a server; When it is detected that the network of the client is good, receiving the second position returned by the server according to the first operation, and controlling the virtual character to move to the second position; When it is detected that the network of the client is available, controlling the virtual character to move to the first position, and when receiving a second position returned by the server according to the first operation, adjusting the position of the virtual character after the movement according to the second position; When it is detected that the network of the client is unavailable, controlling the virtual character to move to the first position; Wherein, adjusting the position of the virtual character after moving according to the second position includes: determining a distance between the first location and the second location; When the distance is less than a preset distance threshold, controlling the virtual character to remain at the moved position; When the distance is greater than or equal to a preset distance threshold, the virtual character is controlled to move to the second position.
2. The method according to claim 1, characterized in that The graphical user interface also includes a virtual joystick control, which is used to control the movement of the virtual character, and the first operation includes a sliding operation acting on the joystick in the virtual joystick control.
3. The method according to claim 1 or 2, characterized in that: The first operation includes a sliding direction and a sliding distance, and the response is used to control the first operation of the movement of the virtual character, and determines a first position to be moved of the virtual character, including: Obtaining the current position and orientation of the virtual character; A first position to which the virtual character is to be moved is determined according to the current position and orientation, sliding direction and sliding distance of the virtual character.
4. The method according to claim 1, characterized in that: After the step of reporting the first operation and the first position to the server, the method further includes: The network delay data of the client within a preset time period is obtained, and whether the network of the client is available is determined according to the network delay data.
5. A method for controlling movement of a virtual character, characterized in that: Applied to the server side, the method includes: receiving a first operation and a first position for controlling the movement of a virtual character reported by a client, and determining a second position to be moved of the virtual character according to the first operation; wherein the first position is determined by the client according to the first operation; When it is detected that the network of the client is good, the second position is sent to the client, so that the client controls the virtual character to move to the second position; When it is detected that the network of the client is available, sending the second position to the client, so that the client adjusts the position of the virtual character after the move according to the second position; When it is detected that the network of the client is unavailable, updating the stored position of the virtual character according to the first position; Wherein, adjusting the position of the virtual character after moving according to the second position includes: determining a distance between the first location and the second location; When the distance is less than a preset distance threshold, controlling the virtual character to remain at the moved position; When the distance is greater than or equal to a preset distance threshold, the virtual character is controlled to move to the second position.
6. The method according to claim 5, characterized in that The graphical user interface of the client includes a virtual joystick control, which is used to control the movement of the virtual character, and the first operation includes a sliding operation acting on the joystick in the virtual joystick control.
7. The method according to claim 5 or 6, characterized in that: The first operation includes a sliding direction and a sliding distance, and determining a second position to be moved of the virtual character according to the first operation includes: Obtaining the current position and orientation of the virtual character; A second position to which the virtual character is to move is determined according to the current position and orientation, sliding direction and sliding distance of the virtual character.
8. The method according to claim 5, characterized in that After the step of determining the second position according to the first operation, the method further includes: The network delay data of the client within a preset time period is obtained, and whether the network of the client is available is determined according to the network delay data.
9. A mobile control device for a virtual character, characterized in that: Applied to a client, displaying at least part of a game scene on a graphical user interface of the client, wherein the game scene includes at least one virtual character, the device comprises: A first position determination module, configured to respond to a first operation for controlling the movement of the virtual character, determine a first position to be moved by the virtual character, and report the first operation and the first position to a server; A first movement control module, configured to, when detecting that the network of the client is good, receive a second position returned by the server according to the first operation, and control the virtual character to move to the second position; A second movement control module is used to control the virtual character to move to the first position when it is detected that the network of the client is available, and to adjust the position of the virtual character after the movement according to the second position when receiving the second position returned by the server according to the first operation; A third movement control module, configured to control the virtual character to move to the first position when it is detected that the network of the client is unavailable; Wherein, the second movement control module includes: a distance determination submodule, configured to determine a distance between the first position and the second position; A first control submodule, configured to control the virtual character to remain at the moved position when the distance is less than a preset distance threshold; The second control submodule is used to control the virtual character to move to the second position when the distance is greater than or equal to a preset distance threshold.
10. A mobile control device for a virtual character, characterized in that: Applied to the server side, the device comprises: A second position determination module is used to receive a first operation and a first position for controlling the movement of a virtual character reported by a client, and determine a second position to be moved by the virtual character according to the first operation; wherein the first position is determined by the client according to the first operation; A first movement control module, configured to send the second position to the client when it is detected that the network of the client is good, so that the client controls the virtual character to move to the second position; A second movement control module, configured to send the second position to the client when it is detected that the network of the client is available, so that the client adjusts the position of the virtual character after the movement according to the second position; A location updating module, configured to update the stored location of the virtual character according to the first location when it is detected that the network of the client is unavailable; Wherein, adjusting the position of the virtual character after moving according to the second position includes: determining a distance between the first location and the second location; When the distance is less than a preset distance threshold, controlling the virtual character to remain at the moved position; When the distance is greater than or equal to a preset distance threshold, the virtual character is controlled to move to the second position.
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 as described in any one of claims 1-4 or 5-8.
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 4 or 5 to 8 is executed.
