Wednesday, May 16, 2018

Ejector

On Sunday morning, I woke up with a game idea stuck in my head; I spent a few hours with GameMaker over the course of the day, and by 9pm I had something I was happy enough with that I posted about it on Twitter. I'm never happy with my stuff enough to post about it on Twitter.

It's still full of other people's art assets and unlicensed fonts, and most of the code is borrowed from ShaunJS tutorials (but that's what they're for and anyway I used to work with him, so that's probably okay).

As I've worked on it over the last couple of days, and started thinking about how to make it a game rather than just a partially-implemented mechanic, I've come to realise that it's pretty much Nanaca Crash: the player has some limited control over the initial vector of their character's travel, and then it's basically just a case of seeing how far they can go.

I'd started to write about another GameMaker project I was working on earlier this year, but when it came to implementing the shooting mechanics I realised that I didn't want to make a game about shooting, so that's been canned until I figure out what the verb needs to be.

(This is still kind of violent, but it's very slapstick and only against your own character so I feel like that's okay.)

I'm close to getting all of the input mechanics finished - rather than Nanaca's single click-and-hold for both angle and power, I want to separate them into a hold for setting acceleration and some kind of Ouendan-type trigger for controlling angle (in progress). Initially these inputs were both controlled by the car object, but since I'm hoping to eventually have an upgrade system that would let you change the car, moving them into a separate launch controller took up most of today.

I'd dropped a basic sin() function in for setting the acceleration value - which worked for the proof of concept, but in practice the way it decelerated around the maximum value made it too easy to get the best distance reliably (in the absence of control over your launch angle).

acceleration_modifier = (1 + (sin(frames_held/period + 3*pi/2)))/2;

What I was after was a curve that would speed up as it got close to the maximum value, and bounced away just as quickly, making it much harder to hit the top every time. It was only when I drew out what I wanted that I realised that it's still basically just a sine wave, but with part of it inverted - which led me to

acceleration_modifier = 1 - abs(sin(frames_held/period + pi/2));

And now, onto the launch angle…

No comments: