Somatosensory game method based on hand waving action
By acquiring acceleration data from motion-sensing devices and generating displacement commands using easing functions, non-linear movement of motion-sensing game objects is achieved, solving the problem of lack of realism in linear movement and improving the smoothness and fun of the game experience.
Patent Information
- Application Number
- CN202310207726.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-02-27
- Publication Date
- 2026-05-15
- Estimated Expiration
- 2043-02-27
AI Technical Summary
The linear movement of game objects in existing motion-sensing games lacks realism and fun, and it is difficult to fully reproduce the real human body movement, resulting in a poor gaming experience.
By acquiring acceleration data from motion-sensing devices, displacement commands for game objects are generated using easing functions to achieve non-linear movement, including motion changes during acceleration, constant speed, and deceleration phases. The motion path of the game object is determined by combining a preset motion path trajectory library and acceleration vectors.
It achieves more realistic and natural movement effects for game objects, improves the smoothness and playability of the user experience, and enhances the fun and flexibility of the game.
Smart Images

Figure CN116196611B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of motion-sensing game technology, and in particular to a motion-sensing game method, apparatus, device, and computer-readable storage medium based on hand-waving gestures. Background Technology
[0002] Currently, most motion-sensing devices still use traditional linear movement to move objects in games. While this linear movement method is simple and easy to implement, it often feels stiff and lacks variety and fun in games. Furthermore, linear movement cannot fully replicate realistic human movement, making it difficult to achieve the optimal gaming experience. Summary of the Invention
[0003] This application provides a motion-sensing game method based on hand-waving gestures, aiming to achieve non-linear movement of game objects and enhance the user's gaming experience.
[0004] To achieve the above objectives, embodiments of this application provide a motion-sensing game method based on waving gestures, including:
[0005] After the motion-sensing game is started, it obtains horizontal or vertical acceleration data from the bound motion-sensing device;
[0006] The motion path of the game object in the motion-sensing game is determined based on the acceleration data;
[0007] The displacement command of the game object is generated based on the acceleration data and the preset easing function;
[0008] The game object is controlled to move non-linearly along the motion path according to the displacement command.
[0009] In one embodiment, determining the motion path of a game object in the motion-sensing game based on the acceleration data includes:
[0010] The acceleration data is then filtered and noise-reduced.
[0011] Generate an acceleration vector based on the processed acceleration data;
[0012] The direction of movement of the motion sensing device is determined based on the acceleration vector;
[0013] Based on the direction of movement, a matching motion path is selected from a preset motion path trajectory library as the motion path for the game object.
[0014] In one embodiment, generating a displacement command for the game object based on the acceleration data and a preset easing function includes:
[0015] Filter the time interval for completing a valid waving motion from the acceleration data;
[0016] Call the preset easing function and use the time interval as the input to the easing function;
[0017] The displacement command is generated based on the output of the easing function.
[0018] In one embodiment, using the time interval as input to the easing function includes:
[0019] Map the start time of the time interval to the start value of the input range of the easing function;
[0020] Map the end time of the time interval to the end value of the input range of the easing function;
[0021] The easing function input value corresponding to each moment within the time interval is calculated using an interpolation algorithm.
[0022] In one embodiment, generating the displacement command based on the output of the easing function includes:
[0023] The coordinates of the game object on the movement path at the current moment are calculated based on the output value of the easing function. The expression of the easing function is as follows:
[0024] f(t)=(1-t) 2 ×P0+2×(1-t)×t×P1+t 2 ×P2;
[0025] Where f(t) is the output coordinate value, P0, P1 and P2 are constants, and t is the input value of the easing function, with a value range of [0,1].
[0026] The current coordinate value is compared with the coordinate value at the previous moment, the displacement of the game object on the movement path at the current moment is calculated, and the displacement is used to generate the displacement command.
[0027] In one embodiment, generating the displacement command from the displacement amount includes:
[0028] Two time anchor points are set in the input interval of the easing function to divide the input interval into three motion time periods: acceleration segment, constant speed segment, and deceleration segment.
[0029] Different weight values are assigned to the easing function output for each motion time segment based on the motion time segment. The weight values corresponding to the acceleration segment, constant speed segment, and deceleration segment are a, b, and c, respectively, where 0... <a<1;c> b>1;
[0030] The displacement command is generated based on the displacement amount and its corresponding time period weight value.
[0031] In one embodiment, after controlling the game object to move non-linearly along the motion path according to the displacement command, the method further includes:
[0032] The game result is generated based on the movement path of the game object.
[0033] To achieve the above objectives, this application also proposes a motion-sensing gaming device based on hand-waving gestures, comprising:
[0034] The acquisition module is used to acquire horizontal or vertical acceleration data from the bound motion-sensing device after the motion-sensing game is started;
[0035] The calculation module is used to determine the motion path of the game object in the motion-sensing game based on the acceleration data;
[0036] The displacement command generation module is used to generate displacement commands for the game object based on the acceleration data and a preset easing function.
[0037] The control module is used to control the game object to move non-linearly along the motion path according to the displacement command.
[0038] To achieve the above objectives, this application also proposes a motion-sensing game device based on waving gestures, including a memory, a processor, and a motion-sensing game program based on waving gestures stored in the memory and executable on the processor. When the processor executes the motion-sensing game program based on waving gestures, it implements the motion-sensing game method based on waving gestures as described in any of the above claims.
[0039] To achieve the above objectives, embodiments of this application also propose a computer-readable storage medium storing a motion-sensing game program based on waving gestures. When the motion-sensing game program based on waving gestures is executed by a processor, it implements the motion-sensing game method based on waving gestures as described in any of the preceding claims.
[0040] The motion-sensing game method of this application has the following advantages compared with the traditional linear movement game method:
[0041] More realistic and natural movement effects: Linearly moving game objects have a constant speed and a straight trajectory, which lacks realism. However, by using easing functions to achieve non-linear movement, more natural movement effects can be simulated, such as changes in acceleration, constant speed, and deceleration phases, which are closer to the movement in the real world.
[0042] A smoother user experience: Non-linear movement using easing functions allows game objects to move more smoothly and fluidly. Compared to linearly moving game objects, which exhibit noticeable jitter and jumps during movement, non-linear movement using easing functions reduces this unpleasant experience and improves the user's gaming experience.
[0043] More flexible and diverse movement modes: Non-linear movement is achieved through easing functions, enabling various movement modes such as acceleration, deceleration, and constant speed. Furthermore, different weight values can be set for different time periods to achieve more complex animation effects. This flexible and diverse movement mode can adapt to different types of games and gameplay, thereby enhancing the game's playability and fun. Attached Figure Description
[0044] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the structures shown in these drawings without creative effort.
[0045] Figure 1 This is a modular structure diagram of an embodiment of the motion-sensing gaming device based on hand gestures according to the present invention;
[0046] Figure 2 This is a flowchart illustrating an embodiment of the motion-sensing game method based on waving gestures according to the present invention.
[0047] Figure 3 This is a block diagram of a module structure of an embodiment of the motion-sensing game device based on waving gestures of the present invention.
[0048] The realization of the objective, functional features and advantages of the present invention will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation
[0049] It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
[0050] To better understand the above technical solutions, exemplary embodiments of this disclosure will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of this disclosure are shown in the drawings, it should be understood that this disclosure can be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of this disclosure to those skilled in the art.
[0051] It should be noted that any reference signs placed between parentheses in the claims should not be construed as limiting the claims. The word "comprising" does not exclude the presence of components or steps not listed in the claims. The quantifier "a" or "an" preceding a component does not exclude the presence of a plurality of such components. The invention can be implemented by means of hardware comprising several different components and by means of a suitably programmed computer. In a unit claim enumerating several means, several of these means may be embodied by the same item of hardware. The use of "first," "second," and "third," etc., does not indicate any order and can be interpreted as names.
[0052] like Figure 1 As shown, Figure 1 This is a schematic diagram of the hardware operating environment server 1 (also called a motion-sensing game device based on hand gestures) involved in the embodiments of the present invention.
[0053] The server in this embodiment of the invention includes devices with display functions such as "Internet of Things devices", smart air conditioners, smart lights, smart power supplies with network connectivity, AR / VR devices with network connectivity, smart speakers, autonomous vehicles, PCs, smartphones, tablets, e-book readers, and portable computers.
[0054] like Figure 1 As shown, the server 1 includes: a memory 11, a processor 12, and a network interface 13.
[0055] The memory 11 includes at least one type of readable storage medium, such as flash memory, hard disk, multimedia card, card-type memory (e.g., SD or DX memory), magnetic memory, magnetic disk, optical disk, etc. In some embodiments, the memory 11 can be an internal storage unit of the server 1, such as the hard disk of the server 1. In other embodiments, the memory 11 can also be an external storage device of the server 1, such as a plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, etc., equipped on the server 1.
[0056] Furthermore, the memory 11 may include both internal storage units of the server 1 and external storage devices. The memory 11 can be used not only to store application software and various types of data installed on the server 1, such as the code of the motion-sensing game program 10 based on hand gestures, but also to temporarily store data that has been output or will be output.
[0057] In some embodiments, processor 12 may be a central processing unit (CPU), controller, microcontroller, microprocessor or other data processing chip, used to run program code stored in memory 11 or process data, such as executing motion-sensing game program 10 based on hand gestures.
[0058] The network interface 13 may optionally include a standard wired interface or a wireless interface (such as a Wi-Fi interface), which is typically used to establish communication connections between the server 1 and other electronic devices.
[0059] The network can be the Internet, a cloud network, a Wi-Fi network, a Personal Area Network (PAN), a Local Area Network (LAN), and / or a Metropolitan Area Network (MAN). Various devices in the network environment can be configured to connect to the communication network according to various wired and wireless communication protocols. Examples of such wired and wireless communication protocols may include, but are not limited to, at least one of the following: Transmission Control Protocol and Internet Protocol (TCP / IP), User Datagram Protocol (UDP), Hypertext Transfer Protocol (HTTP), File Transfer Protocol (FTP), ZigBee, EDGE, IEEE 802.11, Li-Fi, 802.16, IEEE 802.11s, IEEE 802.11g, multi-hop communication, wireless access points (APs), device-to-device communication, cellular communication protocols, and / or Bluetooth communication protocols, or combinations thereof.
[0060] Optionally, the server may also include a user interface, which may include a display, an input unit such as a keyboard, and optionally, a standard wired interface or a wireless interface. Optionally, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, or an OLED (Organic Light-Emitting Diode) touchscreen, etc. The display may also be referred to as a screen or display unit, used to display information processed in server 1 and to display a visual user interface.
[0061] Figure 1 Only a server 1 with components 11-13 and a gesture-based motion-sensing game program 10 is shown. Those skilled in the art will understand that... Figure 1 The structure shown does not constitute a limitation on server 1 and may include fewer or more components than shown, or combine certain components, or have different component arrangements.
[0062] In this embodiment, the processor 12 can be used to call the gesture-based motion-sensing game program stored in the memory 11 and perform the following operations:
[0063] After the motion-sensing game is started, it obtains horizontal or vertical acceleration data from the bound motion-sensing device;
[0064] The motion path of the game object in the motion-sensing game is determined based on the acceleration data;
[0065] The displacement command of the game object is generated based on the acceleration data and the preset easing function;
[0066] The game object is controlled to move non-linearly along the motion path according to the displacement command.
[0067] In one embodiment, the processor 12 can be used to invoke a gesture-based motion-sensing game program stored in the memory 11 and perform the following operations:
[0068] Determining the motion path of the game object in the motion-sensing game based on the acceleration data includes:
[0069] The acceleration data is then filtered and noise-reduced.
[0070] Generate an acceleration vector based on the processed acceleration data;
[0071] The direction of movement of the motion sensing device is determined based on the acceleration vector;
[0072] Based on the direction of movement, a matching motion path is selected from a preset motion path trajectory library as the motion path for the game object.
[0073] In one embodiment, the processor 12 can be used to invoke a gesture-based motion-sensing game program stored in the memory 11 and perform the following operations:
[0074] Based on the acceleration data and a preset easing function, the game object's displacement command is generated, including:
[0075] Filter the time interval for completing a valid hand-waving action from the acceleration data;
[0076] Call the preset easing function and use the time interval as the input to the easing function;
[0077] The displacement command is generated based on the output of the easing function.
[0078] In one embodiment, the processor 12 can be used to invoke a gesture-based motion-sensing game program stored in the memory 11 and perform the following operations:
[0079] Using the time interval as input to the easing function includes:
[0080] Map the start time of the time interval to the start value of the input range of the easing function;
[0081] Map the end time of the time interval to the end value of the input range of the easing function;
[0082] The easing function input value corresponding to each moment within the time interval is calculated using an interpolation algorithm.
[0083] In one embodiment, the processor 12 can be used to invoke a gesture-based motion-sensing game program stored in the memory 11 and perform the following operations:
[0084] The displacement command is generated based on the output of the easing function, including:
[0085] The coordinates of the game object on the movement path at the current moment are calculated based on the output value of the easing function. The expression of the easing function is as follows:
[0086] f(t)=(1-t) 2 ×P0+2×(1-t)×t×P1+t 2 ×P2;
[0087] Where f(t) is the output coordinate value, P0, P1 and P2 are constants, and t is the input value of the easing function, with a value range of [0,1].
[0088] The current coordinate value is compared with the coordinate value at the previous moment, the displacement of the game object on the movement path at the current moment is calculated, and the displacement is used to generate the displacement command.
[0089] In one embodiment, the processor 12 can be used to invoke a gesture-based motion-sensing game program stored in the memory 11 and perform the following operations:
[0090] Generating the displacement command from the displacement amount includes:
[0091] Two time anchor points are set in the input interval of the easing function to divide the input interval into three motion time periods: acceleration segment, constant speed segment, and deceleration segment.
[0092] Different weight values are assigned to the easing function output for each motion time segment based on the motion time segment. The weight values corresponding to the acceleration segment, constant speed segment, and deceleration segment are a, b, and c, respectively, where 0... <a<1;c> b>1;
[0093] The displacement command is generated based on the displacement amount and its corresponding time period weight value.
[0094] In one embodiment, the processor 12 can be used to invoke a gesture-based motion-sensing game program stored in the memory 11 and perform the following operations:
[0095] After controlling the game object to move non-linearly along the motion path according to the displacement command, the method further includes:
[0096] The game result is generated based on the movement path of the game object.
[0097] Based on the hardware architecture of the aforementioned hand-waving motion-sensing game device, an embodiment of the hand-waving motion-sensing game method of the present invention is proposed. The hand-waving motion-sensing game method of the present invention aims to achieve non-linear movement of game objects and enhance the user's gaming experience.
[0098] Reference Figure 2 , Figure 2 This is an embodiment of the motion-sensing game method based on waving gestures of the present invention. The motion-sensing game method based on waving gestures includes the following steps:
[0099] S10. After the motion-sensing game is started, obtain horizontal or vertical acceleration data from the bound motion-sensing device.
[0100] This particular motion-sensing game is linked to hand-waving actions, requiring players to use motion-sensing devices to make hand-waving gestures to initiate the game. Through this game, players can control their characters to swing weapons, rackets, and other objects to perform corresponding attacks and hits. This allows players to experience the fun of swinging games more realistically.
[0101] For example, the fruit-cutting game is a classic motion-sensing game associated with waving gestures.
[0102] It's worth noting that this motion-sensing game can be a local application, or it can be an HTML5-based app or web application. Specifically, the motion-sensing game runs on a terminal, which can be a desktop computer, laptop, game console, portable game console, smartphone, tablet, smartwatch, smart TV, etc.
[0103] Motion-sensing devices are devices that can detect a player's motion data. Typically, motion-sensing devices are configured to include a six-axis IMU sensor, which includes a three-axis accelerometer and a three-axis gyroscope. The six-axis IMU sensor detects the player's motion data by detecting changes in the player's three-axis acceleration and three-axis angular velocity.
[0104] In the technical solution of this application, the acceleration data obtained by the terminal from the motion-sensing device is triaxial acceleration data directly collected by the accelerometer (also known as a gravity sensor). This triaxial acceleration data includes x-axis acceleration data, y-axis acceleration data, and z-axis acceleration data. The x-axis is the acceleration axis in the forward / backward direction, the z-axis is the vertical acceleration axis, and the y-axis is the acceleration axis in the left / right direction. Thus, even if the motion-sensing device only has a gravity sensor, it can still input hand-waving commands through motion sensing.
[0105] Alternatively, the motion-sensing device can be configured as a wearable device, and its form may include, but is not limited to, the following: wristband, watch, game controller, smartphone, etc.
[0106] Furthermore, before playing the game, the motion-sensing device needs to establish a communication connection with the terminal (i.e., be bound to the terminal). This connection can be wired or wireless. For example, when the motion-sensing device establishes a wired connection with the terminal, it can be based on at least one of the following protocols: USB 2.0, USB 3.0, Thunderbolt 3, and Thunderbolt 4. When the motion-sensing device establishes a wireless connection with the terminal, it can be based on at least one of the following protocols: Bluetooth, WiFi, infrared, 2.4G, and NFC.
[0107] S20. Determine the motion path of the game object in the motion-sensing game based on the acceleration data.
[0108] Specifically, game objects refer to virtual objects that are controlled and moved in motion-sensing games. These can be objects of various forms, such as characters, vehicles, and aircraft, or abstract symbols or graphics. Game objects play a crucial role in games and are one of the key factors in gameplay and experience.
[0109] The motion path refers to the path along which a game object moves in a motion-sensing game. In this invention, the motion path is determined based on acceleration data acquired by the motion-sensing device and preset algorithms and rules.
[0110] Specifically, the direction and speed of a game object's movement can be determined based on the magnitude and direction of the acceleration data. For example, if the horizontal acceleration data is positive, the game object moves to the right; if the vertical acceleration data is negative, the game object moves downwards. Furthermore, more complex movement paths can be achieved by combining acceleration data from different directions.
[0111] In some embodiments, determining the motion path of a game object in the motion-sensing game based on the acceleration data includes the following steps:
[0112] S21. Filter and denoise the acceleration data.
[0113] Specifically, since the acceleration data collected by motion sensing devices may contain some noise or interference signals, the data needs to be filtered and denoised to improve its accuracy and stability. Digital filters, smoothing filters, and other methods can typically be used to process the data. For example, low-pass filters can be used to remove high-frequency noise, median filters to remove sudden interference, or Kalman filters can be used to filter the acceleration data.
[0114] S22. Generate an acceleration vector based on the processed acceleration data.
[0115] Specifically, the acceleration vector is a three-dimensional vector calculated from acceleration data, which includes acceleration components in the horizontal and vertical directions as well as the component of gravitational acceleration. The magnitude and direction of the acceleration vector determine the movement direction and speed of the motion-sensing device, and thus the movement path of the game object.
[0116] For example, an acceleration vector can be generated in the following way:
[0117] 1. Calculate the X-axis component of the acceleration vector: Project the acceleration data along the X-axis into a three-dimensional coordinate system, i.e., X = Ax / g, where Ax represents the component of the acceleration data in the X-axis direction, and g is the gravitational acceleration.
[0118] 2. Calculate the Y-axis component of the acceleration vector: Project the acceleration data along the Y-axis into the three-dimensional coordinate system, i.e., Y = Ay / g, where Ay represents the component of the acceleration data in the Y-axis direction.
[0119] 3. Calculate the Z-axis component of the acceleration vector: Project the acceleration data along the Z-axis into the three-dimensional coordinate system, i.e., Z = Az / g-1, where Az represents the component of the acceleration data in the Z-axis direction. Subtracting 1 is to remove the influence of gravitational acceleration.
[0120] 4. The three components obtained form the acceleration vector, namely A = (X, Y, Z).
[0121] S23. Determine the direction of movement of the motion sensing device based on the acceleration vector.
[0122] Specifically, the direction of movement of the motion-sensing device can be determined based on the magnitude and direction of the acceleration vector, such as left, right, forward, or backward. During implementation, the acceleration vector can also be normalized to convert it into a unit vector, thus better determining the direction and speed of movement of the motion-sensing device.
[0123] For example, the normalization of the acceleration vector can be achieved in the following way:
[0124] 1. Calculate the magnitude of the acceleration vector: that is, the magnitude of A, i.e., |A| = sqrt(X^2 + Y^2 + Z^2).
[0125] 2. Calculate the normalized acceleration vector: divide each component by the magnitude of the vector to obtain A' = (X / |A|, Y / |A|, Z / |A|).
[0126] It is worth noting that the normalized acceleration vector can better reflect the direction and speed of movement of the motion sensing device, making it easier to determine the movement path of the game object.
[0127] S24. Select a matching motion path from the preset motion path trajectory library according to the movement direction as the motion path of the game object.
[0128] Specifically, a pre-set motion path trajectory library can store various types and directions of motion paths, such as straight lines, arcs, and curves. Based on the movement direction and speed of the motion-sensing device, a matching motion path can be selected as the movement path for the game object. For example, when the motion-sensing device moves to the left, a straight left turn or a left turn can be selected to match this direction. For different motion-sensing games, the motion path trajectory library needs to be pre-set according to the actual situation and design requirements to achieve a more accurate and smooth gaming experience.
[0129] It is understandable that directly selecting a matching motion path from the motion path trajectory library as the motion path of the game object relative to the motion-sensing device to obtain the motion path has the following advantages:
[0130] 1. More accurate: When selecting a matching motion path, it can be matched based on pre-stored real motion data, thus making it more accurate.
[0131] 2. More stable: By selecting a matching motion path, the influence of outliers or noise in the acceleration data on the motion path can be avoided, thereby improving the stability of the motion path.
[0132] 3. More efficient: Calculating the movement trajectory of a motion-sensing device requires a lot of computing resources, while directly selecting a movement path from the motion path trajectory library can save computing resources and improve the running efficiency of the game.
[0133] 4. Simpler: Calculating the movement trajectory of a motion-sensing device requires complex algorithms and code implementation, while directly selecting a motion path from a motion path trajectory library makes the implementation much simpler and clearer.
[0134] Of course, the design of this application is not limited to this. In other embodiments, the movement path of the game object can also be obtained by calculating the movement trajectory of the motion sensing device.
[0135] S30. Generate displacement commands for the game object based on the acceleration data and the preset easing function.
[0136] Specifically, an easing function is a mathematical function used to describe the motion of an object. It can adjust the speed of an object over time to achieve effects such as acceleration and deceleration, making the motion of the object more natural, comfortable, and realistic.
[0137] Common easing functions include: linear easing function, sinusoidal easing function, exponential easing function, elastic easing function, and bounce easing function, each with different characteristics and effects.
[0138] Displacement commands are instructions used to control the position of game objects. In games, when developers need to control game objects to move along a specific path, they can achieve this by generating displacement commands.
[0139] Typically, displacement commands contain the position information that a game object needs to move in the current frame (game frame).
[0140] According to the technical solution of this application, the terminal can calculate the distance that the game object needs to move in the current frame based on the current position of the game object, the target position, and the preset easing function, and convert the distance into the form of a displacement command.
[0141] It is understandable that setting easing functions to generate displacement commands for game objects can control the speed changes of game objects during movement, making the movement of game objects more realistic, natural, and smooth, and more in line with real-world movement changes.
[0142] In some embodiments, generating a displacement command for the game object based on the acceleration data and a preset easing function includes the following steps:
[0143] S31. Select the time interval for completing an effective waving action from the acceleration data.
[0144] Specifically, by setting certain thresholds and conditions, and combining them with actual testing and adjustments, the time range for waving actions that meet the requirements can be determined.
[0145] For example, the time interval of a valid wave gesture can be obtained using the following method:
[0146] 1. Set the trigger conditions for the waving action, for example: the acceleration of the motion sensing device exceeds the set threshold.
[0147] 2. After receiving the acceleration data, the system processes the data to find the time point when the acceleration change exceeds the threshold.
[0148] 3. Based on the set duration of the waving action, search forward or backward for a period of time, and use that period of time as the time interval for the waving action that meets the requirements.
[0149] Of course, the design of this application is not limited to this. In other embodiments, depending on the needs of the game, the time interval can also be determined by defining the minimum and maximum amplitude of the waving action, as well as the minimum and maximum speed, and filtering out acceleration data that meets the requirements. Alternatively, depending on the game scene and design, the time interval can be determined by defining the start and end positions of the waving action and filtering out acceleration data that meets the requirements. It can also be determined by defining the shortest and longest duration of the waving action and filtering out acceleration data that meets the requirements.
[0150] S32. Call the preset easing function and use the time interval as the input of the easing function.
[0151] Specifically, using the time interval as input to the easing function requires specific operations based on the definition and implementation of the selected easing function. Typically, the input to the easing function is a time parameter t, representing the duration of the animation, generally ranging from 0 to 1. The time interval can be represented as a start time t1 and an end time t2.
[0152] If the input to the easing function is time t, then the time interval needs to be transformed and mapped to the range of 0 to 1. A simple implementation is to map the start time t1 of the time interval to 0 and the end time t2 to 1, and then map the input parameter t of the easing function proportionally to the time interval to obtain the actual time value t'. The specific calculation method is as follows:
[0153] t' = (t-t1) / (t2-t1).
[0154] It is worth noting that the design of this application is not limited to this. The input of the easing function can also be parameters such as displacement and velocity. In this case, it is necessary to convert the corresponding displacement, velocity and other parameters into the input of the easing function according to the specific definition and implementation of the easing function.
[0155] S33. Generate the displacement command based on the output of the easing function.
[0156] Specifically, based on the preset easing function and the time interval of the waving action, a real value can be obtained representing the distance the game object needs to move along the movement path. This distance instruction is broken down into consecutive small steps, with the displacement distance of each small step calculated by the preset easing function. Each small step's displacement instruction can be stored in a queue, and then retrieved from the queue sequentially at regular time intervals to achieve non-linear movement of the game object. It is important to note that the size of the displacement instructions and the time interval need to be adjusted according to specific game requirements to achieve the best gaming experience.
[0157] In some embodiments, using the time interval as input to the easing function includes the following steps:
[0158] S321. Map the start time of the time interval to the start value of the input range of the easing function;
[0159] S322. Map the end time of the time interval to the end value of the input range of the easing function.
[0160] Specifically, if the input range of the easing function is [0,1], and the start time of the time interval is 2 seconds, then mapping the start time of the time interval to the range [0,1] may require a linear mapping algorithm, that is, mapping 2 seconds to 0, i.e., (2 - start time) / (end time - start time) * (end value - start value) + start value. Based on the same method as the start time, the end time can be mapped to the end value of the easing function's input range.
[0161] S323. Calculate the easing function input value corresponding to each moment in the time interval according to the interpolation algorithm.
[0162] For example, if the time interval is [2,4] seconds, the easing function input range is [0,1], and a quadratic easing function is used, then a quadratic interpolation algorithm can be used to calculate the easing function input value corresponding to each moment within the time interval. These values can be used as part of the displacement command to control the game object to move non-linearly along the motion path. This makes the movement of the game object smoother and more natural.
[0163] In some embodiments, generating the displacement command based on the output of the easing function includes:
[0164] S331. Calculate the current coordinates of the game object on the movement path at the current moment based on the output value of the easing function. The expression of the easing function is as follows:
[0165] f(t)=(1-t) 2 ×P0+2×(1-t)×t×P1+t2 ×P2;
[0166] Where f(t) is the output coordinate value, P0, P1, and P2 are constants, and t is the input value of the easing function, ranging from [0,1]. It is worth noting that P0, P1, and P2 can be adjusted adaptively according to the actual situation.
[0167] S332. Compare the current coordinate value with the coordinate value at the previous moment, calculate the displacement of the game object on the movement path at the current moment, and generate the displacement command from the displacement.
[0168] For example, if the coordinates at the previous moment were (2,3) and the calculated coordinates at the current moment are (3,5), then the displacement of the game object on the movement path at the current moment is (1,2), which is used as the displacement command.
[0169] It is worth noting that the easing functions listed above are Bézier curve functions. Choosing a Bézier curve function as the desired easing function has the following advantages:
[0170] 1. Flexibility: Bézier curve functions are flexible, and the shape of the curve can be adjusted by adjusting the control points to achieve different easing effects.
[0171] 2. Smoothness: Bézier curve functions can generate smooth curves, making the movement trajectory of game objects more natural during movement.
[0172] 3. Predictability: Bézier curve functions are predictable, and the position of the game object on the movement path can be predicted based on the input value of the easing function, thereby better controlling the movement of the game object.
[0173] 4. Easy to implement: The calculation of Bézier curve functions is relatively simple and can be implemented through basic mathematical operations, thereby reducing the complexity of implementation and computational overhead.
[0174] In some embodiments, generating the displacement command from the displacement amount includes:
[0175] S3321. Set two time anchor points in the input interval of the easing function to divide the input interval into three motion time periods: acceleration segment, constant speed segment, and deceleration segment.
[0176] Specifically, we can divide the entire displacement process into three motion time periods: acceleration, constant speed, and deceleration. We can also divide the motion time periods by using preset time anchor points and input intervals.
[0177] S3322. Based on the motion time interval, different weight values are set for the easing function output of each motion time interval. The weight values corresponding to the acceleration segment, constant speed segment, and deceleration segment are a, b, and c, respectively, where 0... <a<1;c> b>1.
[0178] Specifically, to achieve smooth and realistic transitions in game object movement, different weight values can be set for the easing function output for each motion time interval. Typically, acceleration and deceleration phases need to be smoother than constant-speed phases, so higher weight values can be assigned to them. Simultaneously, since deceleration phases need to transition from high-speed motion to a stationary state, they require even higher weight values than acceleration phases to achieve a smoother transition.
[0179] For example, the acceleration, constant speed, and deceleration phases can be mapped to different intervals within the input range [0,1] of the easing function, and a corresponding weight value can be set for each interval. For instance, the acceleration phase can be mapped to the input range [0,0.2], the constant speed phase to [0.2,0.8], and the deceleration phase to [0.8,1], with corresponding weight values a, b, and c. Here, a is a value between 0 and 1, c is a value between 1 and 2, and a is less than 1, while c is greater than b. In this way, the output of the easing function will be weighted according to different weight values based on different input values, thereby achieving a smooth transition and a realistic feel.
[0180] S3323. Generate the displacement command based on the displacement amount and its corresponding time period weight value.
[0181] Specifically, the displacement can be multiplied by the corresponding weight value to obtain the final displacement value, and then a displacement command can be generated based on the final displacement value.
[0182] It's understandable that by setting different displacement weight values for each movement time period, a more natural and realistic effect can be achieved during the movement of game objects. By setting different weight values, the movement trajectory of game objects during acceleration, constant speed, and deceleration phases can be made more consistent with the motion laws of real objects. For example, when accelerating, the object will gradually increase its speed, but the acceleration is not constant; instead, it gradually decreases. This avoids sudden changes in speed during the movement of game objects, thereby increasing the game's playability and visual appeal.
[0183] S40. Control the game object to move non-linearly along the motion path according to the displacement command.
[0184] Specifically, nonlinear motion refers to motion in which the change of velocity of an object is not linear, i.e., non-uniform motion. In non-uniform motion, the displacement of an object in the same amount of time is different, and the magnitude and direction of the velocity may also change with time.
[0185] By adjusting the position of the game object through the output of the easing function, you can control the game object to move non-currently along the motion path.
[0186] It is understood that the motion-sensing game method of this application has the following advantages compared with the traditional linear movement game method:
[0187] More realistic and natural movement effects: Linearly moving game objects have a constant speed and a straight trajectory, which lacks realism. However, by using easing functions to achieve non-linear movement, more natural movement effects can be simulated, such as changes in acceleration, constant speed, and deceleration phases, which are closer to the movement in the real world.
[0188] A smoother user experience: Non-linear movement using easing functions allows game objects to move more smoothly and fluidly. Compared to linearly moving game objects, which exhibit noticeable jitter and jumps during movement, non-linear movement using easing functions reduces this unpleasant experience and improves the user's gaming experience.
[0189] More flexible and diverse movement modes: Non-linear movement is achieved through easing functions, enabling various movement modes such as acceleration, deceleration, and constant speed. Furthermore, different weight values can be set for different time periods to achieve more complex animation effects. This flexible and diverse movement mode can adapt to different types of games and gameplay, thereby enhancing the game's playability and fun.
[0190] In summary, compared with traditional linear movement game solutions, the technical solution of this application can provide a more realistic, smooth, and flexible user experience, and has better playability and gameability.
[0191] In some embodiments, after controlling the game object to move non-linearly along the motion path according to the displacement command, the motion-sensing game method of this application further includes:
[0192] The game result is generated based on the movement path of the game object.
[0193] Specifically, game results refer to the achievements or rewards players receive after completing a motion-sensing game. Game results are typically evaluated based on game rules and player performance, which can include game time, score, level, rewards, unlocking new game levels, etc.
[0194] For example, game results can be generated in the following ways:
[0195] 1. Obtain the movement path of the game object, that is, obtain the movement trajectory of the game object during the game process.
[0196] 2. Analyze the movement path of the game objects and calculate the score according to the game rules.
[0197] 3. Generate game results based on the scores and display them to the user.
[0198] Specifically, in motion-sensing games, there are many ways to generate game results based on the movement path of game objects, such as:
[0199] If the game is a fruit-cutting game, the game can calculate indicators such as fruit cutting and combo count based on the movement path of the game object, and score and game results based on the indicators.
[0200] If the game is a parkour game, the jump height, air time, obstacle avoidance and other indicators can be calculated based on the movement path of the game object, and the game result can be generated based on the indicators.
[0201] If the game is a hitting game, the accuracy of hitting the target, the number of hits, and other indicators can be calculated based on the movement path of the game object, and a score can be generated based on the indicators to produce the game result;
[0202] If the game is a flight game, the flight altitude, speed, obstacle passage, and other indicators can be calculated based on the movement path of the game object, and a score can be generated based on the indicators to produce the game result.
[0203] By generating game results based on the movement paths of game objects, the game can be made more challenging and fun, while also allowing users to understand their game performance more intuitively.
[0204] In addition, refer to Figure 3 The present invention also proposes a motion-sensing game device based on waving gestures, the motion-sensing game device based on waving gestures comprising:
[0205] The acquisition module 110 is used to acquire horizontal or vertical acceleration data from the bound motion sensing device after the motion sensing game is started.
[0206] Calculation module 120 is used to determine the motion path of the game object in the motion-sensing game based on the acceleration data;
[0207] The displacement command generation module 130 is used to generate displacement commands for the game object based on the acceleration data and a preset easing function.
[0208] The control module 140 is used to control the game object to move non-linearly along the motion path according to the displacement command.
[0209] The steps for implementing each functional module of the motion-sensing game device based on waving gestures can be referred to in the various embodiments of the motion-sensing game method based on waving gestures of the present invention, and will not be repeated here.
[0210] Furthermore, this invention also proposes a computer-readable storage medium, which can be any one or any combination of several of the following: hard disk, multimedia card, SD card, flash memory card, SMC, read-only memory (ROM), erasable programmable read-only memory (EPROM), portable compact disc read-only memory (CD-ROM), USB memory, etc. The computer-readable storage medium includes a motion-sensing game program 10 based on hand gestures. The specific implementation of the computer-readable storage medium of this invention is largely the same as the specific implementation of the motion-sensing game method based on hand gestures and the server 1 described above, and will not be repeated here.
[0211] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can 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, etc.) containing computer-usable program code.
[0212] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0213] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1The function specified in one or more boxes.
[0214] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0215] Although preferred embodiments of the invention have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including both the preferred embodiments and all changes and modifications falling within the scope of the invention.
[0216] Obviously, those skilled in the art can make various modifications and variations to this invention without departing from its spirit and scope. Therefore, if these modifications and variations fall within the scope of the claims of this invention and their equivalents, this invention also intends to include these modifications and variations.
Claims
1. A motion-sensing game method based on waving gestures, characterized in that, include: After the motion-sensing game is started, it obtains horizontal or vertical acceleration data from the bound motion-sensing device; The motion path of the game object in the motion-sensing game is determined based on the acceleration data; The displacement command of the game object is generated based on the acceleration data and the preset easing function; The game object is controlled to move non-linearly along the motion path according to the displacement command; The process of generating displacement commands for the game object based on the acceleration data and a preset easing function includes: Filter the time interval for completing a valid waving motion from the acceleration data; Call the preset easing function and use the time interval as the input to the easing function; The displacement command is generated based on the output of the easing function, including: The coordinates of the game object on its movement path at the current moment are calculated based on the output value of the easing function. The expression for the easing function is as follows: ; Where f(t) is the output coordinate value, P0, P1 and P2 are constants, and t is the input value of the easing function, with a value range of [0,1]. The current coordinate value is compared with the coordinate value at the previous moment, the displacement of the game object on the movement path at the current moment is calculated, and the displacement is used to generate the displacement command.
2. The motion-sensing game method based on waving gestures as described in claim 1, characterized in that, Determining the motion path of the game object in the motion-sensing game based on the acceleration data includes: The acceleration data is then filtered and noise-reduced. Generate an acceleration vector based on the processed acceleration data; The direction of movement of the motion sensing device is determined based on the acceleration vector; Based on the direction of movement, a matching motion path is selected from a preset motion path trajectory library as the motion path for the game object.
3. The motion-sensing game method based on waving gestures as described in claim 1, characterized in that, Using the time interval as input to the easing function includes: Map the start time of the time interval to the start value of the input range of the easing function; Map the end time of the time interval to the end value of the input range of the easing function; The easing function input value corresponding to each moment within the time interval is calculated using an interpolation algorithm.
4. The motion-sensing game method based on waving gestures as described in claim 1, characterized in that, Generating the displacement command from the displacement amount includes: Two time anchor points are set in the input interval of the easing function to divide the input interval into three motion time periods: acceleration segment, constant speed segment, and deceleration segment. Different weight values are assigned to the easing function output for each motion time period based on the motion time period. The weight values corresponding to the acceleration segment, constant speed segment, and deceleration segment are a, b, and c, respectively, where 0 < b < c. <a<1;c> b>1; The displacement command is generated based on the displacement amount and its corresponding time period weight value.
5. The motion-sensing game method based on waving gestures as described in claim 1, characterized in that, After controlling the game object to move non-linearly along the motion path according to the displacement command, the method further includes: The game result is generated based on the movement path of the game object.
6. A motion-sensing gaming device based on waving gestures, characterized in that, For implementing the motion-sensing game method based on waving motions as described in any one of claims 1-5, the motion-sensing game device comprises: The acquisition module is used to acquire horizontal or vertical acceleration data from the bound motion-sensing device after the motion-sensing game is started; The calculation module is used to determine the motion path of the game object in the motion-sensing game based on the acceleration data; The displacement command generation module is used to generate displacement commands for the game object based on the acceleration data and a preset easing function. The control module is used to control the game object to move non-linearly along the motion path according to the displacement command.
7. A motion-sensing gaming device based on hand-waving gestures, characterized in that, The device includes a memory, a processor, and a gesture-based motion-sensing game program stored in the memory and executable on the processor. When the processor executes the gesture-based motion-sensing game program, it implements the gesture-based motion-sensing game method as described in any one of claims 1-5.
8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a motion-sensing game program based on waving gestures, which, when executed by a processor, implements the motion-sensing game method based on waving gestures as described in any one of claims 1-5.