Jump to content
Jet Set Willy & Manic Miner Community

Playing around with the in-game tune in JSW


IRF

Recommended Posts

  • 2 months later...

I hope 2023 will be remembered, besides other things, as the year of an "explosion" of in-game music in ZX Spectrum games using the MM and JSW48 game engines.

I was privileged to work on the "postproduction" of some of the fine games that have been gamma-released (or updated) this year and I composed in-game tunes for most of them. In total, between September 2022 and December 2023, I coded more than 90 in-game tunes that had never been used in any MM or JSW game for the ZX Spectrum before. They are 128-bytes-long, i.e. twice as long as the tunes in the original "MM" and "JSW". 

76 of these brand new in-game tunes (if I have counted correctly) have been made public and can be listened to while playing Carl Paterson's "AmAZiNG WiLLY" v. 4, "WiLLY iN ThE MiRRoRVeRSE" v. 3 and "JeT SeT JnR aNd ThE CuRsE oF ThE PhArAoH" v. 2, Sendy's "Manic Person" and Pedro Magallares Ocaña's "León Willy". There are also more than a dozen tunes I coded that have not been made public yet but that are ready to be used in future projects (including an individual game project of mine which I hope to continue at some point, hopefully in 2024 if real life circumstances permit).

In addition to these brand-new tunes, I creating extended, 128-byte-long versions of "If I Were a Rich Man" (the in-game tune from the original "JSW") and "In the Hall of the Mountain King" (the in-game tune from the original "MM" and "Jet Set Willy II"), both coded by Matthew Smith, and a couple of extended, 128-long versions of other previously existing tunes. And a 64-byte-long rendition of Chopin's Marche funèbre (preceded by an alarm sound) for rooms designed as multiple-death traps.

I had always wanted to enrich the music in the MM and JSW games, but for many years it seemed to me that coding this music is very difficult. Then I coded my first in-game tune in 2020 while working on the 48K Edition of Fabián Álvarez López (Adban de Corcy)'s "Madam Blavskja's Carnival Macabre" and then suddenly I realised how easy it was. "Easy" thanks to Richard Hallas's document "A Miner Triad. Music in Jet-Set Willy and both versions of Manic Miner" which is instrumental (pun intended) in managing and coding the music. I did have to go through a learning curve (which is evidenced by how some tunes are improved in version 4 of Carl Paterson's "AmAZiNG WiLLY" in relation to their original editions in v. 2), but now I am generally able to code a tune in, say, 15 minutes if the melody is easy and I know it well (and in a couple of hours if the melody is difficult and I have to refer to the musical notation).

Most of the tunes I have coded are melodies that come from various areas of the music I love. This includes (but is not limited to) old American folk music, popular European and U.S. music from the 1930s through the 1960s, various songs from Poland, my home country, and from the Spanish-speaking world. A couple of compositions are entirely my own: either renditions of tunes I believe I once created ("I believe", because I can't be quite sure I didn't hear them, or similar tunes, somewhere), literally decades ago, or coded in recent months specifically as JSW in-game tunes.

In the future, I intend to create a file which will be a sampler of my in-game music compositions: technically a JSW48 game file, but with only one room and a possibility to input the address from which the in-game tune is to be played, thus making it easy to listen to the various tunes. It will also include a detailed description both showing what each tune is and pointing to where it resides in memory (so that the code can be easily copied to be used in other projects). This will have to wait until my individual game project that I mentioned above is released, as I definitely want to include the currently unpublished tunes I have ready for it in this future music sampler.

"AmAZiNG WiLLY", "WiLLY iN ThE MiRRoRVeRSE", "JeT SeT JnR aNd ThE CuRsE oF ThE PhArAoH" and "León Willy" also feature brand-new title-screen tunes I coded (while Sendy's "Jet Set Willy: Role Reversal", which otherwise has no in-game music, features a 128-byte-long version of "If I Were a Rich Man" as the title-screen tune). 

The final note on the music developments in 2023 is that these recent projects feature new code responsible for initiating the in-game tune from the first note. This activation takes place if a different tune was playing before Willy entered the current room or if the same tune was playing in a different mode (in some of these games the tunes play in various modes, e.g. faster or more slowly, or either in their full 128-byte-long versions or in the shorter 64-byte-long versions). Notably, if the same tune was already playing in the same mode, the code ensures the seamless continuation of that particular tune. This is a valuable enhancement of the musical experience (if I may say so myself).

Should anyone want to use any of the tunes I coded in their projects, I will be more than happy for this to happen. Please get in touch if you want specific info about any of the tunes 🙂 .

Link to comment
Share on other sites

4 hours ago, jetsetdanny said:

The final note on the music developments in 2023 is that these recent projects feature new code responsible for initiating the in-game tune from the first note. This activation takes place if a different tune was playing before Willy entered the current room or if the same tune was playing in a different mode (in some of these games the tunes play in various modes, e.g. faster or more slowly, or either in their full 128-byte-long versions or in the shorter 64-byte-long versions). Notably, if the same tune was already playing in the same mode, the code ensures the seamless continuation of that particular tune. This is a valuable enhancement of the musical experience (if I may say so myself).

I devised a similar setup for my long-gestating (currently in abeyance) project: 'Willy's Recurring Nightmare':-

If Willy enters a new 'tune zone', the music note index is reset so that the new tune starts from the first note. (Incidentally, the music note index is set to 0, not to 1 as it is in the original JSW, in which the first note of IIWARM is curtailed when you first start playing a new game.) But if you enter a new room within the same tune zone (or lose a life), then the existing tune carries on seamlessly.

I also added another feature - if you enter a new tune zone, the 'tune on/off' flag is reset so that the new tune starts playing even if the player had opted to turn off the music whilst Willy was in the previous tune zone. I figured that this would increase the exposure of the individual tunes - I appreciate there's a danger that it might annoy a player who wants to play without any music, but then they always have the option of just muting their laptop (if they're playing on an emulator, as most people do these days).

Link to comment
Share on other sites

17 hours ago, jetsetdanny said:

In addition to these brand-new tunes, I creating extended, 128-byte-long versions of "If I Were a Rich Man" (the in-game tune from the original "JSW") and "In the Hall of the Mountain King" (the in-game tune from the original "MM" and "Jet Set Willy II"), both coded by Matthew Smith

In the case of 'In the Hall of the Mountain King', I believe I did that classical piece of music justice in 'Manic Mixup' - implementing a quite faithful 128-byte loop during gameplay (which doubles in speed of play when the air supply in each cavern reaches the 'red zone' - replicating the way that ITHOTMK gains pace towards the end), and a coda that is played during the 'cavern completion' sequence (when Willy goes into a flashing portal), which matches the finale of Greg's original composition. 😎

I look forward to hearing what you've done with it, and also your extended rendition of 'If I Were A Rich Man'. 😊

Edited by IRF
Link to comment
Share on other sites

On 12/31/2023 at 10:43 PM, IRF said:

I devised a similar setup for my long-gestating (currently in abeyance) project: 'Willy's Recurring Nightmare':-

If Willy enters a new 'tune zone', the music note index is reset so that the new tune starts from the first note. (Incidentally, the music note index is set to 0, not to 1 as it is in the original JSW, in which the first note of IIWARM is curtailed when you first start playing a new game.) But if you enter a new room within the same tune zone (or lose a life), then the existing tune carries on seamlessly.

Great minds... 😁

What's "IIWARM"?

IIRC in my setup the note index is set to #FF when the tune is supposed to start from the first note, so that when the in-game music note index is incremented on the first pass through the code *before* the first note is played, it is incremented from #FF to 0 and so the first note is not missed.

Link to comment
Share on other sites

On 12/31/2023 at 10:50 PM, IRF said:

I look forward to hearing what you've done with it, and also your extended rendition of 'If I Were A Rich Man'. 😊

Thanks, Ian! I must say that now when I listen to the original 64-byte-long version of "If I Were a Rich Man" in other games (for example when recording their RZX walkthroughs), it seems very incomplete...

Ian, in one of your projects, you applied a 256-byte-long in-game tune. Could you explain how you did it (from the technical point of view)?

Link to comment
Share on other sites

On 12/31/2023 at 10:43 PM, IRF said:

I devised a similar setup for my long-gestating (currently in abeyance) project: 'Willy's Recurring Nightmare':-

(...)

I also added another feature - if you enter a new tune zone, the 'tune on/off' flag is reset so that the new tune starts playing even if the player had opted to turn off the music whilst Willy was in the previous tune zone. I figured that this would increase the exposure of the individual tunes - I appreciate there's a danger that it might annoy a player who wants to play without any music, but then they always have the option of just muting their laptop (if they're playing on an emulator, as most people do these days).

In the projects I've been involved in, this mechanism (turning the tune on at a specific moment even if the player was playing with the music off) has only been used for the game's completion, when a new - 'victory' - tune kicks in upon reaching the toilet. I believe you actually provided the code to enforce this, Ian - for which I continue to be grateful! 🙂

Link to comment
Share on other sites

34 minutes ago, jetsetdanny said:

Thanks, Ian! I must say that now when I listen to the original 64-byte-long version of "If I Were a Rich Man" in other games (for example when recording their RZX walkthroughs), it seems very incomplete...

Ian, in one of your projects, you applied a 256-byte-long in-game tune. Could you explain how you did it (from the technical point of view)?

First paragraph - that's how I feel whenever I hear the short, 64-byte version of the Radetzky March in-game tune, after having implemented a 256-byte version (score courtesy of Richard Hallas) in Jet Set Mini.

How to achieve a 256-byte tune? I'll get back to you - although the answer may be in an earlier post of this thread? 

Link to comment
Share on other sites

Posted (edited)

The simplest way to have a 256 byte in-game tune is this:

Extend your tune data to 256 bytes.

Then just NOP out the commands at #8B47 and #8B49.

****

However, that by itself will cause the tune to play too fast (as the note counter will be incremented during every pass through the Main Loop). To slow it down to the regular speed, a bit more editing is needed. Insert this into the range of addresses #8B40-#8B4C:

LD D, A (for the addition later on - N.B. this assumes that A is still set to zero as a result of the command at #8B3C)

LD A, ($85CB) (game_tick_counter variable)

AND #01 (test bit 0 of the game tick counter)

LD HL, #85E1 (point HL at the music_note_index variable; NB this doesn't affect the Zero Flag)

JR Z, #8B4C (or JR NZ, whichever polarity doesn't cause the first note to be missed or curtailed upon game startup) - conditional relative jump past the next single-byte command

INC (HL) - The conditional jump prior to this command will ensure that the code which increments the music note index is only executed when the game tick counter holds either an odd or an even value, thereby slowing down the rendition of the tune.

LD E, (HL) - the conditional jump above jumps to here if the condition is met

Then #8B4D onwards is as normal.

P.S. You could check that part of the Main Loop in the Jet Set Mini code to see the above in situ.

Edited by IRF
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.