GTE: The Generic Tile Engine for the IIgs

Jan 2, 2024: A much more recent version of the documentation can be found on the project GitHub page.

This page documents the capabilities and API (Application Programming Interface) of GTE, GTE is designed to offer excellent performance and flexibility for developing Apple IIgs games. There is no support for sound and music built into this engine, but it is compatible with Ian Schmidt's excellent Music Tracker Library. I would suggest you use this in conjunction with GTE. I do.

  1. What is GTE?

    GTE stands for Generic Tile Engine. Quite simply it is a graphics programming library that allows tile based games similar to those found on console systems (NES, Genesis, GameBoy, etc.) to be developed with relative ease on the Apple IIgs. GTE was developed primarily to address the speed issues of IIgs game programming. As anyone who has tried knows, fast, flicker-free animation is difficult. Full-screen scrollers are near impossible. Though there have been excellent games and demos in the past (Rastan, Sword of Sodan), they have either used their own proprietary operating system or were written in ProDOS 8 and did not have to integrate with the system. In either case, other game programmers were unable to use the engines of these games to develop their own platformers. Thus the IIgs community has been lacking in the game department.

  2. What can it do?

    A game library is nearly useless if it can only be used to program one particular type of game or is burdened with unnecessary restrictions. Optimizing for only certain cases leads to an inflexible and difficult to use environment. The philosophy behind GTE is to make it as flexible as possible in regard to screen size, placement, tile size, palette assignments and sprites.


    First of all, GTE allows multiple tile sizes. Though one size must be maintained throughout the game, at initialization time 4x4, 8x8, or 16x16 tiles may be used. This allows for the programmer to decide what is best for their particular game.

    Also, tile maps may be nearly any size. The only restriction is that the total number of tiles be less than 65536. Thus, any size from 256x256 to 4096x16 maps are possible. For most purposes this is a reasonable upper limit, and any special needs others might have can be met with a little more programming effort.

    Not only are the tile maps large, but tiles can be dynamically loaded and unloaded. Any Super High Res. screen can be read into memory and used as a tile sheet. This gives the programmer a huge amount of flexibility since the painstaking process of 'compiling' tiles is eliminated and new tile sets can be quickly and easily generated and integrated into a given project.


    Sprites are one of GTE's strong points. Traditionally, fast sprite animation meant using compiled sprites as bitmaps were too slow to deal with at any appreciable speed. The downside was that compiled sprites were inflexible and didn't allow for clipping at all. Well, that is no longer a concern. GTE uses only compiled sprites, but compiles them with extra information that allows for clipping, stretching and vertical mirroring. Try to find that feature set in any other graphics library! In addition, screen masks provide arbitrary single-pixel masking. Imagine seeing your sprites move behind complex shapes like fences with no speed penalty.

    In addition to their tremendous flexibility, sprites, like tiles, can be dynamically created. Again, just load in a picture and use it as a sprite sheet. In large projects, this can save the hassle of compiling hundreds of kilobytes of sprites for just one or two minor changes. Trust me. I've been there.

    Finally GTE supports the creation of translucent sprites. With an appropriate palette, these sprites 'ghost' over the background and other sprites. Also, multiple translucent sprites can be drawn on top of one another with a greyscale palette and it will do the right thing by consecutively averaging each layer. I find that translucent sprites are perfect for floating scoreboards, head-up displays, and clouds.

    Parallax Scrolling

    One of the outstanding features of GTE is its ability to maintain two independent scrolling backgrounds. Trust me, you've never seen scrolling like this on the IIgs. There are no size restrictions on the second background and it requires very little extra computing time to maintain. There is virtually no compromise to be made. If your game can benefit from a parallax effect -- go for it!

  3. How do I do it?

    The API documentation for GTE can be found here. The documentation follows the style of the Apple Toolbox References.


    The source code is availabe in a browsable form here. A precompiled version of the library can be found in the obj directory.

    To whet your appetite, here are some screen shots of the library in action.