Finally I had my first failure in Game A Week! This time I bit off more than I could chew, but I learned a lot nevertheless. I tried my hands at some advanced Object Pooling patterns and I had to wrestle both with the design and the coding of a Procedural Generation system. Turns out that those two topics are a bit too much to explore all in one week, not to mention that I also had to fit in a coherent gameplay for the platforming.
However, I’m still happy I had the chance to face something this complex and I’ll definitely explore procedural generation in the future.
The game is pretty easy: press Space to jump and go as far as you can. I tried to build some interesting patterns for the generation of the platforms but it was a topic too big for the little time I had.
The game was in such a state that I didn’t even bother to put the score in.
Design & Development
I wanted to take it easy this week. I thought an infinite runner would be a walk in the park so I started on Day 3. first thing I wanted to make the advanced Object Pooling I couldn’t make the week before, just to spice it up a little. It took me until Day 5 to make platforms spawn through the pooling system and then I realized that it was boring. Yes, because platforms would spawn with a random distance to each other, and that didn’t create any kind interesting gameplay. So I went to research procedural generation until I found this video. In the video a guy explains the process and the research for the procedural generation behind his (published) infinite runner 2D. At this point I finally had some clear ideas on how to implement the procedural generation but, despite my efforts, there was too little time for making something good of it.
Advanced Object Pooling
I talked about learning object pooling already last week, but I also said that last week’s system was a bit too simple and didn’t allow for much flexibility and in general wasn’t good for anything else than spawning objects. This time I went with a more advanced object pooling pattern that I encountered when I was messing with the 2DGameKit from Unity. This system uses two virtual classes ObjectPool and PoolObject, these classes are then used as parents for any kind of pooler or object you might need. The key thing is that you don’t need to communicate with the object you spawn because the PoolObject class takes all the reference and data you might need from it. Basically you can code using PoolObject as the object itself.
This system worked great and I’m definitely going to use it again in the future but for this week I spent too much time changing it to suit my purposes, and that left me with little time for the procedural generation.
Once I took care of object pooling I started by generating simple platforms with a more or less random distance, but again, it was boring. My next try would be with sectors. I would design some prefabs to be spawned at runtime in a random order. Each prefab would have an end transform and a start transform, to chained them together when spawned. These sectors I designed were again very simple: a ramp, some stairs, small platforms in succession, things of this kind. Turns out this was still boring.
The thing is that these sectors needed to be much more complex than I thought. They needed to be 15-20 seconds of gameplay each to make for a good flowing experience. Not only that but some sectors can’t spawn one after each other unless it’s on purpose, meaning that I needed some way of codifying what sector would spawn next based on what was last spawned. And I didn’t even take into account how all this changes the character mechanics.
These and other problems led me to throw in the towel: the challenge of making procedural generation is definitely an interesting topic that I would have happily tackled but 7 days are probably not enough to start from scratch, let alone 2.