Totoro64 - A Studio Ghibli fan game for the Commodore 64

Submitted by GG on Wed, 10/27/2021 - 00:00

Totoro64A fun way to introduce coding to kids is game development. Vintage machines are ideal to introduce many low level concepts without the complexity or the abstraction of modern, more powerful systems. The game is a classic vertical catch game featuring characters from Hayao Miyazaki's movie "My neighbor Totoro". The goal is to catch the required number of acorns before the time expires. Poisonous berries, bonus apples and Totoro's spin top add some variations to the basic game. The game is written in C and assembly and fits on a standard C64 16KB cartridge.

Gameplay

Left moves the character left, right moves right and fire makes the character jump.
Player 1 uses joystick in port 2 or 'V', 'N' and left shift. Player 2 uses joystick in port 1.
There are currently 3 game modes:

  • 1P Standard: Player 1 controls chu-Totoro. chibi-Totoro follows automatically and help catch the acorns.
  • 1P Solo: Player 1 controls chu-Totoro. No chibi-Totoro.
  • 2P Co-Op: Player 1 controls chu-Totoro. Player 2 controls chibi-Totoro. Both contribute to catch the required number of acorns.

A 2 Player versus mode is planned but currently not implemented.

Totoro64 stdThere are a few subtle differences between chu-Totoro and chibi-Totoro. The collision mask of chibi-Totoro is smaller making it more difficult to catch acorns. To compensate for this, its acceleration is higher making it easier to control.

Scoring is based on catching acorns (catching while jumping adds a bonus) and a end of stage bonus based on the remaining time. Bonus apples do not contribute to the score but add 10 seconds to the time.
There is no scoring difference between small and big acorns.

Totoro64 hiresThe game has 15 stages of increasing difficulty. Every 3 stages something new is introduced. Wind at stage 4, spin top at stage 7, slow poison berries at stage 10 and confusion poison berries at stage 13.

Downloads

Sources and binary files can be downloaded from the github repository.
To play the game a C64 or a C64 emulator is required. VICE works great and it is routinely tested during development. Alternatively the game can be played right away using a web browser at C64 Online.

Building

To build the game cc65, a GNU compatible make and zopfli are required. just type make to build. Type make test to build and invoke VICE to test the game. The makefile will build the PAL and NTSC version of the game automatically. There are a few compile time options in the totoro.h header file. #define STAGE_TIME 60 default time for the stages. Can be any number from 1 to 99 #define SPRITE_MESSAGES use sprites for most on screen messages #define MOVIE_TITLE use a font similar to the movie for the title screen

Graphic editors

Three different editors have been used for the artwork. VChar64 for the charset, cbm prg studio for the sprites and multipaint for the background.
vchar 64multipaintCBM prg studio

Implementation details

Chu-Totoro is made up of 3 layered sprites. Two single color for the black outline and the blue details. One multicolor to fill in the bag and the white belly. Chibi-Totoro is made up of 2 single color layered sprites. One sprite is reserved for the spin top and potential additional game items. The two remaining sprites are used by the multiplexer to display up to 8 falling items.

The music player is implemented using a custom IRQ player that is locked to VSYNC. The game has correction for PAL and NTSC timing for both playback speed and pitch.

Most game assets are compressed to fit into the 16K cartridge limit. Decompression is done in the title screen using the cc65 zlib routines.

Memory map

Range Notes
0x00F7-0x00FE ZP space reserved for critical variables.
0x0400-0x07E7 Text screen for title. VIC will switch to page 1 after the title screen.
0x07F8-0x07FF Sprite pointers for title screen.
0x0800-0x3DFF Free ram for global and static variables.
0x3E00-0x3FFF Title screen sprites.
0x4000-0x43E7 Multicolor data for game screen.
0x43F8-0x43FF In game sprite pointers.
0x4400-0x5FFF Game sprite data.
0x6000-0x7F3F Multicolor bitmap.
0x8000-0xBFFF Cartridge ROM. Code and compressed data.
0xC000-0xCFFF Multicolor character data.
0xC800-0xCFFF CC65 runtime stack.

Future Work

Planned improvements include:

  • Improve the background music. The second voice track is really not that interesting.
  • Add sound effects for special items
  • 2P versus mode
  • Additional levels
  • End of game cutscene
  • Attract mode