Alex Kidd Pico - Part 3: Code & Music limitations

November 11, 2017

Token count

Staying under the token count was a fun challenge.  It certainly makes you find simpler ways of achieving the same thing, which is always good, though of course there is the ever present question of whether the time spent re-writing and dealing with new bugs is worth the pay off in the long run.  It’s better to be able to make this choice yourself rather than be forced into it by such a thing as a token limit, but it certainly is a good exercise to go through.

 

Compressed code limitation
The “compressed code limit” however, was a literal impossibility to stay under, and I found it strange that the manual states that you will run into the token limit before the compressed code limit.  This is very untrue.  At about 7k tokens I was at 30k compressed bytes, and it wanted 15k. Even with all the text in the game removed it barely made a dint.  I already use single letter variable names for frequently used variables, and I tried replacing function names and variable names with shorter versions of themselves and realised very quickly this wasn’t going anywhere.  


It’s a shame because in my search for “compression limit” on the forums, I’ve seen examples of very interesting projects (such as an RPG in the style of the original Ultima) that were abandoned due to the developer becoming disheartened that they’d never overcome this compression limit, and no word from Zep on the matter in any of the examples I saw.  Here is someone else ranting about it

and someone pointing out that it causes ugly & difficult to read code, since length of variable names affect the compressed code limit. And another more recent rant that I just stumbled across.

 

It was only when I tried out PicoTool that I finally overcame this hurdle. Although you end up with an unreadable mess, which is why I’ve provided a plain text version for download. The final program has the token count maxed, and is about 25k compressed bytes, before running through PicoTool, which brings it down to 9k.

 

But that version has the token count maxed which means no room for you to experiment with, so I've also provided an older version that has a lower token count so you have room to experiment, albeit with a few bugs unfixed.

 

Cramming in all the music!

I started out replicating the music note for note.  I used my MIDI USB keyboard and OpenMPT to rough it out (was easier) and then transposed the notes into Pico8.  But to achieve the mulitiple harmonies, you use a new "sound effect" in the sound effect index for each instrument track, and I very quickly ran out of sound effect indexes.  

 

So I did what other music developers did back in the day and use the arpeggio effect (the trilling notes you hear) which switch between 2 notes rapidly to give the impression of 2 notes being played at the same time.  Pico-8's music tracker has a built in effect for this, like all good music trackers of the time, though it works a bit weirdly and is more limited.   Using this arpeggio trick, I came up with simpler versions of songs with less simultaneous notes (some are just a drum track and a melody!) and in the end, used far less sound effect indexes and was able to cram in all of the songs I wanted to - a total of 7, listed below.   As you can see, every last sound index was used, I maxed it out, like the token count.

 

Music patterns

00: Main theme

06: Death

07: Water theme

23: Bike theme

27: Janken game

31: Heli theme

33: Castle theme

39: Game over

 

List of SFX

00: Jump

01: Punch

02: Main theme: Bass Intro

03: Main theme: Melody Intro

04: Main theme: Bass 1

05: Main theme: Melody 1

06: Main theme: Bass 2

07: Main theme: Melody 2

08: Main theme: Base 3

09: Main theme: Melody 3

10: Main theme: Base 4

11: Main theme: Melody 5

12: Main theme: Percussion 1

13: Main theme: Percussion 2

14: Main theme: Percussion 3

15: Shoot

16: Block break

17: Coin

18: Game Over

19: Castle Theme: Melody 1

20: Castle Theme: Melody 2

21: Monster death

22: Angel: Melody

23: Angel: Harmony

24: Water hit

25: Water hit bass

26: Powerup pickup: Melody

27: Powerup pickup: Harmony

28: Laser Ring

29: Water theme: Bass 1

30: Water theme: Bass 2

31: Water theme: Bass 3

32: Water theme: Bass 4

33: Water theme: Melody 1

34: Water theme: Melody 2

35: Castle Theme: Melody 3

36: Castle Theme: Melody 4

37: Water theme: Melody 3

38: Water theme: Melody 4

39: Castle Theme: Melody 5

40: Pedicopter theme: Bass 1

41: Water theme: Solo 1

42: Water theme: Solo 2

43: Water theme: Solo 3

44: Water theme: Solo 4

45: Water theme: Solo 5

46: Water theme: Solo 6

47: Frog bubbles

48: Water theme: Percussion loop

49: Bike theme: Melody 1

50: Bike theme: Bass 1

51: Pedicopter theme: Bass 2

52: Bike theme: Melody 2

53: Janken match theme: Percussion 1

54: Bike theme: Bass 2

55: Bike theme: Melody 3

56: Janken match theme: Melody 3

57: Bike theme: Bass 3

58: ?? Percussion?

59: Janken match theme: Melody 1

60: Janken match theme: Melody 2

61: Castle theme: Percussion loop

62: Pedicopter theme: Melody 1

63: Pedicopter theme: Melody 2

 

Share on Facebook
Share on Twitter
Please reload

Featured Posts
Recent Posts
Archive
Search By Tags
Please reload

Alex Kidd Pico - Part 2: Everyday I'm shufflin' screens

November 11, 2017

1/1
Please reload

Please reload

Please reload