Well, look at that!

Invasion Defender.

Oh, and did I say I was not an artist? If this works out fairly well I should hook up with someone who can do game art and (a) pretty this guy up, and (b) do other games. 🙂

(By “fairly well”, of course, I mean “make enough money to make this a reasonable hobby.” Since I’m going to be going back to college sometime in the fall, every penny counts.)

Invasion Defender and why I’m not an artist.

As an experiment over the past few weeks I put together “Invasion Defender” and last Friday I shipped it off to Apple for inclusion into the iTunes App Store. We’ll see how long it takes before I can get the application up on the store; however, my bet is that it will land in the store sometime after Christmas.

Which is fine by me.

The game itself is a variant on Missile Command, an old arcade game from the 1980’s. However, as a twist I’ve added missile shooting flying saucers (you complete the level only when all the saucers are destroyed and their missiles are gone), and landers (which, on landing, shoot missiles to surrounding cities). The arcing missiles were particularly interesting in that I created a Quadratic Bezier curve, and subdivided the curve incrementally from the start to the end. Then, drawing the missile was simply a matter of issuing a single CGContextAddQuadCurveToPoint() call.

The idea of the game is simple: you’re sitting at the airport with five minutes to kill. Kill it by killing aliens!

I suspect the paradigm of mobile gaming is that you’re sitting around bored and have five minutes to kill. You’ve already read your e-mail, and there are no sites you want to browse–so you start up a game and start playing for perhaps five or ten minutes. This paradigm then implies one of two things: either (a) your game is story-driven but can be saved arbitrarily at any point, or (b) your game is like one of the old arcade games: quick and limited in time. (Old arcade games are the perfect model because they were deliberately designed to be quick and finite–all the better to drive customers to insert quarters every few minutes.)

My intent, by the way, is to publicly announce what happens to my application, as a sort of experiment–what can a clever, but (obviously) non-artistic programmer can do by making simple arcade-style games for the iPhone. I’ll be posting sales figures and other information as I get them, as well as other iPhone related things.

Like, for example, the fact that to get your account set up for payment is a royal pain in the ass. The most annoying part was setting up the payment information dialog for direct deposit into my bank. They want the following information on the site:

Bank Name which is obvious. Account type which is again fairly obvious, as is account number. But then we reach Branch/Branch ID, Routing Transit Number and Bank Swift Code. Huh?

Well, if you are banking in the United States, you can Google search your bank (I use Wells Fargo), which means your Bank Swift Code (used for international wire transfers from international Apple Stores, each presumably are separate entities) would be ‘WFBIUS6S’, a fact I learned after searching for “Wells Fargo Bank Swift Code”. The Routing Transit Number for a U.S. bank is the Fedwire 9 digit ABA routing number, and can be found on your check or by doing another Google search. (Oddly enough there are apparently three separate ABA numbers for Southern California Wells Fargo branches which point to the same location.)

The real catch was the branch code, which I learned is apparently necessary for some banks in certain countries. Apparently it doesn’t apply to Wells Fargo, though unfortunately you cannot submit the form with that field blank. (*sigh*) Which makes me wonder if what I entered in that field (‘XXX’) will cause problems if someone in Japan buys my game.

Renaming an iPhone executable within a project

By trial and error I figured out the easiest way to rename an executable in Xcode for an iPhone.

Step 1: Select “Edit Active Target ‘MyApp'” under the Project menu in Xcode.
Step 2: Select “Product Name” under “Packaging” within the build settings for the target.
Step 3: Rename the product name to your desired application name.
Step 4: Delete the “Build” directory in your project folder or do a “Clean All”.
Step 5: (And this is where things get tricky) Quit Xcode.
Step 6: Start up Xcode with your project
Step 7: Build.

For some strange reason the product name appears to be cached by whatever system is handling code signing; thus, if you don’t quit Xcode after doing a clean all (which I’m pulling off by deleting the build directory), the old iPhone app name is used for code signing–which means you wind up with two .app folders: one which contains most of your application, and the other which just contains the signing certificate.

Go figure.

The iPhone Simulator

An accidental discovery I thought I’d write down so I don’t forget.

On the iPhone simulator, option left-click simulates two-finger clicking: option-click and drag simulates two fingers sliding in or out for zooming in or zooming out.

Likewise, option+shift left-click simulates two-finger dragging: option+shift and drag simulates two fingers dragging with equal spacing across the screen.

Useful for testing zooming in and zooming out, and useful if two-finger drag means something different than one-finger drag.

Why good user interface design is important.

Good design represents a visual “language” of sorts: when deciding upon the elements of your interface, your book, your map, you are designing the language that you are using to communicate with your reader or user. You are, in other words, giving the subtle cues which say “stop here”, “this is important”, or “this is what you need to do next.” Subtle cues can also indicate things like “I’m doing something in the background” (the rotating network busy icon in the top of the iPhone) or “You may not be able to do that here” (the status bars indicating signal strength).

Design can also save a life. Literally.

A friend of mine was telling me a story of a middleware company that almost killed someone. Their software is used in the medical profession; one element of the software would print the paperwork a pharmacy uses to fill a prescription. And the problem was that one elderly gentleman got a bottle not met for him because in the dozen or so bottles to be filled, the workers at the pharmacy accidently added someone else’s prescription to the stack of pills intended for that elderly fellow.

While he blamed it on user error, the reality is that this is a failure in good design: all it would have taken was a cover sheet between prescriptions to serve as markers between prescriptions intended for a single recipient. Or (since they provided the hardware) a specialized printer which can collate and staple automatically. Or even redesigning the page so that multiple prescriptions are fit on a single page as much as possible, with a large (and easy to read) page number and total number of pages in one corner, along with a count indicating the total number of pills to fill for this individual.

Any of these visual cues would have made it easier for a worker to notice something was wrong: as soon as the prescription count resets to 1 or the page count resets to 1 or he hits a cover page, he’d know that maybe he should read the patients name a little more carefully for this batch of pages, rather than shove potential lethal poison at an elderly individual who doesn’t know better.

The Mortgage Crisis.

When I started this blog, my intent was to limit my discussions to computer development and technical topics. However, in another life I’m also deeply fascinated by politics and economics, and I’m also fascinated by development, especially housing development issues. And today’s mortgage crisis is a perfect storm of problems that all land in my other areas of fascination.

So please excuse me while I indulge myself.

An overview of the Mortgage Crisis.

One of the most readable articles I’ve seen on the mortgage crisis comes from The Institute of Chartered Accounts in Australia: The collapse of the US sub-prime mortgage market.

This report does an amazing job describing all of the players in the U.S. mortgage market, describing the process of a mortgage and mortgage securitization through a set of fictitious players. Page 8 of that report gives a diagram of all of the players in the mortgage market, and later in the report (if you are an accounting geek, which I am thankfully not), a list of issues in U.S. Generally Accepted Accounting Practices which our mortgage crisis illustrates, such as the practice by GAAP to allow banks (such as “Insecurity Investment Bank” on page 8) to show on paper that it has no involvement (and thus no risk) when it is neck deep mediating payments on a CBO.

But I digress.

One thing the article does not describe, though it is relevant here, is the role that Freddie Mac and Fannie Mae play in the mortgage market.

On page 8, Freddie and Fannie play the role of “Insecurity Investment Bank” for conforming sub-prime mortgages. Back in 2003 as a result of an accounting scandal, Freddie and Fannie were given the additional mandate to increase its purchases of sub-prime mortgages to 50% of its overall purchases, in order to encourage low-income families to qualify for home loans.

This increased purchasing requirement created a market distortion, encouraging the other players in the diagram on page 8 to act in ways that would otherwise not be in their best economic interest. Because Freddie and Fannie were funding a greater pool of sub-prime mortgages, banks (“Last Bank & Trust” in the diagram) were encouraged to make more and more sub-prime mortgages safe in the knowledge that Freddie and Fannie would buy the loans. And because Freddie and Fannie were government sponsored enterprises chartered by the U.S. government, both bond insurers (such as AIG) and investors (“SPE Cayman Islands” in the diagram) insured and purchased the CDOs created by Fannie and Freddie thinking that these bonds were insured by the full faith and credit of the United States Government.

When some economists and politicians accuse the government of being in the middle of this whole mess, when you look at the diagram, you can see that in fact Freddie and Fannie were in the middle of this whole mess. The problem was not “deregulation” or “fat cats” preying on poor folks: if you dig through the discussion on the U.S. GAAP practices (which are driven by our tax code, the SEC, and regulations such as Sarbanes-Oxley), it should be clear that each actor in our economic disaster were doing what they believed to be legally correct–though part of the problem here was a lack of understanding by each of the players of the overall risk that each was exposed to.

But the basic problem was this: the bubble in the housing market starting earlier this decade hid the poor quality of loans being made. Freddie and Fannie could continue to drive the sub-prime mortgage market, and the banks and investors and insurance companies could continue to make money believing that the government backed the entire process.

While it is unclear the Freddie and Fannie’s “free money” drove housing prices up, it could not have helped the process: bubbles are often driven by “free money” being irrationally allocated. But it is clear that once that housing bubble popped, the entire market collapsed, leaving us the mess we have today.

Freddie and Fannie’s irrationality.

So why did Freddie Mac and Fannie Mae act against their own economic self-interest? Freddie and Fannie are GSEs, certainly–but that means that while their direction may be set by congress, they are responsible for showing a profit. Until a few months ago when they were effectively nationalized, they did not operate using taxpayer money.

Well, that all goes back to 2004, when the U.S. Department of Housing and Urban Development required Freddie and Fannie to purchase more “affordable” housing loans: How HUD Mortgage Policy Fed The Crisis.

Since HUD became their regulator in 1992, Fannie and Freddie each year are supposed to buy a portion of “affordable” mortgages made to underserved borrowers. Every four years, HUD reviews the goals to adapt to market changes.

In 2004, HUD reset the goal to 56% of overall purchases: that is, HUD required Freddie and Fannie to make 56% of its overall purchases in the sub-prime mortgage market in order to encourage poorer people to buy homes.

Unfortunately, as it turns out, those same poor people couldn’t afford the homes when the teaser rates started to adjust.

Politics: where the rubber meets the road

So one has to ask oneself why was it that banks stopped acting in their own economic self-interest? Even with Freddie and Fannie beating the bushes for sub-prime loans, they were not the only Investment Banks repackaging those mortgages. Part of the problem lands squarely on the Community Reinvestment Act, a law which nominally was supposed to end the practice of “red-lining” low-income areas. The problem is the act essentially created a “quota system” whereby banks operating in a given area had to show that their investment portfolio (including their mortgage portfolio) matched the region’s socio-economic profile.

On page 8 of the Chartered Accountants report, the CRA regulations directly affected the “Last Bank & Trust” in the diagram: it strongly encouraged Last Bank to make its loan to “Mr. & Mrs. Jones”, in order to meet Last Bank’s CRA quota requirements. The fact that the bank could make a buck off the transaction was a bonus–but even so, Last Bank was in the position that if they didn’t make these loans (which were not in the bank’s best economic interests), they could face protesters from various local community groups demanding greater CRA compliance.

And who took advantage of the CRA to force more sub-prime loans into poorer neighborhoods?

Spreading the Virus

Yet ACORN had only just begun. Two days later, 50 to 100 of the same protesters hit their main target – a House Banking subcommittee considering changes to the Community Reinvestment Act, a law that allows groups like ACORN to force banks into making high-risk loans to low-credit customers.

The CRA’s ostensible purpose is to prevent banks from discriminating against minorities. But Rep. Marge Roukema (R-NJ), who chaired the subcommittee, was worried that charges of discrimination had become an excuse for lowering credit standards. She warned that new, Democrat-proposed CRA regulations could amount to an illegal quota system.

FOR years, ACORN had combined manipulation of the CRA with intimidation-protest tactics to force banks to lower credit standards. Its crusade, with help from Democrats in Congress, to push these high-risk “subprime” loans on banks is at the root of today’s economic meltdown.

ACORN (Association for Community Organizations for Reform Now) is an umbrella organization whose goal is to make affordable housing available to poorer people. While their goals are completely laudable, like any powerful organization they had friends in Congress (largely Democratic) and their voter registration arm operates like any other special interest group, gaining votes for their congressional supporters so they can get legislation passed to support their own point of view. As such they are no different than any other organization such as the National Rifle Association.

And like any relatively sophisticated organization, when they ran into problems on the ground with insufficient funding of low-mortgage homes, they sought to resolve the problem in the system where they could:

As ACORN ran its campaigns against local banks, it quickly hit a roadblock. Banks would tell ACORN they could afford to reduce their credit standards by only a little – since Fannie Mae and Freddie Mac, the federal mortgage giants, refused to buy up those risky loans for sale on the “secondary market.”

That is, the CRA wasn’t enough. Unless Fannie and Freddie were willing to relax their credit standards as well, local banks would never make home loans to customers with bad credit histories or with too little money for a downpayment.

So ACORN’s Democratic friends in Congress moved to force Fannie Mae and Freddie Mac to dispense with normal credit standards. Throughout the early ’90s, they imposed ever-increasing subprime-lending quotas on Fannie and Freddie.

The Housing Bubble and the Great Unraveling.

In normal economic times, of course, all this repositioning, while creating a market distorting effect, worked fairly well: lower-income families were able to afford better housing, local communities improved, and the process of “gentrification” started to raise the standard of living for poorer families, especially in inner city areas the CRA was designed to help.

But when the housing price bubble started, the systems that were put in place to allow lower-income families to afford better housing kicked into high gear and created more and more bad sub-prime loans. Freddie and Fannie set standards for ARM mortgages–but to qualify a home owner only had to qualify for the fixed part of an ARM adjustable mortgage. Banks were required to meet CRA targets, which in 2004 were reset ever higher, which means they had to get more “creative” to meet those quotas–and Freddie and Fannie were there providing the funds. Investors bought more and more sub-prime loan CBOs believing they were backed by the full faith and credit of the United States.

And rising house prices were an economic price signal suggesting that the high cost of housing in areas like New York and California (driven by a genuine shortage of housing, in turn driven by high populations) was spreading to the rest of the country: the old rule that the average price of a house is about 3 times greater than average income in a local area went out the window.

Economic bubbles don’t last forever. And when this one collapsed, all the players were stuck holding the bag–including foreign banks who bought CBOs and, ironically, were some of the first players to collapse. (For example, Northern Rock PLC in England failed in 2006.)

But to suggest that this was a failure of deregulation is insane: even without regulations banks will not operate against their best economic interests, unless there are market-distorting reasons to do so. And in this case, Freddie Mac and Fannie Mae, combined with the CRA’s quota requirements to loan into poorer neighborhoods, masked (and partially driven) by higher home prices, created the overall disaster.

And when housing prices popped, the entire row of dominos, set in place by organizations like ACORN who was seeking affordable housing for the poor, by Freddie Mac and Fannie Mae looking to fund that affordable housing, and by laws such as CRA which sought to institutionalize sub-prime mortgages in the name of social justice, fell.