Project IV: Lunar Lander

Project narrative

Land your Lunar Excursion Module [LEM] on the surface of the moon. This is a storied and much beloved game from early digital video-gaming (ca. 1969).

Here’s a re-creation of the earliest iteration of the game — text-based!

And a good overview of the game’s multi-platform history:

Project Requirements: Code

  • Make use of basic collision detection in GameMaker (esp. recommended,e.g.: place_meeting(), position_empty(), etc. For special circumstances, consider also the “advanced collision detection” functions (e.g., collision_point(), collision_line(), etc.);
  • Make use of at least two different sound effects that are synced to player or game behavior;
  • Make use of at least two cameras (e.g., one close-up and one distant; one on the game field and one trained at a control panel, etc.);
  • Make use of at least one simple particle generator (built by you, and not part of the GameMaker physics engine proper).
  • Special Aside: Your code should NOT MAKE USE of the BOX2D PHYSICS simulator in GameMaker.

Advanced Options: Code

  • Consider using procedurally-generated terrain via an implementation of Perlin Noise or Perlin’s more recent innovation, Simplex Noise.
  • Game data should be clearly and intuitively modeled for the player. While a purely numeric dashboard is a good start, for example (displaying remaining fuel, rate of descent, etc.) a graphical presentation of that information — in the form of dials, gauges, etc. — might make it more fun.

Project Requirements: Gameplay

Please consult any of the variants upon the original Lunar Lander (Atari) for game-play ideas. In essence, here’s how gameplay proceeds:

  1. Your LEM has a finite amount of fuel as it attempts to land on some lunar surface;
  2. The player guides her ship, using a main (vertical) thruster and two smaller horizontal thrusters, towards a promising surface for touchdown.
  3. Feel free to vary difficulty (randomly, or by level) by varying (1) gravity, (2) fuel reserves, (3) rate of fuel consumption, and/or (4) how rigidly you evaluate a “soft landing” versus a crash.
  4. The pleasure of this game — aside from its simulative nature — is the tight integration between our input (thrust) and the moon’s pull (gravity, inertia), as both are understood vis a vis our dwindling resources (fuel).

Project Three: Requirements

Procedurally-Generated Bestiary

  1. Write a program that generates and draws the head and face of an imaginary creature;
  2. In order to accomplish this, include at three separate “custom functions” (scripts) in your GameMaker code;
  3. At least one of those custom functions should return() a value (the other two, if you wish, do not need to return() any values;
  4. Creature faces should have at least 3 features (for example, your faces may all feature eyes, a mouth, and a nose);
  5. Parameterize those features across one or more dimensions of variability:
    1. Parameters for any single facial feature might include:  Size, position, color, quantity, angle, transparency, symmetry.
    2. In particular, placement of features on faces should be within random ranges on at least 2 of these features (e.g., you might always put the eyes in the same place, but the exact mouth position for each creature is randomized from a predetermined range);
  6. Your goal is to ensure that every randomized head is unique and surprising (and “makes sense”).


Remember: You’re modeling procedurally-generated creature FACES/HEADS only. Try to steer clear of worrying about bodies, as that introduces so many more variables to this circus.

Your program should generate at least two dozen combinations of features, heads, colors, etc., saving each one independently as a PNG file, at least 800×800 in size.

Advanced Challenges

  • Allow for player input:  Player defines parametric ranges for randomized outcomes (e.g., between 3 and 5 eyes);
  • Introduce basic animation to your procedural beast:  Eye blinking, slight tilt of the head, etc.;
  • Create a short code that describes all of the parameters for any specific creature, and include that DNA-like code on each image you output. 
    • Double-up on the challenge: Players should be able to input that code later and generate a perfect replica of the creature.

Notes on Appearance

This project takes a break from building-out gameplay and highly-interactive dynamics, and instead allows you to focus on the aesthetics of the project. Consider carefully, for example, your color palette, aim for sprites that share a similar visual style, and so on.

Where resized, sprites should still appear relatively clear and not be over-interpolated.

Give thought to the presentation: Is it realistic, pseudo-3D, minimalistic, cartoonish, hand-drawn, etc.? Is there a sense of humor (or an earnest seriousness) visible across all of the creatures? Are faces consistent in their definition?

For a real-world parallel, consider this composite character sheet featuring characters from the animated TV program The Simpsons.

The artists use a lot of shared design features to create a sense of characters that “hang together.”

Look at the eyes in the image above, for example: Even though each pair is unique — you couldn’t easily swap Mr. Burns’ eyes for Marge’s, for example — the fact is they have a lot in common:

  • They tend to occupy a LOT of space on the characters’ faces;
  • the eyeballs have a strongly spherical shape, and often look as though they are barely contained by the characters’ brows;
  • they almost always sit higher on the face than the characters’ ears.
  • In the case of some of the characters, the eyeballs actually touch one another, and are seated atop the nose.
  • Where characters’ eyes don’t touch, they are separated only by the single width of a nose.
  • Most characters do not have eyebrows.
  • Even where they are expressing considerable emotion, the eyes of Groening’s characters tend to continue to operate symmetrically.
  • The line work on the Simpson’s characters is always consistent: Uniformly wide, precisely drawn (not “sketchy”), yet still very recognizably drawn by hand.
  • The artists use an absolute minimum of lines to convey a shape, and they seldom if ever resort to artistic techniques like “shading,” “shadow,” “foreshortening,” etc.

Ideally, we want creatures from our bestiary to look as though they are drawn from the same source material.

Code for review: Bestiary

Here’s another version of the procedurally-generative Bestiary that I’m building. Note that it does not yet meet the requirements for this project (I’ll post those here, too) (for example, my code fills the screen with creature faces, but in your final version of the project, your code will create at least 24 beasts, drawn one at a time to the screen, where each is saved as serial PNG file: For example, beast-001.png, beast-002.png, etc.).

As you’re reviewing this code, pay special attention to the three “custom function” scripts.

Working code: Procedural Bestiary

I’m sharing this code — which we discussed very briefly on Thursday of this past week — so that you can review some of the techniques I’m using in order to generate random faces and save that information inside each “obj_head” instance (in case I want to do something with it later).

An early bestiary

NB that the code mostly lacks comments, because it is such an early draft. But that’s a great opportunity for you to try your hand at reading through the code and making sense of it where you can. I have tried to be consistent and explicit in the code itself about what is happening — there won’t be much weirdness. So have a look!

Also worth looking at: There are two “custom functions” (which appear as “script assets”) in this game. Take a look at them, too.

Word Parsing Exercise

Update: Here’s a more polished version of the magnetic-poetry demo, which uses a “custom function” version of the word-parsing exercise from this week:

Here’s some material to help you think through the word-parsing exercise from class today (5 October 2021). The PDF file (look for it below) contains all of the code printed out for legibility, while the gamemaker zip can be unzipped and run inside gamemaker. They are almost exactly the same body of code and comments, but the gamemaker code lacks the “arrays are tables” illustration, which I’ve included below.

An array is really just another kind of table.

Also worth looking at: This “refrigerator-magnet-poetry” prototype, which uses the word parser code we looked at today.

A Clock Too Far

Here’s a silly “alternative chronograph” I put together on Friday. It took about 3 hours, all told, including comments. The chronograph doesn’t really make any sense: It’s more of a fanciful design. In itself, though, it was an interesting exercise in playing with sinusoidal waves and simple particles. Download the GameMaker zip below if you want to walk through the code.

Wait, what time is it? Seriously, I have no idea.