The Gods Are Angry - The Techy Stuff

I'm still playing catch-up in terms of rating other people's games, but I'd like to take some time to write up a breakdown of some of the techniques and design works that went into developing The Gods Are Angry. I've seen a few other people do this, and I thought it might be an interesting read for fellow PICO-8 devs, or people who like 8-bit-style games.

The Camera

The Gods Are Angry uses an "offset" value to determine how far into the current level you are. In a later post-jam update, I'll use this to render the smallest possible chunk of level, but current, the game draws the whole level at once, with "offset" used as the X co-ordinate of the left-hand side of the level. So if you're 300 pixels into the level, "offset" will equal -300.

If you change direction, the camera doesn't move immediately: there's an eight-pixel window within which the camera will stay still. This wasn't really necessary, since you only have to move left about twice in the whole game, but I hope to make a more complex PICO-8 platformer at some point next year, so having this feature already baked into the engine will come in handy for that.

ld43pj_2.gif

The Graphics

For those not familiar with PICO-8, it has a strict set of graphical limitations: up to 256 8x8 sprites or tiles, a maximum map size of 128x64 tiles, and a fixed 16-colour palette. I've always found it to be perfect for Ludum Dare as its limitations force you to think small.

To fit with the game's sombre tone, I went for a quite dark, subdued look to the graphics. The way the terrain fades away into blackness was actually inspired by Shovel Knight's graphics, and not only did it fit the tone, it reduced the number of tiles I needed to place when making levels, saving me time.

ld43_inspiration.png

The background is drawn in three parts: a repeating 8x8 gradient at the top, a repeating 32x8 mountain range silhouette, and a solid rectangle in between. The rectangle is static, but the repeating parts at the top and bottom are scrolled at different speeds relative to the offset, resulting in a simple parallax effect.

ld43pj_1.gif

The lightning effect is one I'm particularly proud of, but it's actually quite simple. The game generates a random number between 240 and 360, then counts down for that number of frames. When it reaches 5, a thunderclap SFX is played, a lightning bolt is drawn at a random spot in the sky, and a series of palette-swaps brighten up the level. When the counter reaches 0, the bolt disappears, and I use PICO-8's pal() command to reset the palette back to normal.

Oh, and did you know the lightning also flashes if you linger on the title screen?

ld43pj_0.gif

Collision Detection

Since The Gods Are Angry doesn't have any moving obstacles apart from the geysers, its collision detection system is pretty simple. That's one part of the engine I'll have to rewrite if I use it in any future games.

Vertical collision detection runs every frame. If you're moving upwards (i.e. jumping), it checks for obstacles above you, and if you hit one, your vertical momentum is reversed so you sort of ricochet back down again. If you're not moving upwards, it checks for obstacles below you, and if you hit one, your vertical momentum becomes zero.

Horizontal collision detection only occurs while you're moving left or right, and just stops you walking through walls or off the left-hand edge of the level. It also initiates the next cutscene if you walk off the right-hand edge. It's glitchy while you're in mid-air, which is another thing I need to sort out.

That's all!

Thank you for your time, and apologies for having played so few games so far. I only have two more days of work and then hopefully, even with Christmas going on, I'll have time for some more. Please feel free to check out The Gods Are Angry if you haven't already, though!