cobbpg / kye-c64

The C64 port of Colin Garbutt's classic puzzle game, Kye.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Kye for C64

This is the C64 port of Colin Garbutt's puzzle game from 1992, Kye. The game is available as a free download at itch.io. You can play the original game via archive.org's emulator here.

Overview

The reason I made this port was primarily technical: I wanted to implement a game in 6502 assembly involving hundreds of active objects interacting with each other, and push graphical limits at the same time by augmenting hi-res graphics with a dynamic sprite overlay. Kye was the perfect candidate for this experiment, since it saved me the trouble of having to come up with my own design, and it's a mostly forgotten game with a lot of user-made levels that's definitely worth a bit of fresh attention.

The goal of the game is simple: move around with the green circle thing and collect all the diamonds. It's up to you to discover the rules! The game is controlled with the joystick in port 2 exclusively; there's no keyboard input.

Build Instructions

The game was created using the following tools:

As long as you don't want to change any of the art or sounds, you will only need KickAssembler. Just assemble startup.asm directly to get an executable for the desired standard (the command below assumes you have KickAss.jar in your classpath):

java kickass.KickAssembler startup.asm -o kye-pal.prg
java kickass.KickAssembler startup.asm -define NTSC -o kye-ntsc.prg

Otherwise, just run build.bat to create compressed release versions for both PAL and NTSC. If you change the music or the sound effects, sound.bat will refresh the binaries with the correct settings. There's no automation for graphical assets, so you have to export them manually:

  • CharPad: File → Import/Export → Binary → Export All, and choose the graphics folder
  • SpritePad: File → Import/Export → Binary → Export Sprite Set, and choose the graphics folder

Levels

Kye has hundreds of user-contributed levels available over the internet. A good starting point is the fan site My Kye Page, which has the original game as well as the full archive of level packs in the registered version. You can easily change the level packs included in the game by editing the IncludeLevelPack commands at the bottom of startup.asm. You have about 32K RAM available for levels, which should be enough for over 100 of them.

The levels are parsed from the original format and RLE compressed during assembly. This port has a limitation of 255 active objects at the same time (meaning objects that have their own behaviour, so passive elements like inert blocks or diamonds are not subject to this limit), and it will skip levels exceeding the threshold with a warning. Note that this parser ignores the level count at the top of the file, and cannot handle text appended after the levels.

If you're up for a technical challenge, you are welcome to add an in-game level editor (which the original game does have) and a system to load and save levels on disk. :)

Technical Notes

Preprocessor Usage

The code relies heavily on KickAssembler scripting features to wrangle assets during assembly:

  • The sprites for Kye's explosive death are generated by composing the pieces in the sheet by the IncludePlayerSprites macro.
  • The various underlay sprite byte combinations are identified in the character data, sorted and built into LUTs to use at runtime (check the IncludeUnderlays macro).
  • Levels are parsed and RLE compressed by the IncludeLevelPack macro.
  • Various LUTs are generated thanks to the ability to maintain hash tables and lists during assembly time.
  • Self-documenting API for manipulating I/O registers, e.g. ScreenControl1("mode=text,screen_height=25,vertical_scroll=0") returns the correct byte to set to the $d011 VIC register.
  • Light usage of pseudo-ops to simplify some pointer manipulation (I'm not very consistent about this, as I'm still trying to get a feel for what works best).

Game Rules

A lot of advanced Kye levels rely on the precise ways the game works. I tried to make sure to replicate these details correctly, so the active objects are processed in a particular order, and especially magnets ("stickers") are checked in a very specific way. Many of these details are not documented anywhere, and I deduced them by testing the original version.

The original game has a bug which I didn't replicate due to its limited usefulness in level building: if Kye happens to be on top of a one-way door when a monster wanders too close and Kye dies, then the door is teleported to Kye's respawn position. In my C64 port, the door stays where it was.

One thing I didn't implement is the logic to look for a free tile to respawn on if Kye's starting position is already occupied. The original game scans in a rectangular spiral of ever increasing radius, always going counterclockwise starting from the bottom left corner. My version simply puts Kye back in the starting position, which might break some of the more evil puzzles.

Input System

In order to ensure that the game is always responsive and handles well, there's a separate input buffer for both axes (i.e. left-right and up-down). When the joystick is pulled in a certain direction, there's a state machine running each frame generating trigger events (see the ProcessInput function in startup.asm), which need to be acknowledged by the target logic. This is needed to avoid missing input in some cases. The first trigger event in each axis is followed by a longer wait than the rest. The timings can be tweaked in the Frequency namespace in data.asm.

Credits

Original game: Colin Garbutt

Level sets included in the release:

  • Default: Colin Garbutt
  • Sampler: Dr Floyd?
  • Plus 2: Mark & Dave @ Positive Ltd.
  • New Kye: Unkown
  • Shapes & Monsters: Dennis K. Fitzgerald
  • Danish: Jytte Madsen & Erik Jacobsen

C64 port and music: Patai Gergely

About

The C64 port of Colin Garbutt's classic puzzle game, Kye.

License:GNU General Public License v3.0


Languages

Language:Assembly 99.5%Language:Batchfile 0.5%