Here is the first video in the This Dumb Industry series. As I mentioned before, these videos begin as articles and are then turned into videos. I think this works better than going the other way. This ought to read like a slightly informal variant of my old columns. Or you could just watch the video. Whatever works for you.
Like I mentioned on the last video, I have a Patreon reward tier for people who want their names in the credits. These videos are often produced a week or so ahead of time, so if you signed up in the last 7 days or so then your name probably won’t show up yet. I just wanted to make it clear that I didn’t forget you, we’re just dealing with normal video-production lag times. If you’re signed up now then you should show up in the next vid.
One final note is that this is obviously a shorter and less detailed version of an article I wrote back in 2016. I wanted to start off this series with something familiar and easy before we try to tackle more challenging topics.
Anyway, on to the article:
What is Vulkan?
We meet again, The Internet. Today I want to talk to you about Vulcan. Not this vulcan. Not this Vulcan. Not this Vulcan. Not even this vulcan. I’m talking about this Vulkan. With a K for some reason.
Maybe you’ve seen this logo in a splash screen somewhere or maybe you’ve seen Vulkan in gaming news and wondered what the deal is. Isn’t it supposed to make games faster somehow? Is this thing a new graphics engine? Is it a game engine like Unity? Is it middleware?
No. It’s not any of those things. Vulkan is a replacement for OpenGL. So now I need to explain what OpenGL is. And to explain that, we need to talk about…
Standards are important for getting disparate systems to interoperate. Let’s say there’s a power plant out there generating electricity for us. And let’s also say that you’ve got some sort of electrical gizmo that you want to use. You can’t just wire your gizmo directly into the power grid because that would kill your gizmo, and probably you. So we have some standards for how to step down power from the grid to make it suitable for residential use. On the other side we have standards for gizmos, telling them how to accept residential power. The humble household electrical outlet is where these two sets of standards meet.
This means that it doesn’t matter what the power plant looks like, how many there are, or how they work. It doesn’t matter how large or small the gizmo is or how much power it needs. Each system can follow their half of the standards and the two can meet in the middle.
To get a feel for what it’s like in a world without standards, think back to the goofy days of the early 90s and how much hassle there was getting games to support your sound card. If you’re too young to remember those days, I highly recommend the channel Lazy Game Reviews.
In those days, there wasn’t a single standard for sound cards. Every model was a little different, and programmers had to go out of their way to write code specifically to support all the different species of sound devices. You’d find games that supported every card except the one you owned, or they only supported a subset of the features. It was a lot more work for the developers and a lot more frustration for the user.
We eventually got that sorted out so now developers don’t need to care about your specific make and model of card to get sound to come out of the speakers. We have similar standards for graphics, and OpenGL is part of that.
The game talks to OpenGL, which talks to the graphics driver, which talks to the graphics card, which makes the graphics happen. Obviously it’s way more complicated than I’m making it sound. I don’t want to stop and explain what an API is, or the historical evolution of graphics hardware, or all the crazy extensions that were bolted onto OpenGL at one point. So let’s just imagine that OpenGL is a magic black box and not worry too much about the details.
The point is that as long as the developer provides the graphics calls to OpenGL in the proper way, and as long as the graphics card manufacturer builds proper drivers, then the two halves of our system can connect to make the graphics happen.
The beauty of OpenGL is that it has always been steadfastly backwards compatible. You could take your code from a late-90s shooter and compile it against the latest version of OpenGL and it has a reasonable chance of working on a modern machine. We don’t end up with hard walls between the graphics generations like they do in console land, where graphics engines need to be completely rewritten from scratch to work with the new hotness. It doesn’t matter if you write this code in 1998 or 2018, it will still draw a polygon to the screen:
Well, actually, you wouldn’t want to do things like that today or you’d be wasting most of the available processing power. What you really want to do is pack a bunch of triangles into a buffer and send them off in batches.
Actually, that’s a horribly outdated way of doing things too. See, you really need to set up some vertex and fragment shaders. Except, not like this because that’s a naive way of doing things now, what you really want is to…
So now we come to the first problem with OpenGL. It’s got a lot of cruft. Cruft is what programmers call the ugly useless bits leftover from older systems.
The Tyranny of Cruft
Picture an old house. It was built before electricity was common in homes, so all of the wiring is on the outside of the walls. It has an intercom system from the 1960s that hasn’t worked since the 1970s. There’s a satellite dish in the yard that hasn’t been useful since the 1990s. There are lines going from the old roof antenna to every room in the house, even though that system was long since replaced by cable TV, which was itself long since replaced by internet streaming. It’s got ancient landline telephones built into the walls of every room, and nobody wants to remove them because that would just expose a big ugly hole that nobody wants to fix.
This metaphorical house has cruft. Lots of effort was spent over the years in an attempt to keep things modern, but when old systems became obsolete they left behind useless infrastructure. This is the downside of backwards compatibility. If you never get rid of anything, then it tends to pile up. As nice as that retro compatibility is, systems that offer it will eventually accumulate a bunch of ugly bits that make it hard to develop and maintain things.
This is where Vulkan comes in. We’re bulldozing the old house and replacing it with something modern. Hopefully this gives developers the freedom of OpenGL without all the jank.
So that’s what Vulkan is. It’s an effort to replace OpenGL so developers have a portable way to talk to modern graphics hardware without decades of accumulated cruft. Now is a good time to do this. Graphics technology has stabilized over the last decade or so. New stuff is still being invented. (Stuff like raytracing, which I’ll cover in a later video.) But we’re finally past the chaos of the late 90s and early aughts where you had to throw your game engine away every few years because there’s a whole new, better way of doing things.
Is there a downside to this? Sort of. We’re giving up that backwards compatibility I talked about before. Also, Vulkan is a lot more complicated to use than humble OpenGL. It interfaces with the graphics card more directly. It’s more raw. This means that if you know what you’re doing, you can make more efficient rendering code. The downside is that Vulkan makes it a bit harder for students, indies, and other assorted bedroom programmers to get started. But I don’t think that’s a big deal. The days of loners making their own engines from scratch are mostly over. I fiddled with making a lot of experimental engines years ago, but that kind of work isn’t really needed these days. Now we have commercial-grade engines like Unity and Unreal, which are available to anyone, basically for free.
So that’s Vulkan. It won’t make your life any easier, but it’s probably making someone’s life easier, and it’s probably making your PC games just a couple percent faster.
The Gradient of Plot Holes
Most stories have plot holes. The failure isn't that they exist, it's when you notice them while immersed in the story.
The Truth About Piracy
What are publishers doing to fight piracy and why is it all wrong?
Skyrim Thieves Guild
The Thieves Guild quest in Skyrim is a vortex of disjointed plot-holes, contrivances, and nonsense.
Here is a 13 part series where I talk about programming games, programming languages, and programming problems.
Good to be the King?
Which would you rather be: A king in the middle ages, or a lower-income laborer in the 21st century?