PROCEDURAL COURSE GENERATION
When we set out to create a golf game we knew that we didn’t want to go the standard route of shipping a set number of courses that would potentially be based on real-world golf courses. We knew that it would involve licensing, a lot of art manpower and didn’t offer anything new to players. So we very quickly arrived at the idea of a course generator – one that was able to generate an infinite amount of playable content but without requiring a large overhead from users.
Golf games have had course editors in the past and they’ve usually consisted of complex editing tools that required a large number of man hours in order to create any content. We knew we needed a toolset that would be accessible to any user – but that retained the expressive ability for users to create anything they could imagine. That’s where we turned to procedural content generation.
Golf courses have a particular structure to them and a set of rules that makes them well suited to procedural generation. You have a well defined set of parameters that they must fall within if you are going to achieve something playable.
Establishing the Rules
We developed a rule-based algorithm that uses both user parameters and programmed constraints to achieve playable and life-like courses every time. The first step is to generate the scorecard based on user preferences. The algorithm takes into account the desired number of holes, par 3s and par 5s and will try to balance the scorecard by evenly distributing the par values across the course, and ensuring there are not back-to-back par 3s or par 5s.
Once the scorecard has been created it begins arranging the holes into a realistic course design. The clubhouse is placed in the middle and holes are placed on a ring surrounding the clubhouse. In order to ensure realistic course layouts, it makes changes like:
– The tee of hole 1 and green of hole 18 must be close to the clubhouse
– On 18 hole courses the green of hole 9, tee of hole 10 will also be close to the clubhouse
– Bodies of water on the terrain will repel tees and greens
Rather than a series of disconnected holes, the algorithm generates a complete course where all holes are part of the same landscape. When users play holes they can see other greens and fairways (and even other golfers playing live!) as they make their way through a round. This has the added benefit of having zero loading times between holes because the entire course is a single environment.
Underlying the course layout is the terrain on which the course is placed. We generate this terrain using a noise function in order to generate realistic terrain. There are layers of additional data that outline soil depth and light level in order to realistically generate the vegetation around the course.
For instance, more trees will grow where the soil is deep, but this will cause the light level to drop and grass won’t grow so you will see a forest floor texture. When the soil isn’t deep enough, the light level is high and so you get fields with flowers mixed in. If the terrain is very steep but with a low soil depth, then nothing will grow and you will see rocks and cliffs.
In terms of light the game has a sophisticated model of atmospheric scattering in place that not only means you get extremely realistic lighting and shadows – but it creates dramatic atmosphere on the courses without requiring a manual lighting pass by an artist. This is an important factor in why the courses in The Golf Club look as good as hand-made courses even though they are all procedurally generated.
Taking advantage of compute shaders on modern GPUs and next-generation consoles, we can not only generate extremely realistic light scattering, but also use this to generate dynamic realtime clouds. Rather than being billboards, the clouds in The Golf Club have dynamic density based on wind and then also cast realistic shadows based on their position relative to the sun.
Infinitely Editable and Sharable
One of the biggest advantages of our course generation and editing system is that we only store the “DNA” of the course, rather than a fully-rendered model of the course. This means that it is a relatively small amount of data that can be easily shared with friends and makes cross-platform course sharing a reality.
You can also change entire terrain themes after you’ve already created and edited a course. Because the game stores only the course’s “DNA”, you can change from an Alpine to a Desert theme and still retain all of your edits.
In terms of editing, users can edit almost any aspect of the auto-generated course: you can move holes, change waypoints within a hole, sculpt terrain, place objects and accessories, place hazards, sculpt and resize them, change time of day, and much, much more. The goal is to have a toolset that is not only accessible but expressive enough to create anything a user can imagine.
Playability is the Priority
Ultimately, while we wanted the course generation process to be simple and the results to be stunning, we wanted the courses to be playable. One of the biggest advantages of our course generation algorithm is that within a few clicks, you can be playing a brand new course that nobody has ever seen – and have it feel unique, fun, and competitive.