CN114522416A - Virtual character movement control method and device - Google Patents

Virtual character movement control method and device Download PDF

Info

Publication number
CN114522416A
CN114522416A CN202210140565.4A CN202210140565A CN114522416A CN 114522416 A CN114522416 A CN 114522416A CN 202210140565 A CN202210140565 A CN 202210140565A CN 114522416 A CN114522416 A CN 114522416A
Authority
CN
China
Prior art keywords
client
virtual character
virtual
network
controlling
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210140565.4A
Other languages
Chinese (zh)
Inventor
张青阳
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Netease Hangzhou Network Co Ltd
Original Assignee
Netease Hangzhou Network Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Netease Hangzhou Network Co Ltd filed Critical Netease Hangzhou Network Co Ltd
Priority to CN202210140565.4A priority Critical patent/CN114522416A/en
Publication of CN114522416A publication Critical patent/CN114522416A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • AHUMAN NECESSITIES
    • A63SPORTS; GAMES; AMUSEMENTS
    • A63FCARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
    • A63F13/00Video games, i.e. games using an electronically generated display having two or more dimensions
    • A63F13/30Interconnection arrangements between game servers and game devices; Interconnection arrangements between game devices; Interconnection arrangements between game servers
    • A63F13/35Details of game servers
    • A63F13/358Adapting the game course according to the network or server load, e.g. for reducing latency due to different connection speeds between clients
    • AHUMAN NECESSITIES
    • A63SPORTS; GAMES; AMUSEMENTS
    • A63FCARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
    • A63F13/00Video games, i.e. games using an electronically generated display having two or more dimensions
    • A63F13/40Processing input control signals of video game devices, e.g. signals generated by the player or derived from the environment
    • A63F13/42Processing input control signals of video game devices, e.g. signals generated by the player or derived from the environment by mapping the input signals into game commands, e.g. mapping the displacement of a stylus on a touch screen to the steering angle of a virtual vehicle
    • A63F13/428Processing input control signals of video game devices, e.g. signals generated by the player or derived from the environment by mapping the input signals into game commands, e.g. mapping the displacement of a stylus on a touch screen to the steering angle of a virtual vehicle involving motion or position input signals, e.g. signals representing the rotation of an input controller or a player's arm motions sensed by accelerometers or gyroscopes
    • AHUMAN NECESSITIES
    • A63SPORTS; GAMES; AMUSEMENTS
    • A63FCARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
    • A63F13/00Video games, i.e. games using an electronically generated display having two or more dimensions
    • A63F13/80Special adaptations for executing a specific game genre or game mode
    • A63F13/822Strategy games; Role-playing games
    • AHUMAN NECESSITIES
    • A63SPORTS; GAMES; AMUSEMENTS
    • A63FCARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
    • A63F2300/00Features of games using an electronically generated display having two or more dimensions, e.g. on a television screen, showing representations related to the game
    • A63F2300/50Features of games using an electronically generated display having two or more dimensions, e.g. on a television screen, showing representations related to the game characterized by details of game servers
    • A63F2300/53Features of games using an electronically generated display having two or more dimensions, e.g. on a television screen, showing representations related to the game characterized by details of game servers details of basic data processing
    • AHUMAN NECESSITIES
    • A63SPORTS; GAMES; AMUSEMENTS
    • A63FCARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
    • A63F2300/00Features of games using an electronically generated display having two or more dimensions, e.g. on a television screen, showing representations related to the game
    • A63F2300/80Features of games using an electronically generated display having two or more dimensions, e.g. on a television screen, showing representations related to the game specially adapted for executing a specific type of game
    • A63F2300/807Role playing or strategy games

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Human Computer Interaction (AREA)
  • Information Transfer Between Computers (AREA)
  • User Interface Of Digital Computer (AREA)

Abstract

The embodiment of the invention provides a method and a device for controlling the movement of a virtual role, wherein the method comprises the following steps: responding to a first operation for controlling the virtual role to move, determining a first position to be moved of the virtual role, and reporting the first operation and the first position to a server side; when the network of the client is detected to be good, receiving a second position returned by the server according to the first operation, and controlling the virtual role to move to the second position; when the network of the client is detected to be available, controlling the virtual character to move to the first position, and when a second position returned by the server according to the first operation is received, adjusting the position of the virtual character after moving according to the second position; controlling the virtual character to move to the first position when detecting that the network of the client is unavailable. So that the movement of the virtual character can be controlled separately according to different network states.

Description

Virtual character movement control method and device
Technical Field
The present invention relates to the field of game technology, and in particular, to a method and apparatus for controlling the movement of a virtual character.
Background
The pictures and complexity of the network mobile phone games are higher and higher, and the game can be played anytime and anywhere and is a great feature of hand games, but because the game can be played anytime and anywhere, a player can face extreme network conditions when the player is at a position far away from a base station, passes through a tunnel and is in an area with poor subway signals, and the game is generally called as a 'weak network'. The weak network environment is a big problem faced by network games, and the weak network generally means a network with high burstiness, high packet loss and high delay. In the prior art, for the movement control of virtual units in a network game, two different movement control schemes are formed in advance according to whether a client is started:
one is to not enable client forego, for example, in a game using a joystick to realize character movement, a left joystick is usually used to control player movement, after a player moves the joystick, a logic layer receives the direction and distance of the joystick being moved, moves the joystick, and then informs each client back to perform, and this scheme can ensure that all clients behave consistently, but in this process, if a network 'weak network' problem occurs, an extremely poor game response is caused.
The other is to start client-side precedence, so that the client-side can move relatively independently of the server-side, and the user feels good in the case of a weak network, but in the case of a stable network, because the client-side precedence leads the client-side movement to be ahead of the server-side, when a player needs to select an object through the client-side, the area where the object displayed on the client-side is located may be inconsistent with the area selectable by the server-side, and the player may fail to select the object.
Disclosure of Invention
In view of the above-mentioned problem that the game response effect is not good when the network has a "weak network" problem due to the fact that the client is not enabled in advance, and the problem that the area where the target displayed on the client is located is inconsistent with the area selectable by the server due to the fact that the client is enabled in advance in the network game, the embodiments of the present invention are provided to provide a method for controlling the movement of a virtual character and a corresponding device for controlling the movement of a virtual character, which overcome or at least partially solve the above-mentioned problem.
The embodiment of the invention discloses a method for controlling the movement of a virtual character, which is applied to a client and is used for displaying at least part of game scenes on a graphical user interface of the client, wherein the game scenes comprise at least one virtual character, and the method comprises the following steps:
responding to a first operation for controlling the virtual role to move, determining a first position to be moved of the virtual role, and reporting the first operation and the first position to a server;
when the network of the client is detected to be good, receiving a second position returned by the server according to the first operation, and controlling the virtual role to move to the second position;
when the network of the client is detected to be available, controlling the virtual character to move to the first position, and when a second position returned by the server according to the first operation is received, adjusting the position of the virtual character after moving according to the second position;
controlling the virtual character to move to the first location when detecting that the network of the client is unavailable.
Optionally, the 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 smaller than a preset distance threshold value, controlling the virtual character to keep the moved position still;
and when the distance is greater than or equal to a preset distance threshold value, controlling the virtual character to move to the second position.
Optionally, the graphical user interface further includes a virtual rocker control, the virtual rocker control is used for controlling the virtual character to move, and the first operation includes a sliding operation acting on a rocker in the virtual rocker control.
Optionally, the determining, by the first operation for controlling the virtual character to move, a first position where the virtual character is to be moved includes:
acquiring the current position and orientation of the virtual character;
and determining a first position to be moved of the virtual character according to the current position and orientation, the sliding direction and the sliding distance of the virtual character.
Optionally, after the step of reporting the first operation and the first location to a server, the method further includes:
and acquiring network delay data of the client within a preset time length, and judging whether the network of the client is available according to the network delay data.
The embodiment of the invention also discloses a virtual role movement control method, which is applied to a server side and comprises the following steps:
receiving a first operation and a first position which are reported by a client and used for controlling the movement of a virtual role, and determining a second position to be moved of the virtual role according to the first operation; the first position is determined by the client according to the first operation;
when the network of the client is detected to be good, sending the second position to the client so that the client controls the virtual character to move to the second position;
when the network of the client is detected to be available, sending the second position to the client, so that the client can adjust the position of the virtual character after movement according to the second position;
and when the network of the client is detected to be unavailable, updating the stored position of the virtual role according to the first position.
Optionally, a graphical user interface of the client includes a virtual rocker control, the virtual rocker control is used to control the virtual character to move, and the first operation includes a sliding operation acting on a rocker in the virtual rocker control.
Optionally, the determining, according to the first operation, a second position where the virtual character is to be moved includes:
acquiring the current position and orientation of the virtual character;
and determining a second position to be moved by the virtual character according to the current position and orientation, the sliding direction and the sliding distance of the virtual character.
Optionally, after the step of determining the second position according to the first operation, the method further includes:
and acquiring network delay data of the client within a preset time length, and judging whether the network of the client is available according to the network delay data.
The embodiment of the invention also discloses a mobile control device of the virtual character, which is applied to a client, displays at least part of game scenes on a graphical user interface of the client, wherein the game scenes comprise at least one virtual character, and the device comprises:
a first position determining module, configured to determine, in response to a first operation for controlling movement of the virtual character, a first position where the virtual character is to be moved, and report the first operation and the first position to a server;
the first mobile control module is used for receiving a second position returned by the server according to the first operation when the network of the client is detected to be good, and controlling the virtual role to move to the second position;
the second mobile control module is used for controlling the virtual role to move to the first position when the network of the client is detected to be available, and adjusting the position of the virtual role after moving according to the second position when the second position returned by the server according to the first operation is received;
a third mobile control module, configured to control the virtual character to move to the first location when detecting that the network of the client is unavailable.
The embodiment of the invention also discloses a mobile control device of the virtual role, which is applied to a server side, and the device comprises:
the second position determining module is used for receiving a first operation and a first position which are reported by a client and used for controlling the movement of the virtual role, and determining a second position to be moved of the virtual role according to the first operation; the first position is determined by the client according to the first operation;
the first mobile control module is used for sending the second position to the client when the network of the client is detected to be good, so that the client controls the virtual character to move to the second position;
the second mobile control module is used for sending the second position to the client when the network of the client is detected to be available, so that the client can adjust the position of the virtual character after movement according to the second position;
and the location updating module is used for updating the stored location of the virtual role according to the first location when the network of the client is detected to be unavailable.
The embodiment of the invention also discloses an electronic device, which comprises:
a processor and a storage medium storing machine-readable instructions executable by the processor, the processor executing the machine-readable instructions to perform a method according to any one of the embodiments of the invention when the electronic device is operated.
The embodiment of the invention also discloses a computer readable storage medium, wherein a computer program is stored on the storage medium, and when the computer program is executed by a processor, the method of any one of the embodiments of the invention is executed.
The embodiment of the invention has the following advantages:
in the embodiment of the invention, a first position to be moved of the virtual character is determined by responding to a first operation for controlling the movement of the virtual character, and the first operation and the first position are reported to a server side; when the network of the client is detected to be good, receiving a second position returned by the server according to the first operation, and controlling the virtual role to move to the second position; when the network of the client is detected to be available, controlling the virtual character to move to the first position, and when a second position returned by the server according to the first operation is received, adjusting the position of the virtual character after moving according to the second position; controlling the virtual character to move to the first location when detecting that the network of the client is unavailable. The method and the system can respectively control the movement of the virtual character according to different network states, balance the control modes of client-side advance and client-side non-advance, so that when the network of the client-side is good, the client-side movement is not started to enable the player with good network to obtain better game experience in advance, when the network of the client-side is not good, the client-side movement is started to optimize the player with weak network in advance, and when the network is extremely weak, the virtual character can be ensured to move to avoid death in battle.
Drawings
In order to more clearly illustrate the technical solution of the present invention, the drawings needed to be used in the description of the present invention will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without inventive exercise.
Fig. 1 is a flowchart illustrating steps of a method for controlling movement of a virtual character according to an embodiment of the present invention;
fig. 2 is a flowchart illustrating steps of a method for controlling movement of a virtual character according to another embodiment of the present invention;
fig. 3 is a block diagram illustrating a structure of a mobile control device of a virtual character according to an embodiment of the present invention;
fig. 4 is a block diagram illustrating a mobile control device of another virtual character according to an embodiment of the present invention;
FIG. 5 is a block diagram of an electronic device of the present invention;
fig. 6 is a block diagram of a computer-readable storage medium of the present invention.
Detailed Description
In order to make the aforementioned objects, features and advantages of the present invention comprehensible, embodiments accompanied with figures are described in further detail below. It is to be understood that the embodiments described are only a few embodiments of the present invention, and not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
In the prior art, when the virtual character is controlled to move in the network game, if the client is not started, the game response effect is poor when the network has a weak network problem, and if the client is started, the problem that the area where the target displayed on the client is located is inconsistent with the area selectable by the server is caused.
In order to solve the problems in the prior art, embodiments of the present invention provide a method for controlling the movement of a virtual character, in which a network state of a client is classified, and when the virtual character in a game scene needs to be controlled, the virtual character is controlled to move in a server-side advanced manner or in a client-side advanced manner according to the level of the network state of the client. Specifically, a first position to be moved of the virtual character is determined by responding to a first operation for controlling the movement of the virtual character, and the first operation and the first position are reported to a server side; when the network of the client is detected to be good, receiving a second position returned by the server according to the first operation, and controlling the virtual role to move to the second position; when the network of the client is detected to be available, controlling the virtual character to move to the first position, and when a second position returned by the server according to the first operation is received, adjusting the position of the virtual character after moving according to the second position; controlling the virtual character to move to the first location when detecting that the network of the client is unavailable. The method and the system can respectively control the movement of the virtual character according to different network states, balance the control modes of client-side advance and client-side non-advance, so that when the network of the client-side is good, the client-side movement is not started to enable the player with good network to obtain better game experience in advance, when the network of the client-side is not good, the client-side movement is started to optimize the player with weak network in advance, and when the network is extremely weak, the virtual character can be ensured to move to avoid death in battle.
The method for controlling the movement of the virtual character in one embodiment of the invention can be operated on a terminal device or a server. The terminal device may be a local terminal device. When the movement control method of the virtual character runs on the server, the movement control method of the virtual character can be implemented and executed based on a cloud interaction system, wherein the cloud interaction system comprises the server and the client device.
In an optional embodiment, various cloud applications may be run under the cloud interaction system, for example: and (5) cloud games. Taking a cloud game as an example, a cloud game refers to a game mode based on cloud computing. In the cloud game operation mode, the game program operation main body and the game picture presentation main body are separated, the storage and the operation of the virtual character movement control method are completed on the cloud game server, and the client device is used for receiving and sending data and presenting the game picture, 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 television, a computer, a palm computer and the like; however, the terminal device performing the virtual character movement control method is a cloud game server in the cloud. When a game is played, a 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, data such as game pictures and the like are encoded and compressed, the data are returned to the client device through a network, and finally the data are decoded through the client device and the game pictures are output.
In an alternative 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 for presenting a game screen. The local terminal device is used for interacting with the player through a graphical user interface, namely, a game program is downloaded and installed and operated through the electronic device conventionally. The manner in which the local terminal device provides the graphical user interface to the player may include a variety of ways, for example, it may be rendered for display on a display screen of the terminal or provided to the player through holographic projection. For example, the local terminal device may include a display screen for presenting a graphical user interface including a game screen and a processor for running the game, generating the graphical user interface, and controlling display of the graphical user interface on the display screen.
Referring to fig. 1, a flowchart illustrating steps of an embodiment of a method for controlling movement of a virtual character according to an embodiment of the present invention is shown, and the method is applied to a client, where at least a part of a game scene is displayed on a graphical user interface of the client, where the game scene includes at least one virtual character, and the method may specifically include the following steps:
step 101, responding to a first operation for controlling the virtual character to move, determining a first position to be moved of the virtual character, and reporting the first operation and the first position to a server;
the client of the online game in the embodiment of the present invention may operate in a terminal device, and the terminal device may be a portable mobile terminal, such as a smart phone, a wearable device, a Personal Digital Assistant (PDA), a Point of Sales (POS), a vehicle-mounted computer, and the like, or may be an electronic device such as a notebook computer, a tablet computer, and an IPAD. The terminal device may be provided with a touch screen, and for convenience in operation, the touch screen may be used instead of a mouse or a keyboard. The touch screen is composed of a touch detection part and a touch screen controller, wherein the touch detection part is arranged in front of the display screen and used for detecting the touch position of a user and then transmitting related information to the touch screen controller. The touch screen controller is mainly used for receiving touch information from the touch point detection device, converting the touch information into touch point coordinates and transmitting the touch point coordinates to a Central Processing Unit (CPU); it can receive and execute the command from CPU. When a finger, stylus or other operating medium applies pressure (or force) to a touch screen mounted on the front end of the display, the touched position is detected by the touch screen controller and sent to the CPU through an interface (e.g., RS-232 serial port, USB, etc.).
The client is operated on the terminal device, and a graphical user interface of the client is rendered on a touch screen of the terminal device, wherein the content displayed by the graphical user interface comprises at least part of a game scene, wherein the game scene can comprise at least one virtual character, and the virtual character can be a game virtual unit controlled by a player through the terminal device.
When the client receives a first operation of a user, the first operation is used for controlling the virtual character to move, the first operation can be responded, a first position to be moved of the virtual character is determined according to the first operation, and the first operation and the first position are reported to the server.
Step 102, when the network of the client is detected to be good, receiving a second position returned by the server according to the first operation, and controlling the virtual character to move to the second position;
in the embodiment of the invention, the network state of the client is graded to comprise three levels of good, available and unavailable. When the network of the client is good, the client is not started to advance, namely, the scheme of advancing the server is implemented, and the client always controls the virtual character to move according to the moving instruction issued by the server. Specifically, when the network of the client is detected to be good, the receiving server controls the virtual character to move to the second position according to the second position returned by the first operation, and when the network delay of the player is extremely low, fairness of the game of the player is guaranteed in a server-side advanced mode.
103, when detecting 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 moving according to the second position;
in the embodiment of the invention, when the network of the client is available, if the client has a relatively obvious 'lag' hand feeling in a server-side advanced mode, in order to better move the hand feeling, the precision of partial coordinates is sacrificed, the client is started to advance, the client firstly moves according to a first position obtained by local calculation, and then when a moving instruction sent by the server is received, the position of the virtual character is adjusted according to a second position in the moving instruction. Specifically, when the network of the client is detected to be 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.
And 104, when the network of the client is detected to be unavailable, controlling the virtual character to move to the first position.
In the embodiment of the present invention, when the network of the client is unavailable, the network of the client belongs to a state of disconnection, and the packet loss rate and RTT (Round-Trip Time) of the channel are both high, as long as it is ensured that the virtual character operated by the player can be used in the final movement. Specifically, when it is detected that the network of the client 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.
In a preferred embodiment of the present invention, the step 103 includes:
determining a distance between the first location and the second location; when the distance is smaller than a preset distance threshold value, controlling the virtual character to keep the moved position still; and when the distance is greater than or equal to a preset distance threshold value, controlling the virtual character to move to the second position.
The preset distance threshold is a preset distance critical value and is used for correcting the position of the virtual role so as to avoid overlarge position difference of the virtual role in the client and the server.
In an embodiment of the invention, the distance between the first position and the second position is determined; when the distance is smaller than a preset distance threshold value, the virtual character is controlled to be kept in a moved position; and when the distance is greater than or equal to the preset distance threshold value, controlling the virtual character to move to the second position.
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 virtual character to move, and the first operation includes a sliding operation acting on a joystick in the virtual joystick control.
In a preferred embodiment of the present invention, the first operation includes a sliding direction and a sliding distance, and the determining a first position where the virtual character is to be moved in response to the first operation for controlling the movement of the virtual character includes:
acquiring the current position and orientation of the virtual character; and determining a first position to be moved of the virtual character according to the current position and orientation, the sliding direction and the sliding distance of the virtual character.
In the embodiment of the invention, the current position and orientation of the virtual role are obtained through the client; and calculating to obtain a first position to be moved of the virtual character according to the current position and orientation, the sliding direction and the sliding distance of the virtual character.
In a preferred embodiment of the present invention, after the step 101, the method further includes:
and acquiring network delay data of the client within a preset time length, and judging whether the network of the client is available according to the network delay data.
In the embodiment of the invention, the network delay data of the client within the preset time length is obtained, and whether the network of the client is available or not is judged according to the network delay data. And if the preset time length is the preset time length, if the preset time length is 2 seconds, judging whether the network of the client is available according to the network delay data within 2 seconds.
Specifically, firstly, the network condition is defined, for example, the network is very good, and the channel packet loss and rtt are extremely low; the network is available, the channel packet loss and the RTT are moderate, and ping is 100-420 ms for games; the network is not available, the channel packet loss and RTT are high, ping is above 420ms for games. In a specific implementation, the network delay data may be Ping data, the network state of the client is detected through a Ping command, and when the Ping data is stable within a continuous preset time (e.g., 2 seconds) below 65ms, the network is determined to be good; when the Ping data is stable within 65-250 ms within a continuous preset time (such as 2 seconds), judging that the network is available; and when the Ping data appears for more than 420ms within a preset time (such as 2 seconds) or is stable for more than 250ms within a continuous preset time (such as 2 seconds), determining that the network is unavailable.
The following provides a general description of the mobility control scheme according to the embodiment of the present invention, including three mobility control schemes:
1. the server side firstly: the client reports the first operation (such as the sliding direction and the distance of a rocker) of the player to the server in each frame, the server calculates the position of the next frame of the virtual character stored in the server according to the first operation and the current orientation of the player character, and then sends the position to the client, and the client performs interpolation smooth movement.
2. The client firstly comprises the following steps of 1: the client reports the first operation (such as the sliding direction and distance of the rocker) of the player to the server in each frame, moves in advance according to the first position obtained by calculation according to the first operation directly in the client, the server calculates the second position of the virtual character and then sends the second position to the client, and the client integrates the first position calculated in advance by the client and the second position sent by the server to comprehensively interpolate a client position, so that the client and the server do not have a long advance difference.
3. The client firstly comprises the following steps of 2: because the network condition is extreme, the data sending server of the client side cannot receive the data every frame, the scheme is special, the latest coordinate position is firstly calculated by using the first operation (such as the sliding direction and the distance of a rocker) every frame of the client side, and then the latest coordinate position is used as a control position to be sent to the server side. Because the delay is relatively large after the server receives the client message, what the server needs to do is to move the virtual role stored in the server to the position that the client has arrived first. Under this scheme, the position of the virtual character in the view of the client and the real position of the virtual character stored in the server can be greatly different, but the moving experience of the player under the extreme network can be taken care of, and the consistency of the final position can be ensured.
Referring to fig. 2, a flowchart illustrating steps of another embodiment of a method for controlling movement of a virtual character according to an embodiment of the present invention is shown, and the method is applied to a server side, and specifically may include the following steps:
step 201, receiving a first operation and a first position reported by a client for controlling the movement of a virtual character, and determining a second position to be moved of the virtual character according to the first operation; the first position is determined by the client according to the first operation;
in the embodiment of the present invention, when the client receives the first operation of the user, the first location where the virtual character is to be moved may be determined according to the first operation, and the first operation and the first location are reported to the server. The server receives a first operation and a first position which are reported by the client and used for controlling the virtual role to move, and determines a second position of the virtual role to be moved according to the first operation.
Step 202, when the network of the client is detected to be good, the second position is sent to the client, so that the client controls the virtual character to move to the second position;
in the embodiment of the present invention, when the server detects that the network of the client is good, a solution of server foreward may be used, and the client controls the virtual character to move according to the second location issued by the server, and sends the second location to the client through the server, so that the client controls the virtual character to move to the second location.
Step 203, when the network of the client is detected to be available, sending the second position to the client, so that the client adjusts the position of the virtual character after moving according to the second position;
in the embodiment of the present invention, when the server detects that the network of the client is available, the client may use a scheme of client-side forerunner, the client directly controls the virtual movement according to the first position, and the server sends the second position to the client after calculating the second position according to the first operation, so that the client adjusts the position of the virtual character after movement according to the second position.
And step 204, when the network of the client is detected to be unavailable, updating the stored position of the virtual role according to the first position.
In the embodiment of the invention, when the server detects that the network of the client is unavailable, the server only needs to ensure that the virtual role in the client can move, the client directly controls virtual movement according to the first position, and the server updates the position of the stored virtual role according to the received first position.
In a preferred embodiment of the present invention, a graphical user interface of the client includes a virtual joystick control, the virtual joystick control is used to control the virtual character to move, and the first operation includes a sliding operation acting on a joystick in the virtual joystick control.
In a preferred embodiment of the present invention, the determining the second position to be moved by the virtual character according to the first operation includes:
acquiring the current position and orientation of the virtual character; and determining a second position to be moved by the virtual character according to the current position and orientation, the sliding direction and the sliding distance of the virtual character.
In the embodiment of the invention, the current position and orientation of the virtual role are obtained through the server; and determining a second position to be moved by the virtual character according to the current position and orientation, the sliding direction and the sliding distance of the virtual character.
In a preferred embodiment of the present invention, after the step of determining the second position according to the first operation, the method further includes:
and acquiring network delay data of the client within a preset time length, and judging whether the network of the client is available according to the network delay data.
In the embodiment of the invention, the network delay data of the client within the preset time length is obtained, and whether the network of the client is available or not is judged according to the network delay data. And if the preset time length is the preset time length, if the preset time length is 2 seconds, judging whether the network of the client is available according to the network delay data within 2 seconds.
It should be noted that, for simplicity of description, the method embodiments are described as a series of acts or combination of acts, but those skilled in the art will recognize that the present invention is not limited by the illustrated order of acts, as some steps may occur in other orders or concurrently in accordance with the embodiments of the present invention. Further, those of skill in the art will appreciate that the embodiments described in the specification are presently preferred and that no particular act is required to implement the embodiments of the invention.
Referring to fig. 3, a block diagram of a structure of a mobile control apparatus for virtual characters according to an embodiment of the present invention is shown, and is applied to a client, where at least a part of a game scene is displayed on a graphical user interface of the client, where the game scene includes at least one virtual character, and the mobile control apparatus specifically includes the following modules:
a first location determining module 301, configured to determine, in response to a first operation for controlling movement of the virtual character, a first location where the virtual character is to be moved, and report the first operation and the first location to a server;
a first mobile control module 302, configured to receive a second location returned by the server according to the first operation when it is detected that the network of the client is good, and control the virtual character to move to the second location;
a second movement control module 303, configured to control the virtual character to move to the first position when it is detected that the network of the client is available, and adjust the position of the virtual character after moving according to the second position when receiving the second position returned by the server according to the first operation;
a third movement control module 304, configured to control the virtual character to move to the first location when detecting that the network of the client is unavailable.
In a preferred embodiment of the present invention, the second motion control module 303 includes:
a distance determination submodule for determining a distance between the first location and the second location;
the first control submodule is used for controlling the virtual character to keep in a moved position when the distance is smaller than a preset distance threshold;
and the second control sub-module is used for controlling the virtual character to move to the second position when the distance is greater than or equal to a preset distance threshold.
In a preferred embodiment of the present invention, the graphical user interface further includes a virtual joystick control, the virtual joystick control is configured to control the virtual character to move, and the first operation includes a sliding operation that acts on a joystick in the virtual joystick control.
In a preferred embodiment of the present invention, the first operation includes a sliding direction and a sliding distance, and the first position determining module 301 includes:
the orientation obtaining submodule is used for obtaining the current position and orientation of the virtual character;
and the first position determining submodule is used for determining a first position to be moved of the virtual character according to the current position and orientation, the sliding direction and the sliding distance of the virtual character.
In a preferred embodiment of the present invention, the method further comprises:
and the network judgment module is used for acquiring network delay data of the client within a preset time length and judging whether the network of the client is available according to the network delay data.
Referring to fig. 4, a block diagram of a mobile control device of another virtual character according to an embodiment of the present invention is shown, and is applied to a server side, where the mobile control device specifically includes the following modules:
a second location determining module 401, configured to receive a first operation and a first location that are reported by a client and used for controlling a virtual character to move, and determine, according to the first operation, a second location where the virtual character is to be moved; the first position is determined by the client according to the first operation;
a first mobile control module 402, configured to send the second location 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 location;
a second mobile control module 403, configured to send the second location to the client when detecting that a network of the client is available, so that the client adjusts the location of the virtual character after moving according to the second location;
a location update module 404, configured to update the stored location of the virtual role according to the first location when detecting that the network of the client is unavailable.
In a preferred embodiment of the present invention, a graphical user interface of the client includes a virtual joystick control, the virtual joystick control is used to control the virtual character to move, and the first operation includes a sliding operation acting on a joystick in the virtual joystick control.
In a preferred embodiment of the present invention, the first operation includes a sliding direction and a sliding distance, and the second position determining module 401 includes:
the orientation submodule is used for acquiring the current position and orientation of the virtual character;
and the second position determining submodule is used for determining a second position to be moved by the virtual character according to the current position and orientation, the sliding direction and the sliding distance of the virtual character.
In a preferred embodiment of the present invention, the method further comprises:
and the network judgment module is used for acquiring network delay data of the client within a preset time length and judging whether the network of the client is available according to the network delay data.
For the apparatus embodiment, since it is substantially similar to the method embodiment, the description is relatively simple, and reference may be made to the partial description of the method embodiment for relevant points.
An embodiment of the present invention further provides an electronic device, as shown in fig. 5, including:
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 runs, the processor 501 executes the machine-readable instructions to perform the method according to any one of the embodiments of the present invention. The specific implementation and technical effects are similar, and are not described herein again.
An embodiment of the present invention further provides a computer-readable storage medium, as shown in fig. 6, where the storage medium stores a computer program 601, and the computer program 601 is executed by a processor to perform the method according to any one of the embodiments of the present invention. The specific implementation and technical effects are similar, and are not described herein again.
The embodiments in the present specification are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, apparatus, or computer program product. Accordingly, embodiments of the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, embodiments of the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
Embodiments of the present invention are described with reference to flowchart illustrations and/or block diagrams of methods, terminal devices (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing terminal to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing terminal, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing terminal to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing terminal to cause a series of operational steps to be performed on the computer or other programmable terminal to produce a computer implemented process such that the instructions which execute on the computer or other programmable terminal provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
While preferred embodiments of the present invention have been described, additional variations and modifications of these embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. Therefore, it is intended that the appended claims be interpreted as including preferred embodiments and all such alterations and modifications as fall within the scope of the embodiments of the invention.
Finally, it should also be noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or terminal that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or terminal. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or terminal that comprises the element.
The foregoing describes in detail a method for controlling movement of a virtual character and a device for controlling movement of a virtual character according to the present invention, and a specific example is applied to illustrate the principle and the implementation of the present invention, and the description of the foregoing embodiment is only used to help understanding the method and the core idea of the present invention; meanwhile, for a person skilled in the art, according to the idea of the present invention, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present invention.

Claims (13)

1. A method for controlling movement of a virtual character, which is applied to a client, and displays at least a part of a game scene on a graphical user interface of the client, wherein the game scene comprises at least one virtual character, the method comprising:
responding to a first operation for controlling the virtual role to move, determining a first position to be moved of the virtual role, and reporting the first operation and the first position to a server;
when the network of the client is detected to be good, receiving a second position returned by the server according to the first operation, and controlling the virtual role to move to the second position;
when the network of the client is detected to be available, controlling the virtual character to move to the first position, and when a second position returned by the server according to the first operation is received, adjusting the position of the virtual character after moving according to the second position;
controlling the virtual character to move to the first location when detecting that the network of the client is unavailable.
2. The method of claim 1, wherein the adjusting the moved position of the virtual character according to the second position comprises:
determining a distance between the first location and the second location;
when the distance is smaller than a preset distance threshold value, controlling the virtual character to keep the moved position still;
and when the distance is greater than or equal to a preset distance threshold value, controlling the virtual character to move to the second position.
3. The method of claim 1, further comprising a virtual joystick control on the graphical user interface, wherein the virtual joystick control is used for controlling the virtual character to move, and the first operation comprises a sliding operation acting on a joystick in the virtual joystick control.
4. The method according to claim 1 or 3, wherein the first operation includes a sliding direction and a sliding distance, and the determining the first position where the virtual character is to be moved in response to the first operation for controlling the virtual character to move comprises:
acquiring the current position and orientation of the virtual character;
and determining a first position to be moved of the virtual character according to the current position and orientation, the sliding direction and the sliding distance of the virtual character.
5. The method of claim 1, wherein after the step of reporting the first operation and the first location to a server, further comprising:
and acquiring network delay data of the client within a preset time length, and judging whether the network of the client is available according to the network delay data.
6. A method for controlling movement of a virtual character is applied to a server side, and comprises the following steps:
receiving a first operation and a first position which are reported by a client and used for controlling the movement of a virtual role, and determining a second position to be moved of the virtual role according to the first operation; the first position is determined by the client according to the first operation;
when the network of the client is detected to be good, sending the second position to the client so that the client controls the virtual character to move to the second position;
when the network of the client is detected to be available, sending the second position to the client, so that the client can adjust the position of the virtual character after movement according to the second position;
and when the network of the client is detected to be unavailable, updating the stored position of the virtual role according to the first position.
7. The method according to claim 6, wherein a graphical user interface of the client comprises a virtual joystick control for controlling the virtual character to move, and the first operation comprises a sliding operation acting on a joystick in the virtual joystick control.
8. The method of claim 6 or 7, wherein the first operation comprises a sliding direction and a sliding distance, and wherein determining the second position where the virtual character is to be moved according to the first operation comprises:
acquiring the current position and orientation of the virtual role;
and determining 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.
9. The method of claim 1, further comprising, after the step of determining a second location based on the first operation:
and acquiring network delay data of the client within a preset time length, and judging whether the network of the client is available according to the network delay data.
10. An apparatus for controlling movement of a virtual character, applied to a client, displaying at least a part of a game scene on a graphical user interface of the client, the game scene including at least one virtual character, the apparatus comprising:
a first position determining module, configured to determine, in response to a first operation for controlling movement of the virtual character, a first position where the virtual character is to be moved, and report the first operation and the first position to a server;
the first mobile control module is used for receiving a second position returned by the server according to the first operation when the network of the client is detected to be good, and controlling the virtual role to move to the second position;
the second mobile control module is used for controlling the virtual role to move to the first position when the network of the client is detected to be available, and adjusting the position of the virtual role after moving according to the second position when the second position returned by the server according to the first operation is received;
a third mobile control module, configured to control the virtual character to move to the first location when detecting that the network of the client is unavailable.
11. A movement control device of a virtual character is applied to a server side, and the device comprises:
the second position determining module is used for receiving a first operation and a first position which are reported by a client and used for controlling the virtual role to move, and determining a second position to be moved of the virtual role according to the first operation; the first position is determined by the client according to the first operation;
the first mobile control module is used for sending the second position to the client when the network of the client is detected to be good, so that the client controls the virtual character to move to the second position;
the second mobile control module is used for sending the second position to the client when the network of the client is detected to be available, so that the client can adjust the position of the virtual character after movement according to the second position;
and the location updating module is used for updating the stored location of the virtual role according to the first location when the network of the client is detected to be unavailable.
12. An electronic device, comprising:
a processor and a storage medium storing machine-readable instructions executable by the processor, the processor executing the machine-readable instructions to perform the method of any of claims 1-5 or 6-9 when the electronic device is run.
13. A computer-readable storage medium, characterized in that the storage medium has stored thereon a computer program which, when being executed by a processor, carries out the method according to any one of claims 1-5 or 6-9.
CN202210140565.4A 2022-02-16 2022-02-16 Virtual character movement control method and device Pending CN114522416A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210140565.4A CN114522416A (en) 2022-02-16 2022-02-16 Virtual character movement control method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210140565.4A CN114522416A (en) 2022-02-16 2022-02-16 Virtual character movement control method and device

Publications (1)

Publication Number Publication Date
CN114522416A true CN114522416A (en) 2022-05-24

Family

ID=81623458

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210140565.4A Pending CN114522416A (en) 2022-02-16 2022-02-16 Virtual character movement control method and device

Country Status (1)

Country Link
CN (1) CN114522416A (en)

Similar Documents

Publication Publication Date Title
CN111167116B (en) Smooth display method, terminal and computer storage medium
CN107124416B (en) Multi-avatar position synchronization system, method, device, electronic device and storage medium
JP2020504851A (en) Game screen display control method, device, storage medium, and electronic device
CN111659120B (en) Virtual role position synchronization method, device, medium and electronic equipment
CN109568948B (en) Method and device for synchronizing motion states of objects in online game
CN107213636B (en) Lens moving method, device, storage medium and processor
CN111494953B (en) Game role movement synchronization method, device, equipment and storage medium
CN111265863B (en) Target object position correction method, device, equipment and medium
CN112090073B (en) Game display method and device
CN109646943B (en) Displacement technology processing method and device
CN112206511A (en) Game action synchronization method, game action synchronization device, electronic device and storage medium
CN108245889B (en) Free visual angle orientation switching method and device, storage medium and electronic equipment
CN111225287A (en) Bullet screen processing method and device, electronic equipment and storage medium
CN111298429A (en) Method and device for synchronizing states of virtual vehicles in game
CN110975277A (en) Method and device for processing information in augmented reality game, medium and electronic equipment
CN111766989B (en) Interface switching method and device
CN114522416A (en) Virtual character movement control method and device
CN109603153B (en) Virtual event processing method and device, electronic equipment and storage medium
CN111729312A (en) Position synchronization method, device and equipment
CN110769904B (en) Output content processing method, output method, electronic device, and storage medium
CN114095785A (en) Video playing method and device and computer equipment
CN113769384B (en) In-game field control method, device, equipment and storage medium
US20240226744A1 (en) Virtual object control method and apparatus, computer device and storage medium
CN114011058A (en) Game control method and device
CN113398585A (en) Game interaction method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination