itch.io is community of indie game creators and players

Devlogs

Build 103

RollerBlade
A downloadable game

Hello everyone!

Time for a new update! This is build 103.

In this update, I’ve added mostly what could be thought of as “cosmetic features” although I think they add a lot to the game, and some were desperately needed!

This time I’ll give a little more dev details in this devlog!

Let’s start first with the indispensable!

Enemies get properly destroyed when hit now!

Destruction triggers an explosion, enemies get disabled and start emitting smoke for some time.

Explosions are simply alternating black and white discs. An explosion is created with a position and a size, and that size gets declined into a lifetime and a shaking parameter. The discs are drawn at random positions scaled by the size around the initial position, with a random diameter scaled by the size, for a duration also scaled by the size. A screen shake effect is applied for the duration of the explosion, with a random magnitude scaled by the size. The explosion sound is also pitched down for bigger explosions and lasts longer and is louder.

Planes are not as simple as tanks and turrets because they can’t just stay floating in the sky!

When hit, planes will start nosediving at various angles, emit smoke while falling then explode on contact with the ground. To do so, I’m giving each plane its specific “gravity” on initialization so that they fall differently from each other, while emulating gliding and not simply falling like bricks. Using math.atan2 with the speed vector of a plane gives its orientation angle, which can be used to the rotate the body of the plane accordingly to its direction.

Planes that are falling can collide with other planes and start a chain reaction!

Creating that behavior turned out way easier that I thought it would be! At first I thought I’d have to add specific collision check between every enemy and falling planes, but then I realized I just had to spawn a player bullet hidden behind the falling plane to obtain the same behavior!!

Explosions also can cause chain reactions, though that will be a more significant mechanic once I add more enemy types.

To make the smoke, I created a very simple particle system, where each particle starts with a position and a speed, a size and a rate of change of that size, and a lifetime. Particles are discarded when their lifetime expires or they get too small (or go out of the screen).

Having created this particle system, it was easy to reuse it for other purposes with different speed and rate of change settings, and with this I added bullet impacts on the ground:

As well as dust clouds behind the player when rolling on the ground:

Up to now, boosting worked, but the laser fired by the boost was only cosmetic and did not interact with the enemies. This is now remedied, and a bigger laser can be steered for a short while after firing to kill multiple enemies.

Alas, I couldn’t reuse the same trick as with planes colliding by hiding bullets behind the laser because it wouldn’t be instantaneous, wouldn’t go through enemies and wouldn’t follow the rotation of the beam, so I had to properly check if any enemy was in line of the laser while it was firing.

Less indispensable but still cool to have, speed lines when flying at higher speeds:

When the speed is over a certain threshold, a radius is lerp‘d from a high value to a low value. If it’s below that threshold, it gets lerp’d back to that high value. A random number of triangles (scaled by the speed) are then generated with their pointy end at random angle positions on an ellipse centered on the screen with that radius, and their base at a fraction above and below that angle outside of the screen. To prevent having to compute and draw all those triangles all the time, that routine is activated only when the radius gets below the value it would need to be for triangles to be displayed.

And for the cosmetic only, I added phases to the moon, which also gets slightly bigger for the full moon:

There are also things you cannot observe in gifs but that I nevertheless added in this build! I added sounds for the explosions, and a sound effect accentuating when health gets replenished. A bug made it so you could simply let the game run and the tank would slowly advance and regain enough coins to balance damage incurred by colliding with tanks and turrets! This is fixed now and a stopped tank stays stopped and does not continue to slowly advance. Bullets would not properly get removed when hitting an enemy so they got through them, this is also fixed now.

I also made a number of tweaks to this build:

  • allow the camera to zoom out more and shift less to the left, enabling seeing more terrain ahead
  • planes are slowed down and spawn at lower altitude
  • less coins are generated, but the boost and health bonus they give has been increased
  • clouds are spawn at lower altitude
  • increase damage and speed penaly incurred by colliding with enemies and enemy bullets
  • slow down boost charging and make boosting more costly to prevent boost-only gameplay
  • increase speed threshold for health recovery but increase that rate of recovery
  • decrease the slope between stages to make a less vertical launch
  • prevent tanks and turrets from spawning on that slope
  • increase the chance of generating coins on that slope
  • reduce the rate at which the terrain gets harder to navigate

I also worked a lot on the RNG. Without going into too much detail here (I’ll post a much more detailed post on this), the gist is that I use perlin noises for random “draws” and parametric threshold functions as a way to have a controllable and reproducible RNG. But I noticed it wasn’t behaving as I expected it to, and realized multiple things about perlin noise: its distribution is not uniform but normal, its mean fluctuates over time and more surprisingly varies wildly in the first few thousand values before settling into more stable oscillations. So I implemented a few things to regulate this RNG, and to summarise in one (well, actually two) pictures:

The thick curves are the value of the threshold functions over the distance, i.e. what should be the probability of each item spawning at each distance (at distance 2000 you should on average see a cloud every 2.5 hills, coins on every third hill, a plane every 20 hills, and so on). The thin curves are the observed realizations (actually a moving average over the 200 previous hills). As you can see, we went from basically no control at all to something that works quite well! There are still some variations and deviations, but those are not unwelcomed as they add some slight difficulty variations between runs.

I also made lots of optimizations to enable adding all those effects without tanking the framerate!

nb: to facilitate their production, most of those gifs are recorded in debug mode, which is why you can see me simply floating in the sky, moving arbitrarily or even backwards!

Files

  • rollerblade_dev.pdx.zip 260 kB
    4 days ago
Download RollerBlade
Leave a comment