Hello folks!
So far, we’ve described the state machine used for keeping track and modifying the behavior of the AI, and the utility function that is used to select what course of action the AI should take.
And now it’s time to talk about the other piece of the AI puzzle: Actions!
Put simply, these are the functions that the AI executes to perform an action in game; things like moving, idling, shooting etc. All of those actions are self contained in their own methods, take a parameter or three, and execute until the action is successful or fails.
Of special interest to Boss Golf is the shooting action. In golf, there are countless ways that you can hit your golf ball. You can add some backspin, you can give it some fade, you can try to go straight, you can go for a higher angle, you can go full force etc. Your success with that action, however, depends on myriad factors like your skill level, your confidence, your performance, the weather…
Therefore, for Boss Golf, when it comes to the shooting action, I’ll implement another subsystem that is based on intention, that is, the AI will tell the gameplay system what sort of shooting action it plans on executing, and the gameplay system will take all of the aforementioned factors and calculate the outcome for the AI. This will give more “human” results to the actions of the AI, as they would never be able to hit the same shot exactly the same way twice. There will always be deviations.
Breaking the system down:
- The AI would come up with a handful of potential shooting actions for a given situation; it would think of a route by hammering it over the pond, another route by cutting through the trees, and another route by just hitting the fairway.
- It would then parse those actions through the utility system, to see what action would be the one with the best potential reward/utility for the AI
- After it found the best course of action, it would communicate the intention to the gameplay system, telling it it wants to:
- Hit ball with club X
- Hit ball with strength Y
- Aim shot at square Z
- Add X amount of backspin
- The gameplay system would then modify these attributes based on the environmental factors surrounding the AI
- If the AI is lacking confidence, add some uncertainty to the aiming
- If the AI is behind in the championship, add some extra strength due to nerves
- If the AI doesn’t have great skill, add way more backspin than the AI intended
- If the AI has a lucky modifier, alter the shot slightly so that it lands in a slightly better position
- The action is executed, the AI hits the ball with the modified intention, and analyzes the result
Of course, this is a higher level breakdown of what is going on behind the scenes, to better illustrate to you the capability of the AI. There will be a myriad other factors that can potential add a modifier to the AI’s decision. Our friend Jumper made a very nice write-up on our discord channel, giving his take as a sports psychologist on the mind of the players and the many factors that can affect their performance on the pitch.
Now we know how to manage behavior, how to make decisions, and how to act with intention. There’s one more piece of the puzzle missing: Memory! As golfers go around the course, we want them to remember the way they tackled a hole before, so that they can try and improve on it or follow their old steps. I’ll break this feature down on my next post!
That’s it for today’s update, folks!
As an addendum, I’ve been hard at work implementing the AI, and also redoing part of the terrain system as it’s grown to be too bloated and not smart enough for the AI to work with. I’ll be done with that by the next weekend, and hopefully have some AI gameplay to show as well. Such is the nature of game development: the best ideas always come after you’ve implemented a system. This new structure will make it easy for the AI to evaluate the shots, as well as to place decorations and other structures on the course.
So stay tuned for it!