Hello folks!
As promised, today I’m going to talk about the Memory component of our AI golfers!
So far, we’ve taken a look at how the behavior is controlled via State Machines; we’ve looked at how we’ll use Utility to choose the best course of action; and we’ve also taken a look at how the AI will execute Actions through a system of intentions.
But we want our AI to be smart; this means that we want the AI to be able to learn from its past mistakes in order to improve its score and rating. And we do that through memory!
Memory will be separated by holes. The AI will record the intention of the shots it took, the location of each shot, rate the outcome, and the overall performance for any given hole. Next time the AI plays the same hole, it will generate the actions as usual, but it will also compare with the previous taken in similar circumstances, and compare the utility value of that action against the outcome, and weigh it against current circumstances.
A simple example to illustrate the system is driving off the hole below:
In the image above, we have three shooting options that the AI came up with.
- The top orange option is the shot that the AI took the last time it went around the course
- The bottom orange option is the shot that the AI calculated as the best for this time around
- The purple shot is what actually happened
So in the situation above, we have an AI that remembered that the last time around this hole, it took an awesome shot through the left side of the fairway, stopping quite near the edge of the water but within awesome range of the green.
For the other options that the AI came up with, among them the bottom orange one, through the right side of the fairway, was the one that the AI felt most promising at this time.
The outcome of the left-side action was stronger than the predicted outcome for the right-side action. The AI evaluates this. It looks into its memory for the previous outcome, and compares with what it expects of the other outcomes. In this case, it is pretty clear that it is the superior action.
But, alas, just like us humans, the AI will also remember the past in a different light.
The last time it played that particular hole, it had a super drive right of the tee, exceeding its expectations and being regarded as a “star memory”, meaning it values it far higher than what it should. So memories aren’t just a 1 to 1 remembrance of the past: they also have their fair share of rose-tinted glasses. If an AI does better than it expects on a shot, its memory will also be colored by that event. Granted, this will depend on mental attributes for the AI, but it will be a likely occurrence.
And more than that, the accuracy of the memory also decays with time. Since the last time the AI played this hole was months before the current moment, the outcome will be slightly mistaken, as will the parameters the AI used to take the shot. In this case for this particular AI character, he will overestimate his strength, he will mistaken his position, and he will end up landing the ball square on the bunker trap. This will now take the place as his most recent memory of the driving stroke of this hole. He won’t immediately forget his previous memory; it’ll just have a weaker connection since the next attempt at that resulted in catastrophe.
Next time he plays around, he’ll likely try something new, or he’ll try the previous previous memory (IE: the top orange stroke) but will be more careful this time around.
The memory system will also work to help with the knowledge representation of the hole. The AI will remember each hole in a tile/type/landscape system, so that it can always compare the hole to the memory it has of the hole. So if the hole has changed, either through your own landscaping efforts or otherwise, the AI will know, will disregard the memories of past strokes a bit more, and will focus on trying something new.
This should end with an AI that is always trying to familiarize itself with your course, and has past performance to base future performances off of. It’ll also help in making the AI decide its feelings towards a particular hole (phrasing!), so that it can react to the changes you make to your course.
So I hope you enjoyed this overview! It’s very high level, but it should give you some clarity as to how the AI will work. Now we have the 4 main systems sketched out, I can continue implementing them. Will be done with the new terrain this weekend, then I can focus on finishing the first pass of the AI. For this month, the goal is to have AI golfers playing with your holes (phrasing!) so that I can test out some basics of the systems.
That’s all for now, folks! Stay tuned for more!