Only One Heart Dev Log

The making of One Heart, the neon samurai deathmatch game

The reason things have been a little quiet on the update front is because I've been gunning development on One Heart, a game to feature in the SK Games' Interstate Arcade, a pop-up arcade that will be touring Australia come November. Cool right?

Well, I definitely thought so when I read about it, and couldn't resist signing up. Matt was in a similar frame of mind, and altered Fatal Theory to include a continuous play survival mode suited to their cabinets. But I'll let him announce that later.

THE CONCEPT

Back to my contribution. I needed to think of a local multiplayer game I could make fairly quickly for the arcade so as not to bottleneck SSK's development for too long. I mulled it over and realised I had just the thing tucked up my sleeve already: an idea for a one hit kill swordplay game, like Bushido Blade meets Nidhogg. The scope for this particular project is pretty big, and will be a major release from our studio, but I figured if I could at least prototype the most basic combat and throw players into a frantic deathmatch, it would satisfy the requirements of the arcade while also being useful down the track. The old two birds, one stone trick.

I'd also just been to a 'Game Masters' exhibit at the Powerhouse Museum, which had all the classic awesome arcade games on display and the stories of their creation. Missile Command, Space Invaders, Asteroids, Tempest, Pac Man... All those wonderful games from the very birth of gaming, when it was all still fresh and devs were testing the limitations of both the joystick controls and computational power. Before things got all high budget, cookie-cutter press-X-to-cutscene. There was something magical in this arcade, it spoke to my soul, and I wanted to make something honouring that heritage, if only in aesthetics.

 This is the concept art I submitted to the Interstate Arcade planners:

Design

The design was inspired by my experience in the arcade too. Before "stick to move, buttons for actions" became the standard, people were doing really interesting things with their inputs. Rapidly spinning a trackpad around to try and shoot missiles, for instance, is a really physical way to engage with the action you're undertaking. I wanted to do something like that.

I got to choose what cabinet I would be using for the arcade, and I landed on one with just two sticks and a button in the middle. The left stick would be to move, and the right stick would throw slashes in the direction you tilted it: high, mid or low, and would need to be resetted to the center before you could throw another slash. This would make attacking in game a physical action for the player, and I'm hoping to see them throwing the sticks around like crazy in the heat of battle.

 

The mechanics besides that are simple, and very much inspired by Bushido Blade and Nidhogg: if you hit your opponent's sword with a slash, both weapons are deflected. If they're slashing and you hit their slash with your own, you cause a knockback that sends you sliding backwards. If you hit your opponent's body, they die. The middle button was originally going to be a change of stance, to put the sword behind you (less front defense) and make your attacks slightly faster, but I ran out of time. I think the game is fine without it anyway.

The Making Of

I let that concept sit there for awhile, until Matt and I put aside a weekend to jam. He worked on Ludum Dare while I worked on this. I decided to use libGDX because it's what I'm most comfortable with, and gutted my code from Starslinger Kings, pulling out what was useful. The physics, collision code, menu hierarchies and player states/rendering were all modded straight over. I had a little samurai dude running around in no time.

Then I made a decision that would prove unnecessarily time consuming but ultimately rewarding: I decided to learn to write a fragment shader. 

Getting the look

Part of the whole retro arcade cabinet look is the RGB colour shifting that occurred around pixels on the old CRT monitors -- and if that's gibberish to you, look at the image above. You'll notice the cyan has edges of green pixels above and blue below, and that the white flash top left has all red green and blue surrounding it. It's probably most visible on the yellow guy actually. I'm no science guru and couldn't tell you why CRT monitors used to do this, but I can tell you that it looks cool. And I wanted it in the game.

In the concept, this effect was achieved in Photoshop, by separating the image into 4 layers: one for the red channel, the blue channel, the green channel, and the regular image on top. Then the separate RGB channels were just shifted one pixel up or left or down from centre, and voila. It's absurdly easy to do in Photoshop.

So I could have just baked the effect into the assets, realistically. The time drain would have been negligible. But, as always, I wanted to learn something new, so shaders it was.

I hit the docs, read this wonderful resource about the render pipeline and shader implementation in libGDX, asked around on twitter a bit, and within a couple of hours had this hot mess happening...

 

What followed was endless, ENDLESS tweaking to get it to look right, complete with much confusion and a lot of forehead slap-worthy moments. I was in completely foreign territory here, but eventually I was able to prevail. And by eventually... I mean after about 2 weeks of an hour here or there, thrown in after midnight or before going to work.

The Everything Else

With the shaders in place, the first thing I did (in what was definitely a weird moment for me) was build the menu first. It was simple enough: animated title, connect players, start a countdown if sufficient players connected. I knocked it over in a night.

Then it was time to make the animations. The hardest part, surprisingly, was the run cycle. It took me all of Captain America: The Winter Soldier to get right. I had no clear idea what I was doing with the slashes or the death animation but they just kind of fell into place, I'm pretty happy with them. Also pretty happy with my decision to run stylised neon silhouettes for characters, having no detail to mess with cut down the total time spent animating immensely. These are the base animations I came up with, shown here without shaders.

The blood proved especially fun to animate, especially getting it to look like it was spraying onto the wall behind. Here's a gif, if you want to see how I did it feel free to pull it apart (and if you don't know how, get in touch and I'll show you the frames).

Though there was this one incident, where I came home super drunk from a party and tried to whip up an alternate animation... Try to guess which of these sets was made drunk, and which sober!

And that just left the deflects, which I got Matt to help me visualise and came out like this. Thanks bro!

 

Pixel Perfect Sword Collisions

With all the assets done, all that remained was the collision checking of the sword attacks. I wanted it to be pixel precise, mostly because I was curious how I could possibly do that. I was going down the shader path all over again. Eagerness to learn new things, it turns out, is my biggest flaw in project/scope management. Who knew.

I had an idea to draw player masks just long enough to check them for overlaps, then draw the actual frame based on those collisions. Then I found occlusion queries, which basically does just that, but draws the masks to the GPU instead of the screen, which makes way more sense. Unfortunately, for the CPU to do anything with the data returned by the GPU, it has to wait until that render frame is finished. In other words, every time a collision check is completed, a frame is dropped. Not exactly ideal for a lightning fast reflex oriented game.

So I said fuck it, used basic AABB collision checking instead and was done with it. And you know what? Aside from one or two moments, you'd never know the difference.

Polish

Now came the fun part. I'd put all that junk in the game, but it was still clearly missing something. That's right... the game still had no screenshake! What a disaster. I put screenshake in, but also introduced in a matter of a few lines of code what, to me, makes this game more than anything else: kill shot freeze frames.

Maybe this just speaks to my disposition and lack of good character, but something about pausing the action to see where your blade landed is so satisfying.

And finally, sound. I sounds were completed with my good buddy bfxr, which lets even talentless hacks like me make sounds for their games. Neat huh! The sword deflections sound super 80s anime, but I think they work. The whole thing is pretty 80s anyway.

The actual fun part: testing

With the game sitting on done, it was time to test. Matt and I grabbed a controller and after the first match, looked at each other and said "yeah, again." We were never able to play it just once or even twice, every time I needed to test something turned into a handful of matches. Which I honestly feel is the best sign of a good game: I really just wanted to keep playing it. Unfortunately nobody else was handy to test all four players, so that process looked like this:

Yeah. I still haven't played it with four people yet.

Ship that bad boy!

With the game done, only thing left to do was ship it! I sent it over to SK Games for the Interstate Arcade and chucked it up on itch.io for free. I'm glad I did too, as it currently stands (one night on) I've made $10 from people choosing to pay for the game, and 22 people have downloaded it. That doesn't seem like much, but the game is pretty restrictive in terms of you needing friends, xbox controllers, windows and a JRE just to run the damn thing. Still, people have told me they're enjoying it and have plans to stream a 4 player match, so that's awesome. That is honestly all I want from this game: people to have a great time.

I can't wait til November. The Interstate Arcade hits Sydney right on time for my birthday, so my present will be getting to see people playing my game at an arcade. Best. I think I'll challenge a few of them, and just not tell them they're playing the game's creator. I think that could be fun hahaha. Chances are I'll get my demolished at my own game, but I'm totally happy for that to happen.

Here's how it looked in the end

Joomla BJ Metis template by ByJoomla.com