Singing the fragment shader blues


I’m making a PC version of Dominant Species. There, I said it.

I don’t think I have to tell you that Chad Jenson is a genius or that this board game is one of the best piles of wood and cardboard ever to grace my table. You know perfectly well how excellent Dominant Species is.

It is also easier in concept than a full-fledged video game. I can make this into a video game, theoretically putting out a working hotseat-style game within the next couple months and integrating internet play without too much more difficulty later. Possibly even building an applet version that can be based online.

All of this is almost certain to land me a job with GMT games. And I will be rich beyond my wildest dreams. I think.

Anyway: fragment shaders can lick my balls.

Every fragment color that goes through there (using a four byte RGBA format), no matter which of the 17 million possible floating point values between 0 and 1, will always be output as if it had an alpha value of 1. Which means that transparency is impossible. No fancy fade ins or fade outs or just fucking transparent objects. It’s driving me batty.

If any of you fine, gentle readers know of a way to fix this problem, I will put you in the credits for the first full-fledged game I create.

Meine Realität ist fragmentiert.

Life in the Shade

Okay.  An update.  Yeah.  I haven’t been working as diligently on this project in the last week or so.  Life, as they say, intervened.  Indeed, this past weekend, I was involved in a 24 hour play production.  Five writers, five directors, 15-18 actors, 24 hours.  As a writer, I was tasked with drawing an object, a location, and a first line from three hats and then writing a fifteen-ish minute play between 8pm and 7am.  The next morning, the casts and directors took my script and made art out of it.  It was all immensely gratifying and fun.  Indeed, it was the first time I’d ever seen anything I’ve written performed by actual human beings.  I have performed sketches that I’ve written, but never watched it from the audience.  So it was fun.  Jolly, great fun.  Perhaps I’ll post the script to the play here at some point in the future.

Anyway.  I’ve had a bit of a breakthrough.  I have been wracking my brain to come up with ways to get more than 30 frames per second.  I have a really nice computer; this is no reason that I should be getting any less than 60 frames per second on a rendered 2D world.  Well, it turns out that the Lightweight Java Games Library (LWJGL) is a pretty curious and odd API and not only was I using only the tiniest fraction of its functionality, I was using literally the oldest commands OpenGL had to offer.  I have found a far more efficient way of rendering the map.  The problem is, I have to rewrite the whole thing.  This is fine, of course.  The first test program was just a way of seeing whether the heightmap software worked and whether I could make a map that I could scroll through.  That worked, so, great.  But then I hit the wall.

I have a spritesheet for an avatar (I’ll probably have a post about overcoming the fact that I’m not a pixel artist, or indeed, any artist), but I had no idea how to make it render and animate properly.  Well, yesterday I learned about Vertex Buffer Objects and Vertex Object Arrays.  And my entire life changed.  instead of using just the OpenGL 1.1 commands, I’ve expanded far further, well into OpenGL 3.0.  It has been terrifying.  I had not realized just how much I have to learn yet.  Shaders are a pretty key concept.  If I’m going to be shoving this stuff off to the graphics card to process, I have to use OpenGL shaders.  If I’m going to use OpenGL shaders, I have to learn about…OpenGL shaders.  And so I’m learning GLSL.  And it’s utterly confusing.  But I’m making progress and that’s good and my current goal is to have a world with an avatar by the end of November.  Fingers crossed.

Cirque du fouture de merde.


Not only was today my birthday, but I got the map demo to function properly. The current code can generate a random heightmap from a seed integer, render it to the screen, and–and–I can scroll around map with arrow keys or by grabbing it with the mouse. For a 96×96 tile map, I get an even 30 frames per second. This is not ideal. I’m not sure how to make it render faster, but honestly, I feel pretty damned good about this. It looks good, it slides well, and I really think it’s a success.

Next task, I think I’m going to try my hand at spriting. I’m going to create a player avatar and attempt to animate him/her. Maybe once he/she is ready, and I have a few other game assets (and a new ground tileset), I’ll tell you all what the core concept of the game will be.

I’m starting to feel hopeful about this.

Alles Gute zum Geburtstag fur mich.

So close, yet so far away.

Would it be trite to say that this is a Sisyphean task? Am I breaking some sort of horrible cliche rule? I don’t care.

Anyway, I’m so close I can taste it. Some problem with my textures mapping to the tile in the world. I’m grabbing too much texture and I want to grab just enough. Sprite sheets be damned.

I’m off to game night.

In the meantime, if someone would be so kind as to explain how to use the following code:

GL11.glScalef(1f/10f, 1f/8f, 1f);

Just leave complete and concise explanations of how the glScalef() function works and you will be my best friend.