1
\$\begingroup\$

I am making a fighting game AI that can predict the player's next move using a N gram predictor. Once I have the prediction, when do I use it ? Do I wait till player makes a move and then use the prediction ? What about distance from the player ? How do I make the use of my prediction look realistic ?

\$\endgroup\$
  • \$\begingroup\$ What is a N gram predictor? \$\endgroup\$ – Stephen Nov 14 '13 at 13:59
  • \$\begingroup\$ It is a predictor that keeps a record of the players' moves and predict their next move based on probability. Wikipedia can explain it better than I can. en.wikipedia.org/wiki/N-gram \$\endgroup\$ – kira Nov 15 '13 at 23:03
1
\$\begingroup\$

In that type of game the time frame is an important variable to consider, because the attacks/defenses must be well synchronized to be effective. I bet that is indeed one reason you've chosen to use that kind of predictor (i.e. based on continuous sequences). Even more, the decision about taking one countermeasure must be done based on the chances of the opponent taking a particular measure, and thus eventual errors (i.e. the NPC tried to block a strike that the opponent DIDN'T perform) make the result to look more realistic. Therefore, your prediction should be performed at the NPC's own agenda and in a time-based fashion (i.e. inside the game loop, whenever possible to avoid consuming too much processing power).

Just like the "moment" to take an action, the distance between NPC and opponent and the fighter's abilities are important variables. The predictor needs to consider the minimum distance in which either (NPC or opponent) can strike a punch or a special power, and the type of action taken also depend upon that. For instance, close blows usually require blocking and ranged shots can be avoided bu jumping over or counter attacking with a similar power/weapon.

In my experience, in game domains - and depending on the complexity desired, simple state machines or decision trees are useful and usually allow to achieve very good results without consuming too much computing resources.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.