Blog

Procedural game progression dependency graphs

In 2022 I came up with some new ideas for what kind of game The Big Forest (working title) could be. During the year, I developed a way to procedurally create dependency graphs and also procedurally create fully playable game levels based on the graphs.

In the video below you can see the prototype I had near the end.

A dependency graph is a concept in mathematics and computer science which has been independently "discovered" by lots of game developers because it turns out to be pretty central to designing any non-linear game.

At its simplest you can think of locks and keys. A locked door has the corresponding key as a dependency to be able to progress through the door. But dependencies can also be abilities in a Metroidvania game, quest objectives in an RPG, or required inventory items for a puzzle in a point-and-click adventure.

Here's a few different articles by others that discuss what they are. Note the lack of standardized terminology. I personally use "game progression dependency graph" since the concept is applicable to all non-linear games, not just puzzles or dungeons.

I posted about my game progression dependency graph tech on social media (Mastodon and Twitter) throughout developing it. But when people ask me about it now, it's hard to point to posts scattered across a year of social media posts.

I've copied all those posts (nearly verbatim) into this blog post so it's documented conveniently in one place. For this reason it contains not only the conclusions at a single point in time, but also the questions I asked, my confusion, and my developing understanding of the problem space over time. Each header corresponds to a new thread. Images and videos generally relate to the text above them.

Let's start the journey.

March 30 2022

I'm slowly starting to experiment with novel generated graph structures again, here with an early and rough game progression dependency tree. I'll need to merge certain locations, turning it into a directed acyclic graph, and later generate a spatial graph based on it.

I must say I find it tricky to work out data structures for this. Which concepts should be nodes and which should be edges? And with both different types of nodes and different types of edges, should those types be represented as class types (inheritance) or just with data?

I keep having to revise my thinking about which concepts are represented as nodes in the graph and which as connections...

The graph generation now creates a directed acyclic graph rather than a tree structure. It took a long time to get the layout to be nice, avoiding crossed edges when possible and minimizing wasted space.

In the replies someone mentioned Metazelda. It looked familiar so I might have seen it a long time ago. I also did basic lock+keys for my game Cavex myself back in 2007. (Cavex eventually turned into The Cluster.)

The concept I'm working on now takes place in a bit more of an open world where areas are accessible by default and only certain places locked off. The "tunnel/dungeon carving" mindset feels like it might not be as helpful in this context, but I'm still figuring things out.

April 6 2022

If I have to spend a lot of time looking at these generated game progression dependency graphs, I might as well make them nice to look at.

I revised my thinking on the nodes again and added a "location" requirement to almost all the node types. On the first try, the resulting graph had multiple new neat ways of bending the connections, without me having changed the layout function at all. Robust algorithm I guess. :)

Unfortunately it doesn't seem as robust in avoiding crossed edges anymore.

Hmmmmmmmm

First glimpse of an idea to generate a dependency graph and a spatial graph simultaneously from the same underlying data structure.

Really, no need for distant parts of the spatial graph to repel each other quite so much. This can make the graph more curvy, more interesting looking, and more compact at the same time.

April 10 2022

Left: Game progression dependency graphs.
Right: Spatial graphs that could be the basis of where things are located in the world.
A key for a locked gate is a direct dependency, but can be located far away spatially.

Some people may be reminded of articles on squidi.net about procedural generation, which discuss how you could generate an entire game using these principles. It’s a classic resource, and those articles cover a lot of ground, some of which one will inevitably hit when trying to do procedural progression (as this article on puzzle trees also states). Light on implementation details but great food for thought.

I'm going towards an approach of generating the structures by incrementally injecting new dependencies anywhere rather than a simple recursive top-down approach. And I decided to generate both graphs simultaneously rather than as consecutive passes.

These two things combined should hopefully make it possible to inform new dependency injections both on what would be a good spot dependency-wise and a good spot spatially. That's the next thing I'll focus on.

The game progression dependency graph and spatial graph visualizations now support changing the data structure on the fly. This makes it possible to see the node injections as they happen, and exactly how they modify the graph. Alas the jiggles had to go.

I found out I can create more balanced game progression dependency graphs by switching to an approach I call ... (checks notes)
Exploding The Graph, Then Picking Up The Pieces.

The approach so far is powerful in the theoretical possibility space of graphs it can create, but it tends to only open up one new location at a time, stifling player choice. I'm struggling to find a way for the generation to embody the "just right" shapes described by Gareth Rees.

The problem definitely relates to the branching factor, though whether to focus on in-going or out-going edges or both is unclear. The question is then how to construct a DAG with one start node, one end node and n in-between nodes with a given desired branching factor.

April 18 2022

I guess I'm getting closer to something I might be able to use: Dividing n nodes into m columns and then connecting them. But I'm not entirely happy with how specific/hardcoded/restrictive this approach is. For example, this will never create connections that skip rows.

By the way, the graphs here are at a different abstraction level than the previous graphs I've shown. Here, only location nodes are considered. All the other node types can be injected and connected later in a way that respects the same dependencies.

After sleeping on it I came up with a much better approach that creates more random and organic graphs, and always ensures ingoing and outgoing edges are either 1 or 2. Just looking at these results makes me much happier than the results in the previous video.

The new approach is based on a simple graph rewrite rule I keep applying on random edges until the desired number of nodes is reached.

I may have been inspired by a chapter in Dormans Joris' thesis Engineering Emergence which I read recently after some people mentioned it.

Graph layout rewrite

At this point I took some time improving the graph layout algorithm for the dependency graph, but didn't post on social media about it. The graph layout takes cues from the algorithm explained on the Wikipedia page about Layered Graph Drawing (Sugiyama-style) and I improved my implementation by taking ideas from these papers:

After the layout improvements I took a six month break from the game progression dependency graph research and focused on other things for a while, before taking it up again in November.

November 13 2022

Top: Game progression dependency graphs.
Bottom: Spatial graphs that show where things are in the world.
A key for a locked gate is a direct dependency, but can be located far away spatially. Next step is making gameplay objects from the spatial graph nodes.

The graph rendering used to be based on IMGUI with ugly matrix hacks but I spent today changing it to be based on Shapes by Freya Holmer so it supports perspective and is just much nicer. It's an awesome library and the switch was very easy.

November 19 2022

"I'll just add some icons to my game progression dependency graph," I thought. Haha, except, what do the icons really represent? The obstacle or the reward? Both? One week later, I've ended up with this schematic representation.

Here's two quite similar graphs before and after the iconographic makeover. Icons inside a node represent the obstacle/medium of that node, while icons shown at the top edge of a node represent the reward/outcome.

November 24 2022

With the dual game progression dependency graph and spatial graph, I can now begin to construct a world to explore. Right now it's still looking rather abstract. 😅

November 28 2022

Whee, I now have actual "gameplay" created from my game progression dependency graph and spatial graph (starting from 16s in the video). Only a few node types for now, but it's a cool milestone! 🗝🍎🐱🚩

The game will be focused on exploration, paying attention to the environment and finding clues in it about how to progress.

A note on the spatial graph. The spatial positions of elements are laid out based on a node relaxing / repulsion algorithm, and then Voronoi cells are created at each position and walls created between cells that don’t belong to the same location.

November 30 2022

Every gate, key, creature etc. now has a unique generated pattern to identify it by, so I could get rid of all the letters. One step closer to a world full of visually depicted clues.

Adding some trees. Trees make everything 1000% better.

December 3 2022

Generating a strange walled garden full of secret clues, based on a game progression dependency graph.

Someone noted in the replies that the "kitty keys" are an unusual concept, and that they couldn't think of an example where you need item A to lure creature B to point C to unlock gate D. I don’t know of that exact constellation elsewhere either. In some animes (and also The Fifth Element) a human is a key. And in the game Rime there’s some robots that serve as keys. I thought animals could be a fun variation on this already strange theme.

December 19 2022

Why did I implement this mechanic!? It'll just reveal I'm terrible at remembering things! Anyway, just a few new mechanics implemented for my strange walled garden that's procedurally generated based on a game progression dependency graph.

December 23 2022

Playing an instrument and finding songs with curious powers in this strange garden. (The game progression dependency graph it's procedurally generated from is shown at the end.)

End of prototype

At this point I stopped working on this prototype. As a proof of concept it had succeeded with the successful generation of fully playable little levels with a variety of gameplay mechanics and clue types.

The limiting factor was no longer the dependency graphs themselves.

One limiting factor now is the iconographic gameplay. Different creatures are all little cat head icons only differentiated by different colored patterns. For things to be more evocative, immersive, and easy to remember, I need to actually generate 3D animals of a wide variety. So that's the next thing I started working on, though out of scope for this blog post.

Another limiting factor is that I envision exploration to play an important rule in making the game satisfying to play, but the aesthetic of the prototype does not make exploration interesting at all. Luckily, another aspect of the game I've been working on is beautiful terrain generation. So eventually I need to integrate the procedural progression gameplay into those generated landscapes. But again, I need to first put work into creating procedural 3D models of the various gameplay elements before it can all be meaningfully integrated.

I hope you enjoyed this chronology! If you have any questions, let me know in the comments. And if you want to follow the ongoing development of The Big Forest, check out the social media links in the menu, or copy-paste my blog URL into your RSS reader.

Read More »

The Cluster is now released

The Cluster is finally released and available for free on Itch. It's a 2.5D exploration platformer set in an open world that's carefully procedurally planned and generated, and does a few interesting things I haven't yet seen in other games (check out the links for more info).

Here's a trailer: My last blog post about The Cluster was in 2016 and titled "Development of The Cluster put on hold", and by that I meant put on hold indefinitely.

At that time I had reached the conclusion that I had to give up my ambition of releasing The Cluster in the form I had envisioned. That would have required way more variety and features to be implemented, and due to a variety of burdens detailed in the post, that was not really viable after all, due to various details of the game's design and implementation.

The context for this decision was that I had envisioned The Cluster to be a commercial title, and it was my primary game development project at the time. (Back then I was a game developer only in my spare time.) I wanted to switch my focus to different projects that were more viable to be able to be released as commercial games, specifically Eye of the Temple, which has since been completed and released to decent success, and The Big Forest (working title), which I'm working on these days.

Still, I had put an incredible amount of work into The Cluster over many many years (going back to an initial prototype in Game Maker in 2003!), so I never managed to get reconciled with the idea of it never being available for others to see and play. Especially since, like I mentined, it does some things I haven't seen elsewhere. So at some point I decided I wanted to release it for free sooner or later, as I also mentioned in this 2022 blog post. Not in the ambitious form originally envisioned, but in the limited but fully playable state it had already reached, plus a bit of polish to smooth out rough edges - for example adding robust gamepad support.

And so, between 2016 and now I returned now and then to work on The Cluster for a little while, polishing it, fixing bugs, adding gamepad support, adding a settings menu, adding interaction prompts for how the controls work, and lastly, getting a round of playtesting by volunteers and addressing feedback from them. At the beginning of 2024 I said I wanted to get it out this year, and well, now it's finally out.

The graphics are nothing special and the gameplay can get a bit repetitive over time, but still, for people who are content exploring a big world in search of artefacts, where there is a clear structure and purpose to the world layout, the game can be fun for a few hours, and provide an experience different from other games out there.

It's also a showcase game for my open-source framework for layer-based infinite procedural generation, LayerProcGen. Oh yeah, I released that a few months ago, which I guess I never blogged about!

Anyway, the game is free, so give it a try. And if you do, let me know what you think! :)
Read More »

2023 retrospective and goals for the new year

Jan 8, 2024 in , , ,

2023 was a pretty good year for me!

I'll touch here briefly on my personal life, then go on to talk about the Quest 2 release and sales of Eye of the Temple, and finally talk about my new game project and goals for 2024.

Personal life

It's the first year since the pandemic that didn't feel affected by it. I moved from Denmark to Finland in 2020, just as the pandemic began, so on the social side it was some slow years initially.

Things picked up in 2022, but especially in 2023 we had lots of family and friends from Denmark visit us here and have a great time, and we also made more strides on the local social network front.

Particularly memorable was a wonderful weekend celebrating the 40th birthdays of me and a friend, with some of my closest family and friends from Denmark and Finland at a site called Herrankukkaro in the beautiful Finnish archipelago.

Eye of the Temple released on Quest and turned a profit

In April 2023, a year and a half after the original PC release on Steam, my VR game Eye of the Temple was finally released for Quest 2, with the help of Salmi Games. While it was super tough getting there, in the end we managed to ship the game at a level of quality I'm very proud of. Others agreed; it got a great critical reception, as well as a high user rating of 4.7 out of 5 stars.

It's super gratifying regularly seeing new reviews of the game from people who say it's the best VR experience they've had. Oh, and recently, UploadVR ranked it the 5th best game for Quest 3 and Screen Rant ranked it the 6th best game for Quest 2. Wow, what an achievement for my little game! (But remember, critical acclaim does not equal sales…)

I’m no longer working on the game at this point. After being occupied with it over a span of seven years, I really want to move on, and I'm also done with VR in general for now. But the sales of the game are still developing, so let's talk a bit about that.

My thinking about the game’s sales performance has changed a lot over time. I didn't pay myself a regular salary during the game’s three years of full time work. But when evaluating the game financially, I use the old salary from my previous job as reference, and calculate whether my time investment at that salary (I’ll refer to it as just “my investment”) would be covered retroactively by the game’s revenue. Of course, I also keep in mind that the covered percentage would be higher if I based it on a more moderate salary.

I was initially slightly disappointed in the Steam sales. As I wrote about back in November 2021, the projected year one sales would only cover 25% of my investment. Back then I expected the Steam year one revenue to make up the majority of the game's lifetime revenue. One year later, the sales had outperformed that projection, and my investment was actually covered 40%.

A lot has happened since then, in particular due to the Quest launch.

Comments from many VR developers in 2021 and 2022 had indicated that Quest sales could commonly be 5x-10x as large as Steam VR sales. For Eye of the Temple, the Quest week one revenue was merely twice of what the Steam week one revenue had been, so it was not quite as high as Salmi Games and I had hoped for. Speaking with other VR developers in 2023, it seems that the time when Eye of the Temple launched on Quest was generally a bad period for Quest game sales.

Still, Quest is easily the most important VR platform, and later the sales picked up significantly, with the recent Black Friday and Xmas sales combined having as big an impact on revenue as the launch sales. Already, 70% of total revenue has come from Quest and 30% from Steam, with the Quest version having been out for a shorter time.

Cumulative revenue from Steam and Quest

My investment is now covered 140%. In other words, even based on a proper salary for myself that's fitting for my experience, Eye of the Temple has recently flipped well into profitability. That still doesn't make it a runaway hit, but it's really nice to know that it's a success not only creatively and as a passion project, but also in terms of financial sustainability. Back in 2020 when I was still developing the game, I had not expected that at all for my first commercial title.

My new project: The Big Forest

So what comes after Eye of the Temple? Like I wrote above, I'm done with VR for now.

The working title of the new game I'm developing is "The Big Forest". It's set in a big mystical forest and has a strong focus on exploration. The gameplay will involve light puzzles based on connecting clues found through exploration and gradually gaining access to new areas.

The project is in its early stages. The game will be fully procedurally generated, and so far I've been working on a series of disconnected experiments and proofs of concept that will eventually all be rolled into the game. These include procedural generation of terrain, gameplay progression, creatures and music.

I started working on the game in 2022, but I put it on hold shortly after, when I started working on the Quest 2 version of Eye of the Temple. In the last third of 2023, I started working on the procedural landscape for the game again. You can see an overview of that progress in the video below.

As for what the game is about in general, I made this page about The Big Forest where you can read more about it.

Goals for 2024

I expect The Big Forest to be my focus for several years (and that might end up being an understatement).

But I also have a list of more concrete things I hope to get done in 2024, not all directly related to my game:

Present my Fractal Dithering technique

I want to release a video, blog post, and source code for a rendering technique I call Fractal Dithering. It's unrelated to my game — just something I developed because I had an idea for it and had to try it out. The code is all done, and I worked on an explainer video (not the one here below) back in June-July 2023. But making the video took so long that I ended up having to take a break from it because I was losing motivation. Let's get that wrapped up.

Release my Layer-Based ProcGen for Infinite Worlds framework as open source

Update May 2024: It's done

I've put more than a decade into developing a framework for contextual procedural generation of infinite worlds. I wrote about it here in 2013. I originally developed it for the game The Cluster I was working on at the time. I since abandoned that game, but now I'm using the framework for The Big Forest. I think the framework could be useful for others as well, which is why I'd like to open-source it.

The generality of the framework is proven by using it for two entirely different games - The Cluster being a 2.5D platformer where the world is made out of generated meshes and The Big Forest being a first/third-person game based on generated terrains. In 2023 I put some work into removing cruft from the framework that was only relevant to The Cluster, and generally streamlining it. There's still some more of that work left to do.

Wrap up and release The Cluster as a free experimental game

Update August 2024: It's done

I already wrote about it here in 2022, but I'd like to wrap up my old game The Cluster and release it for free as an unfinished game, partly because the game is fully playable and one can easily have a few hours of fun playing it, and partly because the game demonstrates a lot of interesting things that can be done with my Layer-Based Procedural Generation for Infinite Worlds framework in areas including level design and pathfinding. It's the longest-running project of my life, and it'd be nice to get it out there, even if it's in an incomplete state.

Make better use of my YouTube channel

Until recently, my YouTube channel just had various videos that show off things with little or no comment, and without any channel branding or identity. I'd like to start making videos in a more "classic YouTube format" where I discuss a subject with a proper intro and outro, channel branding, background music, etc.

I've just recently kickstarted that effort with the video about developing a procedural landscape for The Big Forest that I embedded further up this page. I aim to produce a few more such videos in 2024, for example one video for each of the subjects mentioned above.

What would you like to see?

The goals above all relate to things I'd like to share, so I'm very interested in gauging which of those things might be of interest to you all. If there's anything you'd be interested in in particular, let me know!

Read More »