I need something handy that will let me change program options without needing to compile. Right now I have everything bound to mysterious and unexplained hotkeys. There are enough of these that I’m getting confused. Hotkeys are great for turning things on and off, but terrible for fine-tuning options. It looks like I need some sort of interface for my program.
|This computer interface is notable for the upper-arm and back conditioning required to use it. The upside is that, if it’s adopted, Photoshop artists will eventually look like bodybuilders.|
Now, I’m always banging on about how libraries should be as focused and unencumbered as possible, how you shouldn’t need to go on a multi-stage fetch quest to get the thing to compile like you were trying to assemble the pieces of the Tri-Force or something. The problem is, there is pretty much no way around this. Interfaces need to use fonts, and fonts are fiendishly complex beasts. Interfaces need to render stuff, and rendering is complicated. They need to process keyboard and mouse input, and those are complicated. (It seems simple, but tracking keyboards and mouse wheels and all the different things that can happen with the CTRL, ALT, and NUMPAD… it gets very hairy.) That’s a lot of things for one library to do, on top of running a window system with buttons and scrollbars and the ability to tab between interface elements and all of the other tiny details that we all take for granted.
Still, the inability to adjust options is really killing my productivity. So let’s see what we can find.
Wow. That is a very daunting list. Some of these libraries won’t have the functionality I need. Some will, but will have horrible dependency issues (some may even encapsulate others, or be forks of other items in the list, I don’t know yet) that will make them prohibitively difficult to use. Others will have horrible C++ interfaces that make a cluttered mess of your code. Some will have the functionality I need, but will lack the visual customization I need. (I know a few of these are designed to create standard “windows” style interfaces, which would look just awful floating atop my Seussian fantasy world.) Some might have all of the above, but be tied to a particular platform. Or lack proper documentation. Or turn out to be long-abandoned projects that no longer work due to shifting technology.
I could easily burn a couple of days downloading each and every library, getting it to (hopefully) compile, testing it out, evaluating the interface, the looks, reviewing the documentation, and making sure it actually has all the features it claims to have. (I don’t want to install the thing into my project and three days later discover that something fundamental like “text input boxes” is still on the to-do list.) This promises to be a massive investment of time. The truth is, I’m not ready to make this kind of commitment. Really. It’s not you, it’s me. I just can’t afford to be tied down at this point in the development cycle.
I began this project as a tech demo, that could become a game. But the tech demo comes first. And adding a all-singing, all-dancing, multi-window interface falls way, way outside of that scope.
Thinking about this more, what I really need is a “Quake-style” console. If you ever hit the tilde key in Quake, you probably saw the text window that opens up. That window lets you enter commands, change variables, and generally control the application without needing menus and scroll boxes and the like. This is exactly the reason console windows exist: For the proof-of-concept / prototyping stage of a project.
I ask Google, and it brings me this: glConsole.
The bad news is that it was developed on another platform (Linux, I suspect) and there are no binaries available. So I’m going to have to get it to compile. It uses CMAKE, which is supposedly a totally cross-platform system for compiling code, a claim of which I am mildly skeptical. Well, it can’t hurt. Let’s see how this goes…
(Two hours later.)
I return to you a changed man. Everything I knew was wrong. CMAKE took a little self-education to use, but once I had the knowledge it did its job flawlessly. There was an odd compile problem where glConsole complained that it didn’t match it own version number or some such piffle, but commenting out a couple of lines fixed that right up.
Let me tell you about glConsole…
It works. It works beautifully. It works seamlessly. It dropped directly into my project with no additional dependencies. It displays text, but I have no idea how. I don’t see a bitmap among its resources and it doesn’t do any font loading. It just magically makes text. I suppose I could look at the source, but so far there’s been no reason to do so. I was able to add it to my project in, I kid you not, five lines of code. I tell it when to open and close. I tell it when to draw. I feed it keypresses. That’s it. Done. I don’t even need to initialize it.
Even better, it comes with a bunch of other features:
- Built-in environment variables. I create them and access them at will. It keeps track of them for me, saves them, remembers them between sessions. It even has auto-complete, so it can remind me of my own variable names while I’m typing them in the console.
- Environment variables can be organized into groups. I have one group: render.wireframe, render.lighting, and render.textured. And another group: mouse.invert, and mouse.sensitivity. This system can plug into another, so when I DO add a full-featured interface, I’ll already have all of the functionality implemented. I’ll just need to have the interface change the already-existing environment variables and it will be done.
- It can save options into any file I like. It can save groups or sub-groups of options. So, I can stick all of the player data into a group: player.position, player.heading, player.camera_zoom, etc. Then I can save all of the player.* options into a file. Boom. My save-game system is done, and I wasn’t even planning on working on that this week. I got it done as a side-effect of adding this library.
- It keeps a command history, which persists between sessions. So, I open up the console window and hit the up arrow to cycle through previously typed commands, even if I closed the program since I typed them. This is incredibly useful when I’m debugging and iterating very quickly, needing to try the same options over and over.
- I can execute functions from within the console. So, I can have commands to save the game, load the game, restart the rendering subsystem, purge texture data, or whatever else is needed for testing.
I’m dumbfounded. Not only did this library perfectly and seamlessly solve the problem I had in mind, but it solved future problems I hadn’t yet considered. Author Gabe Sibley has shamed me as a coder. I’ve used hackjob libraries downloaded from the internet. I’ve used enterprise level solutions that cost tens of thousands of dollars to license. And nothing I’ve ever used as been as smooth to integrate and intuitively designed as glConsole.
“If I could write software like that, I’d call myself a programmer.”
The Death of Half-Life
Valve still hasn't admitted it, but the Half-Life franchise is dead. So what made these games so popular anyway?
Raytracing is coming. Slowly. Eventually. What is it and what will it mean for game development?
Why Google sucks, and what made me switch to crowdfunding for this site.
Top 64 Videogames
Lists of 'best games ever' are dumb and annoying. But like a self-loathing hipster I made one anyway.
Gamers Aren’t Toxic
This is a horrible narrative that undermines the hobby through crass stereotypes. The hobby is vast, gamers come from all walks of life, and you shouldn't judge ANY group by its worst members.