Development has become easier realizing I’ve accidentally built a procedural generation game.
Specifically in terms of how to structure an objects data.
Previously, I would muddle the data of what can be used to generate objects, and the objects that would be generated.
Now that I’ve started thinking in terms of procgen, I’ve landed on a pattern:
GeneratedFoo vs. CandidateFoo
I’ve been developing SongSections for my procedurally generated music. Intro, Chorus, Verse, etc.
I want the game to decide if the next section should be a Intro, Chorus, Verse, etc.
So I’ve started using a pattern of defining CandidateSections
, listing all possible sections.
And a GeneratedSections
for the things actually chosen at runtime:
This naming convention makes it very clear on when each object should be used: Fill the Candidates at initialization time, fill the Generated at runtime.
You can even see that codified in the commit above: InitializeSongSections()
vs GenerateSongSections()
I still find it kind of ridiculous that I’ve been working on this musical generation feature for several months and I’m just realizing it’s procedural generation. I’ve always associated it with Minecraft style terrain building.
Either way, the realization of what I’m doing has made developing the code for this feature easier.
And gives me a deep field to do research on the best approaches… Even if the best approach is to just keep coming back every day and writing a bit more code.