Step control method of virtual character and related device

Through the step control method of virtual characters, the target point and path point are obtained according to the step control instructions, and the step effect is achieved through style switching, which solves the problem of high game engine development costs, improves step control efficiency and reduces resource waste.

CN119951135APending Publication Date: 2025-05-09GUANGZHOU QIANJUN NETWORK TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510255395.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-05
Publication Date
2025-05-09

AI Technical Summary

Technical Problem

In game systems, the development and call of different game engines requires a lot of development and maintenance costs, resulting in low efficiency in stepping control of virtual characters and waste of resources.

Method used

Through a step control method of a virtual character, the target point is obtained according to the step control instructions of the target virtual character, and the path point on the step path is obtained based on the starting point and the target point. Then, in the order of path points, switch the style of the target virtual character to the point style corresponding to the path points until the target point style.

Benefits of technology

It achieves the efficiency of stepping control of virtual characters, reduces resource waste, and ensures a natural transition of animation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119951135A_ABST
    Figure CN119951135A_ABST
Patent Text Reader

Abstract

The invention discloses a stepping control method of a virtual character and a related device, and relates to the technical field of Internet, and the method comprises the steps: obtaining a target point location of a target virtual character according to a stepping control instruction of the target virtual character; and obtaining each path point location on the target stepping path based on the starting point location and the target point location of the target virtual character. According to the sequence of all the path point locations on the target stepping path, the styles of the target classes of the target virtual characters are sequentially switched into point location styles corresponding to the path point locations until the styles of the target classes of the target virtual characters are the point location styles corresponding to the target point locations, and the point location style of each point location is used for locating point location coordinates. According to the method and the device, the stepping point locations of the virtual characters are converted into the class styles, and the stepping effect is realized by switching the classes of the virtual characters, so that simple and efficient stepping control is achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of Internet technology, and in particular to a stepping control method and related devices for a virtual character. Background Art

[0002] In game systems, professional game engines are usually used to implement step control of virtual characters in map scenes, so that the virtual characters can respond to control instructions and step to the target point. However, different game engines require the development of different APIs (Application Program Interfaces). In lightweight map scenes based on Web page interactive interfaces, the development and calling of game engines require a lot of development and maintenance costs, resulting in low step control efficiency and waste of resources. Summary of the invention

[0003] In view of the above problems, the present application provides a stepping control method and related devices for a virtual character, so as to improve the efficiency of controlling the stepping of the virtual character and reduce the waste of resources. The specific scheme is as follows:

[0004] The first aspect of the present application provides a stepping control method for a virtual character, comprising:

[0005] According to the step control instruction of the target virtual character, the target point position of the target virtual character is obtained;

[0006] Based on the starting point and the target point of the target virtual character, obtaining each path point on the target stepping path;

[0007] According to the order of each path point on the target stepping path, the style of the target class of the target virtual character is switched to the point style corresponding to the path point in sequence, until the style of the target class of the target virtual character is the point style corresponding to the target point, and the point style of each point is used to locate the point coordinates.

[0008] In a possible implementation, the stepping control method of the virtual character further includes:

[0009] Create a point set on a preset map according to actual needs, the point set including coordinates of multiple points on the preset map;

[0010] Based on the coordinates of each point in the point set, the sequence number and style of each point in the point set are configured to generate a point style table.

[0011] In a possible implementation, the stepping control method of the virtual character further includes:

[0012] Configuring preset virtual character elements, and binding a dynamic class and a static class to each of the virtual character elements;

[0013] The static class style and the dynamic class initial style of each virtual character element are configured, wherein the static class style includes a moving style, the attributes of the moving style are transition attributes, the parameters of the transition attributes include time parameters and effect parameters, and the dynamic class initial style is a point style of a preset initial point.

[0014] In a possible implementation, obtaining the target position of the target virtual character according to the step control instruction of the target virtual character includes:

[0015] Obtaining a target moving step number according to the step control instruction of the target virtual character;

[0016] Obtaining a preset stepping rule, wherein the stepping rule includes that the path point position numbers are continuous;

[0017] Add the current position of the target virtual character to the target moving step number to obtain the sequence number of the target position;

[0018] The sequence numbers of the path points that the target virtual character passes through from the current point to the target point are obtained to obtain a point queue.

[0019] In a possible implementation, according to the order of each of the path points on the target stepping path, the style of the target class of the target virtual character is switched to the point style corresponding to the path point in sequence until the style of the target class of the target virtual character is the point style corresponding to the target point, including:

[0020] Based on the point queue and the point style table, the value of the style variable in the dynamic class of the target virtual character is updated in sequence to the sequence number of the path points in the point queue until the value of the style variable in the dynamic class is equal to the sequence number of the target point.

[0021] In a possible implementation, obtaining a target moving step number according to the step control instruction of the target virtual character includes:

[0022] receiving an instruction sequence, and generating a point quantity queue based on the instruction sequence, wherein the instruction sequence includes continuous control instructions, one control instruction carries one moving step, and the point quantity queue includes a plurality of moving steps arranged in sequence;

[0023] Taking out the moving steps from the point quantity queue in order as the target moving steps;

[0024] According to the order of each of the path points on the target stepping path, the style of the target class of the target virtual character is switched to the point style corresponding to the path point in sequence until the style of the target class of the target virtual character is the point style corresponding to the target point. The stepping control method of the virtual character also includes:

[0025] Determine whether the point quantity queue is empty. If so, end the step control. If not, return to execute the step of sequentially taking out the moving steps from the point quantity queue as the target moving steps.

[0026] A second aspect of the present application provides a stepping control device for a virtual character, comprising:

[0027] A target point acquisition unit, used to acquire the target point of the target virtual character according to the step control instruction of the target virtual character;

[0028] A path point acquisition unit, used to acquire each path point on the target stepping path based on the starting point and the target point of the target virtual character;

[0029] A style switching unit is used to switch the style of the target class of the target virtual character to the point style corresponding to the path points in sequence according to the order of each path point on the target stepping path, until the style of the target class of the target virtual character is the point style corresponding to the target point, and the point style of each point is used to locate the point coordinates.

[0030] A third aspect of the present application provides a computer program product, comprising computer-readable instructions, which, when executed on an electronic device, enables the electronic device to implement the stepping control method for a virtual character of the first aspect or any implementation of the first aspect.

[0031] A fourth aspect of the present application provides an electronic device, comprising at least one processor and a memory connected to the processor, wherein:

[0032] The memory is used to store computer programs;

[0033] The processor is used to execute the computer program so that the electronic device can implement the stepping control method of the virtual character of the first aspect or any implementation manner of the first aspect.

[0034] A fifth aspect of the present application provides a computer storage medium, which carries one or more computer programs. When the one or more computer programs are executed by an electronic device, the electronic device can use the stepping control method of a virtual character according to the first aspect or any implementation of the first aspect.

[0035] By means of the above technical scheme, a stepping control method and related device of a virtual character provided in an embodiment of the present application obtains the target point of the target virtual character according to the stepping control instruction of the target virtual character. Based on the starting point and the target point of the target virtual character, obtain each path point on the target stepping path. According to the order of each path point on the target stepping path, the style of the target class of the target virtual character is switched to the point style corresponding to the path point in sequence, until the style of the target class of the target virtual character is the point style corresponding to the target point, and the point style of each point is used to locate the point coordinates. The present application converts the point of the virtual character's stepping into the style of the class, realizes the stepping effect by switching the class of the virtual character, thereby achieving simple and efficient stepping control, thereby improving the efficiency of stepping control and reducing the waste of stepping control resources. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the accompanying drawings, the same or similar reference numerals represent the same or similar elements. It should be understood that the drawings are schematic and the originals and elements are not necessarily drawn to scale.

[0037] Figure 1 A schematic diagram of a flow chart of a step control method for a virtual character provided in an embodiment of the present application;

[0038] Figure 2 A schematic diagram of a specific implementation flow of a step control method for a virtual character provided in an embodiment of the present application;

[0039] Figure 3 A schematic diagram of a static map provided in an embodiment of the present application;

[0040] Figure 4 An example of a code diagram for configuring point styles is shown;

[0041] Figure 5 A code diagram of a class for configuring virtual character elements is illustrated;

[0042] Figure 6a An example of a style code diagram of a static class for configuring a virtual character element is provided;

[0043] Figure 6b An example of a schematic diagram of virtual character displacement under a transition effect is shown;

[0044] Figure 7 A flowchart of a specific implementation method of the step control process provided in an embodiment of the present application;

[0045] Figure 8A schematic diagram of the structure of a stepping control device for a virtual character provided in an embodiment of the present application;

[0046] Fig. 9 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0047] The following describes the embodiments of the present application in conjunction with the drawings in the embodiments of the present application. The terms used in the implementation method section of the present application are only used to explain the specific embodiments of the present application, and are not intended to limit the present application.

[0048] The embodiments of the present application are described below in conjunction with the accompanying drawings. Those skilled in the art will appreciate that, with the development of technology and the emergence of new scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.

[0049] The terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and need not be used to describe a specific order or sequential order. It should be understood that the terms used in this way can be interchangeable under appropriate circumstances, which is only to describe the distinction mode adopted by the objects of the same attributes when describing in the embodiments of the present application. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, so that the process, method, system, product or equipment comprising a series of units need not be limited to those units, but may include other units that are not clearly listed or inherent to these processes, methods, products or equipment.

[0050] In order to avoid the waste of resources caused by game engine development, the canvas can be used to implement the step control of the virtual character. Specifically, when the step operation is triggered, the coordinate sequence of the virtual character in the preset map is calculated, and the virtual character is drawn on the canvas frame by frame according to the coordinates in the coordinate sequence. The step animation effect of the virtual character is achieved by playing the canvas frame by frame.

[0051] For example, when the control instruction instructs the virtual character to step from the first coordinate (5, 5) to the second coordinate (10, 20), the distance A from the first coordinate (5, 5) to the second coordinate (10, 20) is calculated according to the Pythagorean theorem, and then the step time T = A / S of the virtual character from the first coordinate (5, 5) to the second coordinate (10, 20) is calculated according to the set speed S (assuming it is a uniform speed animation), and the step time is converted into the number of animation frames Z = T × 30 (assuming 30 frames per second).

[0052] According to the number of animation frames and the distance A, a stepping route from the first coordinate to the second coordinate is planned to obtain a coordinate sequence. For example, the coordinate sequence includes Z stepping coordinates, wherein the x coordinate of the stepping coordinate increases by (10-5) / Z, and the y coordinate increases by (20-5) / Z. The virtual character is updated and drawn on the stepping coordinates in the canvas frame by frame. By playing the canvas frame by frame, a stepping animation effect of the virtual character along the stepping route is presented.

[0053] However, if the stepping control method of Canvas is used to achieve the stepping animation effect of controlling the natural transition of the virtual character, it is necessary to increase the length of the coordinate sequence, that is, to increase the number of animation frames. The complexity of the coordinate calculation is high, especially in the case of variable speed animation, the coordinate calculation is more complicated. The method of drawing the canvas using frame callback will also reduce system performance.

[0054] In order to solve the above technical shortcomings, an embodiment of the present application provides a step control method for a virtual character, which uses CSS (Cascading Style Sheets) to achieve progressive step control of the virtual character, reduce resource consumption, improve the efficiency of step control, and ensure natural animation transition.

[0055] Reference Figure 1 , Figure 1 A schematic diagram of a flow chart of a step control method for a virtual character provided in an embodiment of the present application, such as Figure 1 As shown, the method includes:

[0056] S101. Acquire a target position of the target virtual character according to a step control instruction of the target virtual character.

[0057] In this embodiment, the target virtual character is any virtual character in a preset map scene. One or more virtual characters can be configured. The target virtual character is selected by a user's point selection operation, and a step control instruction is triggered by a step control operation such as throwing a dice.

[0058] In this embodiment, the target position of each round of stepping is the end point of the round of stepping. For example, in a dice rolling scenario, a target moving step number is generated based on the dice rolling result, thereby generating a step control instruction to instruct the target virtual character to step the target moving step number, and the target position is generated based on the current position of the target virtual character and the target moving step number along the preset stepping path.

[0059] S102: Based on the starting point and the target point of the target virtual character, each path point on the target stepping path is obtained.

[0060] In this embodiment, the target stepping path refers to a stepping path from a starting point to a target point, wherein each path point on the target stepping path is arranged in sequence.

[0061] It should be noted that the target stepping path is obtained according to a preset stepping rule or is randomly generated.

[0062] In an optional embodiment, the target moving step number is obtained according to the step control instruction of the target virtual character, and a preset step rule is obtained, the step rule includes a continuous sequence number of path points, the current point of the target virtual character is added with the target moving step number to obtain the sequence number of the target point, and the continuous sequence numbers of the path points that the target virtual character passes from the current point to the target point are obtained to obtain a point queue.

[0063] In an optional embodiment, the step control instruction carries the target point, obtains a preset step rule, and the step rule includes the shortest path. Based on the step rule and the target point, the sequence numbers of the path points included in the shortest path from the current point to the target point of the target virtual character are obtained to obtain a point queue.

[0064] S103, according to the order of each path point on the target stepping path, sequentially switch the style of the target class of the target virtual character to the point style corresponding to the path point, until the style of the target class of the target virtual character is the point style corresponding to the target point.

[0065] In this embodiment, the point style of each point is used to locate the point coordinates, and the point style of each point can be pre-configured based on the map coordinate system in the map scene.

[0066] In an optional embodiment, a point set on a preset map is created according to actual needs, and based on the coordinates of each point in the point set, the style of each point in the point set is configured to generate a point style table. Based on the point queue and the point style table, the value of the style variable used to indicate the target point in the class is updated in sequence, and the value of the style variable is the serial number of the path point in the point queue until the value of the style variable is equal to the serial number of the target point.

[0067] It can be seen from the above technical solution that an embodiment of the present application provides a stepping control method for a virtual character, which converts the stepping points of the virtual character into a class style, realizes the stepping effect by switching the class of the virtual character, thereby achieving simple and efficient stepping control.

[0068] In summary, the embodiment of the present application provides a stepping control method for a virtual character, which obtains the target point of the target virtual character according to the stepping control instruction of the target virtual character. Based on the starting point and the target point of the target virtual character, obtain each path point on the target stepping path. According to the order of each path point on the target stepping path, the style of the target class of the target virtual character is switched to the point style corresponding to the path point in sequence, until the style of the target class of the target virtual character is the point style corresponding to the target point, and the point style of each point is used to locate the point coordinates. It can be seen that this scheme converts the complex point coordinate transformation in the stepping process of the virtual character in the map animation into a simple class switch. At the logical processing level, the class style of the character is updated to realize the class switch, so as to achieve the purpose of using a simple and small number of control variables and operations to complete the complex character stepping control. There is no need to introduce a huge game engine in the stepping control process, nor is there a need to use a Canvas canvas with frame callbacks to draw animations, thereby reducing redundant performance overhead.

[0069] The web end is the browser web page end, which is generally developed and implemented by a combination of three technologies: Html, Css, and JavaScript. The map game scene implemented in the web end includes a map and a virtual character. Multiple points are configured in the map, and the stepping process of the virtual character is that the virtual character steps along the points on the map according to certain rules (such as rolling a dice) until it reaches the target point. Next, taking the web end game in the map scene as an example, a stepping control method for a virtual character provided in an embodiment of the present application is introduced. Figure 2 A schematic diagram of a specific implementation flow of a step control method for a virtual character provided in an embodiment of the present application is shown in FIG. Figure 2 As shown, the method includes:

[0070] S201. Create a set of points on a preset map according to actual needs.

[0071] In this embodiment, the preset map can be a dynamic map or a static map. The points on the dynamic map can be dynamically created. Figure 3 Take the static map Map1 shown as an example. The point set Q1 of the static map Map1 includes multiple static points. The point set Q1 includes 24 static points. The upper left corner of Map1 is the coordinate origin (0,0) on the map coordinate system. The sequence number and coordinates of each static point are obtained. For example, the sequence numbers of the 24 static points are arranged as 1 to 24 in sequence according to the position relationship on Map1. Thus, the static points are recorded as points point1 to point24. Taking point1 to point3 as an example, the coordinates of point1 are (321 px, 55 px), the coordinates of point2 are (392 px, 94 px), and the coordinates of point3 are (460 px, 140 px).

[0072] It should be noted that the specific methods for creating maps and points and constructing coordinate systems can be found in the prior art.

[0073] S202: Based on the coordinates of each point in the point set, configure the style of each point in the point set to generate a point style table.

[0074] In this embodiment, the styles of the points include but are not limited to transformation and transition.

[0075] Among them, transform is a style in Css. The translate attribute of transform can add movement on the x and y coordinate axes to the element, which is the basis for the step-by-step movement of the character. Transition is a style in Css that can add transition animation effects to elements. Transition effect refers to the effect when the attribute of an element changes gradually. For example, when the height of an element is updated from 100px to 200px, if a transition effect is added, the height of the element will gradually increase from 100px to 200px within a certain time interval, presenting a smooth transition animation effect.

[0076] In this embodiment, the coordinates are used as attribute values, and the mobile attributes of the transformation style are configured for each point in the point set to construct a point style table. Taking point1 to point3 as an example, the style of point1 in the point style table is transform: translate (321px, 55px), the style of point2 is transform: translate (392 px, 94px), and the style of point1 is transform: translate (460 px, 140 px). Figure 4 An example of a point style code diagram is shown.

[0077] S203: Configure a preset virtual character element and bind a class to the virtual character element.

[0078] In this embodiment, the classes bound to the virtual character element include static classes and dynamic classes. The static class is the player class, and the dynamic class is bound to the virtual character element using vue, that is, the 'point'+currentPoint class, where 'point' is a preset identification string, and currentPoint is the corresponding style variable. The style configuration of the dynamic class of the virtual character element is realized by assigning values ​​to the style variables. Figure 5 The following is a code diagram for configuring a class of a virtual character element, where class represents the class of the html element and specifies the Css style sheet corresponding to the element.

[0079] S204: configuring the static class style and the dynamic class initial style of the virtual character element.

[0080] In this embodiment, the static class style configured in the virtual character element includes a moving style transform, and the attributes of the moving style are a transition attribute transition, a time parameter and an effect parameter of the transition attribute, wherein the transition attribute specifies that when the point changes, it is performed in the form of transition, that is, the movement from the current point to the target point is gradual rather than jumpy. The transition attribute time parameter indicates the transition time, and the effect parameter indicates the transition effect.

[0081] Figure 6a The following is a schematic diagram of a style code for configuring a static class of a virtual character element, such as Figure 6a As shown, the time parameter of the transition attribute transition is configured to 0.5s, and the effect parameter is the first transition effect ease. Figure 6b This example shows the speed curve of the ease transition effect. Figure 6b In the figure, the virtual character is marked with a circular sphere, the horizontal axis marks the time, and the vertical axis marks the displacement distance of the virtual character. The circular sphere array above the coordinate graph represents the displacement of the virtual character over time. Figure 6b As shown, under the ease transition effect, the movement speed of the virtual character is first slow, then fast, and then slow again, which is more in line with the movement speed law of objects in reality.

[0082] In this embodiment, the virtual character element adopts absolute positioning, and the initial point is the map origin. The initial style of the dynamic class configured for the virtual character element is assigned to the style variable of the dynamic class according to the initial point of the virtual character and the point style table. For example, if the initial point is Point1, the serial number of the initial point is assigned to the style variable currentPoint, so that currentPoint = 1, thereby realizing the initial style configuration of the dynamic class of the target virtual character element.

[0083] S205, obtaining a step control instruction of the target virtual character, and obtaining a target point according to a preset step rule.

[0084] In this embodiment, in the initial state, the initial position of the target virtual character is the map origin or a preset starting point, and in the non-initial state, the initial position of the target virtual character is the target point of the previous step.

[0085] In this embodiment, the step control instruction is used to indicate the target point or target moving steps of the target virtual character. The step rule includes the path point sequence number continuity, or the shortest path, wherein the path point sequence number continuity refers to the adjacent path point sequence numbers on the step path being continuous, and the shortest path refers to the path with the least number of path points on the step path.

[0086] For example, in a dice-rolling scenario, a target number of steps is generated based on the result of rolling the dice, thereby generating a step control instruction instructing the target virtual character to step the target number of steps, and along the preset step path, the target position is generated based on the current position of the target virtual character and the target number of steps.

[0087] It should be noted that the pre-configured path point number is continuous and forward stepping rule, and each point is identified by a serial number. When generating the target point based on the current point and the target moving step number of the target virtual character, the serial number of the current point can be added to the target moving step number (forward stepping path) to generate the serial number of the target point.

[0088] Still Figure 3 Taking the map scene shown as an example, the initial position of the target virtual character is point1, so the starting variable name of the variable in the dynamic class of the target virtual character is point1, recorded as currentPoint = 1. The user controls the dice rolling, and the result of the rolling is 3. Then the target virtual character step control instruction is received to instruct the target virtual character to step forward 3 steps, and the target point is calculated as point1+3= point4. In the initial state, the target point of the target virtual character is point4, recorded as targetPoint=targetPoint+3=4.

[0089] S206: Generate a point queue based on the starting point and the target point.

[0090] In this embodiment, the point queue includes the path points from the starting point to the point queue. For example, pointQueue = [2 3 4] means that the virtual character starts from the starting point point1, passes through point2 and point3 in sequence, and arrives at point4.

[0091] S207 . Based on the point queue and the point style table, update the value of the style variable in the dynamic class of the target virtual character in sequence until the value of the style variable in the dynamic class is equal to the sequence number of the target point.

[0092] In this embodiment, for one step execution:

[0093] A1. Sequentially extract the serial numbers of the path points in the point queue, search the point style table, and obtain the point style corresponding to the serial number of the path point, which is the path point style.

[0094] A2. Modify the value of the style variable in the dynamic class of the target virtual character to the serial number of the path point, so as to modify the style of the dynamic class of the target virtual character to the path point style, thereby moving the target virtual character to the path point.

[0095] A3. Determine whether the path point is equal to the target point. If not, return to execute A1 until the path point is equal to the target point, so as to move the target virtual character to the target point according to the stepping path indicated by the point queue.

[0096] Take pointQueue = [2 3 4] as an example. The first step changes the value of the style variable in the dynamic class of the target virtual character from 1 to 2. That is, the style in the dynamic class of the target virtual character is changed from transform: translate(321px, 55px) of the point1 class to transform: translate(392px,94px) of the point2 class. This causes the target virtual character to move from the point indicated by point1 to the point indicated by point2.

[0097] It can be seen from the above technical solutions that the stepping control method of a virtual character provided by the embodiment of the present application converts the complex point coordinate transformation in the stepping process of the virtual character in the map animation into a simple class switch. At the logic processing level, the class style of the character is updated to implement the class switch, so as to achieve the purpose of using a simple and small number of control variables and operations to complete the complex character stepping control. There is no need to introduce a huge game engine in the stepping control process, nor is there a need to use a Canvas canvas with frame callbacks to draw animations, which reduces redundant performance overhead.

[0098] Furthermore, this solution pre-configures static classes and dynamic classes for virtual characters, controls the stepping state by configuring the constant style in the static class, and controls the stepping point movement of the virtual character based on the modification of the style variable by configuring the style variable in the dynamic class. It is not necessary to configure the stepping state every time, but only to control the value of the style variable in the dynamic class, currentPoint, to switch the class of the virtual character so that it can step according to the preset stepping state. This further reduces the consumption of computing resources, improves the efficiency of stepping control, and reduces stepping delay.

[0099] Furthermore, by adding a moving style transform, a transition attribute transition, a time parameter and an effect parameter of the transition attribute in a static class, a progressive moving animation effect of the virtual character is achieved.

[0100] Furthermore, this solution configures different stepping rules and different stepping paths to obtain a point sequence representing each path point on the stepping path, and realizes stepping movement in sequence based on the point sequence, thereby improving the flexibility of stepping control and improving the fun and flexibility of the game in the map scene.

[0101] It should be noted that the above embodiment is only an optional specific implementation of a step control method for a virtual character provided by the present application, and the present application can also be implemented through other specific implementations.

[0102] In an optional embodiment, the stepping rule is pre-configured as a stepping rule with continuous and positive path point numbers, that is, the virtual character can only step from small to large point numbers. Then, after calculating the target point, there is no need to generate a point queue, and it is only necessary to modify the value of currentPoint by self-incrementing by 1, that is, turn on currentPoint self-increment, and modify currentPoint = currentPoint + 1 each time it moves to realize dynamic class switching of the virtual character element.

[0103] It should be noted that in the scenario of point number cycle, the result of adding 1 to the end point is the starting point. For example, Figure 3 In the map scenario shown, when calculating the target point, if the calculation result is greater than 24, the subtraction operation of 24 is performed, and the result of adding 1 to point 24 is point 1. Specifically, the two operations of currentPoint = currentPoint + 1 and targetPoint = targetPoint + a need to be judged. If it exceeds 24, the subtraction operation of 24 is performed. For example, the original point targetPoint is 23, and the result of the dice throw is 5, then targetPoint=23 + 5 – 24 = 4.

[0104] In an optional embodiment, when a continuous step control instruction is received, a continuous step control process is executed, wherein the continuous step control instruction includes a plurality of continuous throwing results.

[0105] Figure 7 The specific implementation method of the step control process provided in the embodiment of the present application, the continuous step control process includes:

[0106] S701, receiving an instruction sequence, and generating a point quantity queue based on the instruction sequence.

[0107] The instruction sequence includes continuous step control instructions. A step control instruction includes a moving step, and the point quantity queue generated based on the instruction sequence includes multiple moving steps arranged in sequence. It should be noted that the step control instructions in the instruction sequence are arranged according to the receiving timing, and the order of the moving steps in the point quantity queue is consistent with the order of the step control instruction corresponding to the moving step in the instruction sequence, that is, the moving steps in the point quantity queue are arranged in sequence.

[0108] S702, taking out the target moving step number indicated by the step control instruction with the order of 1 from the point quantity queue.

[0109] In this embodiment, the moving step number with a sequence number of 1 in the point number queue is used as the target moving step number. It should be noted that taking out any moving step number from the point number queue means obtaining the moving step number and deleting the moving step number from the point number queue. It can be understood that in each iteration of this step, after taking out the moving step number with a sequence number of 1, the sequences of other moving steps are updated to the original sequence number minus 1 until the queue is empty.

[0110] S703: Obtain the target point according to the preset stepping rule.

[0111] S704: Generate a point queue based on the starting point and the target point.

[0112] S705 . Based on the point queue and the point style table, update the value of the style variable in the dynamic class of the target virtual character in sequence until the value of the style variable in the dynamic class is equal to the sequence number of the target point.

[0113] For the specific implementation process of S703~S705, please refer to S205~S207.

[0114] S706, determine whether the point quantity queue is empty, if so, end the step control, if not, return to execute S702.

[0115] It can be seen that this scheme obtains the first step control instruction from the instruction sequence each time, and executes a step according to S205~S207 until the point instruction sequence is empty, thereby realizing multiple rounds of step control of a continuous step control.

[0116] For example, the user rolls the dice five times and stores the dice rolling results [abcde] in order in the point number queue. At this time, the point number queue pointQueue = [a, b, c, d, e]. Take out the first item a in the queue, calculate targetPoint=targetPoint+a, and update pointQueue = [b, c, d, e]. After executing S205~S207, the first round of stepping is realized, and the target virtual character is controlled to step to the point targetPoint+a. The next round of stepping is started with the target point of the previous round of stepping as the initial point. After executing 5 rounds of stepping, the target virtual character is controlled to step to the point Point0+a+b+c+d+e, where Point0 is the initial point.

[0117] Furthermore, between steps and between rounds, execution can be delayed by adding a timer to simulate the rest between real movements and improve the user experience. For example, in order to distinguish each step, after modifying the style variable of the dynamic class, the timer is turned on, and after reaching the preset first buffer time, the next modification of the style variable of the dynamic class is started. In order to distinguish each round of steps, after each round of steps ends, the timer is turned on, and after reaching the preset second buffer time, the next round of steps is started. Among them, the second buffer time is longer than the first buffer time.

[0118] In summary, by setting multiple rounds in one step control process and setting multiple self-loops in one round, the efficiency and flexibility of step control can be improved.

[0119] In an optional embodiment, the method further includes creating a dynamic point based on a dynamic point creation instruction, updating a point set and a point style sheet, and implementing dynamic point addition or modification. The flexibility of the step control method in the map scene is improved, as well as the fun of the game and the user experience is improved.

[0120] In summary, the embodiment of the present application provides a method for stepping control of a virtual character. First, the required points are created in the map. Fixed points can be manually added during development of fixed maps, and points can be dynamically generated according to user operations during runtime on dynamic maps. One point corresponds to a class. In the style sheet corresponding to the class, transform: translate(x, y) is used to set the character's moving position, that is, the corresponding point coordinates. By switching the class of the virtual character, the character can move between different points, and the animation effect of gradual jump between points is added by the transition attribute transition, thereby improving the smooth transition effect of the stepping animation.

[0121] In an optional embodiment, the present solution can also be applied to technology platforms that use classes to control styles and contain style attributes such as transformations and transitions, such as WeChat applets.

[0122] A stepping control method for a virtual character provided by an embodiment of the present application is introduced above. A device for executing the stepping control method for a virtual character will be introduced below.

[0123] See also Figure 8 , Figure 8 This is a schematic diagram of the structure of a step control device for a virtual character provided in an embodiment of the present application. Figure 8 As shown, the virtual character step control device 800 includes:

[0124] The target point acquisition unit 801 is used to acquire the target point of the target virtual character according to the step control instruction of the target virtual character;

[0125] A path point acquisition unit 802 is used to acquire each path point on the target stepping path based on the starting point and the target point of the target virtual character;

[0126] The style switching unit 803 is used to switch the style of the target class of the target virtual character to the point style corresponding to the path points in sequence according to the order of each path point on the target stepping path, until the style of the target class of the target virtual character is the point style corresponding to the target point, and the point style of each point is used to locate the point coordinates.

[0127] In a possible implementation, the step control device for the virtual character further includes: a point pattern configuration unit, configured to:

[0128] Create a point set on a preset map according to actual needs, the point set including coordinates of multiple points on the preset map;

[0129] Based on the coordinates of each point in the point set, the sequence number and style of each point in the point set are configured to generate a point style table.

[0130] In a possible implementation, the step control device for the virtual character further includes: a class configuration unit, configured to:

[0131] Configuring preset virtual character elements, and binding a dynamic class and a static class to each of the virtual character elements;

[0132] The static class style and the dynamic class initial style of each virtual character element are configured, wherein the static class style includes a moving style, the attributes of the moving style are transition attributes, the parameters of the transition attributes include time parameters and effect parameters, and the dynamic class initial style is a point style of a preset initial point.

[0133] In a possible implementation, the target point acquisition unit is used to acquire the target point of the target virtual character according to the step control instruction of the target virtual character, specifically to:

[0134] Obtaining a target moving step number according to the step control instruction of the target virtual character;

[0135] Obtaining a preset stepping rule, wherein the stepping rule includes that the path point position numbers are continuous;

[0136] Add the current position of the target virtual character to the target moving step number to obtain the sequence number of the target position;

[0137] The sequence numbers of the path points that the target virtual character passes through from the current point to the target point are obtained to obtain a point queue.

[0138] In a possible implementation, the style switching unit is used to switch the style of the target class of the target virtual character to the point style corresponding to the path point in sequence according to the order of each path point on the target stepping path, until the style of the target class of the target virtual character is the point style corresponding to the target point, specifically for:

[0139] Based on the point queue and the point style table, the value of the style variable in the dynamic class of the target virtual character is updated in sequence to the sequence number of the path points in the point queue until the value of the style variable in the dynamic class is equal to the sequence number of the target point.

[0140] In a possible implementation, when the target point acquisition unit is used to acquire the target moving step number according to the step control instruction of the target virtual character, it is specifically used to:

[0141] receiving an instruction sequence, and generating a point quantity queue based on the instruction sequence, wherein the instruction sequence includes continuous control instructions, one control instruction carries one moving step, and the point quantity queue includes a plurality of moving steps arranged in sequence;

[0142] Taking out the moving steps from the point quantity queue in order as the target moving steps;

[0143] The stepping control device of the virtual character also includes a round end determination unit, which is used to switch the style of the target class of the target virtual character to the point style corresponding to the path points in sequence according to the order of each path point on the target stepping path, until the style of the target class of the target virtual character is the point style corresponding to the target point, and then determine whether the point quantity queue is empty. If so, end the stepping control; if not, return to execute the step of sequentially taking out the moving steps from the point quantity queue as the target moving steps.

[0144] The present application also provides an electronic device in an embodiment. Fig. 9 As shown, it shows a schematic diagram of the structure of an electronic device suitable for implementing the embodiment of the present application. The electronic device in the embodiment of the present application may include but is not limited to fixed terminals such as mobile phones, laptops, PDAs (personal digital assistants), PADs (tablet computers), desktop computers, etc. Fig. 9 The electronic device shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.

[0145] like Fig. 9As shown, the electronic device may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 901, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 902 or a program loaded from a storage device 908 to a random access memory (RAM) 903. When the electronic device is powered on, various programs and data required for the operation of the electronic device are also stored in the RAM 903. The processing device 901, the ROM 902, and the RAM 903 are connected to each other via a bus 904. An input / output (I / O) interface 905 is also connected to the bus 904.

[0146] Typically, the following devices may be connected to the I / O interface 905: an input device 906 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 907 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 908 including, for example, a memory card, a hard disk, etc.; and a communication device 909. The communication device 909 may allow the electronic device to communicate with other devices wirelessly or by wire to exchange data. Although Fig. 9 An electronic device having various devices is shown, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead.

[0147] An embodiment of the present application also provides a computer program product including computer-readable instructions. When the computer-readable instructions are executed on an electronic device, the electronic device implements any stepping control method for a virtual character provided in the embodiment of the present application.

[0148] A computer-readable storage medium is also provided in an embodiment of the present application. The storage medium carries one or more computer programs. When the one or more computer programs are executed by an electronic device, the electronic device can implement any stepping control method for a virtual character provided in an embodiment of the present application.

[0149] It should also be noted that the device embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed over multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. In addition, in the drawings of the device embodiments provided by the present application, the connection relationship between the modules indicates that there is a communication connection between them, which may be specifically implemented as one or more communication buses or signal lines.

[0150] Through the description of the above implementation mode, the technicians in the field can clearly understand that the present application can be implemented by means of software plus necessary general hardware, and of course, it can also be implemented by special hardware including special integrated circuits, special CPUs, special memories, special components, etc. In general, all functions completed by computer programs can be easily implemented by corresponding hardware, and the specific hardware structure used to implement the same function can also be various, such as analog circuits, digital circuits or special circuits. However, for the present application, software program implementation is a better implementation mode in more cases. Based on such an understanding, the technical solution of the present application is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a readable storage medium, such as a computer floppy disk, a U disk, a mobile hard disk, a ROM, a RAM, a disk or an optical disk, etc., including a number of instructions to enable a computer device (which can be a personal computer, a training device, or a network device, etc.) to execute the methods described in each embodiment of the present application.

[0151] In the above embodiments, all or part of the embodiments may be implemented by software, hardware, firmware or any combination thereof. When implemented by software, all or part of the embodiments may be implemented in the form of a computer program product.

[0152] The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from a website site, a computer, a training device, or a data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, training device, or data center. The computer-readable storage medium may be any available medium that a computer can store or a data storage device such as a training device, a data center, etc. that includes one or more available media integrations. The available medium may be a magnetic medium, (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive (SSD)), etc.

Claims

1. A stepping control method for a virtual character, characterized in that: include: According to the step control instruction of the target virtual character, the target point position of the target virtual character is obtained; Based on the starting point and the target point of the target virtual character, obtaining each path point on the target stepping path; According to the order of each path point on the target stepping path, the style of the target class of the target virtual character is switched to the point style corresponding to the path point in sequence, until the style of the target class of the target virtual character is the point style corresponding to the target point, and the point style of each point is used to locate the point coordinates.

2. The stepping control method of a virtual character according to claim 1, characterized in that: The stepping control method of the virtual character also includes: Create a point set on a preset map according to actual needs, the point set including coordinates of multiple points on the preset map; Based on the coordinates of each point in the point set, the sequence number and style of each point in the point set are configured to generate a point style table.

3. The stepping control method of a virtual character according to claim 2, characterized in that: The stepping control method of the virtual character also includes: Configuring preset virtual character elements, and binding a dynamic class and a static class to each of the virtual character elements; The static class style and the dynamic class initial style of each virtual character element are configured, wherein the static class style includes a moving style, the attributes of the moving style are transition attributes, the parameters of the transition attributes include time parameters and effect parameters, and the dynamic class initial style is a point style of a preset initial point.

4. The stepping control method of a virtual character according to claim 3, characterized in that: The step of obtaining the target position of the target virtual character according to the step control instruction of the target virtual character comprises: Obtaining a target moving step number according to the step control instruction of the target virtual character; Obtaining a preset stepping rule, wherein the stepping rule includes that the path point position numbers are continuous; Add the current position of the target virtual character to the target moving step number to obtain the sequence number of the target position; The sequence numbers of the path points that the target virtual character passes through from the current point to the target point are obtained to obtain a point queue.

5. The stepping control method of a virtual character according to claim 4, characterized in that: The method of switching the target class style of the target virtual character to the point style corresponding to the path point in sequence according to the order of the path points on the target stepping path, until the target class style of the target virtual character is the point style corresponding to the target point, includes: Based on the point queue and the point style table, the value of the style variable in the dynamic class of the target virtual character is updated in sequence to the sequence number of the path points in the point queue until the value of the style variable in the dynamic class is equal to the sequence number of the target point.

6. The stepping control method of a virtual character according to claim 4, characterized in that: The step of obtaining the target moving steps according to the step control instruction of the target virtual character includes: receiving an instruction sequence, and generating a point quantity queue based on the instruction sequence, wherein the instruction sequence includes continuous control instructions, one control instruction carries one moving step, and the point quantity queue includes a plurality of moving steps arranged in sequence; Taking out the moving steps from the point quantity queue in order as the target moving steps; According to the order of each of the path points on the target stepping path, the style of the target class of the target virtual character is switched to the point style corresponding to the path point in sequence until the style of the target class of the target virtual character is the point style corresponding to the target point. The stepping control method of the virtual character also includes: Determine whether the point quantity queue is empty. If so, end the step control. If not, return to execute the step of sequentially taking out the moving steps from the point quantity queue as the target moving steps.

7. A stepping control device for a virtual character, characterized in that: include: A target point acquisition unit, used to acquire the target point of the target virtual character according to the step control instruction of the target virtual character; A path point acquisition unit, used to acquire each path point on the target stepping path based on the starting point and the target point of the target virtual character; A style switching unit is used to switch the style of the target class of the target virtual character to the point style corresponding to the path points in sequence according to the order of each path point on the target stepping path, until the style of the target class of the target virtual character is the point style corresponding to the target point, and the point style of each point is used to locate the point coordinates.

8. A computer program product, characterized in that The method comprises computer-readable instructions, and when the computer-readable instructions are executed on an electronic device, the electronic device implements the stepping control method of a virtual character as claimed in any one of claims 1 to 6.

9. An electronic device, characterized in that: The method comprises at least one processor and a memory connected to the processor, wherein: The memory is used to store computer programs; The processor is used to execute the computer program so that the electronic device can implement the stepping control method of the virtual character as described in any one of claims 1 to 6.

10. A computer storage medium, characterized in that: The storage medium carries one or more computer programs, and when the one or more computer programs are executed by an electronic device, the electronic device can implement the stepping control method for a virtual character as described in any one of claims 1 to 6.