TWI668043B - Method and system for predicting an object location, and game decision method - Google Patents
Method and system for predicting an object location, and game decision method Download PDFInfo
- Publication number
- TWI668043B TWI668043B TW107114925A TW107114925A TWI668043B TW I668043 B TWI668043 B TW I668043B TW 107114925 A TW107114925 A TW 107114925A TW 107114925 A TW107114925 A TW 107114925A TW I668043 B TWI668043 B TW I668043B
- Authority
- TW
- Taiwan
- Prior art keywords
- collision
- environmental
- controlled object
- post
- speed
- Prior art date
Links
Landscapes
- Processing Or Creating Images (AREA)
Abstract
一種落點預測方法,包含輸入環境狀態以及輸入參數;根據輸入參數及該環境狀態利用環境物件估算模型計算出受控物件的第一移動距離;偵測受控物件在第一移動距離內是否與第一環境物件或第二環境物件發生碰撞;當發生碰撞,估算受控物件之碰撞後路徑,並更新環境狀態,根據碰撞後路徑重新利用環境物件估算模型計算出受控物件的第二移動距離;以及當在第一移動距離內未發生碰撞,估算受控物件之停止位置。 A method for predicting a falling point includes inputting an environmental state and an input parameter; calculating a first moving distance of the controlled object by using an environmental object estimation model according to the input parameter and the environmental state; and detecting whether the controlled object is within the first moving distance The first environmental object or the second environmental object collides; when a collision occurs, the post-collision path of the controlled object is estimated, and the environmental state is updated, and the second moving distance of the controlled object is calculated according to the post-collision path re-utilization environmental object estimation model. And estimating the stop position of the controlled object when no collision occurs within the first moving distance.
Description
本案是有關於一種落點預測方法、落點預測系統及遊戲決策方法,且特別是有關於一種預測遊戲中非玩家角色位置的方法、系統及遊戲決策方法。 This case is about a method of landing point prediction, a point-of-sale prediction system and a game decision-making method, and in particular, a method, a system and a game decision-making method for predicting the position of a non-player character in a game.
近年來,隨著行動裝置的蓬勃發展,線上即時的手機遊戲也越來越受玩家喜愛,透過即時配對玩家進入雙人或多人的對戰模式,讓玩家享受與真人對戰的樂趣。但如果某些特定時段在線人數過少,將會導致玩家上線後找不到人對戰的狀況發生,因此為了讓玩家隨時都能享受對戰的樂趣,遊戲開發商將人工智慧應用於遊戲中,讓電腦可以模擬真人的行為與玩家對戰。 In recent years, with the rapid development of mobile devices, online instant mobile games have become more and more popular among players. By instantly pairing players into a double or multiplayer battle mode, players can enjoy the fun of playing against real people. However, if there are too few online users in a certain period of time, it will lead to the situation that the player can't find a match after the player goes online. Therefore, in order to let the players enjoy the game at any time, the game developer applies artificial intelligence to the game and lets the computer You can simulate the behavior of real people and play against players.
但人工智慧通常需要經過繁複的設計與計算,因此如果想要得到精準的結果往往需要耗費大量的時間,使得在即時對戰遊戲中無法即時給予回饋,並且由於運算量龐大,對於手機的處理器而言也是龐大的負荷。因此,如何在 不影響精準度的情況下更快速的運算,達到即時回饋的功效是本領域待解決的問題。 But artificial intelligence usually requires complicated design and calculation, so if you want to get accurate results, it often takes a lot of time, so you can't give feedback in real-time game, and because of the huge amount of computing, it is for the processor of mobile phone. Words are also a huge load. So how do you The faster calculation without affecting the accuracy, and the effect of real-time feedback is a problem to be solved in the field.
本發明之主要目的係在提供一種落點預測方法、落點預測系統及遊戲決策方法,其主要係改進以往人工智慧因運算龐大而導致計算時間過長的問題,利用將遊戲中非玩家角色(Non-Player Character,NPC)的行為,分成多個可估算的小行為,再將多個小型為個別訓練成為訓練模型,使得預測NPC行為可以更準確,達到即時回饋的功效。 The main object of the present invention is to provide a method for predicting a drop point, a system for determining a drop point, and a method for determining a game, which are mainly to improve the problem that the artificial intelligence is too long to calculate due to the large operation, and utilize the non-player character in the game ( The behavior of Non-Player Character (NPC) is divided into a number of small behaviors that can be estimated, and then multiple small individual trainings are used as training models, so that the predicted NPC behavior can be more accurate and achieve the effect of instant feedback.
為達成上述目的,本案之第一態樣是在提供一種落點預測方法,此方法包含以下步驟:輸入環境狀態以及輸入參數,環境狀態包含第一環境物件或第二環境物件的位置;根據輸入參數及該環境狀態利用環境物件估算模型計算出受控物件的第一移動距離;偵測受控物件在第一移動距離內是否與第一環境物件或第二環境物件發生碰撞;當發生碰撞,估算受控物件之碰撞後路徑,並更新環境狀態,根據碰撞後路徑重新利用環境物件估算模型計算出受控物件的第二移動距離;以及當在第一移動距離內未發生碰撞,估算受控物件之停止位置。 In order to achieve the above object, the first aspect of the present invention is to provide a method for predicting a drop point, the method comprising the steps of: inputting an environmental state and inputting a parameter, the environmental state comprising a location of the first environmental object or the second environmental object; The parameter and the environmental state use the environmental object estimation model to calculate a first moving distance of the controlled object; and detect whether the controlled object collides with the first environmental object or the second environmental object within the first moving distance; when a collision occurs, Estimating the post-collision path of the controlled object, and updating the environmental state, calculating the second moving distance of the controlled object according to the post-collision path re-utilization environmental object estimation model; and estimating the control when no collision occurs within the first moving distance The stop position of the object.
本案之第二態樣是在提供一種落點預測系統,其包含:處理器以及儲存裝置。儲存裝置電性連接至處理器,用以儲存環境狀態以及輸入參數,環境狀態包含第一環境物件或第二環境物件的位置。其中,處理器包含:環境物 件估算模組、碰撞偵測模組、碰撞計算模組以及位置計算模組。環境物件估算模組根據輸入參數及環境狀態以以計算出受控物件的第一移動距離。碰撞偵測模組與環境物件估算模組電性連接,用以偵測受控物件在第一移動距離內是否與第一環境物件或第二環境物件發生碰撞。碰撞計算模組與碰撞偵測模組電性連接,用以計算發生碰撞後受控物件之碰撞後路徑,並更新環境狀態,接著根據碰撞後路徑重新利用環境物件估算模型計算出受控物件的第二移動距離。位置計算模組與碰撞偵測模組電性連接,當在第一移動距離內未發生碰撞時,用以估算受控物件之一停止位置。 A second aspect of the present invention is to provide a drop prediction system comprising: a processor and a storage device. The storage device is electrically connected to the processor for storing an environmental state and an input parameter, where the environmental state includes a location of the first environmental object or the second environmental object. Wherein the processor comprises: an environment An estimation module, a collision detection module, a collision calculation module, and a position calculation module. The environmental object estimation module calculates the first moving distance of the controlled object based on the input parameters and the environmental state. The collision detection module is electrically connected to the environmental object estimation module to detect whether the controlled object collides with the first environmental object or the second environmental object within the first moving distance. The collision calculation module and the collision detection module are electrically connected to calculate a post-collision path of the controlled object after the collision, and update the environmental state, and then calculate the controlled object according to the re-use of the environmental object estimation model according to the post-collision path. The second moving distance. The position calculation module is electrically connected to the collision detection module, and is used to estimate a stop position of the controlled object when there is no collision within the first moving distance.
本案之第三態樣是在提供一種遊戲決策方法,其包含:取得環境狀態;決定複數個輸入參數;將環境狀態及複數個輸入參數依序應用於落點預測方法,得到該受控物件之複數個停止位置,停止位置分別對應至輸入參數的其中之一;估算停止位置各自之價值;以及根據估算之停止位置各自之價值,由輸入參數中決定最佳輸入參數。 The third aspect of the present invention is to provide a game decision method, which comprises: obtaining an environmental state; determining a plurality of input parameters; and sequentially applying the environmental state and the plurality of input parameters to the drop prediction method to obtain the controlled object. a plurality of stop positions, the stop positions respectively corresponding to one of the input parameters; estimating the respective values of the stop positions; and determining the optimal input parameters from the input parameters according to the respective values of the estimated stop positions.
本發明之落點預測方法、落點預測系統及遊戲決策方法主要係改進以往人工智慧因運算龐大而導致計算時間過長的問題,利用將遊戲中NPC的行為,分成多個可估算的小行為,再將多個小型為個別訓練成為訓練模型,使得預測NPC行為可以更準確,達到即時回饋的功效。 The drop point prediction method, the drop point prediction system and the game decision method of the present invention mainly improve the problem that the artificial intelligence has a long calculation time due to the huge operation, and divides the behavior of the NPC in the game into a plurality of small behaviors that can be estimated. Then, multiple small individuals are trained as training models, so that the predicted NPC behavior can be more accurate and achieve the effect of instant feedback.
100‧‧‧落點預測系統 100‧‧‧Droping Prediction System
101‧‧‧處理器 101‧‧‧ processor
102‧‧‧儲存裝置 102‧‧‧Storage device
110‧‧‧環境物件估算模組 110‧‧‧Environmental Object Estimation Module
120‧‧‧碰撞偵測模組 120‧‧‧ collision detection module
130‧‧‧碰撞計算模組 130‧‧‧Collision calculation module
140‧‧‧位置計算模組 140‧‧‧Location Computing Module
200‧‧‧落點預測方法 200‧‧‧Drop prediction method
400‧‧‧遊戲決策方法 400‧‧‧ Game decision method
510‧‧‧球桿 510‧‧‧ clubs
520‧‧‧母球 520‧‧ ‧ cue ball
530a、530b、530c‧‧‧子球 530a, 530b, 530c‧‧‧a ball
S210~S250、S241~S346、S410~S450‧‧‧步驟 S210~S250, S241~S346, S410~S450‧‧‧ steps
為讓本發明之上述和其他目的、特徵、優點與 實施例能更明顯易懂,所附圖式之說明如下:第1圖係根據本案之一些實施例所繪示之一種落點預測系統的示意圖;第2圖係根據本案之一些實施例所繪示之一種落點預測方法的流程圖;第3圖係根據本案之一些實施例所繪示之步驟S240的流程圖;第4圖係根據本案之一些實施例所繪示之一種遊戲決策方法的流程圖;第5A圖係根據本案之一些實施例所繪示之撞球遊戲的示意圖;以及第5B圖係根據本案之一些實施例所繪示之撞球遊戲的示意圖。 The above and other objects, features and advantages of the present invention are The embodiment can be more clearly understood, and the description of the drawings is as follows: FIG. 1 is a schematic diagram of a landing point prediction system according to some embodiments of the present invention; FIG. 2 is a drawing according to some embodiments of the present invention. A flowchart of a method for predicting a placement point; a third diagram is a flowchart of step S240 according to some embodiments of the present disclosure; and a fourth diagram is a game decision method according to some embodiments of the present disclosure. FIG. 5A is a schematic diagram of a billiard game according to some embodiments of the present invention; and FIG. 5B is a schematic diagram of a billiard game according to some embodiments of the present invention.
以下揭示提供許多不同實施例或例證用以實施本發明的不同特徵。特殊例證中的元件及配置在以下討論中被用來簡化本揭示。所討論的任何例證只用來作解說的用途,並不會以任何方式限制本發明或其例證之範圍和意義。此外,本揭示在不同例證中可能重複引用數字符號且/或字母,這些重複皆為了簡化及闡述,其本身並未指定以下討論中不同實施例且/或配置之間的關係。 The following disclosure provides many different embodiments or illustrations for implementing different features of the invention. The elements and configurations of the specific illustrations are used in the following discussion to simplify the disclosure. Any examples discussed are for illustrative purposes only and are not intended to limit the scope and meaning of the invention or its examples. In addition, the present disclosure may repeatedly recite numerical symbols and/or letters in different examples, which are for simplicity and elaboration, and do not specify the relationship between the various embodiments and/or configurations in the following discussion.
請參閱第1圖。第1圖係根據本案之一些實施例所繪示之一種落點預測系統100的示意圖。如第1圖所繪 示,落點預測系統100包含處理器101以及儲存裝置102。儲存裝置102電性連接至處理器101,並用以儲存環境狀態以及輸入參數,環境狀態包含第一環境物件或第二環境物件的位置。處理器110更包含環境物件估算模組110、碰撞偵測模組120、碰撞計算模組130以及位置計算模組140。環境物件估算模組110與碰撞偵測模組120電性連接,碰撞偵測模組120與碰撞計算模組130及位置計算模組140電性連接。 Please refer to Figure 1. 1 is a schematic diagram of a drop prediction system 100, in accordance with some embodiments of the present disclosure. As depicted in Figure 1 The drop prediction system 100 includes a processor 101 and a storage device 102. The storage device 102 is electrically connected to the processor 101 and configured to store an environmental state and an input parameter, where the environmental state includes a location of the first environmental object or the second environmental object. The processor 110 further includes an environment object estimation module 110, a collision detection module 120, a collision calculation module 130, and a position calculation module 140. The environment object estimation module 110 is electrically connected to the collision detection module 120. The collision detection module 120 is electrically connected to the collision calculation module 130 and the position calculation module 140.
於本發明各實施例中,處理器101可以實施為積體電路如微控制單元(microcontroller)、微處理器(microprocessor)、數位訊號處理器(digital signal processor)、特殊應用積體電路(application specific integrated circuit,ASIC)、邏輯電路或其他類似元件或上述元件的組合。儲存裝置102可以實施為記憶體、硬碟、隨身碟、記憶卡等。 In various embodiments of the present invention, the processor 101 can be implemented as an integrated circuit such as a micro control unit, a microprocessor, a digital signal processor, or an application specific integrated circuit (application specific) Integrated circuit (ASIC), logic circuit or other similar component or combination of the above. The storage device 102 can be implemented as a memory, a hard disk, a flash drive, a memory card, or the like.
請參閱第2圖。第2圖係根據本案之一些實施例所繪示之一種落點預測方法200的流程圖。本發明的一實施例之落點預測方法200可以用來計算NPC行為,此處所指的NPC行為可以是指遊戲中所有非為家角色的物理狀態,舉例而言,在撞球遊戲中的NPC行為可以是指母球、子球與球檯之間的關係,以及母球及子球的物理狀態等。於一實施例中,第2圖所示之落點預測方法200可以應用於第1圖的落點預測系統100上,處理單元110用以根據下列落點預測方法200所描述之步驟,進行NPC行為的估算。如第2圖所示,落點預測方法200包含以下步驟: 步驟S210:輸入環境狀態以及輸入參數;步驟S220:根據輸入參數利用環境物件估算模型計算出受控物件的第一移動距離;步驟S230:偵測受控物件在第一移動距離內是否與第一環境物件或第二環境物件發生碰撞;步驟S240:如果發生碰撞,估算受控物件之碰撞後路徑,並更新環境狀態;以及步驟S250:如果在第一移動距離內沒有發生碰撞,估算受控物件之停止位置。 Please refer to Figure 2. 2 is a flow chart of a method of landing prediction method 200, according to some embodiments of the present disclosure. The placement prediction method 200 of an embodiment of the present invention can be used to calculate NPC behavior. The NPC behavior referred to herein can refer to the physical state of all non-home characters in the game, for example, NPC behavior in a pool game. It can refer to the relationship between the cue ball, the sub-ball and the table, and the physical state of the cue ball and the sub-ball. In an embodiment, the placement prediction method 200 shown in FIG. 2 can be applied to the placement prediction system 100 of FIG. 1 , and the processing unit 110 is configured to perform NPC according to the steps described in the following placement prediction method 200 . Estimation of behavior. As shown in FIG. 2, the placement prediction method 200 includes the following steps: Step S210: input an environmental state and input parameters; Step S220: Calculate a first moving distance of the controlled object by using an environmental object estimation model according to the input parameter; Step S230: Detect whether the controlled object is within the first moving distance and the first Collision of the environmental object or the second environmental object; step S240: estimating a post-collision path of the controlled object and updating the environmental state if a collision occurs; and step S250: estimating the controlled object if no collision occurs within the first moving distance Stop position.
於步驟S210中,輸入環境狀態以及輸入參數,環境狀態包含第一環境物件或第二環境物件的位置。於一實施例中,第一環境物件可以是子球,第二環境物件可以是球檯,輸入參數可以是擊球的力道、擊球的位置以及擊球的方向等。本發明僅需要改變輸入的環境狀態以及輸入參數即可適用於不同即時對戰遊戲中(例如:棒球遊戲、對打遊戲等),並不限於使用在即時對戰的撞球遊戲中。 In step S210, an environmental state and an input parameter are input, and the environmental state includes a location of the first environmental object or the second environmental object. In an embodiment, the first environmental object may be a sub-ball, and the second environmental object may be a table. The input parameters may be a force of hitting the ball, a position of the hitting ball, and a direction of hitting the ball. The invention only needs to change the environment state of the input and the input parameters to be applicable to different instant competition games (for example, baseball games, game play, etc.), and is not limited to use in the pool game of instant competition.
在執行步驟S220之前,需先將母球的運動狀態、母球與子球碰撞的物理狀態以及母球與球檯碰撞的物理狀態分成多個模型個別進行訓練,多個模型分別是環境物件估算模型、碰撞前速度模型以及切線偏移模型,而環境物件估算模型中包含三個子模型,分別是基底距離子模型、狀態切換子模型以及滾動速度衰減子模型。 Before performing step S220, the motion state of the cue ball, the physical state of the cue ball and the collision of the sub-ball, and the physical state of the collision between the cue ball and the table are separately divided into a plurality of models for training, and the plurality of models are respectively the environmental object estimation model. The pre-collision velocity model and the tangent offset model, and the environmental object estimation model includes three sub-models, namely the base distance sub-model, the state switching sub-model and the rolling speed attenuation sub-model.
首先介紹基底距離子模型,母球有未撞到任何東西(子球或球檯)而停止的情況,於此實施例中將母球受力 後直到停止,在移動間未發生碰撞的情況,作為母球移動的基底距離。輸入在不同擊球力道下母球移動的距離,再利用類神經網路(Neural Network)或是線性回歸(Linear Regression)的方式產生基底距離子模型,使得之後可以直接輸入擊球力道藉由基底距離子模型輸出母球移動的基底距離。 First, the base distance submodel is introduced. When the cue ball has stopped without hitting anything (a ball or a table), the cue ball is stressed in this embodiment. After the stop until there is no collision between the movements, as the base distance for the cue ball movement. Enter the distance that the cue ball moves under different ball striking forces, and then use the neural network or Linear Regression to generate the base distance submodel, so that you can directly input the battering force path through the base. The distance from the submodel outputs the base distance at which the cue moves.
接著介紹碰撞前速度模型,在進行碰撞計算前,必須先知道母球碰撞前的速度,因此需計算母球在對應的擊球力道下初始的速度、初始的角速度以及母球至碰撞點的移動距離等參數。首先輸入在不同擊球力道下初始的速度、初始的角速度、母球至碰撞點的移動距離、碰撞前的速度以及碰撞前的角速度,再利用類神經網路或是線性回歸的方式產生碰撞前速度模型,使得之後可以直接輸入初始的速度、初始的角速度以及母球至碰撞點的移動距離,藉由碰撞前速度模型輸出母球在碰撞前的速度及角速度。 Next, the pre-collision velocity model is introduced. Before the collision calculation, the velocity before the cue ball collision must be known. Therefore, the initial velocity of the cue ball under the corresponding ball striking force, the initial angular velocity, and the movement of the cue ball to the collision point must be calculated. Distance and other parameters. First, enter the initial velocity under different ball striking force, the initial angular velocity, the moving distance from the cue ball to the collision point, the velocity before the collision, and the angular velocity before the collision. Then use the neural network or linear regression to generate the collision. The velocity model allows the initial velocity, the initial angular velocity, and the moving distance of the cue ball to the collision point to be directly input, and the velocity and angular velocity of the cue ball before the collision are output by the pre-collision velocity model.
接著介紹切線偏移模型,母球與子球在進行碰撞時會發生近似完全彈性碰撞的情況(母球碰撞後會沿切線方向移動),因此根據碰撞前速度、碰撞前角速度以及母球與子球的夾角即可推知母球及子球碰撞後的速度及角速度。但母球上的動能除了會轉移至子球上之外,還會因為摩擦力的作用,使得母球移動方向與原定的切線方向產生一切線偏移角,需要根據碰撞前速度、碰撞前角速度以及母球與子球的夾角等參數建構切線偏移模型,以獲得切線偏移角。當然母球也有與球檯碰撞的球況發生,如果撞到球檯,先利 用入射角等於反射角的原理,計算母球的行進方向,接著再根據碰撞前速度及碰撞前角速度,對碰撞後的方向進行修正。 Next, the tangent offset model is introduced. When the cue ball and the sub-ball collide, an almost complete elastic collision occurs (the cue ball moves in the tangential direction after the collision), so according to the pre-collision speed, the pre-collision angular velocity, and the cue ball and the sub-ball. The angle between the balls can be used to infer the speed and angular velocity of the cue ball and the sub-ball collision. However, in addition to the kinetic energy on the cue ball, it will be transferred to the sub-ball. Because of the frictional force, the moving direction of the cue ball and the original tangential direction will produce all the line offset angles. The angular velocity and the angle between the cue ball and the subsphere are used to construct a tangent offset model to obtain the tangent offset angle. Of course, the cue ball also has a ball condition that collides with the table. If it hits the table, it is profitable. The traveling direction of the cue ball is calculated by the principle that the incident angle is equal to the reflection angle, and then the direction after the collision is corrected according to the pre-collision speed and the pre-collision angular velocity.
接著介紹滾動速度衰減子模型,為了模擬母球以及子球滾動時的真實情況,需要將滾動時球與桌面摩擦的動能損耗歸納出一衰減函數,由於球會經過多次的滑動或滾動狀態的切換,狀態切換的次數越多球的速度衰減程度也會以指數成長。因此,需要計算球在運動中經過多少次的狀態切換,將次數代入衰減函數中即可估算出球的衰減速度。 Then introduce the rolling speed attenuation sub-model. In order to simulate the real situation of the cue ball and the sub-ball rolling, it is necessary to generalize the kinetic energy loss of the ball and the table friction during rolling to a function of attenuation, because the ball will go through multiple sliding or rolling states. Switching, the more times the state is switched, the more the speed of the ball will decay. Therefore, it is necessary to calculate how many times the ball is switched during the movement, and the number of times is substituted into the attenuation function to estimate the attenuation speed of the ball.
接著介紹狀態切換子模型,經由觀察母球的運動狀態後可發現,將母球擊出或母球經過碰撞後,母球都會先滑動一段距離再滾動一段距離,而滑動狀態的速度衰減與滾動狀態的速度衰減不同,滑動狀態的速度衰減會以線性方式衰減,而滾動狀態的速度衰減則會以指數方式衰減。因此可計算出滑動狀態球的移動距離後,利用母球至碰撞點的移動距離與滑動狀態球的移動距離相減即可推知滾動狀態球的移動距離。 Then introduce the state switching submodel. After observing the motion state of the cue ball, it can be found that after the cue ball is hit or the cue ball passes the collision, the cue ball will slide for a certain distance and then roll for a distance, and the speed of the sliding state is attenuated and scrolled. The velocity decay of the state is different, the velocity decay of the sliding state is attenuated linearly, and the velocity decay of the rolling state is exponentially attenuated. Therefore, after the moving distance of the sliding state ball can be calculated, the moving distance of the rolling state ball can be inferred by subtracting the moving distance of the mother ball to the collision point and the moving distance of the sliding state ball.
將基底距離子模型、狀態切換子模型、滾動速度衰減子模型、碰撞前速度模型以及切線偏移模型訓練完畢後,便可開始進行母球與子球移動路徑的估算。 After the base distance sub-model, the state switching sub-model, the rolling speed attenuation sub-model, the pre-crash speed model, and the tangent offset model are trained, the estimation of the cue ball and the sub-ball movement path can be started.
請再參考第2圖,於步驟S220中,根據輸入參數利用環境物件估算模型計算出受控物件的第一移動距離。於一實施例中,利用基底距離子模型、狀態切換子模型、滾動速度衰減子模型可以計算出母球在碰撞前移動的距離。 Referring to FIG. 2 again, in step S220, the first moving distance of the controlled object is calculated according to the input parameter using the environmental object estimation model. In an embodiment, the distance of the cue ball before the collision can be calculated by using the base distance sub-model, the state switching sub-model, and the rolling speed attenuation sub-model.
於步驟S230中,偵測受控物件在第一移動距離內是否與第一環境物件或第二環境物件發生碰撞。於此實施例中,利用之前計算出的母球在碰撞前移動的距離以及移動向量,判斷在此移動向量中是否於其他環境物件(子球與球檯)的向量發生重疊。 In step S230, it is detected whether the controlled object collides with the first environmental object or the second environmental object within the first moving distance. In this embodiment, whether the previously calculated distance of the cue ball before the collision and the motion vector are used to determine whether the vector of the other environmental objects (the sub-ball and the table) overlap in the motion vector.
於步驟S240中,如果有發生碰撞,估算受控物件之碰撞後路徑,並更新環境狀態。步驟S240的細部流程請參考第3圖,第3圖係根據本案之一些實施例所繪示之步驟S240的流程圖。如第3圖所示,步驟S240包含以下步驟:步驟S241:如果發生碰撞,利用碰撞前速度模型計算受控物件碰撞前的速度;步驟S242:判斷受控物件是否與第一環境物件發生碰撞事件;步驟S243:如果受控物件與第一環境物件發生碰撞事件,利用切線偏移模型計算受控物件與第一環境物件碰撞後的角度偏移量;步驟S244:計算受控物件的第一碰撞後速度以及計算第一環境物件的第二碰撞後速度;步驟S245:如果受控物件未與第一環境物件發生碰撞,而是與第二環境物件發生碰撞事件,計算受控物件與第二環境物件碰撞後的角度偏移量及碰撞後速度;以及步驟S246:紀錄碰撞事件的發生位置,並根據發生位置、第一碰撞後速度及第二碰撞後速度更新環境狀態。 In step S240, if a collision occurs, the post-collision path of the controlled object is estimated, and the environmental state is updated. For the detailed process of step S240, please refer to FIG. 3, which is a flowchart of step S240 according to some embodiments of the present disclosure. As shown in FIG. 3, step S240 includes the following steps: Step S241: If a collision occurs, the velocity before the collision of the controlled object is calculated by using the pre-collision velocity model; and step S242: determining whether the controlled object collides with the first environmental object. Step S243: If a collision event occurs between the controlled object and the first environmental object, the tangential offset model is used to calculate the angular offset after the collision between the controlled object and the first environmental object; and step S244: calculating the first collision of the controlled object a post-speed and a second post-collision speed of the first environmental object; step S245: calculating the controlled object and the second environment if the controlled object does not collide with the first environmental object but collides with the second environmental object The angular offset after the collision of the object and the speed after the collision; and step S246: recording the occurrence position of the collision event, and updating the environmental state according to the occurrence position, the first collision speed, and the second collision speed.
於步驟S241及步驟S242中,如果發生碰撞,利用碰撞前速度模型計算受控物件碰撞前的速度,接著判斷受控物件是否與第一環境物件發生碰撞事件。當步驟S230判斷是否發生碰撞之後,如果發生碰撞,需要先利用之前建立好的碰撞前速度模型計算碰撞前母球剩餘多少速度及角速度,接著才進一步判斷母球是與第一環境物件或第二環境物件(子球或球檯)發生碰撞。 In step S241 and step S242, if a collision occurs, the velocity before the collision of the controlled object is calculated by using the pre-collision velocity model, and then it is determined whether the controlled object collides with the first environmental object. After step S230 determines whether a collision has occurred, if a collision occurs, it is necessary to first calculate the remaining speed and angular velocity of the pre-collision cue ball using the previously established pre-crash velocity model, and then further determine that the cue ball is the first environmental object or the second. Collision of environmental objects (sub-balls or tables).
於步驟S243及步驟S244中,如果受控物件與第一環境物件發生碰撞事件,利用切線偏移模型計算受控物件與第一環境物件碰撞後的角度偏移量;接著計算受控物件的第一碰撞後速度以及計算第一環境物件的第二碰撞後速度。於一實施例中,如果母球與子球發生碰撞,先將母球與子球預設為彈性碰撞,計算母球與子球碰撞後的角度,再將先前得到的碰撞前母球的速度與角速度,以及經過彈性碰撞計算後得出的母球碰撞後角度,代入切線偏移模型中,可以得到修正過的母球碰撞後角度,再分別計算母球與子球碰撞後的速度與角速度,而子球碰撞後的角度則為彈性碰撞計算出的角度。 In step S243 and step S244, if a collision event occurs between the controlled object and the first environmental object, the tangential offset model is used to calculate an angular offset of the controlled object after colliding with the first environmental object; and then the first object of the controlled object is calculated. The velocity after a collision and the calculation of the second post-collision speed of the first environmental object. In an embodiment, if the cue ball collides with the sub-ball, the cue ball and the sub-ball are first preset as elastic collisions, the angle between the cue ball and the sub-ball collision is calculated, and the previously obtained cue ball velocity before the collision is obtained. Compared with the angular velocity and the angle of the cue ball after the elastic collision calculation, the angle of the cue ball is substituted into the tangent offset model to obtain the corrected post-collision angle, and then calculate the velocity and angular velocity of the cue ball and the sub-ball collision respectively. The angle after the collision of the sub-ball is the angle calculated by the elastic collision.
於步驟S245中,如果受控物件未與第一環境物件發生碰撞,而是與第二環境物件發生碰撞事件,計算受控物件與第二環境物件碰撞後的角度偏移量及碰撞後速度。於現實中,依據母球撞擊至球檯會造成球檯的陷入程度、母球的角速度以及摩擦力的強弱等,都會對母球狀及球檯後的反彈角有很大的影像。為了簡化計算,於本實施例中,如果母 球與球檯發生碰撞,將母球與球檯的撞擊面視為垂直於桌面之平面,因此母球撞擊球台後的角度可以經由入射角等於反射角的理論計算得出。 In step S245, if the controlled object does not collide with the first environmental object, but collides with the second environmental object, the angular offset and the post-collision speed after the collision between the controlled object and the second environmental object are calculated. In reality, depending on the impact of the cue ball on the table, the degree of sinking of the table, the angular velocity of the cue ball, and the strength of the friction will have a large image of the bounce angle behind the ball and the table. In order to simplify the calculation, in this embodiment, if the mother The ball collides with the table, and the impact surface of the cue ball and the table is regarded as a plane perpendicular to the table top. Therefore, the angle after the cue ball hits the table can be calculated theoretically by the angle of incidence equal to the angle of reflection.
於步驟S246中,紀錄碰撞事件的發生位置,並根據發生位置、第一碰撞後速度及第二碰撞後速度更新環境狀態。於一實施例中,會記錄母球碰撞到子球或母球碰撞到球檯的位置,接著將子球從原本的位置上移除,並將碰撞位置、以及母球與子球的撞擊後的速度及角速度回傳至紀錄環境狀態的列表中,成為下次母球與子球運動的參數。而母球與子球在碰撞後的位置及移動距離,則會從步驟S220開始重新計算,因此當母球被擊出後除非是未撞擊到子球或球檯而停止的情況,其他情況母球或子球直到停止前都會經過多次的落點預測方法200的計算,因此會具有許多碰撞階段。 In step S246, the occurrence position of the collision event is recorded, and the environmental state is updated according to the occurrence position, the first post-collision speed, and the second post-collision speed. In an embodiment, the position where the cue ball collides with the sub-ball or the cue ball hits the table is recorded, and then the sub-ball is removed from the original position, and the collision position and the impact of the cue ball and the sub-ball are The speed and angular velocity are passed back to the list of recorded environmental conditions and become the parameters for the next cue ball and sub-ball movement. The position and moving distance of the cue ball and the sub-ball after the collision will be recalculated from step S220, so when the cue ball is knocked out, unless it is stopped without hitting the sub-ball or the table, the other situation is cue ball. Or the ball will go through the calculation of the multiple point prediction method 200 until it stops, so there will be many collision phases.
於步驟S250中,如果在第一移動距離內沒有發生碰撞,估算受控物件之停止位置。於一實施例中,如果母球被擊出後都未撞擊到子球或球檯,母球會因為與球檯桌面產生摩擦而逐漸停止,計算出停止位置後,將母球位置更新並存入紀錄環境狀態的列表中。如果母球未發生撞擊事件而停止,則表示母球的運動結束,如果沒有再輸入擊球的力道,母球的運動不會開始。 In step S250, if no collision occurs within the first moving distance, the stop position of the controlled object is estimated. In an embodiment, if the cue ball does not hit the sub-ball or the table after being hit, the cue ball will gradually stop due to friction with the table top. After calculating the stop position, the cue position is updated and stored in the record. In the list of environmental states. If the cue ball stops without an impact event, it means that the movement of the cue ball ends. If the force of the hitting ball is not input, the movement of the cue ball will not start.
於另一實施例中,被母球撞擊的子球的運動,也可利用落點預測方法200來估算,將子球被撞擊產生的速度及角速度作為輸入參數,藉著判斷被撞擊的子球是否有跟球檯或其他子球發生碰撞,重複進行步驟S220~S240的計 算,直到被撞擊的子球停止為止。 In another embodiment, the motion of the sub-ball struck by the cue ball can also be estimated by using the drop prediction method 200, and the velocity and angular velocity generated by the impact of the sub-ball as an input parameter, by judging the impacted sub-ball Whether there is a collision with the table or other sub-balls, repeat the steps S220~S240 Count, until the impacted ball stops.
請參閱第4圖。第4圖係根據本案之一些實施例所繪示之一種遊戲決策方法400的流程圖。本發明的一實施例之遊戲決策方法400可以用來自動從多種可能中選擇一個最佳的結果,使得在與玩家對戰中得到更好的結果。如第4圖所示,遊戲決策方法400包含以下步驟:步驟S410:取得環境狀態;步驟S420:決定複數個輸入參數;步驟S430:將環境狀態及輸入參數依序應用至前述的落點預測方法,得到受控物件之複數個停止位置,停止位置分別對應至輸入參數的其中之一;步驟S440:估算停止位置各自之價值;以及步驟S450:根據估算之停止位置各自之價值,由輸入參數中決定最佳輸入參數。 Please refer to Figure 4. 4 is a flow diagram of a game decision method 400, illustrated in accordance with some embodiments of the present disclosure. The game decision method 400 of an embodiment of the present invention can be used to automatically select an optimal result from a plurality of possibilities such that a better result is achieved in combating the player. As shown in FIG. 4, the game decision method 400 includes the following steps: Step S410: Acquiring an environmental state; Step S420: Determining a plurality of input parameters; Step S430: Applying the environmental state and the input parameters to the aforementioned Falling Point Prediction method in sequence Obtaining a plurality of stop positions of the controlled object, the stop positions respectively corresponding to one of the input parameters; step S440: estimating the respective values of the stop positions; and step S450: according to the respective values of the estimated stop positions, by the input parameters Determine the best input parameters.
於步驟S410及步驟S420中,取得環境狀態,接著決定複數個輸入參數。於一實施例中,環境狀態包含子球及母球的位置,而在撞球遊戲中可以選擇要用多少力氣將母球擊向子球、球檯或某一位置,因此具有多種擊球的可能。 In steps S410 and S420, an environmental state is acquired, and then a plurality of input parameters are determined. In one embodiment, the environmental state includes the position of the sub-ball and the cue ball, and in the pool game, it is possible to select how much force to use to hit the cue ball, the table or a certain position, and thus has the possibility of multiple hitting.
於步驟S430中,將環境狀態及輸入參數依序應用至前述的落點預測方法200,得到受控物件之複數個停止位置,停止位置分別對應至輸入參數的其中之一。請一併參考第5A圖及第5B圖。第5A圖係根據本案之一些實施例所繪示之撞球遊戲的示意圖,第5B圖係根據本案之一些實施例所繪示之撞球遊戲的示意圖。如第5A圖所示,在此實施例 中,母球520有3個擊球選擇分別是可以撞擊子球530a、530b及530c,利用落點預測方法200計算母球520撞擊子球530a、530b及530c後的位置,因此會計算出3個不同的母球落點位置。 In step S430, the environmental state and the input parameters are sequentially applied to the foregoing landing point prediction method 200, and a plurality of stop positions of the controlled object are obtained, and the stop positions respectively correspond to one of the input parameters. Please refer to Figure 5A and Figure 5B together. FIG. 5A is a schematic diagram of a billiard game according to some embodiments of the present invention, and FIG. 5B is a schematic diagram of a billiard game according to some embodiments of the present invention. As shown in Figure 5A, in this embodiment In the middle, the cue ball 520 has three hitting options, respectively, which can impact the sub-balls 530a, 530b, and 530c, and the position of the cue ball 520 after hitting the sub-balls 530a, 530b, and 530c is calculated by the drop prediction method 200, so three calculations are calculated. Different cue ball placement locations.
承上述,於步驟S440及步驟S450中,估算停止位置各自之價值,以及根據估算之停止位置各自之價值,由輸入參數中決定最佳輸入參數。於第5A圖及第5B圖的實施例中,母球520撞擊子球530a,使得子球530a進洞後,如果母球520停在原地即可接著撞擊子球530b。而如果母球520先撞擊子球530b或子球530c,由於母球520子球530b及530c的距離較遠,而使得控制母球520停止位置的準確度不好,導致母球520最後的停止位置不佳而無法接著打下一顆球,因此可以利用母球520與子球530a、530b及530c之間的距離,當作選擇擊球的標準,當然本發明不以此為限,也可利用撞球的遊戲規則一併當作判斷標準。因此球桿510最後移動到要打擊子球530a的位置撞擊母球520,可以使得母球520撞擊子球530a後,讓子球530a入袋並使得母球520停在原地可以繼續打子球530b。 In the above, in steps S440 and S450, the respective values of the stop positions are estimated, and the optimal input parameters are determined from the input parameters based on the respective values of the estimated stop positions. In the embodiment of FIGS. 5A and 5B, the cue ball 520 strikes the sub-ball 530a such that after the sub-ball 530a enters the hole, the cue ball 530b can be subsequently struck if the cue ball 520 is parked in place. If the cue ball 520 first hits the sub-ball 530b or the sub-ball 530c, since the distance between the cue ball 520 balls 530b and 530c is far, the accuracy of controlling the stop position of the cue ball 520 is not good, resulting in the final stop of the cue ball 520. The position is not good enough to play a ball, so the distance between the cue ball 520 and the sub-balls 530a, 530b and 530c can be used as the standard for selecting the ball. Of course, the invention is not limited thereto. The rules of the game of pool are used as a criterion. Therefore, the club 510 finally moves to the position where the ball 530a is to be hit, and the ball 520 can be caused to hit the ball 530a, and the ball 530a is put into the bag and the ball 520 is stopped in place to continue the ball 530b. .
由上述本案之實施方式可知,主要係改進以往人工智慧因運算龐大而導致計算時間過長的問題,利用將遊戲中母球及子球的物理滾動行為,分成多個可估算的小行為,再將多個小型為個別訓練成為訓練模型,使得預測母球及子球的物理滾動行為可以更準確,達到即時回饋的功效。 It can be seen from the above-mentioned embodiments of the present invention that the problem of excessive computational time caused by the huge computational complexity of the prior art is improved, and the physical scrolling behavior of the mother ball and the sub-ball in the game is divided into a plurality of small behaviors that can be estimated, and then A plurality of small-sized individual trainings are used as training models, so that the physical rolling behavior of the predicted cue ball and the sub-ball can be more accurate and achieve the effect of instant feedback.
另外,上述例示包含依序的示範步驟,但該些 步驟不必依所顯示的順序被執行。以不同順序執行該些步驟皆在本揭示內容的考量範圍內。在本揭示內容之實施例的精神與範圍內,可視情況增加、取代、變更順序及/或省略該些步驟。 In addition, the above examples include sequential steps, but these The steps need not be performed in the order shown. Performing these steps in a different order is within the scope of the present disclosure. Such steps may be added, substituted, altered, and/or omitted as appropriate within the spirit and scope of the embodiments of the present disclosure.
雖然本案已以實施方式揭示如上,然其並非用以限定本案,任何熟習此技藝者,在不脫離本案之精神和範圍內,當可作各種之更動與潤飾,因此本案之保護範圍當視後附之申請專利範圍所界定者為準。 Although the present invention has been disclosed in the above embodiments, it is not intended to limit the present invention. Anyone skilled in the art can make various changes and refinements without departing from the spirit and scope of the present case. The scope defined in the patent application is subject to change.
Claims (11)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
TW107114925A TWI668043B (en) | 2018-05-02 | 2018-05-02 | Method and system for predicting an object location, and game decision method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
TW107114925A TWI668043B (en) | 2018-05-02 | 2018-05-02 | Method and system for predicting an object location, and game decision method |
Publications (2)
Publication Number | Publication Date |
---|---|
TWI668043B true TWI668043B (en) | 2019-08-11 |
TW201946682A TW201946682A (en) | 2019-12-16 |
Family
ID=68316208
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
TW107114925A TWI668043B (en) | 2018-05-02 | 2018-05-02 | Method and system for predicting an object location, and game decision method |
Country Status (1)
Country | Link |
---|---|
TW (1) | TWI668043B (en) |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
TW201122882A (en) * | 2009-12-31 | 2011-07-01 | Ind Tech Res Inst | Collision simulating method of three dimensional object |
CN104376154A (en) * | 2014-10-31 | 2015-02-25 | 中国科学院苏州生物医学工程技术研究所 | Rigid-body collision track prediction display unit |
TW201812267A (en) * | 2016-07-14 | 2018-04-01 | 美商Esb研究公司 | Apparatuses and methods for detecting deviation of a ball from a path |
-
2018
- 2018-05-02 TW TW107114925A patent/TWI668043B/en active
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
TW201122882A (en) * | 2009-12-31 | 2011-07-01 | Ind Tech Res Inst | Collision simulating method of three dimensional object |
CN104376154A (en) * | 2014-10-31 | 2015-02-25 | 中国科学院苏州生物医学工程技术研究所 | Rigid-body collision track prediction display unit |
TW201812267A (en) * | 2016-07-14 | 2018-04-01 | 美商Esb研究公司 | Apparatuses and methods for detecting deviation of a ball from a path |
Also Published As
Publication number | Publication date |
---|---|
TW201946682A (en) | 2019-12-16 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
JP6981719B2 (en) | Virtual tennis simulation system, sensing device and sensing method used for this | |
US11439903B2 (en) | Information processing system, storage medium storing information processing program, information processing apparatus, and information processing method | |
US20120289296A1 (en) | Method and apparatus for video game simulations using motion capture | |
CN109045688B (en) | Game interaction method and device, electronic equipment and storage medium | |
US8777746B2 (en) | Gestures to encapsulate intent | |
TWI600456B (en) | Battle-type game control methods and programs | |
CN109529317B (en) | Game interaction method and device and mobile terminal | |
US20110098114A1 (en) | Behavior control data generation system, generation method for behavior control data, information processing device, control method for an information processing device, and information storage medium | |
KR102342219B1 (en) | System and method for evaluation and improvement of golf ability | |
KR20130068613A (en) | Method of collision simulation for spinning ball | |
KR101346211B1 (en) | Cyber-physical game | |
CN105709417B (en) | Intelligent fighting Role Dilemma system and method in billiard game | |
CN113509726B (en) | Interaction model training method, device, computer equipment and storage medium | |
TWI668043B (en) | Method and system for predicting an object location, and game decision method | |
RU2638518C1 (en) | System and method for simulating game elements behaviour during remote game | |
TWI723801B (en) | Game device, game system, recording media and control method | |
US20230191221A1 (en) | Interactive soccer system | |
KR20210047169A (en) | System and method for automatically recognizing virtual ball sports information | |
US10258851B2 (en) | System and method for calculating projected impact generated by sports implements and gaming equipment | |
JP4974559B2 (en) | GAME DEVICE, GAME PROGRAM, AND COMPUTER-READABLE RECORDING MEDIUM | |
CN110433494A (en) | Drop point prediction technique, drop point forecasting system and gaming decision method | |
CN115843273A (en) | Virtual golf simulation device and virtual golf simulation method | |
KR102025394B1 (en) | Method for simulating a screen baseball using modified status information based on user's gesture | |
TW201718061A (en) | Game system, control method and program | |
Nierhoff et al. | Strategic play for a pool-playing robot |