“I Think Aidan is Dying”

By Kevin Ryan

Posted on September 30th, 2016

The Transplant

It was 17 years ago today, September 30th 1999, that our son, Aidan, had his liver transplant surgery. He was 2 days short of being 4 months old. We heard earlier in the day that a donor liver had become available and the surgery was scheduled to start in the evening. We brought all our other children in with us to visit with him. Just before they were going to take him off for the transplant his heart stopped. My wife said, “I think Aidan is dying.” I will never forget that moment. Hits you right in the heart – hard.


Aidan’s brothers and sister visiting with him before his transplant surgery.

While the medical team worked on getting his heart going, a nurse shuttled us into an office right next to the NICU on the 15th floor of UCSF. The nurse took us to small visitor room first. “Can you please leave?” she asked the 3 people in there. “Why?” the guy asked. “We have a family in crisis.” They didn’t leave so the nurse took us across the hallway to a doctors office. We followed numbly and sat on the floor. My wife was inconsolable. We were scared the surgery would be canceled. We had walked with Aidan through 4 months of very tough times (this wasn’t the first time his heart had stopped) and it looked like all our hopes were going to disappear.


Aidan just a few minutes before his heart stopped a second time.

The surgery wasn’t canceled and he was wheeled past us soon afterwards on his was to transplant surgery and we were able to say goodbye and that we loved him. They set up an impromptu  place for my wife and kids to sleep and I went to the visitor room on the 6th floor near the NICU to wait for reports from the surgeon. Aidan was taken off for the transplant around 7 pm and the surgery lasted until 6 the next morning. The transplant surgeon, Dr. John Roberts, would come in a give me updates as the surgery progressed. And then I would walk over to where my wife was with the kids and give her an update.

Post Transplant

Aidan was very sick immediately post-transplant. We heard that his evening nurse came to see him and started crying. He was in bad shape. It was obvious the next evening that something was very wrong. His blood pressure was dropping and they were pumping blood into him. I stood there with my wife for hours, my arm around her shoulder, just watching – rooted to the spot – helpless. I remember seeing the blood pressure number drop down to around 30. The nurse was pumping blood into him by hand from a very large syringe into the tubes. I remember her rubbing her arm because it was getting sore.

At one point a large amount clear fluid suddenly poured out of Aidan’s mouth and nose. My wife and I gasped. They said, “No no, its okay, he’s still here.” A little after midnight the whole liver team was there and Dr. Roberts took him back into surgery. The anesthesiologist was also there. He must have been in his mid-60s and was legendary for how good he was. I remember him as a very gruff older guy. When they wheeled Aidan off for another surgery to figure out what was wrong, I saw him gently pat Aidan on the head and whisper, “Don’t worry sweetheart we’ll take good care of you.”

In this follow up surgery they found bleeding and fixed it. He ended up needing two more surgeries in the next couple of day to solve his immediate post-transplant problems. So we were there standing next to him in PICU around midnight the next night as they took him off for emergency surgery again. He needed a 3rd follow up surgery the next night It was three late night surgeries in a row.



About a week and a half post-transplant when his color was coming back to normal and Aidan was getting better.

At this point we settled in for the wait to see if rejection would occur and hopefully move on to a normal post-transplant life. At first his color returned to normal and things were going well. But he ended up having a long string of various medical problems – some minor – some major – all scary. I’m not going to list out everything, but it was another five years of bad stuff happening. A month and a half after the transplant he had an “event” in November that affected the left side of his body and also his cognitive abilities. It was five years before he finally got past having periods of long hospital stays.

Other Stories and Kids

When you are living in the hospital for large parts of five years you see many things. When Aidan was having his brain surgery I spent a month with him in the PICU. There was a 11 year old boy from Africa there at the same time. He moved in the PICU bay next to us – all the walls are glass. He was not too bad and then something happened and suddenly he was in very bad shape. When he was off to surgery, his nurse started hanging up equipment in his room like he was preparing for war. Over the next couple of hours all the other nurses stopped by and told him to let them know if he needed any help. There was a real sense of camaraderie. I don’t know what happened to that boy. I never asked.

Pre-transplant I was in the snack room that the nurses let us use on the 15th floor of UCSF. There was another Dad in there whose child was in the NICU too. One of the long term stays like us. He talked a lot and I just listened. He had to unburden himself from all the stress he was feeling. He talked about future plans for his child. Sometimes people just need to you to sympathetically listen to them. We asked later and found out his child had eventually died.

When Aidan was more healthy he would stay in a regular room in the hospital instead of the PICU. I was staying in his room with him about 10 months post-transplant when he was in the hospital for some bile duct surgery. Our room was right next to the nurses station and there was a 15-year old girl who would hang out there talking to the nurses. She would lend Aidan her tape recorder. We had recorded our kids talking to Aidan or reading him stories and we would play the tapes for him. When Aidan and I were back for another stay a few months later I was talking to one of the managers of that floor, a friend, who looked and sounded just like Morgan Freeman. I asked about the girl and found out that she hadn’t made it. This made me reluctant to ask about other kids in the future. It hurt.

Soon after we first showed up at UCSF there was a family we met. This when things had calmed down just a little for Aidan. By calmed down I mean he was day-by-day instead of minute-by-minute. When we first got there Aidan was minute-by-minute for the first few days. He could have gone at any moment. We didn’t leave the 6th floor. Anyway the boy in the other family needed a bone marrow transplant and eventually got it. It must have been a year or two later and we were at UCSF with Aidan across the street from the main hospital for a clinic visit. And sitting there was this 14 year old boy. We heard his first bone marrow transplant failed. He was just sitting with eyes not focused on anything and looking way too old for his age. I really really hope he made it.

When Aidan was about 2 years old I was pushing him around in the stroller and was going past the PICU. There was a lady there whose young nephew had just been admitted to the PICU with acute liver failure. I think he had ingested the wrong thing. I told her Aidan’s story and how far he had come. She got down on her knees and looked at Aidan with tears streaming down her face. Writing this brings back the emotions that I felt at the time. As I looked at her gently talking to Aidan, I realized that he was a living symbol of hope.

I think it was around 3 years post-transplant when we met the family from Afghanistan. They had had a very eventful life. Their baby needed a liver transplant and the transplant happened while I was there at the hospital with Aidan. I talked to them quite a bit both pre and post transplant. Their baby had post-transplant problems like Aidan. I talked with them about our path – hope. Later on the transplant coordinator told me, “they really really like you.” That made me feel good that I was able to slightly ease their burden.


A week before Aidan had his transplant we were just in a holding pattern waiting for a donor liver to become available. I was stopped at the light on 19th and Sloat avenue in San Francisco driving back to our apartment next to San Francisco State and I started thinking about the donor-to-be. That kid was most likely somewhere playing right at that moment. It was a sad feeling. A week later Aidan received his liver from a 7 year old Hispanic boy from the Central Valley of California who was hit by a car. His parents gave us a gift beyond measure. They are often in my prayers.

I’ve kind of rambled on here. This anniversary day always brings up a strange mix of emotions. I’m acutely aware that I could be visiting Aidan at a graveyard. But I’m not. He is up in Eugene, Oregon with me today. He is my buddy. Cognitively he will always be around 6 years old. I took this photo of him this afternoon taking a nap next to me. Life is good.


The Incredible Machine and a Billiard Ball Computer

By Kevin Ryan

Posted on August 9th, 2016

The Incredible Machine (TIM) is a computer game released in 1992 that is driven by custom physics and is very similar to Rube Goldberg and Heath Robinson machines. There were a few games in the series and it got a surprisingly large and loyal following. We won an “Honored Developer” award at the 1993 Game Developers Conference for it which I think was the first year that they gave out any sort of awards. I think I still have it somewhere – it was a pin or something like that. Later on TIM was inducted into Computer Gaming World’s Hall of Fame which was a very pleasant surprise.


Oh this looks neat!

In the summer of 1992 when I was partway through implementing the original group of parts in The Incredible Machine, I read about Edward Fredkin and Tommaso Toffoli’s Billiard Ball Computer. Roger Penrose also discussed it in his book The Emperor’s New Mind which I was reading at the time. Along with a technical description it had a nifty graphic showing a billiard ball model for an AND gate similar to the one pictured below.


Modeling an AND gate with Billiard Balls

Wow, that would be cool to implement! I realized that I already had the basic physics and collision frameworks in place and I could implement the needed parts in TIM without too much effort. Walls, incline, and balls were already working. Finding enough free time before shipping would be the constraint on whether I could get it done in time by the ship date or not. TIM had a very tight development schedule.

Coding The Incredible Machine

Coding on TIM started on March 26, 1992. I know that exact date from the title page of my design. On the day that I finished the design, I wrote the date on the title page, printed it out, went “whew, finally” and then immediately started coding in the unheated and unfinished basement of my home in Eugene. Note: this was not my parents’ basement – I was married and had three young kids at the time. Once I week I’d walk over to Jeff Tunnell’s office with the latest build on a floppy disk and show the build to everyone.

The Incredible Machine Design

Title page of the original design.

Collision System

The first order of business when I started coding was getting a collision system in place. No Google, no big Internet search space, so I ended up writing the collision code from scratch. I decided to go with polygon borders for all the parts. Everything had to be integers because at the time the speed of floating point operations on CPUs was slow.

The conversion factor for the 16-bit integers was: 1,024 in the physics space was equal to 1 in the screen space. A shift of 10 bits left or right would convert between the two coordinate systems. The 360 degrees of a circle were covered by 16-bits and went from 0 (0 degrees) to 65536 (360 degrees). In hex it came out as: 0x0000 flat facing up, 0x4000 vertical on left, 0x08000 flat facing down, and 0xc0000 vertical facing left.

All the parts collision shapes were defined by polygons which could be either concave or convex. The collision checks were line segment to line segment – projecting each point of the polygon to where the new position would be based upon the velocity, creating a line segment, and checking for collisions with other polygons. If a collision was found, then the projected line would be adjusted to the point of first collision.

As an aside, there are now terms for most all of this stuff which in many cases didn’t exist at the time. Lots of ad-hoc development here – making it up as I went along. So the segment-to-segment check would be what is now called swept collisions. There was also a broad-phase collision check. The way collisions were implemented allowed me to do a bit check on the high bit and reject roughly half the checks – less calculations – important because frame rate was a big concern. The fastest code is the code that isn’t executed.

The collision polygons for the Balloon and Birdcage became my debug test cases. I created graph paper version that exactly matched how they were represented in the game data. I would move the paper cutouts around by hand in various collision scenarios to verify that the code was working correctly. The hex values in the balloon and birdcage photos are the slopes of the line.


Balloon and Birdcage. Testing models and how they appeared in game.

Physics Code

Written in parallel with the collision code was the physics code to apply forces to resolve collisions. Every part was a point mass with some parts being static and some dynamic. Each part had a density, mass, elasticity, friction, terminal velocity, and various other parameters. Sir Isaac Newton wrote the physics code for me roughly 300 years before TIM. I just had to put it in modern C code and make it fast and use only integers.

The structure for how the basic properties of the parts were defined is listed below. (Ugh, I don’t like the code style I used back then). Those last elements in the struct are function pointers. They pointed to general routines for the parts and I would override them with pointers to specific functions for parts that needed them. TIM was written in C and this is similar to overridable methods in C++ although I wasn’t familiar with C++ at the time.

struct part_elements
   short          density;
   short          mass;
   short          elasticity;
   short          friction;
   short          acel;
   short          terminal_velocity;
   TIM_VEC        max_size;
   TIM_VEC        min_size;
   struct shape   **part_shapes;
   SSHAPE         **super_shapes;
   TIM_SCVEC      *shp_offset;
   TIM_VEC        *shape_size;
   unsigned char  plane_num[2];
   short          num_borders;
   short          part_bin_order;
   VOID_BPARTFPTR bounce_func;
   VOID_PARTFPTR  internal_func;
   VOID_PARTFPTR  reinit_func;
   VOID_FPARTFPTR flip_func;
   VOID_PARTFPTR  resize_func;
   VOID_RPARTFPTR rope_func;


So Where is the Billiard Ball Gate in TIM

Short answer: It’s not there. I ran out of time.

Slightly longer answer: I really wanted to make an adder just like the picture below instead of just making an AND gate. Defining the elasticity and borders needed for the billiard balls would have been very quick and easy, but getting all the parts lined up correctly even for just the simpler AND gate would have been more time consuming than defining the needed parts.


Diagram of an adder circuit.

Game Dev Weight Loss Program

As best as I can remember, we shipped the first version of The Incredible Machine in mid-November of 1992. I remember that at the time getting to gold by mid-September was important for the Christmas season. Big orders by the distributors and stores were being made in September and then they’d duplicate a whole bunch of floppies and print up all the boxes. There was a lead time for all this so we would usually be shooting for mid-September to have a gold disk ready for shipment. It was a very bad thing to have bugs in the shipping floppy disk version because there was no simple way to get out an update.

So the summer of 1992 was a mix of implementing all the parts, tweaking the collision and physics code, and creating all the puzzles that would ship with the game. Creating new puzzles started becoming harder and harder. I was very busy and over that summer my weight dropped from 155 to a little below 140. It was fun! Really! I wouldn’t still be doing games for all these years if it wasn’t fun. But it was tiring too. Near the end of TIM development I started referring to it as a 6 month sprint.


Some of the puzzles from TIM. I would go through them all and reorder how they showed up in game to gradually increase difficulty for the end users.

I just played the first version of TIM for the first time in a long time – a very long time. I had to buy it from the Good Old Games website because I don’t have a running copy here. I see that Billiard Balls aren’t even in the first version, but they did make it into the “Even More’” version where more parts and puzzles were added. And they aren’t affected by gravity and are perfectly elastic so they had the correct physics attributes to implement the AND gate. But they would have still needed work to give each of them the exact same initial velocity when entering the gate and then there would have been lots of tweaking of position to get them working correctly.

Over the last year few of years I’ve been working on Contraption Maker with Spotkin. It is published on Steam and we continue to make updates for it. There is a different publishing paradigm in place. Now it is easy to do updates seamlessly to the end user. A Billiard Ball Computer is on my to-do list for Contraption Maker although the physics system being used would make it just a little harder because it doesn’t use swept collisions. Maybe someday in an update I’ll get it in there.

More Reading:

Conservative Logic a paper by Edward Fredkin and Tommaso Toffoli.

A Good Egg Named Alice – Physics and Design of the Egg in Contraption Maker

By Kevin Ryan

Posted on May 16th, 2016


Alice rolls down next to Eggclops.

One of the parts in Contraption Maker is an egg. I’m going to write just a little here about its gestation and implementation.

I was looking through some old emails and chats to refresh my memory and found the chat listed below. The egg was originally going to be a breakable ball, but I decided to make it an egg instead.


I thought that an egg would have more whimsy and character than a ball. It is obvious what it is to the end user and it is also very obvious that it is fragile. In addition to that it also has a different rolling motion than a ball has which gives the opportunity for more variety in the puzzles created.

One thing that I wanted to do to give the egg more personality was to have multiple versions with different names. And each of them also had a different look so they looked better and would give a more varied look on the screen than just a single white colored egg. Here are all the eggs along with the pop up window that lets the user select which egg to use.


Current batch of Contraption Maker eggs.

One other nice side benefit was that I was able to name the eggs after friends and acquaintances and let them be in game – if only as a egg. Once I had the egg implemented it seemed only natural to have it attract the dog Tinker if it broke.  Once you’ve added a new part then suddenly more possibilities open up about how it can interact with all the other parts in the game. As you add more and more parts you end up with a rich cacophony of interactions between them all.

Here is a short animation of how the egg attracts the dog when it breaks.


If you look underneath the hood you’ll see that this is accomplished by a method in the egg class that is called when any other part sees it. If the calling part is a dog then the egg returns the dog attract info, otherwise it returns NULL which means no attraction.

CMPartAttractsInfo *CMPartEgg::getAttractsInfo(CMPart *part)
    if (mCracked && (part->mType == PART_DOG || part->mType == PART_SCAREDY_DOG))
        return &sDogAttractsInfo;

    return NULL;

This is the structure that is returned to let the dog know how attractive the egg is to it. Since the dog may see multiple other items besides the egg, it is up to the dog’s AI to take this attracts info along with any other attracts info it gets from other parts and then figure out what to do. (I’m formatting code below to look okay within this blog post.)

// Constructor for the attracts info returned
// - Att postfix is the attracts values
// - Rep postfix is the repulses values
   int minDistFrontAtt, int maxDistFrontAtt, int minDistFrontRep, int maxDistFrontRep,
   int minDistBehindAtt, int maxDistBehindAtt, int minDistBehindRep, int maxDistBehindRep,
   int priorityAtt, int priorityRep,
   bool canLookBehind, bool shouldRun, bool edible,
   int repulseHighPriorityDist=FLOAT_TO_INT32(50))

// The attracts info for the egg attraction for dog
// Only attracted to eggs in front of it that aren't more than 230 units away
static CMPartAttractsInfo sDogAttractsInfo(
   FLOAT_TO_INT32(0),FLOAT_TO_INT32(230), 0,0,
   0,0, 0,0,

One last thing on how the design evolves. These are all “good eggs.” If there are “good eggs” then shouldn’t there be “bad eggs?” It is on my internal list of parts to someday implement. Bad eggs would be smelly and repulse lots of other creature/character parts.

In closing here is the code that implements the egg:




Inspiration – How I Designed a Hole in Sierra’s Bestselling 3D Ultra Minigolf

By Kevin Ryan

Posted on May 5th, 2016

Designing in a Meadow

I used to do quite a bit of computer game design work at a meadow near Kaiser Pass which is up around the 9,200 foot level of the Sierra Nevada Mountains. It’s about 40 minutes from our home at Shaver Lake. This was back in 1997 and I would sit with a yellow pad sketching down ideas and hole layouts for 3D Ultra Minigolf Deluxe while my kids would run around and have fun. It was a good work environment.


Kaiser Meadow – Kids way off in distance on the right. Wife and toddler in foreground at left.

It was a neat place for the kids because there were a lot of frogs and if we came at the right time of the year there were also tadpoles or big groups of frog eggs. I can remember coming up to the same meadow back in the 1960s when I was their age.


Looking for frogs in one of the ponds.

Because it is at such a high elevation it would get very cold at night so things could freeze over even in the late summer. Depending upon the winter there could also be snow patches until late in the summer too.


My son finds some ice.

So I got to sit outside in a beautiful environment and work on my game.

Eventually I’d have to go inside and sit down at a computer in my home to get the ideas into a specific digital form. It has been like that for me lately in that I can get a lot of creative work done, or inspiration on how to solve a problem, while just walking through the forest or even just driving somewhere in the car. For the minigolf game the “sit down at computer and implement” step would involve creating models of each hole in 3D Studio Max. I’ll write about that process a few paragraphs down.


Raindrops and Opening Screens

The idea for the opening of one of my very first published games, Black Belt (not the Sega game of same name), came back in 1983 when I was driving home from college in Oregon to my parent’s house. Somewhere near the Oregon-California border it started raining big fat occasional raindrops on my windshield and the way I wanted the opening title screen for Black Belt just magically occurred to me.

So when I got back to my apartment in Eugene across from Beall Music Hall (which I recently learned is pronounced “bell” not “be-all”) I implemented the idea. It is nothing awe-inspiring or great or anything, but the genesis of the idea seemed pretty neat to me and I’ve remembered it. Ha, someone uploaded it on YouTube, so you can see the opening here:

I suppose writing is like that too in that you can come up with general plot ideas, characters, situations, etc. anyplace, but eventually you have to sit down at a computer (anyone still use a typewriter?) and write down the specific words that make up the story.


A Minigolf Hole

The drive up to the meadow at Kaiser took about 50 minutes and on the way we’d drive past the Shaver Lake dam and the marina. The road there curves along the lakeside and I suddenly saw an alignment of geography that could be used as a hole in my game. When I got up the meadow that day I sketched out a design for the hole while thinking of any technical challenges that various elements would cause. Here is a view of the area courtesy of Google Earth:


Shaver Lake marina and highway 168 along lakeside.

And here is the sketch of the minigolf hole:


At this point the next work on a hole would be done in my home office where if I thought the concept was okay and had enough fun elements then I would spend a few days creating a playable 3D model of the hole. I would putt around on it, making different adjustments so that it played well and adding and/or removing different elements. Fun to play and works? Okay, good, keep it. Otherwise it goes into the trash.

The 3D model that I’d make didn’t have any of the artwork detail, only the shapes need to make the hole playable. The following scans are from the artwork design document. There would be three views of a hole: overview, tee, and top down. The top down view also had a very general description. (Sorry, printed them in black and white back then):

After making sure that it played well the last step was to get a concept drawing done of the hole that could be used by the artists who would be rendering out all the artwork. I was very lucky because I worked with Don Carson on this project. He designed Mickey’s Toontown in Disneyland and a bunch of other stuff. Click here to see some of the neat things he has made. And some more here in Part Two. Really click – his stuff is awesome. His blog is here and is worth following. I always knew that the concept artwork that I’d get back from him on any of my games would be just amazing! Here is the concept he drew for this hole:



Unfortunately I can’t show you how this hole turned out in the game because it wasn’t implemented. My design had 18 holes and I got them all to the playable state and Don did concept artwork for all of them, but because of budget issues only 9 of them were actually rendered off and put into the game. The rendering of all the artwork took a long time. Below is the Moon Base hole so you can get a sample of what a final hole did look like.

We had musical themes for each hole and that really added a lot to the atmosphere. Chris Stevens along with Ken Rodgers creates the music and sound effect. Chris has gone on to win multiple Grammy awards. Hit the play button and you can hear the moonbase theme.


Dynamite Cows

So we come to Dynamite Cows. I live high up in the mountains and will occasionally make trips to Fresno, the closest large town, to do shopping. When driving through the foothills I’d see lots of cows in the fields. One day for some reason the thought popped into my head, “How about herding cows with dynamite.” I actually spent some time developing a product from that idea. Here is the title screen. Sorry again, don’t have anything but black and white printouts with me now. I’m sure I have source code and nice real art backed up somewhere on a CD.



Here is a very rough first pass at a game play screen.


And here are a few of the cows. Wish I had a color version of these screens.


Mercifully (for end users) I never got past some very preliminary work on this one. It was fun for me though and sort of a joke. “Mooooves” “Cowleidoscope” – shakes head. It is the nature of the beast to have things that don’t pan out. If you never have failed projects perhaps you’re not challenging yourself enough?

I’ll end with this little story from a biography of G. K. Chesterton.

Restaurants and pubs, in fact, not newspaper offices, were much more likely places to find Chesterton writing his articles. Charles Masterman remembered one such Fleet Street restaurant where Chesterton used to write articles,

mixing a terrible conjunction of drinks, while many waiters hovered about him, partly in awe, and partly in case he should leave the restaurant without paying for what he had had. One day…the headwaiter approached [Masterman]. ‘Your friend,’ he whispered, admiringly, ‘he very clever man. He sit and laugh. And then he write. And then he laugh at what he write.’

That seems to be the key for me. Enjoy what you do so much that you can laugh as you do it. My work has never felt like a job.