Maps and Ghosts

It’s been another week with a minimum of work on Gunmetal Arcadia, so today I’ll be covering the ongoing updates to Super Win the Game in greater depth.

xan_valk_update_1

For starters, I’ve added a highly-requested mapping feature to Super Win the Game. As in most Metroidvania titles, the map is automatically filled in by traversing the environment. Regions containing gems that have not yet been collected will be flagged on the map with a red dot. A minimap sits in the corner at all times and can be expanded to full size with the press of a button.

Initially, my hope was that I could automatically generate the map images from game data. I even got as far as prototyping an algorithm that would do a flood fill through the world looking for adjacent rooms and drawing the map as it went. Unfortunately, this was insufficient for a number of reasons. It was too slow to accurately determine rooms that the player could walk between; to do this, I would have needed to do a flood fill of each tile in every room, marking space as inside or outside the walls, in order to correctly identify paths between rooms. Furthermore, it would have been impossible for this algorithm to flag rooms as secret areas, as this decision is often based on context and not something that could be easily determined by examining a room algorithmically.

For these reasons, I’ve had to draw each map by hand. In fact, there are two versions of each map, one with secret areas revealed and one without. Once the player has traversed a secret area, the map will show this path, but until then, it may appear as a wall.

I was initially considering only showing the map within dungeons, but I’ve had to expand the scope for a variety of reasons. This decision was based on the fact that many areas of the game (towns, building interiors, various caves and forests accessible from the overworld map) are trivially small and don’t warrant a map, but as I began drawing maps, I realized some areas that I don’t technically consider dungeons — for instance, the icy lake outside the glacial palace, or the exterior facade of the desert ruins — could still benefit from having a map. The final nail in the coffin was the inclusion of gem markings on the map; once I knew for sure I would be supporting that feature, it pretty much meant I would need a map everywhere. The one exception is the dream sequences. These never contain gems, so I feel I can get away with not having a map during these sequences, and I think the exclusion of a map may help to further clarify the delineation between the real world and dreams.

One of the reasons I rejected a minimap when I was originally developing Super Win last year was because the game’s regions are not always logically represented by its map files. Many seemingly disparate locations may exist within the same map file, such as the tutorial, all dream sequences, and the hidden region within Subcon, or the interiors of many buildings across a few different towns. Likewise, some areas that are logically connected, such as the Lair of the Hollow King and the Hollow Heart at its conclusion, actually exist in separate map files. I knew that one of my first tasks would be solving this disparity. This involved tagging every map file or region with an identifying name.

xan_valk_update_2

Ultimately, I ended up breaking down maps into the smallest possible discrete regions, even when these are just a single room, as in the case of many building interiors. This decision led to another problem: once I began marking gems on the map, I found that I wanted to be able to see the total number of gems in a region, but the regions I had defined were too small to provide a meaningful count. To address this, I added another layer of markup to define regions that were part of the same larger logical space. In this way, I could keep track of, e.g., how many gems existed in a town, even when this space spanned multiple maps.

Calculating the number of gems within each region is done at runtime when the game starts up. This is a somewhat intensive process, as the contents of each room must be examined to see whether it contains any gems, whether those gems have been collected, and so on. In the future, once I’ve finished building the new speedrun courses and am certain that content is locked down, I may cache these results for faster loading, but in the event that I don’t, I’ve added a loading screen such that the game doesn’t appear to have crashed or frozen.

There is one remaining problem that I haven’t solved yet, and that is how to handle saved games that were made prior to this update. As it stands, the game would be loaded with no minimap data, so any rooms the player had already traversed would have to be revisited in order to fill in the map. As a partial fix-up, it would be easy to automatically fill in rooms from which the player had previously collected a gem, as I would know for sure they had been there already. Any further fix-ups would have to be guessed at, possibly by attempting to pathfind through the world from known visited rooms to known entry points. Alternatively, I might simply pop up a notification when loading an older saved game explaining that the minimap will not be filled in. We’ll see.


The second order of business is speedrun courses. This goes back to an idea I had early in the development of Super Win, but eventually the underworld region I had set aside for this purpose ended up becoming something of an epilogue to the main campaign instead, and I shelved the speedrun idea for a time.

I’m planning to have a number of speedrun courses, probably five or so, and these will be accessible from the Town of Lakewood right at the start of the game. Each speedrun course will prescribe its own set of gear, so the playing field will be level regardless of how far you’ve advanced in the campaign. You may also find familiar powerups on the course that will last for the duration of the run and will be forfeited upon its completion. Finally, I’ve added one new powerup: a coffee cup which provides a speed boost for a short duration.

I’m currently in the processing of grayboxing speedrun courses, and I’m pretty excited about the results so far. I’m aiming for difficult platformer challenges more in the vein of the original You Have to Win the Game. I also want to provide multiple paths through each course. My hope is that these paths will provide a good balance between difficulty and speed and incentivize repeated playthroughs in the interest of finding and perfecting the optimal path.

From the start, I knew that if I were implementing a speedrun feature, I would want ghosts, but it took some time to figure out a good implementation. I had previously implemented input recording for Gunmetal Arcadia as a solution for an attract mode and possibly for saving and replaying full game sessions. I ported this code back to Super Win, but it turned out not to be useful for ghosts, as wholesale input recording is only useful in the absence of ongoing player input. Eventually, I decided to implement this feature in the simplest way I could imagine, by saving off snapshots of the player’s position at regular intervals. I’m still playing around with the exact rate, but currently I take a snapshot every tenth of a second while the player is moving and also in response to significant events such as jumping, landing, wall hugging, dying, and respawning.

Ghost data is saved to file when the player finishes a speedrun course and chooses to overwrite their previous best time. This ghost data will automatically be replayed the next time the player enters that course, allowing the player to compare their current performance against their previous best.

The next step, and one that I’ve prototyped far enough to have confidence in being able to ship it, is to associate ghost data with online leaderboard scores such that players can choose to race against each other’s best results. Naturally, this feature will only be available for Steam players, but for non-Steam versions, local results can still be saved and replayed.


I don’t yet have a release date for this new content, but as I’ve mentioned previously, it will be available free of charge to all current players and will coincide with a relaunch of the game at a new lower price. Hopefully this will be sooner rather than later; I’m a little over three weeks into this work and itching to get back to Gunmetal Arcadia, but I also want to make sure this is a substantial piece of high-quality content, so I’m trying not to take any shortcuts or do anything halfway.