Saturday, November 30, 2013

What was it like to learn how to code?

About a year and a half ago, I seriously started learning how to code.  I had no formal training, but had picked up some programming knowledge since graduating from undergrad.  Now in business school, I had the idea that I could program a game instead of a normal summer internship.  I'd learn more about technology, put my previous gaming experience to use, and might even make a few dollars.

I remember visiting a friend's gaming startup.  One of the engineers asked me what I planned to do over the summer.  I - hesitantly, I'm sure - answered that I was going to create my own simple tactical RPG. But oh, by the way, I didn't even know how to code.  I was learning as I went along.  He looked at me like I was crazy.

But the thing is - I did it!  I built Solarian Tactics on a shoestring budget and actually shipped something.  This summer, I released a sequel of sorts, Sol Heroes, based on my learnings from the first experience.  Tens of thousands of people have played my games.  And while it's nothing compared to what we would have considered a success when I was at Playfish, sometimes I am still shocked to think that more people have touched this product I made than I will probably get to know in my entire life.

So how does it feel to have my year and half of coding experience?

Mostly it feels like I am doing something wrong.
I always have this nagging feeling that I am doing something wrong.  In the beginning, I had some amazingly ignorant comments in my code like //What is an instance variable?

But even now, I sometimes worry that the entire architecture of my game is fundamentally screwed up or that I have misunderstood something all this time.

When someone asks me how I wrote the artificial intelligence for my game, I still chuckle to myself.  To me, I felt like I wrote some horribly inefficient code and plugged in some probably stupid variables, not something that I can dare call an "AI algorithm."

I fought a lot more with libraries than I expected
I used an open source framework, Cocos2D, to help run my game.  There were a lot of questions I had that I couldn't easily find the answer for - could I use Cocos2D with storyboards? Does it make sense to use CCBatchNode when I just have 10 sprites?  I was simultaneously shocked that the documentation could be so bad, and amazingly thankful that someone took the time to make the framework available to me free of charge.

There was a time when Sol Heroes was crashing more than once a day for each user it had. Someone left a review of my app with the title "Terrible Coding" and I felt my users had finally figured me out.  The issues turned out to be related to how I misunderstood Cocos2D.  And I felt I spent days searching Google and Stack Overflow for my obscure error.  It didn't feel productive at all - I wasn't writing any code and I also wasn't learning something useful about the library.  I just went down different rabbit holes hoping the problem went away.  I finally fixed that particular problem - and I'll leave this graph here since I'm damn proud of it - but it was painful.

It was times when I could just write code that I felt most productive - for example, ironically, the "AI Algorithm" that I created.

I'm afraid of updating anything
In this last year, I learned to be afraid when updating anything (I suspect "real programmers" would not feel this way).   For example, I updated my iPhone to iOS 7 when it came out.  This simple change led to a series of pain.  First, I realized that I could no longer test my game on my phone through Xcode.  I had to update Xcode.  So I went ahead and tried to do that.  I realized I had to pay $20 for the Mountain Lion upgrade to my Mac OS before I could update Xcode.  I paid and upgraded to Mountain Lion.  Now, I updated to Xcode 5.  Unfortunately, Xcode 5 is really meant to only work with iOS 7.  My whole games UI was based on iOS 6.  So I had to look up some clever ways to support both iOS 6 and 7 on StackOverflow.  Okay, now that I did that, I realized iOS 7 displays fonts differently than iOS 6, so I needed a solution to that... and it went on and on.

It's satisfying to ship something
Despite all of these hiccups, I had a great time making these games.  It was satisfying to have an idea of what feature I want to make and then just be able to make it.  I could see feedback from users, good or bad, once it was released.  It is fun to open up my iPhone and show people what I made.

If I step back, it was satisfying not just release games, but to take on a big technical challenge like learning how to code a game without any experience.  A part of me never thought I could actually actually do it (though I obviously decided to try!).  And I think I demystified for myself a lot of what it means to program something.

Overall, I expect in the future I'll be less afraid to tackle new technical challenges.

Wednesday, November 20, 2013

How successful is NASA's COTS program?

Cots?  Are those beds?
COTS stands for the Commercial Orbital Transportation Services program.  NASA needs to regularly resupply the international space station (those astronauts need to eat).  The USA previously did this with the Shuttle program until it was cancelled following the Columbia disaster. As a result, NASA created the COTS program in 2006 to fund commercial firms with good proposals for the 'routine' resupply of the international space station.

The program is now complete with the SpaceX Dragon and Orbital Sciences' Cygnus graduating from the program by demonstrating they can deliver supplies to the space station.

COTS by the numbers
The Shuttle, it pains me to say, turned out to be extremely expensive.  Over the lifetime of the program, each launch cost about $1.5 billion.  It cost around $20,000 to put a pound into orbit.  In comparison, NASA's total investment in the COTS program is around $800 MM, less than a single shuttle flight.  Now, SpaceX is delivering cargo to orbit for about a tenth of what the Shuttle was, around $2000 per pound ($56.5 MM per trip).

Some might point out that the comparison is unfair since the Space Shuttle carried 5-7 astronauts to the international space station, which obviously need more life support than a bunch of cargo.  Plus, the Shuttle has more storage capacity than SpaceX's Falcon 9.  That's all true.  But we can add all of that up.

NASA currently pays Russia $70 MM to get each astronaut to the ISS.  So say you pay Russia to fly 7 astronauts (7 x 70 MM or 490 MM) to the ISS and then fly two SpaceX Falcon 9 for supplies (2 * 56.5 MM or 113 MM).  That adds up to $603 MM.  If Shuttle costs truly are $1.5 B, that's nearly $900 MM in savings each flight.


If COTS' goal was to reduce the cost NASA pays to get supplies to the ISS, it has been hugely successful.

Wednesday, November 13, 2013

Book Review: Apollo

"When they said, "Let's go to the moon" - hell, everybody didn't stand around saying, "What am I supposed to do" or "Send me a directive," or "What's the procedure for going to the moon?"

I'd highly recommend Apollo by Charles Murray and Catherine Bly Fox.  It was humorous, informative, and surprisingly suspenseful.  Like with my review of The Making of the Atomic Bomb, I'll record what impressed me about the book:

The Influence of the Cold War
Prior to reading the book, I thought Eisenhower didn't like the space program, but JFK was excited about it.  It turns out JFK was not excited at all in the beginning of his term. Wiesner, President’s Science Advisory Committee in Washington, hated the idea of manned space exploration, pointing out that it was orders of magnitude more expensive than unmanned exploration.  The science benefit couldn't justify the cost.

What changed everything was the Russians putting a man into space first. Even after reading the book, it is hard to imagine the Cold War environment and how strong public pressures must have been on the White House to make JFK go from viewing manned spaceflight as unimportant to a number one priority. This dramatic change (which would cause the government to increase the budget of NASA 10x in the course of 4 years) happened less than 2 months after the Russians put a man into space.

I wonder -  would anything have the same effect on the US public?  What if China landed on the moon?  On Mars?

Incredible Speed
To land a man on the moon 8 years after JFK's speech, NASA had to move fast.  "In those days, you could do things with a half-page memo," one employee recalled. Look at the month by month timeline that kicked off after JFK gave his moon speech:
  • July - specifications for spacecraft hardware were completed; RFPs sent out
  • August - Spaceport site selected and land acquired
  • September - Production facility for rockets selected; land for Houston (of "Houston we have a problem" fame) acquired
  • October - Rocket test facility land acquired
  • November - Command and service module contract awarded
  • December - First stage of Saturn contract awarded
Mission control was created when Chris Kraft went up to someone and said, "There needs to be someone in charge of the flights while they're actually going on and I'd like to be that person."  On how soft or hard the lunar surface might be, Cadwell Johnson recalled that the scientific community just couldn't agree, "So Owen and I got together and we said, 'It's got to be like Arizona! The moon has just got to be like Arizona! Can't be nothin' else'"

Once in a lifetime...
The book is filled with examples of people that felt that the Apollo program was special.  For example, Bill Tindall "had the exuberance of a seven-year old on his way to the circus." "It's just incredible that we'd get paid to do what we're doing!" he'd exclaim.  The authors point out that "for the last half of the 1960s, NASA seemed to be getting the best of both worlds - superb management without bureaucratic paralysis."  And it's worth repeating that the people of the Apollo program accomplished their seemingly impossible goal that JFK had given them.


Overall it seems the feeling of a clear goal and national pride was enough to push the Apollo team to work harder and longer (many described the experience as a blur) without the financial incentives.  Perhaps it was this feeling of teamwork that led those in Mission Control who had the power to assign themselves to the most exciting and historic part of the job (the Apollo 11 lunar descent) instead assigned others, and a dozen other examples that led to success.

So my final takeaway from the book is that it was exciting and great to read in much more depth about something I'd always cared about.  But it was a bit depressing as well because the NASA of the Apollo program doesn't sound like the NASA of today.  

Wednesday, November 6, 2013

In a car in the year 21XX

"Do you believe people used to drive these things?"

"What're you going on again about?"

"These cars.  Humans used to have to physically drive these cars around themselves."

"I mean it's not a big deal is it, you just tell the car where to go."

"It is a huge deal!  It's so primitive.  Let me tell you, they basically let children drive these things and guess what - they'd crash into things.  Tens of thousands of deaths per year! Traffic accidents used to be the leading cause of death for people 15-24 years old."

"That's horrible.  Why even let them drive at all?"

"I mean what else are you going to do?  They've got to learn how to drive sometime right.  Pretty much everyone learned how to drive."

"I suppose so..."

"And you know what's worse?  People used to get drunk, drive these cars around, and kill people."

"Are you serious?  Now that's just stupid!"

"But is it really - how many bars are within walking distance of our place?"

"Well, zero I suppose."

"And do you like going to a bar every once in a while."

"I do."

"There you have it!  You're stuck now, aren't you?  You would go to a bar, grab a drink or two, then operate this deadly machine back home.  The law even said you could have a couple of drinks before driving since you weren't too impeded."

"Gosh."

"That's not even saying where you'd put the damn thing when you got your drinks."

"The car?  You'd own one of these?"

"Damn right you would.  It can't drive itself so it sure as hell can't pick up Aunt Millie and take her to where she needs to go after it drops us off.  So you'd have to find a place to park in this congested city, grab your drinks, then drive it back to your home."

"Why put it in your house?  What the hell's it going to do there?"

"Nothing!  It used to just sit there useless.  The average American drove their cars maybe 1-2 hours each day.  So the other 22 hours it would just sit there like a piece of brick."

"That's so inefficient."

"Damn right it is."

...

"Geez well I'm glad they figured out this car stuff since then."

---

Thanks to Hillary and Jonathan for the idea

Wednesday, October 30, 2013

Is fighting aging controversial?

Google's announcement of Calico was covered by Time with the controversial headline "Can Google Solve Death"?  It was a grandiose title that leads one to think of immortality and whether humans should even be considering the question.  The negative responses normally didn't criticize the science, but were beliefs like "should humanity be working on this" or "we shouldn't live forever."

Really, I think aging research should be viewed like any other medical advance: stents, new drugs, pacemakers.  There's a lot we do which isn't "natural" with the goal of making human welfare better, and I think it's a worthy goal.  I don't know if aging research will pan out, but some mythical sense that it is a taboo isn't a good reason to reject it.   Here are my top reasons why aging research isn't controversial at all.

We'll still going to die
Even if we solve aging completely, we are still going to die.  After all, no amount of aging research is going to prevent me from trying to "hold my wee for a Wii", winning a Darwin Award. or kneeling over while playing Starcraft.

Proponents of anti aging research claim we will reach some sort of "longevity escape velocity" where we will figure out how to extend our lives by 20 years.  Then in those 20 years, we can figure out how to extend our lives by another 20 years.  I think they want to make anti aging research seem even more appealing by offering the holy grail itself - immortality!  I have a hard time getting my head around that. And I worry it turns people off from considering aging research since it violates some well known Hollywood taboos.

For me, I don't need immortality to support the idea of extending lifespan.  I'm happy with any additional years you give me however you give them to me.  But don't get me wrong - I'd love to be proved incorrect that immortality won't happen (and you can have the rest of my infinite lifetime to hold it against me).

Living longer is a historical trend
Life expectancy has gradually increased - probably since the beginning of human history - but certainly in the last 150 years we have data for.   Since 1850, life expectancy at birth has roughly doubled.  Even if you account for just those who have reached the age of 20 (which screens out much child mortality), you find that life expectancy has increased by over 40%.

We view a life expectancy of 70 or 80 as normal because we are used to it: not because it is "natural."  It's the result of decades of research and painstaking trial and error.  It'll be much more natural for us to all die young of any of the myriad of diseases we now have cures for.  If we somehow extend life expectancy to 120 years or so, we'd get pretty used to that too.


It's just another therapy
Sometimes people say things like "But I don't want to live that long." I don't really understand that because if we do have some breakthrough in fighting aging, it'll come like any other therapy. It'll be an optional therapy that people can take or not. No one forces someone to take high blood pressure medication or get a stent, but sure enough people tend to do so since it increases their lifespan.  Not to mention that we know plenty of ways you can reduce your life expectancy if living longer is a problem.

"Newsflash: Medical researchers are conducting medical research"
So all in all, I think anti aging research should be far less controversial than "solving death." It's just like another research task that is likely to be a dead end, but could lead to some good.  It's likely we'll still die (if it even works at all), we'll just live longer (like we have for all of history), and it'll be an optional therapy (that you can take just like other drugs).  And that is why I don't think fighting aging is controversial at all.

Wednesday, October 23, 2013

Book Review: The Making of the Atomic Bomb

I read The Making of the Atomic Bomb which was recommended to me by Mike Munie.  I thought it was a great book which somehow explained to me both the history and science of the project in an accessible way.  Here are some thoughts impressions the book left on me:

The huge power of government to turn things on.  The Manhattan Project was initially stalled behind a ineffective committee but soon became a top priority where cost was not an option.  If there was a question of what to do, the answer was often "just do both."  Before reading this book, I did not know that the atomic bombs dropped in Nagasaki and Hiroshima were actually entirely different designs, both of which were created during the Manhattan Project.  Another scary fact: approximately 130,000 people were employed at the project at its peak - roughly the size of the entire American automobile industry!

Predicting the (sometimes scary) future.  I tend to think that the future is so uncertain that it is impossible to predict what will happen.  It is impressive that some scientists were able to imagine the atomic bomb more than a decade before it was completed.  For example, Leo Szilard thought about a sustaining chain reaction with neutrons in 1933 (before fission was even discovered).  After confirming that neutrons multiplied in nuclear fission in 1939, Szilard and many other scientists realized that a bomb was theoretically possible.  James Chadwick (the discoverer of the neutron) conducted more experiments on the feasibility of the bomb in 1940.  Later, he had this to say: "I did realize how very serious it could be.  And I had then to start taking sleeping pills.  It was the only remedy. I've never stopped since then.  It's 28 years, and I don't think I've missed a single night in all those 28 years."

An Inspiring, Big Goal.  The book emphasizes that having a big, audacious, and clear goal is inspiring.  Working on the project was a pain: scientists couldn't tell their spouses about their work, they would be relocated to the middle of a dessert, and they would live in with barracks-like conditions.  At the same time, being a part of a major undertaking that would win the war was so appealing that most accepted.

Great Leadership.  Leslie Groves and Oppenheimer organized the Manhattan project from the military and scientific side (respectively).  They seem to have universally earned the respect of their peers.  I was especially interested to read about how Groves (who was not a top physicist) immediately earned respect (for example, the scientists were worried they would not have enough ore, but Groves found a source of uranium just 1 day after being assigned the job).

The horrors of war.  The book did a good job of balancing the amazing scientific discoveries and accomplishments of the Manhattan project with the pain of war.  For example, Rhodes argues that bombers were not accurate enough to hit military targets so were instead used to just kill civilians (which was euphemistically called hurting "morale").  The end of the book describes graphically the effects of the bombs dropped on Hiroshima and Nagasaki.  I won't leave any gruesome quotes here, but I hope war never comes to this again.

Tuesday, October 8, 2013

Are iOS games more blockbuster driven than even Hollywood?

We classically hear about some industries (such as movies, pharmaceautical drugs or games) as having a blockbuster business model.  The top products make a ton of money, making up for all the loses of the average product.

I've always thought that the iOS game market might rely even more on blockbusters than Hollywood itself.  Sensortower recently released their app leaderboards, which estimate how much each App is worth.  I obviously can't say whether or not their estimates are correct (and they don't claim to be representing revenue exactly), but I just took it as the truth and compared it with the top grossing movies of 2012.


I represented the revenue of each game or movie as a percentage of the top grossing example in its category. The results are interesting - movies exhibited a much flatter curve than the iPhone games.

Why is this?  It could be because more people discover iPhone games by looking at the top charts, whereas movie recommendations work in a variety of ways.  It could be that it is difficult to market to a niche iPhone game segment compared to a niche movie segment - leading to mass market games being most popular.  And it could be because the top iPhone games really are that much better than the 100th iPhone game.