Dev Update #1.1: A* Update

Dev Update #1.1: A* Update

So one last update before calling it a day, just improved the A* pathfinding to take into account undesirable tiles while tracing the basic shot from the Tee, and to sample in all 8 neighbours instead of just the regular four. You can see it in action below:

codemagic

  • The solid white line represents the direct distance to the hole
  • The blue tiles are the tiles selected by the A* algorithm as the best candidates for strokes
  • The dashed line is the combination of strokes creating the basic shot of this course

The distance to hole also changes based on the strokes created by the basic shot, and of course so does the Par rating. At 282m, this is a rather short Par 4 that can decently be accomplished in 3.

Next step is to make the algorithm take into account if there’s any fairways between the tee and the hole, in order to create more desirable base shots.

Dev Update #1: Start State

Dev Update #1: Start State

So, to give you a basic rundown of where we are:

-The “resort” generation system works. It places the tiles on the grid according to rules, can also save/load to a text file for safekeeping.

-Just updated the base shot generation for the courses: You start making a course by placing the Tee tile, and then the Hole tile. The game will use a couple of algorithms to generate the basic shots necessary for finishing the course, taking into account the available tiles. This will work as the guideline for the hole, letting you know the par, the distance. Golfers will be able to take their own decisions.

-Currently, you can play around with landscaping and creating golf course. Just switched to a new system using separate objects for each stroke on a course, for future-proofing. Works fine for now, needs tweaks.

-Finished updating to DoozyUI; It really removes a lot of the boring work of creating UI, very good stuff.

This is what the prototype currently looks like:

currentState

On the image we can see a basic Par 4 hole. Currently the base shot generator isn’t caring about trees or other obstacles. Changing that just after this post. I am using a simple A* algorithm to find candidate tiles for the strokes, works like a charm and very fast.

That’s all for now!