For today’s update to Boss Golf, I wanna talk about clubs!
So I’ve implemented a system that now makes use of proper golf clubs when playing the game. Until now, the AI had access to “infinite” clubs; it would decide how to shoot based on the maximum distance it could achieve, and how close it was to the hole. Based on this, and information regarding maximum/minimum angles/distances for each club type, a trajectory would be generated and that would be that.
This meant that even if the AI was in a bunker, it could still use an Iron to drive out of it in massive distances.
That’s not very likely in real life!
So I finally went ahead and implemented clubs. Now we have clubs divided into basic categories, representing the main club types (wood, iron, hybrid, putter, wedge), all further categorized into their respective numbers and/or types (1 Iron, 2 Wood, Sand Wedge etc).
Each club also has a difficulty rating (cause lord knows not even god himself can hit a 1 Iron!), which will be factored into the decision making process.
Further, each AI will have a limited number of clubs in their little AI golf bag. No more infinity clubs; they’ll have their 14 clubs and that’s that. Makers will be implemented later, giving slight deviation to angles and maximum ranges, adding even more variation to an AI’s arsenal (and other income avenues for your club with a pro shop!).
For now, these are being generated semi-randomly at the start of the game. Later on, when the AI generation becomes based on the database, these will be recorded and AI will routinely change their arsenal.
Now I’m onto implementing these new clubs into the shooting decision making. I’ve created a new “GolferBrain” class, which will be used by the AI to determine their “best” option for their current shot. Basically, it’ll generate a handful of potential shots, grade their likelihood of success, difficulty, payoff, and use the golfer’s confidence to decide on which one to take. And then shoot it! And hope for the best! And watch as their perfectly thought out strike lands in the bunker, or the fire hazard!
After this is implemented for the AI, I’ll roll it out to the Player as well. You’ll also start with a right now randomized bag of clubs, and later on you’ll be able to change your collection to better suit your playstyle.
That’s all for now folks! Stay tuned for more AI updates!
Today I’ll expand upon the basic system driving the golfer’s state in Boss Golf!
It is very common for tycoon type games to have a sort of happiness/needs meter for the guests to your park/hospital/zoo/dinosaurland. This is one of the main aspects of gameplay in those games, and you as the tycoon have the sole objective to fulfill their needs while extracting the money out of them.
But in most of the games, guests are reactive actors. They go on rides, get their share of adrenaline, eat some food, drink some drink, spend some money, and go home. Most of their actions are reacting to their needs at any given point.
With Boss Golf, that wouldn’t work as well: we also have to factor in the activity of playing golf, the main driver of the AI’s state in the game.
Therefore, for Boss Golf, I’m implementing a system based on 3 “meters” of sorts: Confidence, Mood, Need.
The confidence meter affects and is affected by the golf gameplay of the AI. However, instead of being a universal boon/curse, it is a double edged sword. Being too confident can lead to complacency; lacking confidence may lead to lucky breaks if your confident opponents get complacent.
In terms of affecting the gameplay, it works basically like this:
Higher confidence means attempting more difficult/risky shots if the AI thinks the payout is worth it
Higher confidence can also mean going on autopilot since the adversaries aren’t playing as great as the AI, so they think they can relax
Lower confidence means playing more safe/easy shots
Lower confidence can also lead to more consistency over the holes, as safe shots tend to land better than risky shots
In terms of being affected by gameplay, it works roughly like this:
Landing a good stroke, with little deviation, will increase your confidence
Landing in a lucky position will increase your confidence
Slicing/Hooking your shot will decrease your confidence
Landing in the wrong place will decrease your confidence
Other “passive” factors can also affect confidence, such as rivals playing badly/godly, external life events, divine inspiration…
And the increase/reduction isn’t on a simple scale. There are diminishing returns for increasing confidence depending on your current confidence level; there are also increasing returns for decreasing confidence depending on your current confidence level. Overconfidence and hit the bunker on an easy shot? Your confidence will shoot down. Unsure and hit a successful shot? Your confidence will increase well, as you played exactly the way you wanted. If it was a lucky shot, your confidence could remain the same or even diminish, as you wouldn’t believe it would happen again.
Mood is the overall happiness of the golfer as he’s visiting your course and playing the golf.
It can be affected by quality of play, by the environment, by special events, and mainly by the fulfillment of the golfer’s needs.
In Boss Golf, however, each golfer’s mood over the day is like a tiny “Hero’s Journey“. It isn’t important just to have a “good” experience on the course: golfers want a meaningful experience. And they each have their own idea of what their meaningful experience is, affected by their own personality traits and whatnot.
Basically, over the course of the day, each golfer has their mood map built. This is done by taking snapshots of the golfer’s mood every ingame half hour or so, and whenever a special event happens. This little mood map is available for the player to look at on the character’s panel in the form of a nifty graph. This graph will also show the “ideal” values that this golfer has for his meaningful experience.
So at the end of the day, the golfer mood map is compared to his threshold for a meaningful experience, and a rating is assigned to it, ranging from F to S. (S being Super Meaningful) (This is a good thing). Good ratings means satisfied golfers; satisfied golfers mean $$$!
This microgameloop will revolve around hitting as many of those beats as possible for the highest number of golfers. The more meaningful experiences your golfers have, the more likely they are to become members, make donations, spread the popularity of your course. Of course, you can’t please them all, so you’ll have to be careful when you build your golf course experience.
Needs are the most basic and simplest feature to explain. These are the basic requirements that the golfer has to be an actual functioning boss person walking around your golf course. It is divided into 5 categories:
Social: contact with other golfers, with your character, with staff.
Food: golf is a sport, and practicing sports requires energy, and food gives you that. Can also poison you, though!
Drink: keeping hydrated is important, and the proper drink can give you an edge. Or take the edge off.
Energy: golfers are people too! And energy is required for performing actions. If your golf course is large, you’ll want to have carts available to help save some energy. If your golf course is small, you may want other activities so that the golfers can expend their energy.
Environment: no golfer likes a dirty, ugly, unsightly golf course. They want beautiful vistas, peaceful views, and consistency. You’ll need to wear your boss landscaper hat to fulfill their dreams.
Satisfied needs will increase the golfer’s mood. Unsatisfied needs will decrease your golfer’s mood. Other events can also happen depending on the level of each need’s fulfillment. You may end up with drunk golfers falling all over the course, passed out golfers, golfers who are depressed because they feel alone in your course…
And that’s about it for now. I’ve begun implementing this system this week, so this will be featured in 0.5, and your boss golfers will become more human. Or simmish. Each mood, need, confidence, will have an impact on the golfer’s thoughts, and you’ll have a direct window to each golfer’s mind. Kind of like Being John Malkovich.
Who knows, maybe I’ll even implement a feature that puts you inside the golfer’s mind, seeing things from their point of view!
Today I’ll be talking about another part of the AI of Boss Golf: Utility
Simply put, Utility is a value that determines how useful an action is for the AI to take at a specific moment in time. For example:
Take an enemy AI that has a health value and an ammo value. And it has only three possible actions:
At the start of a conflict with a player, if the AI is at full health and full ammo, then the utility value of the first two action is pretty much zero: Shooting would be a much more useful action in that specific moment.
As the AI engages in combat with player, things get more murky. If the ammo is approaching zero, then the utility of the reload action increases; the act of reloading becomes more important than shooting as you need bullets in order to shoot. At the same time, as the health of the AI decreases, the utility factor of the use healthpack action increases, as the AI needs health otherwise it will die.
The way this calculation is done depends a lot on the factors and data that the AI has access to. If it knows that the player is at low health, then reloading first instead of healing might be a better option. If it’s a particularly coward enemy, it will give priority to heal itself instead.
And this is just with three possible actions; add in more actions, such as running, finding cover, dodging etc, and you get much more variety of behavior.
The same thing will happen in Boss Golf, specifically when it comes to deciding the type of shot to take along a hole. Let’s use a sample hole to illustrate how it would work:
In the Par 3 above, hitting the green from the start seems like a solid choice. The hole is well within the 150 yard range, which is achievable by most golfers that take to the course. But even pros make mistake; and there’s a couple of factors that can affect the success of a stroke:
Performance so far
Wind can drastically affect a stroke, making your ball go lower than expected, slower than expected, veer laterally.
Confidence can affect the quality of your stroke. Lower confidence can lead to slice/hook, lack of power, reduce your accuracy, among other things.
Performance so far. If the golfer has been having a great day, he’ll be more likely to take risks; If he’s playing his ultimate best, he might be more risk-averse in order to keep his good handicap; if he’s having a bad day, he’ll take even less chances in order to try and recover.
All of those attributes (and more) would affect the calculation for utility of the shot. For Boss Golf, the golfers would always calculate a specific number of shot (based on their attributes), calculate the utility for them, and make the choice.
Below I’ve simulated some potential shots and their results, to give you an idea of what could happen:
Some golfers would try and keep to the straight brown shot, getting very close to the hole. Others might go the blue route since they’re lacking the confidence they’d be able to hit the ball across the lake in one go. Some might overshoot it into the green following the pink line because they believe they needed more power. The guy in the green line may have messed up his first shot due to lack of confidence. And the poor fella on the white line just sent it straight into the water hazard.
After taking the shot, the result would also affect his current attributes, affecting his next shooting decisions as a result. So if the shot landed where the golfer wanted or better, his confidence will increase, so he’ll be more prone to taking a risky shot next; by the same token, if the shot ended up going badly, his confidence could decrease, leading him to be more risk averse on his next shot.
And that’s about it. Now we know how the AI will be controlled (via State Machines) and we know how he’ll decide which action to take (via Utility).
But we’re still missing one key piece of the puzzle: the Actions themselves.
Boss Golf features an action system that limits the possibility/quality of actions by the attributes/ability of the golfer. A pro-level AI golfer will have more tools (read: shots) at his disposal than a first-timer out in the tee. He’ll know when to pull, when to push, when to chip, when to approach, and be able to use these actions when out in the green, whereas a first-timer will be limited to less imaginative and simpler shots. As they grow in skill, they’ll be able to add more shots to their arsenal.
All of that will have to be factored in by the player when designing the course. If it’s catered mainly to beginners, it makes little sense to have very difficult courses; if it’s catered to professionals, it would make little sense to have too many easy holes. This balance will be vital in the development of your golf course.
I’ll make a write-up about the actions on my next post this week. Writing about the systems like this has been very helpful in aiding me with visualizing how the system works and building it!
So expect AI integration by the end of this month, bringing life to your course!