Make a Monkey Island-style adventure game | Wireframe #69

Create a scripting system with a re-creation of LucasArts’ point-and-click classic, Monkey Island. Mark Vanstone has the code in this month’s edition of Wireframe magazine, available now.

In 1990, LucasArts debuted a point-and-click adventure that immediately captivated audiences with its humour, storytelling, and devious puzzles. Indeed, The Secret of Monkey Island – first released on the Amiga, Atari ST, MS-DOS, and Mac – is so beloved that the series is still going today; the latest instalment, 2022’s Return to Monkey Island, saw series creator Ron Gilbert return as director.

A screen from the original Secret of Monkey Island, published in 1990. Hero Guybrush Threepwood is on his way to the Scumm bar.
Guybrush arrives at the Scumm Bar in LucasArts’ pirate-and-click classic, The Secret of Monkey Island.

The original game’s story follows the young Guybrush Threepwood, his ambition to become a pirate, and his encounters with the ghostly villain, LeChuck. Like LucasArts’ other adventure games of the era, Monkey Island combined scripted interactions between characters, animation, and interactable objects in each scene. For this sample, we’ll re-create the game’s opening, where Guybrush meets the lookout man and asks how he can become a pirate. We’ll be coding a scripting system that can deal with character interactions and respond to options the player is presented with.

Our scripting system is straightforward in concept, but it’s flexible enough to allow us to add extra options as we go along. The script is held in a text file, data.txt. In it, we’ll have commands such as Background:clifftop, which we’ll interpret as meaning, “set the scene background to be the image called clifftop”. We’ll have one command per line, each separated from its action with a colon. We may need to vary the format depending on what the command is.

To start our scene, we load in our data file, set our default background image to be a title screen, and then start reading lines from the script list. Our processScriptLine() function breaks up each line of the script into commands and action data. For example, our first line of script is Pause:8Pause is a command and 8 is the data. This sets a countdown lasting eight seconds before the next line of script is read. Then we can set the background image with a Background command, and in this scene, we’ve set a foreground image of a wall so that our characters can move behind it.

Our Python homage to The Secret of Monkey Island.
Our Python homage to Monkey Island. Perhaps you could take Guybrush’s adventure in a whole new direction?

To set up our characters, we have a list of Actors, and our script command will determine which slot in the list we use for that character. For Guybrush, we’ll use slot 0 and in the script write Character:0:guybrush1,460,220. This translates to, ‘Set character 0 to the image guybrush1 and position it at x=460, y=220’. We can set up a character for the lookout man in the same way and make Guybrush walk towards him by alternating between two walking frames and pausing in between each. We then start the dialogue between the two characters. We define a Speech command and have the text defined in this script line appear over the character’s head. While this speech is being displayed, we can alternate between two animation frames to make it look like the character’s talking.

So there we have the basis of our scripting system for a scene. There are several lines of dialogue before it’s time to move to the next scene. For this example, we can set up some text options for the player to click on. When the player clicks on the option text to ‘Go to the Scumm Bar’ we search through the script looking for the Scene command for ‘Scumm Bar’ and start reading the script from there.

We’ve only made a small section of the Secret of Monkey Island adventure here. To continue the action, we’d need to add more commands to the scripting system to allow Guybrush to move around the screen and interact with items, but our code snippet should give you a good basis to start making your own point-and-click adventure.

An image of the Python and Pygame Zero code listing from this month's edition of Wireframe magazine.
Here’s Mark’s code for a Monkey Island-style adventure game scene. To get it running on your system, you’ll first need to install Pygame Zero. Full instructions can be found at wfmag.cc/pgzero. The full code listing and assets can be found here.

Get your copy of Wireframe #69

You can read more features like this one in Wireframe issue 69, available directly from Raspberry Pi Press – we deliver worldwide.

The cover of Wireframe issue 69, featuring a landscape image from the upcoming adventure game, Planet of Lana.
The shiny new edition of Wireframe. It even has a free poster inside!

And if you prefer your magazines in digital form, you can also download Wireframe issue 69 as a free PDF!

1 comment

Jamie Biggs avatar

This take me straight back to the 90’s, I will be having a good look at this later! Thank you.

Comments are closed