Interview With Sean Gugler (author of Candy Weaver and Chief Bug Wrangler of Ultima IV Remastered)

Sean Gugler is the talented programmer and game designer behind the highly-acclaimed Apple II puzzle game Candy Weaver as well as the much appreciated Ultima IV Remastered project to rid the world of troublesome crashes and bugs!

Sean’s addictive and fun Candy Weaver game, from the A2SE fall programming exhibition


Sean’s Candy Weaver rose to the top of the competition during Apple II Software Enthusiasts (A2SE) fall programming exhibition on Facebook, showcasing his skills and Applesoft BASIC ingenuity.

Candy Weaver has received much praise for its engaging gameplay, story mode, and challenging puzzles, making it a must-play for folks looking for new Apple II software!

I recently had the pleasure to sit down with Sean (virtually) and ask him a few questions regarding his various Apple II pursuits and interests. I hope you enjoy this interview and will join us in congratulating Sean on his success! We can’t wait to see what he comes up with next!


Tell us a bit about yourself. Where do you live? What Apple II hardware / emulators do you currently use? What other hobbies do you participate in?

Silicon Valley is home, I landed here after college. Most of my Apple II enjoyment comes via the AppleWin emulator for now … looking forward to setting up the various machines I have in storage, though! There’s a Platinum //e and a IIgs in there, and even a 512K Macintosh.

Preservation is a keen interest of mine. The exploits of the scene-famous hackers 4am and qkumba fascinate me to no end. But there’s something special about the tangible items that no emulator can really replicate … the boxes, the manuals, the controllers, etc. I’m a volunteer at the Digital Game Museum and those are the sorts of things we prioritize for our collection. We’ve had to cocoon during the pandemic but look for us to emerge again someday soon!

Growing up in the 1980s gave me two unrealistic aspirations: make video games for a living, and learn how to dance that zombie choreography in Michael Jackson’s Thriller. I’m happy to report I’ve managed to achieve both. In fact I now teach the dance for our local chapter of Thrill The World in our annual Halloween workshops.

What was your first Apple II or clone that you owned?

There were several models I coveted over the years: my grandpa’s diskless Apple II+ in 1979, the Apple //e at school, the neighbor’s Apple IIc, my wife’s fully loaded Apple //e Enhanced. That last one was the first to become mine-mine-all-mine when she was finally done with it, haha!

Wait? A Diskless Apple ][+?

Disk drives for the machine didn’t exist yet. Programs could be loaded from tape, or typed in from listings.

The experience of seeing the “]” prompt immediately after the startup beep, with no disk chugging noises, was the standard experience for a brief moment in that machine’s life, haha!

What got you interested in programming? How old were you when you were bitten by the bug?

How do you keep a curious child occupied when you have to bring him to work or college with you? You let him stab at the typewriter keys. Or the punch card keys. Or an idle teletype. Imagine my amazement when that machine received a call and started typing all by itself! Imagine the thrill of being sat down in front of a keyboard attached to a CRT instead of a ribbon, where I could move this blinking square around anywhere I wanted and it didn’t use up any paper.

Then came Adventure (known these days as Colossal Cave), a magical give-and-take where I wasn’t the only one in charge of what happened on that screen. The bloom of “personal” computers put that power ever closer in reach: first at the department store, then at a class, then at my grandfather’s place, and finally in my own house. I had an insatiable appetite for exploring what could be done with these machines, lured by games and fueled by David Ahl’s famous book full of BASIC programs to transcribe and enjoy … then tweak … then create from scratch.

By the time I came to understand that what I was doing was called “programming” I was probably about nine or ten years old. And hooked for life.

What inspired you to create Candy Weaver?

This Applesoft contest arrived with perfect timing for me, between jobs. It seemed like just the right scale project for the time frame I had, and well-matched with my peculiar skill set of a) remembering the Apple II days, b) having a long career in modern game development, and c) some recent experience with so-called “retro-computing” that had refreshed my familiarity with Apple II.

Candy Weaver was forged from a number of tight constraints. There’s no way I could do a real-time action game in Applesoft – I didn’t really think it was possible (kudos to the other contest entrants for proving me wrong!) Puzzles are my jam anyway, so I leaned into that. All-text felt boring, and hi-res felt too time-consuming, both for me and the CPU. So what’s the simplest, fastest, low-resolution graphic design I could bang together? I remembered Applesoft had built-in “stripe” commands (HLIN and VLIN) and cross-hatching them was literally the first thing that came to mind. Why candy? I don’t know; the theme was “strange jobs”, so I pick something unexpected for the player to be “weaving”, something light-hearted, to lend a theme to the otherwise sterile weaving activity.

After a couple hours I had a playable prototype that ended up being very close to the final design of the core game loop: let the computer draw a random pattern for the player to replicate. To my surprise it was not a boring dud, as first drafts usually are, but just the right amount of challenge. That left me the rest of the contest time to refine and polish it: build a tutorial; hand-craft levels of increasing difficulty; and write a simple story to give it some human interest.

Were there any notable challenges in writing the game in Applesoft BASIC?

Line numbers! Ugh. It’s been ages since I had to care about line numbers. Forget using the Apple II itself to write this program; I’m using modern tools. One of the first things I did, even before starting my prototype, was slap together a very quick Python program to auto-number a text file for me. Then I realized I couldn’t write GOTO or GOSUB without numbers, so I expanded the tool to use labels. Might as well support comments and automatic upper-casing too. That half hour of Python saved me countless hours of BASIC pain. It was actually pleasant to write Applesoft this way.

Speed was the other big challenge. Drawing colored bars is fast and easy. Knowing when your drawing matches the given puzzle is harder. I ended up using PEEK to compare screen pixels which was fine for small grids but annoyingly slow for bigger ones. Major props to François Vander Linden for publishing optimization tips! [1] They were invaluable for helping me speed up both my comparison loop and the main gameplay loop in general. Turned my game from sluggish to peppy. Turns out integer-type variables are a waste of time in Apple’s particular implementation of floating-point BASIC; who knew?

https://github.com/tilleul/apple2/tree/master/applesoft/nfs

What was your motivation in creating your Ultima IV Remastered project for the Apple II?

It kept crashing! All I wanted at first was to just play it, haha. While waiting for Nox Archaist to be released, I had decided to revisit the games that inspired it, starting with Akalabeth and working forward through the series. Progress was smooth until I got my soul crushed by Ultima IV, crashing hard after I had gotten pretty far. This was on a Commodore 64 emulator, and even though I had a snapshot from earlier, it wouldn’t run for more than three minutes – even if I did nothing but watch – before the dreaded blue screen crash appeared with its characteristic “ready” prompt. Rather than start the game all the way from the top, I shelved it for a while.

Well, eventually Nox Archaist did release, and I was motivated afresh to pound through Ultima. This time I found MagerValp’s “Ultima IV Remastered” edition, which promised many bug fixes. So I started over with renewed optimism, but wouldn’t you know it, when I reached the same progress point it crashed again. Furious, I rolled up my sleeves and attacked the obstinate thing with the emulator’s built-in debugger. Found out pretty quickly that it was overflowing the stack from a memory leak. One quick patch to memory and I was able to continue my saved game and finish it – hooray!

Since MagerValp’s release was open source, I figured I ought to at least patch the memory overflow bug he had overlooked, so no one else would have to suffer as I did. While hunting for the origin of the leak, I ran across two more stack bugs, so I fixed them also. And while play-testing to make sure I had fixed them properly, I found more bugs. The more I studied the disassembly, the more issues I kept finding (and fixing).

What led me to Apple II were telltale signs in the code that the Commodore version had been ported from Apple II. For example: in one place, someone had forgotten to replace an obvious piece of Apple-style sound code with its Commodore replacement. Taking apart the Apple edition, I found it was largely identical to the Commodore release, bugs and all. My mission was clear: no rest until the last known bug was eradicated.

What is one thing that you’d like people to understand about the project that might not be widely known or understood?

Candy Weaver was made in pure Applesoft. I chose not to use binary data files nor assembly routines, even though the contest rules allowed them. Also, the Python “pre-processor” I constructed to assist the development process is worth a look all on its own. It is not specific to Apple’s flavor of BASIC; any microcomputer of the time would probably be equally supported.

Ultima IV Remastered is not just a bug-free edition of the original game, it’s an educational document for posterity. Anyone who wants to study how the graphics routines worked, how sound worked, how Richard Garriot organized his code, just have a look at the source I published. All disassembler-generated symbols like “a5AC8” have been meticulously replaced with sensible labels like “terrain_occlusion”. Furthermore, each modification I made has been explained in great detail, both within the code and on the project’s wiki page.


Thank you Sean for taking the time to share your story and congratulations again on Candy Weaver’s win!

More information on Sean’s tireless efforts on the Ultima IV Resurrection project can be found on his GitHub page at https://github.com/sean-gugler/u4remasteredA2

To check out his Candy Weaver game or the other amazing entries, drop by the Facebook A2SE group anytime at https://bit.ly/3B8BsgL

Sean also maintains the game on his GitHub site as well https://github.com/sean-gugler/candy-weaver

Author: Roby Sherman