Blueprints from Buildings
June 9, 2017
When working on a long term project, like my Robyn HUD computer game, it can be beneficial to take a little time out to work on something else and clear the cobwebs out of the brain. It can be especially beneficial if that “something else” can be folded back into the long term project to help it along. Such was the case with a little side project I did recently to help generate the blueprint images I need for Robyn HUD.
In Robyn HUD, the player is the “eye in the sky” computer hacker on various heists, helping to guide a cat burglar through the locations the two visit. To assist in this, the hacker is provided with blueprints for the current location that show the layout as well as various points of interest within that location. From a game development standpoint, this means that each location needs to have an image created that shows the location in “blueprint” view.
For the couple of early prototype test levels I did, I created these blueprints by taking top-down screenshots out of the level building application I was using. These raw screenshots looked something like this:
There were several problems with these screenshots:
- Various axis and other reference markers appear that are useful in the level building application aren’t applicable for the blueprint image.
- The intent with the blueprint images is that they should show the floor plan of the locations the player visits. However, taking a top-down screenshot not only includes lines for the floor but also the ceiling, so the image becomes much more cluttered with excess lines that have to be cleared out.
- Other temporary geometry lines are present when creating a level but are omitted when the final level is compiled. These also add clutter to the blueprint image.
These different “visual artifacts” meant that time had to be devoted to cleaning up the screenshots to get them to a state where they could actually be used in the game. This wasn’t too painful for one or two prototype levels but it was obvious it was going to become more of an issue with the actual production levels of the game itself. More than that, I anticipate having to adjust the layouts of the levels based on feedback from testing once I get that far. Such adjustments will mean that not only will the levels themselves have to be reworked but the blueprint images will then have to be changed. Not the greatest use of production time.
Taking a step back, it occurred to me that it might be possible to programmatically generate the blueprints from the level geometry itself. Since the ultimate goal is to get to a blueprint that shows the floorplan of the level, if I had an application that could “trace” the contours of just the floor and ignore the ceiling, for example, then that might produce a much more usable image immediately without futzing around with cleaning up all the issues I outlined above.
With that in mind, I whipped up a little program in a couple of hours that takes a compiled level and a value indicating the height in the level where the floor is. The program then checks all the geometry in the level. Specifically it looks for any polygons that have vertices at the level of the floor and vertices above the level of the floor. Basically, it looks for walls that start at the floor and go upwards. The program then discards the height component of these vertices and uses the remaining horizontal components (width and depth) to draw lines into an empty image sized to the dimensions of the level.
Here’s the result after running a level through the program:
Much cleaner and much closer to being immediately usable within the game. For the game, I wanted something a little more polished looking than black lines on white. It’s a very quick process to bring an image like this into a painting program, swapping the black line colors with grey and then texture filling the white areas to produce something like this:
There’s still a little bit of manual work needed to prep the blueprint images for the game. However, the blueprint extracting program saves the bulk of the time spent on blueprint images by removing all of the cleanup steps. As production continues we’ll see how working with the blueprints goes. If the few remaining cleanup steps become overly burdensome or time consuming I may enhance the program to do even more in preparing the final images.