In Octave Devlog #2 - How to tune your octagon


The first early prototype is now complete! It's a functional instrument, that already provides me some rooms to explore. Before I show you how it sounds, I want to explain a bit how it works. It's time for some music theory!

The instrument

As planned, I used ToneJS to managethe sound made by the octagon. It has a nice Sampler class, with which I can create instruments from a set of samples. It's simple, allows me to use either prerecorded sounds or exported samples from custom synths, and I can even plug it to dynamic effects such as reverb or low-pass filter! For now, I just use a basic piano sample. During composition, I will decide what instrument to use.

Each side of the game's octagon is linked to one note, that is made when the wall is hit by a ball. This makes us 8 different notes. These notes will all be part of a musical scale, going from the fundamental to the octave. If you are not familiar with scales, let's say it's an ordered group of musical notes that sound "well" together and convey a certain emotion. For example, C major scale is C D E F G A B (and C again for the higher octave). Here I intend to use a natural minor scale (aeolian), maybe in D ou A. In D, this scale is simple: it's D E F G A B C (D)! However, I don't want to write those notes manually, especially if I want to try different scales. This is why I use teoria, a JS library for music theory. I've already used it in another project, and while it has its perks, it's simple to use and really well documented. This way, I can have my whole scale in a single line, that I can easily edit:

const scale = teoria.scale('A3', 'minor').notes();

There is one last thing I had to take care of: how those notes are disposed. Sure, I could just put them in a circular order, 1 2 3 4 5 6 7 8, but that wouldn't create interesting melodies. The bouncing balls are unpredictable, but not absolutely random: when they bounce on a wall, they are likely to hit the opposite wall. If they are close to a corner, they will hit an adjacent wall very quickly. I must take those kind of movements into account so that the emergent melody makes sense. So far, I came up with three settings:

1 represents the fundamental, 8 the octave. To come up with these, I followed those rules:

  • Opposing walls should be interesting combinations
  • Spatial adjacency should be a bit consistent (lowest notes on bottom, highest on the top, and same from left to right)
  • Adjacent notes and wall should be avoided when possible

I'm not if that's third rule is that pertinent. I won't describe in detail these three pattern, but there area few things that can be noticed. First, the fundamental and octave are opposed, and thus create a strong "line" that give consistence to the other notes. Except in the third one, where it's the fundamental and the fifth that create the line! That third pattern is special: I created it whith combinations of opposed walls and "squares" in mind. I call "squares" the combinationof 4 perpendicular, often hit successively by the balls. In patterns 2 and 3, there is one square that creates a minor chord (I), and the other square makes a major 7 (VII).

I have tested the three, and my preference goes to the second one! The most balanced in my opinion, with the opposition of 1 and 8, the minor chord in the "main square", and a good spatial consistency. We'll see if I keep this one.

Now I have a working instrument, easily configurable! Here is how it looks. This is the octagon playing in A3 minor, with the second pattern.

Link to video

Well, I feared that my idea would only sound right in my head. But this seems not too bad! That's reassuring.

Let's talk a bit about how the game should be played, then!

The rules

Here is how In Octave will work: at the beginning, the player will only have one ball. They will shoot it, and the ball will bounce on walls. Once it has bounce 8 times, the player will access to the level 2, and gain another ball. They must shoot it again, and wait for the two balls to bounce 16 times together. Then level 3 with 3 balls and 24 bounces, then level 4, and so on up to level 8. Whenever the player collides with a ball, the counter will go back to 0, and the player must shoot back the ball that they've "caught".  Every balls must be out for the counter to increment.

Thus, the first levels should be really easy, and hopefully things will get more complicated in level 4, to become really intense in the last levels. Once the player beat level 8, the game will show them the time they've took to finish the game, and how many time they have been hit. Hopefully I will be able to save their personal record so that they can try again to beat it!

I've been able to implement those basic rules. The player can now hit the balls, has a stock of them, and pass levels to gain more. But there is absolutely no feed-back! So this will be the goal of next week: create the base of the UI to show the player its progress! And it will be a bit part of the game's aesthetic too. So more interesting graphics lesson for me!

Get In Octave

Leave a comment

Log in with itch.io to leave a comment.