Project Bug Hunt #1: What Are We Doing?

By Shamus Posted Tuesday Sep 8, 2020

Filed under: Programming 42 comments

As I’ve alluded to before, I’ve been working on a new programming project. Like most of my other projects, this one is tied to procedural content generation. While the Good Robot project turned into a real video game, most of these projects are intended to be experiments, educational projects, or proof-of-concept demos. I guess this project is all three.

What are we Doing?

I want something just like this, except completely different.
I want something just like this, except completely different.

Our goal is to make a procgen shooter level. It probably won’t matter, but I’m aiming for something that would work as an immersive simYes, this is a confusing and awkward name for this genre. It was named back in the 90s when a lot of genre boundaries hadn’t settled in and we were still calling shooters “Doom Clones”., not a turbo-charged run-n-gun shooter. Games like System Shock, System Shock 2, and Prey are some of my most beloved games. I like how the space station setting allows for open-ended exploration without needing to contrive a silly wall around the world to keep the player in the playpen. I like how the isolated setting creates a quasi survival horror vibe, where you’re all alone in a haunted box full of monsters. I like how combat is slow-paced and risky, and I like having to balance my supply of ammunition, weapons, tools, and healing items.

I also give partial credit to games like Thief, Deus Ex and Dishonored for being Immersive Sims, even if they don’t take place in my favorite settings or feature the open-endedness I’m looking for. I give partial-partial credit to the BioShocks for being watered-down examples of the formula.

You can argue over genre boundaries all day, but you don’t need to haggle with me that game X should be included or game Y should be excluded. It’s fine. You can decide for yourself what Immersive Sim really means, but it’s not going to change my design. I’m just trying to make something I’d like, which means a procgen space station / space ship setting.

I’m not going to be adding AI or monsters to fight, so this focus on “Immersive sim levels” is mostly academic. I just want to head off objections that the stuff I’m building wouldn’t work as a shooter because it’s too constrained to allow for insane run speeds and rocket-jumping.

So anyway, back to defining our overall goals…

We want to design a level layout, turn it into polygons, fill it with stuff, light it, add some sort of basic interactivityProbably moving doors and other simple moving objects., include some basic sounds, and let the player explore it all. I don’t expect to add real gameplay, but to keep with the spirit of the project the end product should be capable of working from a gameplay sense. The space should be coherent in the sense of having a complete route from the starting point to the ending point. It should be something that an AI could navigate. A few things should emit sounds to prove that the program is capable of it and has a way of placing correct sounds in sensible locations. The lighting should make sense, and there should be proper collision detection on everything.

While visuals don’t matter in a tech demo, I’m going to strive to make something vaguely presentable. It certainly won’t look like something you could ship to consumers, but it should be something that could be made cool with the help of an artist that knows what they’re doing.

Another goal is to limit complexity of the code. I’m normally inclined to do things “the right way” the first time, but for this project I’m sort of trying to find out what the Right Way is. So instead of building complex and optimized code, I’m going to focus on writing as little code as possible. The idea is that when I change my mind, I want to feel free to throw old code away and do something completely different. That’s hard to do if you’re thinking, “No! I spent two weeks on this! I can’t just throw it out!”

An additional bonus goal is that it should be possible to change the procgen parameters without changing the code.

Magic Numbers

Well shit. I knew I should've done the reading before class.
Well shit. I knew I should've done the reading before class.

See, every game runs on “magic numbers” to some degree. Maybe you’ll see the number 1.655 in the code. If the programmer is responsible and sane, then they’ll assign this number to a variable with a helpful name like “playerHeight” so you understand what the number is for and even have a chance to figure out what units this number is inIt’s meters, BTW.. If the programmer is lazy or inexperienced, then they’ll just name the variable “height” and you’ll be left wondering “Um. Height of WHAT? A font? A jump? Screen size? What scale are we dealing with? Miles? Feet? Pixels? Megapascals? Building stories? Parsecs? Giraffes?”

You end up with a lot of numbers like this in a game. You need numbers for height, speed, hitpoints, weapon accuracy, monetary value, volume level, damage inflicted, sight distance, weight, friction, cooldown time, mana cost, magazine capacity, font size, stack size, particle size, effective duration, and gluten content. The thing is, these numbers control gameplay, and that usually isn’t the programmers’ job. If the team decides that the AR-15 needs 15% more gluten, then the gameplay designer shouldn’t need to make a request to the programmers asking them to set aside their long and highly technical work so they can find a number somewhere in the code and change it.

So you put all the magic numbers into some sort of settings file where the design team can fiddle with them as much as they want without dragging coders away from their jobs.

You won’t be able to use these numbers to turn a shooter into a Minecraft clone or a 2D platformer into a visual novel, but you should be able tweak the behavior of the game. In the case of this project, that would mean fiddling around with procgen parameters to make different kinds of spacesI’ll probably use XML to store these numbers. so we’re not trapped with a hard-coded system. When I worked on Good Robot, Ross Zevenhuizen was able to do a lot of things that had never occurred to me using the settings files. It’s a little more work, but it can really pay off if your art team is up for experimenting with things. Of course, I imagine I’ll be the only one working on the project. But still. It’s nice to be able to make quick changes without needing to re-compile whenever you want to iterate over a new idea.

But Why?

This project is the product of many inspirations. In chronological order:

All these people wore the same outfit to work today. They were evidently so embarrassed about it that they beat themselves to death with a wrench. Tragic.
All these people wore the same outfit to work today. They were evidently so embarrassed about it that they beat themselves to death with a wrench. Tragic.

1) System Shock 2

Way back in 1999, I got sorta hooked on System Shock 2. I have no idea how many times I’ve played through the game, but it’s probably at least a dozenDisclosure: I never cared for the end section where you enter the fleshy tunnels to face the Many. I think I’ve only played through that four or five times. I usually get to the point just before the Many, and then declare the game over, quit to the main menu, and start a new game.. At some point I had to stop playing because I’d memorized all of the loot and gotten stuck in the rut of an overly-optimized run. I wished there was a way to randomize all the loot and enemy positions so I could return some sense of mystery and surprise to the experience.

Also, I noticed that the levels were actually pretty simple. Unlike the convoluted multi-level maps of the late 90s, System Shock 2 was designed to look like a reasonable human-designed space that could be depicted on a 2D map. It didn’t depend on labyrinthine tunnels, winding corridors, or stacked room designThere was a little vertical movement, but it was very simple compared to contemporaries like the Unreals, the Quakes, or Half-Life. System Shock 2 was mostly a main corridor that branched off into cuboid side-rooms. Procgen systems code ought to work really well with that sort of thing.

2) The Lost Project

Back in 2015, I worked on this project:

This was made using my homebrew engine in C++.
This was made using my homebrew engine in C++.

You can see additional screenshots of the project in my OpenGL series. That project served multiple purposes. It was a failure on all counts, but it was an educational kind of failure. I wish I’d written about it at the time, because I’d love to read through that process before embarking on this project.

The main purpose was to experiment with blending modern rendering techniques with retro styling to see what it would look like. That didn’t work out for the reasons I explained in the middle of this post.

The secondary purpose was to experiment with procgen level design. I was trying to make something really open-ended that could generate a 90s style deathmatch level, and the lack of structure made it impractical. The space would end up being boring, cluttered, non-sequitur rooms. I found myself gravitating towards using prefab pieces, but I felt like that went against the intent of what I was trying to do. I discovered that you need some limitations and structure or the whole problem becomes too abstract. So now I want to take those lessons and try again with a different approach.

3) Strafe

I played Strafe a few years ago.

Three years later, and I still have no desire to return to this game. Shame. I loved the art.
Three years later, and I still have no desire to return to this game. Shame. I loved the art.

I liked the idea of a procgen level, but in the end a level was mostly a chain of prefab pieces. I’d walk into a room and go, “Oh yeah. This one again.” That’s not bad or anything. It’s more than other games attempt. But I still felt like there was more that could be done with the idea. Authors of 2D side-scrolling roguelikes have gotten really good at making procedural 2D gamespace, but very few people are trying for that sort of limitless variety in 3D. Yes, it’s true that 3D is many times harder than 2D, but I think it’s a reasonable idea to strive for.

4) System Shock Remake

I’m still following the development of the System Shock remake, and every time I see a new video or screenshot I find myself thinking how good this particular grid system would be for procgen levels.

This is a lot more pink than was in the original, and I don't recognize this particular corridor, but it's still pretty cool.
This is a lot more pink than was in the original, and I don't recognize this particular corridor, but it's still pretty cool.

In the original System Shock, spaces are built on a 2-meter grid. You can use any cube or wedge shape that fits in that grid. That would work really well with a system that branched off corridors into smaller corridors into rooms.

I’m not going to actually use this grid system, but seeing the screenshots makes me want to do procgen stuff.

5) Project Hammertime

Earlier this year I did that weird project where I tried to load Half-Life levels from the Hammer editor into my Unity game.

No, we're not going to be using raytracing in this project. It's cool, but this feature is not ready for realtime rendering in Unity.
No, we're not going to be using raytracing in this project. It's cool, but this feature is not ready for realtime rendering in Unity.

That was fun and made me want to do more programmy-type stuff. And yes, it was actually called “Hammertime”, even though I never confessed that during the write-up.

For the Unity!

Evidently Steppenwolf is a huge fan of Unity?
Evidently Steppenwolf is a huge fan of Unity?

If you’ve been following my site for the last few years, then you probably won’t be surprised to learn that I’m going to be doing this in Unity.

Before Unity, I did all my projects by hand in C++. That’s cool, but I dropped a lot of projects because I was sick of needing to constantly build infrastructure for myself. C++ is really barebones. No built-in rendering pipeline. No support for 3D models. No sound, no physics, no collision detection, no font support, no controller support, no skeletal animation, and no support for image loading. Yes, there are free libraries for all of this stuff out there. But finding them, figuring out how they work, and getting them to inter-operate gracefully is still a monstrous task. It’s perfectly normal for me to spend far more time building infrastructure than working on the problem I’m interested in.

At the other end of the spectrum, Unreal Engine is way too heavy for small experimental projects like this. Also, I’ve never seen anyone doing serious live procgen content using the engine. Unreal seems to be built around the idea of loading premade assets. Okay, there’s this one video that’s one of those insufferable live training sessions. The end product was needlessly convoluted and impractical and in the end it was basically a randomizer for a Doom 2016 snapmap setup. That’s… completely inadequate. If Unreal has any real tools or even basic allowances for making your own assets at runtime, I’ve never seen it documented or demonstrated.

I was hoping Jai would be out by nowIt was supposed to be available at the end of 2019., and I’ve been sitting on this project for months in the hope that Jai would come out. But it’s late in 2020 now and we still don’t have a revised date for any kind of public release. I’d love to try Jai, but I think I need to move on and come back when Jai is available and the community has worked out a rough set of standard practices, documentation, and maybe some quasi-standard libraries. Waiting until the first round of bug fixes would probably be smart too.

So that’s the plan. We start next week.

 

Footnotes:

[1] Yes, this is a confusing and awkward name for this genre. It was named back in the 90s when a lot of genre boundaries hadn’t settled in and we were still calling shooters “Doom Clones”.

[2] Probably moving doors and other simple moving objects.

[3] It’s meters, BTW.

[4] I’ll probably use XML to store these numbers.

[5] Disclosure: I never cared for the end section where you enter the fleshy tunnels to face the Many. I think I’ve only played through that four or five times. I usually get to the point just before the Many, and then declare the game over, quit to the main menu, and start a new game.

[6] There was a little vertical movement, but it was very simple compared to contemporaries like the Unreals, the Quakes, or Half-Life

[7] It was supposed to be available at the end of 2019.



From The Archives:
 

42 thoughts on “Project Bug Hunt #1: What Are We Doing?

  1. spacesjut says:

    I give partial-partial credit to the BioShocks for being watered-down examples of the formula.

    I see what you did there.

    1. Asdasd says:

      I sea what he did there too.

      1. DGM says:

        Seas-and-desist, you jerks.

        1. tmtvl says:

          Oh dear, a deluge of puns seems about to rain down on us.

          1. DeadlyDark says:

            I’m pondering on what was just said here

            1. tmtvl says:

              Well, we’re up to our ears in water puns so just feel free to go with the flow and dive in.

              1. Nimrandir says:

                I would, but I have to take a bath. Is fear keeping others from stepping into my place?

                1. evileeyore says:

                  The flood of puns has us drowning in ‘comedy’.

  2. Anorak says:

    Looking forwards to this. This is the sort of content that brought me here in 2009, I was looking for examples of terrain generation + rendering.

    1. tmtvl says:

      I second this. In fact, I was binging the old programming series over the weekend, so it’s like a favourable omen that another programming series starts now.

    2. Lee says:

      Same here. Though I read DMotR way back, what brought me here was the procgen city series in (checks google) 2009?!

    3. Echo Tango says:

      I’ll also +1 for game-programming posts! :)

    4. Ander says:

      Same here!

  3. Darker says:

    Also looking forward to how this turns out hoping it provides some inspiration for my own project :) On the web there are tons of tutorials on how to do noise based terrain generation or maze-like dungeon generation, but not much about “logical” interior space generation.

  4. Geebs says:

    Speaking of which, did you ever play The Persistence? It was a fairly decent procedural System Shock clone on PSVR. There’s now a non-VR version on other platforms. I thought it was pretty interesting, and it stressed me out in the same ways that System Shock 2 used to; although VR certainly helps in that respect.

  5. Echo Tango says:

    I’m not going to actually use this grid system

    Any particular reason why? Many successful games with random levels were built on a grid, and the devs for some of them have even published retrospectives, tutorials, or guides. Spelunky, The Binding of Isaac, Red Rogue[1], Necrodancer, Rogue/Slashem/ADOM/Ivaan/etc[2]. Minecraft is a 3D one. There’s some games with non-grid randomization, like Sublevel Zero, but those run into the problem of “oh, this level” much more readily.

    [1] This one definitely published the algorithm for the levels, although I can’t seem to find it anymore. :|
    [2] These older ones might even have source-code available to learn from.

    1. Decius says:

      I think that a cubic grid for walls and a hexagonal prism grid for set dressing would work pretty well.

  6. C.J.Geringer says:

    This is probably my favourite piece of procedural generaton with unity:

    https://catlikecoding.com/unity/tutorials/hex-map/

    itis a prretty good step-by-step implementation f a hexagonal grid map with procedural meshes.

  7. Paul Spooner says:

    I’m so excited for this project!
    I don’t know what your plan is for the controls, but it would be neat to be able to do the procgen from within the game. Like, you have a gun that you can shoot walls that makes doors, and those doors open into procedurally generated rooms. And then you can tweak the ammo in the gun to alter the properties of the rooms that you generate when you shoot the gun.
    I had some ideas for the underlying principles of the generation schemes, which I wrote down here:
    http://blog.projectfledgeling.com/20180501/1118/
    Looking forward to seeing where you’re going with this!

    1. Philadelphus says:

      Oh man, that sounds like a cool idea. You’re exploring/trapped in an infinitely expanding space, and have to make your way to an exit which just “exists” some distance away as you spawn into each level. Use your gun/multitool to spawn whatever procedural rooms you need to be able to traverse there!

      1. Paul Spooner says:

        Yeah! Or having level objectives like a certain number of a certain kind of room? Or a certain quantity of kinds of objects?

        1. Sleeping Dragon says:

          Huh, web filters at my workplace block that link with extreme prejudice. The concept is not entirely alien to modern roguelikes. I’m gonna be short on titles as I’m not an expert in the genre but many let the player make decisions such as weighing risks and rewards when picking paths or somehow manipulating odds. For example FTL will let the player pick a sector type with some being riskier than others, or riskier in certain ways. Hand of Fate iirc lets players slip cards into the deck that the dealer is using… So there is definitely a precedent for this concept of gameplay though I don’t recall one in first person (again, not my genre), though of course this could be taken in multiple directions.

  8. MelTorefas says:

    I also love procgen stuff and am super looking forward to this series!

  9. eldomtom2 says:

    So it’s called Bug Hunt despite not being any more focused on hunting bugs than any other programming project?

    1. Echo Tango says:

      Maybe the game will have bug enemies!

  10. RFS-81 says:

    I’ve played the beta for Dominus Galaxy, a game inspired by Master of Orion 1, and it has not only magic numbers, but all the formulas (for things like population growth and so on) in a plain text file. I don’t know how common it is to go that far, but it seemed really clever to me.

  11. Rosseloh says:

    but in the end a level was mostly a chain of prefab pieces. I’d walk into a room and go, “Oh yeah. This one again.”

    As beloved as Shadow Warrior 2 is to me, because it’s just plain fun to play once you get the movement down….This is my big beef with it, and I hope it’s something they realized and fix in the third one whenever that comes out.

    (The first remake was more of a classic shooter with crafted/tailored levels. The second is a borderlands-style looter with procgen levels in this “building blocks” way.)

    Your comment on the way System Shock 2’s levels were designed is also something that comes to mind as a gripe with Star Citizen. I’m still an SC apologist, to a point (namely: it’s not a scam, they’re clearly working on a product that is in fact worth $60 *now* if you’re the sort of person who likes good scenery and carting boxes around a solar system….they’re just really bad with feature creep). But there are reasonably new space stations in the game that are….horribly designed. And it’s because they’re designed by artists, not architects. You’ll disembark your ship on the landing pad, enter the elevator, and then because the artist decided the main level area needed to be in the bulk of the station instead of near the landing pad, your elevator will ZOOM off like 3 kilometers in random directions (you can see this by watching your ship’s icon on the HUD). Then once you’re in the station proper, the layouts make no logical sense. I had to huck a box across like 700 meters of hallway because the artist decided the admin office should be at the other end of the playable space to the ship elevators.

    A more logical design, to me, would be to have the player accessible area on these stations be right at the landing area. Elevators would move 10 meters, not 3000, and you’d have a central hallway (straight or curved depending on if it’s a spur off the station, or on the rounded hull itself), with common facilities like admin offices and restrooms placed near the ship elevators because pilots are going to be using those most.

    1. Echo Tango says:

      Maybe the in-universe bureaucrats are really bad at station design – did you consider that? Working as intended!

    2. DeadlyDark says:

      Tbh, I’m hoping that SW3 returns to the style of the first one (premade levels and placed enemies with toned down “rpg” elements), with the movement of the second one

      Don’t take me wrong – I enjoyed SW2 and glad that devs made it, but I still have my preferences

  12. Jordan says:

    Steppenwolf screencaps feel pretty appropriate, given he already looks like a rejected Unreal tech demo.

    1. Echo Tango says:

      Man, I was super confused until I realized this Steppenwolf was a comic-book guy, not a rock band. ^^;

      1. Nimrandir says:

        For what it’s worth, I claim that the band is better.

  13. Mr. Wolf says:

    I take it this project won’t be a stand-up fight.

    1. Shamus says:

      You secure that shit Hudson.

  14. raifield says:

    This is the content I crave from TwentySided.

  15. Sleeping Dragon says:

    Not trying to goad you into anything but just gonna point out that exploring a space station can make for something fun to play*. Tacoma comes to mind but I’m also going to throw Verde Station out there without spoilers because that would be doing it a disservice. Again, I do realise that’s not the point of the exercise but…

    *or “experience” in case someone wants to start the old walking sim war.

    1. raifield says:

      Doesn’t Event[0] do something similar? I keep trying to get into the game and lose interest after five minutes.

      1. Sleeping Dragon says:

        It does as well, although there is an undercurrent of something slightly different to Event[0] that I’m not going to spoil either. Also I guess our tastes diverge strongly.

  16. avenger337 says:

    Earlier this year I did that weird project where I tried to load Half-Life levels from the Hammer editor into my Unity game.

    Despite the fact that I’m 100% sure you looked up the date on this before publishing, I still didn’t believe that was earlier this year. In fact, even after clicking the link and seeing the date of “April 2020”, I’m not sure I believe that project was earlier this year. I’m… I’m pretty sure it was at least a decade ago. Are you sure you got this right?

    1. Paul Spooner says:

      Lol, Covid Lockdown Chrono-Dilation Syndrome.

  17. Naota says:

    I haven’t gone completely dark! I was just… well, not resting exactly.

    I switched hosts to save a boatload of money, and was too focused on development to bother re-instituting my site, with its outdated portfolio and older WordPress version. It’s still a little rough around the edges, but the site is up and functional again, with a post about what I’ve been busy with.

  18. Elzair says:

    I know you have already started using Unity for this project, but have you looked at Godot? It is a nice little open source engine. I am using it myself for a project.

Thanks for joining the discussion. Be nice, don't post angry, and enjoy yourself. This is supposed to be fun. Your email address will not be published. Required fields are marked*

You can enclose spoilers in <strike> tags like so:
<strike>Darth Vader is Luke's father!</strike>

You can make things italics like this:
Can you imagine having Darth Vader as your <i>father</i>?

You can make things bold like this:
I'm <b>very</b> glad Darth Vader isn't my father.

You can make links like this:
I'm reading about <a href="http://en.wikipedia.org/wiki/Darth_Vader">Darth Vader</a> on Wikipedia!

You can quote someone like this:
Darth Vader said <blockquote>Luke, I am your father.</blockquote>

Leave a Reply to Paul Spooner Cancel reply

Your email address will not be published.