It’s finally here! Alpha has now been updated to 0.3, allowing you to do the following:
Have a wall surrounding your resort to keep out “undesirables”
A Clubhouse has been placed, from where AI golfers will now spawn
AI golfers will either roam around or attempt to play any hole that is open
They will accordingly queue by the Tee waiting patiently by their turn
And so will you! You can also play as the AI is playing the course, taking your turn on the queue!
A handful of other under the hood improvements
Saving and loading! No more starting from scratch every time you load the game!
That’s it for this version. Now you’ll have a more workable experience and you can see how the AI tackles your golf course. I may release a tweak later on to modify the AI a bit, like a 0.31 or 0.3.1 or 0.3a, not sure yet. But this should give you some ideas about how the AI will react.
A word of warning: If you do attempt to edit the course as the AI is playing, you may make their ball disappear! If that happens, just relaunch the game. Will work on a fix for this later.
Ditto for if the AI falls through the ground. Haven’t improved the dynamic collider yet, so depending on your machine performance, hijinx might ensue.
A golfer waiting, another stepping up to the tee, and a third making his way to the other hole!
Now on to 0.4! The details of which I’ll be sharing later this upcoming week! But for a sneak peak, think Time Management!
That’s all for now folks, please enjoy.
If you haven’t signed up for the Alpha, you can do so here!
After integrating the basic state machine for the AI, I’ve also added a function that allows it to take a very simple shot (basically, aim at the hole, hit as hard as it can inside the distance to hole) and, as a result, the AI in Boss Golf can now play golf!
For the test scene, I’ve built a course with 4 holes:
The holes are all connected by their tee at the center. Spaced them out this way to remove other potential interference. I also added two golfers: Liger Forest, and Ryu.
The holes now have an option to open or close them. Opening them tells the AI they can be used for play. The AI will then queue up for their turn at the hole, and play it when the player in front of them has finished. And it all works!
For debugging, you’ll see a yellow line which marks the path that the AI wants to take, and a purple line which marks the direction of the stroke.
Here you can see the Liger taking a basic strike:
And at another hole, Liger teeing off:
And here you can see both golfers playing on separate holes:
It’s in. Now there’s some work to be done on smoothing out movement and fixing some collision problems. But the basic skeleton of the system is there. Once I add saving/loading, I’ll update alpha to 0.3!
Today’s update for Boss Golf is about pathfinding. Well, part of it.
I’ve added a new tile type, Path, that allows you to build more scenic routes through your golf course, that the AI will use when deciding how to go from point A to point B. You can see the tile in the course below:
Next step is to add this to the pathfinding system, so that the AI actually prefers to use it. Should be done with that this week.
Under the hood I’ve also done some other improvements:
Created a vertex bank so that editing it is quicker, there’s no more issues of double vertexes, and is it far easier to save/load.
Changed the height system to one using an integer to decide the HeightStep of the vertex, and set a height modifier that I can change easily for tweaking that decides how much in Y each HeightStep is worth
Removed the current component for the decoration objects, which was causing some overheard when there were thousands of decoration objects on the scene. Instead, added a simpler class that pretty much works as a struct to keep information, and modified the way that the randomization of size/rotation/position is done to use integers so that I can more easily save/load the details of the decoration
Began reformatting a couple of things so that I can actually save and load the stuff that is being built
As such, the goal for Alpha 0.3 is:
Save and Load capabilities
Pathfinding system for the AI
Golf gameplay for the AI
Meaning that Alpha 0.3 will be quite a vertical slice! You’ll be able to build your course, play it, and watch the AI go around trying to score something good. The game is coming along well!
I’m getting my winter break soon as well, so expect a major rush of progress this coming week!
I’ve updated the Boss Golf closed alpha to version 0.2.
This version features golf gameplay, including the player character, basic idling AI that roams around your course, and a number of other small fixes.
Those of you who signed up for the closed alpha should get an email soon with more download information. Otherwise, just hit up itch.io and the build should be there.
Those of you who haven’t signed up for a club membership, you may apply for the closed alpha here!
We’re not at capacity yet for the closed alpha, but the spots will run out soon! So get that sign up going!
That’s all for today folks. For alpha 0.3, I’m aiming at basic play AI, better ground collision, basic pathfinding/avoidance, as well as paths that you can build to link your holes. As a stretch goal, basic save/load capabilities.
That’s all for now folks! It’s a beautiful weather out today. Get to that green!
Billy Golf is now back in action! The character will now once again move to the ball, prepare himself, and take the shot. I’ve added a handful of new states to the state machine, to delegate the golf gameplay to the golfer. Now you will prepare the shot, and the little dude will move to the ball and execute it. Look at him go!
Funnily, the first couple of times he approached the ball too close, and the ball ended up colliding with himself on the way to the hole haha. But that’s been fixed. For now. Can easily be unfixed too, perhaps for some easter eggs, such as an extremely clumsy golfer.
And some of the more eagle eyed among you may have noticed a couple of other characters hanging around the golf course. I’ve added a handful of AI golfers to make things seem more lively, and will be hooking them up to the state machine this week. Hopefully this weekend I’ll get alpha 0.2 done, so that you can play the game with better golf gameplay, and see little AI people milling about your course. Hopefully also can get some walls in to separate your owned land from the rest of the land too.
I’ve finished coding the improved terrain system and the actions. Now all that’s left is connecting it to the UI!
But first, I’ll give you a preview of what’s coming. First, you have the good old drag to place the decoration:
Select the tree type, drag the tiles and the trees will be placed. Each tile can support up to 4 decoration pieces. Adding anything after that will result in the decorations simply being shuffled around.
If you want to fix it up, I’ve added a trimming tool that currently removes the last placed decoration object from the tile:
Later, I’ll make it so it actually aims at the decoration object you’re aiming at and removes that.
Then, for elevating the terrain, I’ve reworked the previous options to use the vertex directly. For altering the elevation directly, you can either click and drag (for fine-tuning), or simply click and hold (for painting). For each of them, you can choose between 1 vertexes, 4 vertexes (a tile), or 16 vertexes (the tile and the neighbours) as below:
And for painting:
And finally flattening:
As you may have noticed, the decorations nicely go up and down as the elevation is changed. This is part of the update to the decoration system, which makes it work much better than before.
So that’s what I’ve been working on this week! I’ll finish hooking it all up to the UI tomorrow, and perhaps release an updated version of the demo so you can try it out. And then go back to the AI implementation!
(Ah! Forgot to add: I’ll be turning off the water tile for now as it’ll need a deeper reworking. I’ll just replace it with a regular blue tile so that you can still plan on how the water would feel.)
Quick update on the implementation of the new terrain for Boss Golf!
Look at this:
That, my friends, is a massive terrain composed of a 20×20 grid of chunks, each chunk containing 16×16 tiles. That’s roughly 102400 tiles. All much more easily manageable, and with better performance than before. Now I can actually make the terrain surrounding the golf courses so that you no longer can peek at the end of the world!
As explained before, this new system relies more on preprocessing the grid data, so that alterations to vertices and UVs are much more quickly resolved than before. No more loops inside loops inside loops!
Just finished implementing the UV mapping to it, as well as the mapping of surrounding tiles and vertices. No seams when you move vertices between chunks. Already have some plans for new terrain tools too, to give you more possibilities when editing your golf resort course!
Next up is connecting it to the existing controls, and changing how the decoration system works so that placement is handled better and performance is improved.
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.
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:
Use Healthpack
Reload
Shoot
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:
A tricky Par 3.
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:
Wind
Confidence
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!
For today’s golf gameplay-related dev update, I’ve added automatic movement to the character, for reaching the ball and sort of positioning himself to take the shot!
It was easier than expected, thanks to some foresight of past Gus when coding the game. I simply moved the function to shoot the ball away from instantaneous execution after releasing the mouse button over the desired location, and put it in another action executed by the golfer character once it has reached the calculated point of shooting.
This calculation is a bit dirty now, as it only tries to get position slightly away from the ball and perpendicular to the direction from the ball to the desired target. For the current prototyping purposes it works.
The golfer also slightly delay the shot when he arrives in position, in order to “think” about how to hit the ball. I’ll add some animations and fluff to this step later.
You can see the execution of a hole with the new system below:
Golfer teeing off!
Chipping it in closer to the green!
Sweet chip in, Payne!
And that’s it for today’s update on golf gameplay! Still need to automate the moving to the ball more, so that the doesn’t wait for your to finish deciding on the stroke before taking position. And the shot visualizer thing is still broken, giving out NaN results depending on the slope. I’ll make a better fix for that later!
That’s all, folks! Keep on teeing! And may your strokes never slice!
(Also, starting from today, I’ll drop the numbered update from the format and put in a more relevant title off the bat. This will give you, readers, a quicker idea of what the feature is relevant to straight off the title. Categories like Golf Gameplay, Tycoon Gameplay, Management Gameplay etc will make it easier for navigation!)