April 7, 2014 · technical gaming projects

Let's make the warp suck less

From our previous installment, we know that we got the warp stage throwing some spheres at the player with some pretty colours involved. The problem is that we're creating a static playfield of obstacles, and emerging from the other side into safe, empty space isn't fun. We need something more dynamic.

In this build, we create the illusion of a large continuous playfield by creating asteroids on every frame, and placing them only in the player's field of view.

you really need to see this moving...

Here's how we do it. On every update, we project into the distance along the player's line of sight: say 15,000 units away on the Z axis. Then we take a random offset to the right or left. So that's a translation on the X axis, somewhere between -15,000 (far left) and 15,000 (far right). Since our field of view is 45 degrees, these asteroids will definitely appear somewhere on the visible horizon.

If you visualise a T shape stretching out in front of you, we're creating danger on the top bar of the T. Since the T shape is always projecting straight ahead, no matter where you turn we will create asteroids in the right place.

With some tweaking, the current version gives a passable warp experience. Crucially,

the original warp

It strikes me that the unbearable tension in the original game is mostly due to the horrendous wailing of your warp drive (it's a warp drive in my mind. Who knows what the official explanation is). When you reach top speed on the C64, a solid atonal blare vibrates into your bowels and makes basic motor function difficult.

That's a solid item for the TO DO list. For the moment I have no idea how I'm going to create continuous sounds in Javascript - like Warp, or the Player movement noise - while keeping the authentic synth effect.

To make warp a bit more intimidating in the meantime I inflated the asteroids to be sized at 150% of normal Shots in the world phase.

With an eye on detail, the way that the asteroid field is generated is a bit naive and needs improvement. Currently we create one sphere per frame. This means when you're going slowly - i.e. the acceleration phase - the field is more dense for no good reason. Added to that, a low-FPS platform is going to have an easier time with a sparser field. So that's another item for the TO DO: create N asteroids per second and don't depend on the current FPS.

Lastly, there's a pretty obvious bug right now for triggerhappy players. Any shots in flight when you enter the Portal will hang around and mysteriously freeze... then come back to life when you exit warp into the next round. This is because I don't have a clean way to sweep the Shots specifically out of the State.actors array. Not a big deal but some refactoring needed.

Finally lastly, don't tell anyone, but you can press K (mnemonic for Kill Evil UFO) at any time to zap the enemy and skip to the warp.

If you find a bug or have any suggestions, don't forget to leave a comment : )

Loading Google+ Comments ...