Skip to main content
Featured Articles

I Learned How to Code from IBM Gorillas

By March 22, 2015No Comments

This article was written by John Gill and was originally published on GameCrate.

I Learned How to Code from IBM Gorillas

While the city sleeps below, simians make war.

Before Windows there was the black screen of DOS. Computers hummed and hard drives clacked an erratic staccato. Then you were greeted by the “C:\>” prompt. It was the dark ages, and it was where I found Gorillas.

Before the 1992 release of Microsoft Windows 3.1, and later the even more ubiquitous Windows 95, gaming on a PC meant learning basic DOS commands. To a game-minded youth like myself, navigating DOS had the trappings of a clunky text adventure. Just like I learned to navigate by typing “go south,” checking out where I was by typing “look,” and typing “get lamp” to add a lantern to my inventory, so too could I change directories, list files, and run CARMEN.EXE to play Where in the World is Carmen Sandiego?

It was in these twisted labyrinths that I found qBasic, a simple programming environment with extensive documentation and a handful of example programs. Gorillas was the finest among them.

Gorillas is a simple two-player artillery game. After entering each player’s name and how many points to play to, a cityscape is drawn and a gorilla is placed on either side of the skyline. Each gorilla then takes turns lobbing exploding bananas by indicating the angle of the toss and how much power to put behind the fruit. Each round the direction and intensity of the wind may change, forcing players to adjust their numbers.

A single well-placed banana throw will destroy a gorilla, with the victorious player’s ape dancing in celebration. The city is then redrawn, giving new terrain to consider. Play resumes until the point limit is reached.

I Learned How to Code from IBM Gorillas

The carnage of a direct hit. Support banana disarmament.

Gorillas was included with MS DOS 5.0, and continued to ship with Windows up until the release of Windows ME in 2000. This widespread distribution alone would grant Gorillas a heartfelt place in many gamers’ histories similar to other pack-ins like Gameboy Tetris or Microsoft’s Minesweeper. But Gorillas is additionally significant for how it was distributed: as raw source code.

It is easy to take for granted how widespread computing knowledge is today. Computers are affordable and in every home, if not in every pocket. In touchscreen world computers are easier to use than ever. The internet has made all knowledge, including computer knowledge, instantly accessible and searchable. But before all that, back when libraries maintained card catalogs, when Coke was new and Pepsi was crystal, Gorillas was a look into how things are done.

The Gorillas source code is thoughtfully arranged and lends itself to exploration. The opening lines are comments, explaining the rules of the game, how to run it, and the first bit of programming instruction:

Speed of this game is determined by the constant SPEEDCONST.  If the program is too slow or too fast adjust the “CONST SPEEDCONST = 500″ line below.  The larger the number the faster the game will go.

The year was 1992. It was a Saturday. I was wearing footie pajamas, hair tousled, reading the above paragraph while leaning into the tiny monitor of my family’s 286. A thought occurred:

“Y-you mean I can have turbo bananas?”

Over Nine Thousand. Screenshot taken from qb64, a modern version of qBasic.

Over Nine Thousand. Screenshot taken from qb64, a modern version of qBasic.

I searched for the line, edited it, and found the game was changed. Now the gorillas tossed comically fast yellow blurs across the screen.

I’m sure what happened next is a realization shared by countless children and adults alike who read the Gorillas source. I looked below SPEEDCONST and saw what else I could do. Other “constants,” which are variables that are defined once and never change, allowed the player to adjust friendly fire or modify some of the colors of the game world. I was hooked, and kept reading.

Looking into the source code revealed the simple building blocks of all video games. TheGorillas source code demonstrated things like collision detection in the thrown bananas, and procedurally-generated content with how the heights of the buildings are chosen and drawn. But beyond any individual lesson, Gorillas taught the structure of games.

Gorillas’ opening functions and subroutines, with their descriptive names like “DrawGorilla” and “MakeCityScape,” showed that that everything that happens in a game, from an explosion to a dancing gorilla, is a little sachet of code, usually only a few lines long. Players reading the code could see that each part was governed by math and shaped by player choices, and that each little piece of the puzzle talked to the others by passing information, like classroom notes traded on folded sheets of notebook paper. Delving deeper showed they were joined together by one bit of code, managing the note passing and deciding how long it would continue: the game loop.

This insight was the most important thing I learned from Gorillas, and taught me the difference between how players experience games, and how computers experience them. When I was a wee lad, however it was I imagined games were made, I thought they were like storybooks: on page one, the player presses start, on page ten Mario stomps on a goomba, on page twenty-five he stomps another, and on the last page he saves the princess.

I Learned How to Code from IBM Gorillas

How far we’ve come.

Gorillas taught me that games were like a giant flowchart, asking, “What did the player do?” modifying the world a tiny bit, and then looping back to ask the question again. The gorillas, the bananas, the city, the prompt asking what angle I wanted to throw at, each was a separate piece, reused again and again, and working together.

Since the Gorillas source code is laid bare for all to see it has been relentlessly ported and modified. A relatively faithful flash version is available on Kongregate, with all the original graphics and sounds recreated, plus the important addition of a single-player mode where you can square off against an AI opponent. There are other browser-based implementations which prefer improvements over fidelity to the qBasic version. One example, Mascot Mashup: Gorillas features an improved user interface and a staggering 800-plus characters to choose from.

While each of these ports allow contemporary readers to play Gorillas, their very existence shows the importance of the game, reaffirming an old adage: give someone a game, and they play it for one Saturday. Teach someone to make a game, and they play for life.

 Visit GameCrate for more in-depth gaming coverage.

Author Newegg Staff

Newegg Insider writers and contributors from throughout the Newegg.com team.

More posts by Newegg Staff