Jan 27, 2019 - How to Design a Gun

Comments

I love guns in video games; there’s a lot that look and sound really cool. Many games feature gun designs that are so iconic they become part of the identity of the game: there’s the versatile gravity gun in Half Life 2, the beefy assault rifle in Halo, clever portal gun in Portal, and beastly lancer in Gears of War.

assault rifle lancer

Some guns are not only iconic in games, but in movies, even in real life. James Bond’s favourite pistol, the Walther PPK. Or the AK-47, perhaps the world’s most famous assault rifle, well-known in Counter-Strike and many other games, as well as real life - even the flag of Mozambique. Needless to say, their appeal is universal.

ppk ak47

Let’s say you want to design some cool guns for your game. How would you do it? A lot of first-time designers might take bits they like and mash them together. There’s a lot of art kits and even some programs that allow you to do this. Unfortunately, the result often doesn’t make sense, and looks inconsistent.

gun kit

Read more

Oct 2, 2018 - SDL_RenderCopyEx

Comments

SDL_RenderCopyEx is a function in SDL2 that allows you to rotate, scale and flip sprites. But how do you use it? I was wondering the same as I wanted to add bullet trails to C-Dogs SDL. The official documentation tells you what parameters to use but not how they will look. So I just tried it out myself:

sdl2-rendercopyex-demo

This is a simple demo project which uses SDL_RenderCopyEx to rotate, scale and flip a sprite. There’s also a center parameter which controls the center of rotation, which defaults to the center of the sprite you are rendering.

sdl2-rendercopyex-demo

Read more

Aug 16, 2017 - Three Factions

Comments

Some of the most fun and interesting games feature three factions. The number 3 is a magic number, allowing for interesting asymmetries. You often see factions that are unique, provide lots of gameplay variety, and are flavourful too. But how do you mechanically balance three radically different factions? And how do you come up with three thematically unique factions?

It’s not easy. With just two factions, balance is a lot easier, as you simply buff one and nerf the other, but with three (or more) factions, anything you do could inadvertently affect the balance with the third faction.

Duality

One common method is to take a classic duality, and have two factions represent each extreme, with the third, “balanced” faction in the middle. TVTrope’s article on the subject mentions the classic duality of powerhouse/subversive. So one faction is a powerhouse, favouring raw strength, the second is subversive, favouring clever tactics and engagements, and the third balanced between the two.

Yin Yang

How does this work? The important thing is that there is no inherent advantage to either side of this duality. The powerhouse is powerful but slow and predictable; the subversive is weak but fast and flexible.

A great example of this is in Westwood’s Dune RTS games and the unique tanks of each faction. The “evil”, powerhouse Harkonnen have the Devastator, the most powerful in the game but slow and ponderous. The “insidious”, subversive Ordos have the deviator, a tank which has no attack but can temporarily take over enemy tanks. The “noble”, balanced Atreides have the sonic tank, which apart from having a unique attack, is otherwise equivalent to a heavy tank.

Devastator > Deviator > Sonic Tank

Read more

Mar 6, 2017 - 3D Rendered Pixel Sprites

Comments

In the recent C-Dogs SDL release, I introduced a new walk cycle animation using pre-rendered 3D sprites; check it out (before, after):

C-Dogs SDL walk cycles

The content pipeline goes like this: Blender, bash/python render scripts, Imagemagick touch-up, montage spritesheet. The results are surprisingly good, given that no manual retouching was required; I can directly edit the blender file, and create updated spritesheets.

Background

Initially I was leery of this whole project. Pixel art is usually done by hand and laborious enough already; creating animations just makes the amount of work explode. The original sprites only had 4 directions (left/right can’t be mirrored due to the gun-handedness), 2 poses (unarmed and holding gun), with idle (1 frame) and walk (4 frames) animations, for a total of 4 × 2 × (4 + 1) = 40 frames. The project was to show all 8 directions with an improved walk cycle of at least 8 frames, which would make the total number of frames balloon to 8 × 2 × (8 + 1) = 144 frames. That’s a lot of work to do manually!

Not only that, but there are future plans for more improvements, like “textures”, different body types, different animations, each of which multiplies the amount of sprites.

Obviously the alternative is to model and animate the whole thing in 3D. But there are big questions around this approach. Will the animations look as good? Can rendered sprites avoid that “rendered” look?

Molez

This is what pre-rendered sprites looked like in the 90’s

Read more

Dec 2, 2016 - 2D Overhead Traversal

Comments

Why are open world games so fun? A lot of reasons: a huge, interesting world, lots of things to see and do. But one important mechanic that support this, and which pops up a lot when people talk about open world games, is traversal. What’s that?

In a nutshell, it’s the way the player moves around the world, getting from A to B. This sounds (and often is) mundane, which would be a problem for open world games with huge worlds, which is why these games often have interesting, advanced techniques to get around. You see this a lot on 3D open world games.

When it comes to great traversal mechanics, two games often get mentioned: Spiderman 2 and Just Cause 2. In the former, you use your web to swing around the city, and in the latter, a unique combination of paraglide and grappling hook lets you fly around quickly. Both take some skill to pick up, but the result is a fast and cool way to get around their game worlds.

spiderman 2just cause 2

Other games also get mentioned, but I’ve noticed that they are all 3D games, and the traversal mechanics described are 3D mechanics. I’ve been thinking about how traversal might work in a top-down 2D game; a lot of the things that work in 3D simply aren’t there. Like:

  • Great views: open world games are fun because they have great scenery to enjoy. Many open world gamers have anecdotes of climbing up that big mountain to get a spectacular view, or seeing majestic buildings and landscapes in the distance. In a top-down 2D game this simply isn’t possible.

    oblivionarkham knight

Read more