Thank you, Xzyliac, Occams, Law, Corduroy and Mana for indulging my desperate bid for title tweets. Special thanks to Xzyliac for the current title and Turtle for "Much Ado About Muffin," because Jiminy Cricket, that is wonderful.
I can't help but notice the proliferation of thought blogs these days
. And that's fantastic. Your words are like the third bowl of oatmeal - just right, and put together by things which terrify little girls. But, here's what you guys need to do: get yoselves a Google Doc together and let the cup runneth over. Just have at it, see what comes out.
a terrible idea.
Another week, another level in the text adventure of my blog. Let's throw some arbitrary artifacts together and hope it unlocks the hidden door. Uh, the hidden door of the mind
. Yeah, no, this is happening.
Let's try something new. Something a might narcissistic, and probably very boring. These days, all my thought trains are leaving the station in the direction of Let's-Make-A-Game City (approx pop: the internet
). It's kind of what I'm fixated on and of late, I haven't spared much for anything else. However, I'd tentatively propose that this seemingly modest vein is a rich one. What if, I wondered to myself, I put word to some of the fancies which were fleeting through my mind? Well, I further reasoned, then I'd probably lose what meager readership exists. So what, I rationed, most of them were only sticking around in the hopes that I'd finally announce my retirement.
And then we arrived here.
The design de jour
is procedurally generated textures. Now, procedural generation is a big, sexy topic and I hope to get down and dirty with it along the way, but for the time being, we'll make do with some teasing about textures. Now, listen, I'm a programmer (of sorts), so I do this thing called "programmer art
." While that's hardly the crux of the motivation, it does lend itself to a certain impetus. Y'see, I am right awful at drawing things, so the idea of drawing a lot of things is, well, - y'know how getting poked in the ear with a pickle is unpleasant enough that you're unhappy to experience it once, let alone enough for an entire spritesheet worth of, er, pickle pokes?
My, that analogy soaked up a little too much brine.
The source of all my inspiration.
With procedurally generated textures, properly done, you take that multiplicity out of the equation, somewhat. The procedural generation throws a smock on the PC and lets it play the artist for a spell, creating the game's images. Some sort of algorithm describes the makeup of the texture in production. Exactly how that breaks down is a big ol' can of worms, but the idea that you can sit back and let a script churn out a mess of pleasant pictures on your behalf is grand. It doesn't have to do things from the pixel-up, but anything that'll pull together images is a boon. Anyway, today, I tried in earnest to hash out a way to make that happen.
Since my game will be, hopefully, generating random people, it's important they look distinct. So, the idea was to design a way in which my game would create sprites for the people in it. Ideally, the sprites would introduce some variation, but still look, if not pretty, at least not eye-searingly hideous. Obviously, yours truly was a prime base line insofar as hideousness goes. And three workable schemes floated to the surface.
First, and least peachy, pounding out a whackton of static sprites and letting the game grab one as needed. That is, a person would be created by pulling one of the predefined images out of the set like you would a card from a deck. This? Nope. Nope
. First, it's really, really boring. Second, this doesn't really spare me from drawing a lot. Next
The second, and most best idea, is defining pieces
. Segment your images, then mix-and-match. For a face, you'll take eyes, a mouth, a nose, a chin, maybe some eyebrows and hair, each pulled randomly from a superset, then maybe stretch them out a bit and stitch 'em together. It's a really cool, practical idea. You can define a great range and it's really easy to not just reliably and predictably make a decent face, but adding a new feature to the set is a simple matter of adding it to your spriteset or what have you.
So, I mean, that's rad. It's like, well, a menu is a good analogy. You grab your appetizer, entr馥, and desert and go to. They don't necessarily have to go together perfectly, but you can still have a great dinner and go home happy.
And then there's the third option. Oh boy.
Okay. Take a face. Now, mark a few points as vertices. These are the critical, defining features of the face. Do stuff like the chin and the top of the forehead. Good. So, these vertices are connected by edges, and that polygon is a face. Confused? Don't worry, that's because I'm like a bear wielding a pistol when it comes to words. Y'know, clumsy, and a dangerous to everyone around. Let's look at a picture.
Your head doesn't look like this?
Great. So, let's say you wanted to add some variation into this guy. Principally, you could throw in a bit of randomness in the vertices. Give 'em a bit of variation, just a pixel or two, up or down. Suddenly, blammo, you've got a random face. Wonderful. Of course, there's so much wrong with this. It's hard to describe formulaically. It's not reliable. There is no guarantee that any amount of effort will really pay off. You would really, truly have to be aggressively idiotic to go after this.
"So, dickboner," I remarked myself, taking a moment to reflect on the increased hilarity of using "dick-" as a prefix and giving no thought to the inevitable decline in readership this perceived humour would inevitably lead to, "I bet it'd be pretty awesome to do that last one."
And increasingly long story short, I did. And god, the efforts paid very little dividends. Still, I think it's a really neat idea. Just in brief, I'm taking in a sprite like the one in the picture above and eeking out the red vertices. The green channel of the vertex pixel gets parsed out into the X and Y variation (ie, 21 can vary 2 pixels in the X and 1 in the Y), and the blue gets parsed into the vertex's order in the set (ie, so dots can be connected). Then, well, the vertices are placed and connected and the polygon filled in. And bingo, you've got a face. Uh, sort of. Looks kind of like this:
Oh, hey, eyes. Uh, they're all blinking. Don't worry about it.
Alright, so it's not pretty. A big part of that is the unbounded variation. Since the vertices wobble about without regards to one another, things get really wild. The next step, presumably, is to make the randomness more deterministic, maybe with a little information in the as-of-yet unused red channel. We'll see. But yeah, feeling pretty okay. Some of those look like they could've once actually been people, before the nuclear rain which mutated man into a race of deformed and twisted beasts. For a prototype of a couple hours, it'll do.
God almighty, how boring was that? Jesus. Okay, sorry. I think I might try this again, but if I do, I promise I'll try to make it more exciting. Don't know how, just yet, but I sort of stomped this out for the sake of getting a blog done. But goodness, why is it so long? Oh well. Until next week, my lovelies.
LOOK WHO CAME: