Tuesday, June 23, 2015

Pixel Pushing

Hey all! It's been a while, hasn't it. Last post was shortly before finals week, I believe, after which May term classes and a new job ate up most of my time. That doesn't mean I haven't been working on game development, though!

In my last post (long, long ago), I talked about procedural generation. Procedural generation (proc gen for those of us In The Know) means using algorithms to create levels, enemies, worlds, characters - anything, really - instead of making those assets by hand. It allows for a single developer to develop A LOT of content quickly, as all he (I) have to do is write an algorithm. Now, I don't want to minimize that - those algorithms can take months (if not years) to develop. But once the code is working, it can literally generate an infinite amount of unique content. That's pretty sweet.


Last blog post, I was hoping to work on an algorithm that would generate an entire city for a first-person shooter type game. I basically concluded that that is a little too ambitious for my current level of coding expertise, and talked about some alternative plans. You might remember this guy?

Well, that's the angle I ended up pursuing. I set aside the shooter - temporarily, not forever! - in order to focus on a more attainable project in two-dimensional procedural generation. Here's a quick peek at my progress:

In that image, the stars and the mountains are procedurally generated. I can generate a new, totally random and unique layout of them at the click of a button:

These algorithms are completely customizable - I can specify the color of the sky and stars and the probability of different-colored stars appearing, I can choose the average height of the mountain peaks or how jagged or smooth the ridge line looks. The beauty of this method is that I can generate new backgrounds on-the-fly, giving each level or scene of the game a unique background without any memory overhead.

It took me quite a while to get these right (more information on how I achieved the mountain-generating algorithm can be found here), but the truly hard part is what I'm working on right now - level design.

This is going to be a platformer in the sense that it is side-scrolling and navigating the environment will be part of the challenge of the game, but I don't want a tile-based system (think Spelunky or Super Mario Brothers). Instead, I want a beautiful game world that is as much fun to look at and explore as it is to jump around in. I'm drawing inspiration from Superbrothers: Sword & Sworcery EP and Ori and the Blind Forest. These games are gorgeous - but all of their art is hand-drawn. I need to develop algorithms that know how to make aesthetically pleasing, mechanically interesting levels that fit my art style and can be generated quickly and on-the-fly.

So that's where I'm at now - coming up with level-generation algorithms. I am studying the art and level design in S:S&S EP and Ori and the Blind Forest and noting how the levels are set up. Essentially, the algorithm will need to generate platforms - discrete, mostly level areas where the character walks - and know where to place them in relation to each other for a natural look that stays interesting to play in. Then it will have to know how to connect the platforms to each other. Finally, in order to avoid the 'blocky' look of Super Mario Brothers, it will need to know how to 'disguise' the platforms with scenery and transitions between them. Both of my reference games do this very well.

So stay tuned on that! Hopefully now that May term is over I'll be able to post more regularly.

I haven't given up on 3-D procedural generation, either. I will get back to it at some point, either after this project or a few projects down the line. Starting simple was a good idea, though - this project is teaching me the basics of procedural generation algorithms. It feels much more achievable than my previous project, as well.

Thanks for reading! More on the level generation algorithm next time.

No articles this week, but if you're anything like me this 30-minute Fallout 4 E3 segment will have you salivating. It's set in Boston!

No comments:

Post a Comment