Jump to content
  • Advertisement
Sign in to follow this  
gamerking

predicting the future

This topic is 4815 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, how do i create an ai that not only learns but predicts your next move off prievious information. eg. it predicts your going to throw a head punch so it preforms a head block?

Share this post


Link to post
Share on other sites
Advertisement
There are possibly many ways to do this, but one idea may be to train a neural network which receives as input the last move made by the player, and outputs the next move. Initially its prediction would probably be completely incorrect, but if the player plays in a very pattern based manner (i.e. always doing a low kick after a head punch), then as the neural network is trained while playing the player it should become more accurate. The prediction from the neural network could then be used by the ai to decide how to react.

To cope with more complex patterns, the input could be expanded to include, for example, the last three moves.

Share this post


Link to post
Share on other sites
If you are doing AI for a first person shooter, and are using nodes. Just set up weights for each node. If you go there a lot, it adds some points to the location on the tree. Soon when you are searching your network for where you might be for an easy kill, the weighted area should pop right to the top of the list to get to.

Share this post


Link to post
Share on other sites
That's an overly complicated solution for a simple problem.

Typically speaking, the easiest way to predict an action in an agent is to compute the statistics of combinations of its actions and make a decision based on that.

Let's assume that the agent you are studying has only 4 actions (a,b,c,d) it can choose from and it can execute only 1 of these at a time. Then, you might expect to see action sequences like: abaadcdabbabcbdbdd...

Now, I just typed that out (pseudo)randomly. Consider all of the sequential pairs of actions: ab,ba,aa,ad,dc,cd,da,ab,bb,ba,ab,bc,cb,bd,db,bd,dd and count up how many times each one occurs. You'll not that some of those don't occur in the sequence at all (ac,ca,cc) while 'ab' occurs 3 times. If the selection method of actions were uniform, you'd expect them all to occur an equal number of times in a long sequence.
So, lets say that the next move is an 'a' (so the sequence ends bdda). What is the most likely next move? Well, consider the possible next moves (a,b,c,d) and the frequency of the pairs 'aa','ab','ac' and 'ad' in the previous string. They were (1/17,3/17,0/17,1/17). (There were 17 pairs in the list above). Which is more likely to occur? Clearly the pair 'ab'. It's 3 times more likely than 'aa' or 'ad' and we've never seen an 'ac'. Hence, your best prediction is that the next action will be 'c'.


Now, there are limitations to this method and to many other method based on observation.
(1) As the size of the state space grows (in the above example, the number of moves), then the number of observations required (the length of the string above) to formulate reasonable estimates of the frequencies of substrings grows.
(2) In your example, you have an agent that must react. Early in the observation sequence it has insufficient information on which to act, so it must choose its actions based on a different method.
(3) Innovation on the part of the agent being observed will cause this method to fail as an accurate predicter (and indeed is a general strategy in combat: lure them into a particular belief about your behaviour and then act not in accordance with this belief).

There are other limitations specific to how you implement your prediction method. All such methods though, be they counting frequencies or using an ANN, fall into the same problem class, which involves first clustering sequences of actions and then working out the relative likelihood of any substring of actions belonging to any given cluster. Decision making then unfolds given this posterior likelihood.

My advice: keep it simple to start with. Get some basic and simple going. Then consider improving it, using your simple method as your benchmark.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!