Design Diary: Balance of the Planet

June 2nd, 2011

Four days ago I decided to design and program an updated version of my environmental game of twenty years ago, Balance of the Planet. That design was quite advanced and boasted a number of important features that the serious games movement seems to have overlooked, much to my chagrin. I continue to get requests for an updated version, With modern development tools the programming task is fairly straightforward, so the task should not be as herculean as it was back when we had to scratch marks on CD-ROMs with teensy-weensy stone tools. 

Monday, May 30th
I set to work on Monday morning, May 30th. I knew that the basic data structure would be a hypertexty set of pages, each page addressing a single environmental factor, such as sulfur dioxide emissions or environmental regulations about coal mining. It was a no-brainer to decide to set up an XML document to contain this information. I set to work writing both the XSL document defining the structure and my first-draft version of the document itself. I decided to work backwards, with the final score being the first document in the list, then the factors that determined that score, then the factors that determined those, and so on. Pretty soon I had a couple of dozen pages set up.

Next came the code to read the XML document, which is boilerplate stuff; that was easy. I also had to set up the basic data structures in the program, which closely echoed the data structure in the XML document, but differed in a few crucial ways.

Tuesday, May 31st
The task for the day was to get the basic display up and running. I approached the task with dread, recalling my previous disastrous confrontations with Java Swing. But I hitched up my pants and set to work, preparing a screen mockup first to guide my design. Surprise, surprise, the process went rather smoothly. Yes, I encountered plenty of snags along the way with the screen layout refusing to comply with my expectations — the Layout Manager seldom operates in a comprehensible fashion. But I was able to deal with each misalignment in turn, and by lunchtime I had an acceptable screen display. After lunch I set up the button operations so that the user could navigate through the page structure. Again, it all went surprisingly smoothly, and by the end of the day, I had the following screen operational:

Although my discussions of this work is brief, the quantity of work is impressive; as of Wednesday morning, I had about 500 lines of Java code and 700 lines of XML data representing about 30 different pages. That’s a lot of stuff for two days’ work!

Wednesday, June 1st
I changed gears and started working on some serious design problems. There were a number of improvements I had in mind for the simulation, and these would require a restructuring of the page set, so I had to make some substantial changes in the data set. The handling of energy production was the first task. In the original simulation I addressed coal, natural gas, oil, nuclear, hydro, and solar as energy forms. This time around, I want to add geothermal (to demonstrate how tiny its contribution is) and wind. I also want to break solar energy down into solar photovoltaic and solar water heating, which have pronounced differences in their economics. All of this would require a restructuring of the page set addressing energy. Moreover, I had to deal with the whole mess of price/supply/demand relationships, which although conceptually simple is computationally tricky. The basic equations are obvious:

Supply = Price Elasticity Of Supply * Price
Demand = Last Year’s Demand * Economic Growth * Last Year’s Price / This Year’s Price
Price = Price Coefficient * Demand / Supply

Looks easy, doesn’t it? Unfortunately, I ran into a nasty snag: I have nine different sources of energy, and each of them has a different function for the Price Elasticity of Supply, yet they all have the same Price. This is not so easy a problem, and I didn’t solve it on Wednesday. The full-scale attack will have to come on Thursday, June 2nd.

Thursday, June 2nd
Friday, June 3rd
Saturday, June 4th
Sunday, June 5th
Monday, June 6th
Tuesday, June 7th
Wednesday, June 8th
Saturday, June 11th
Monday, June 13th
Tuesday, June 14th
Wednesday, June 15th
Thursday, June 16th
Monday, June 20th
Wednesday, June 22nd
Thursday, June 23rd
Tuesday, June 28th
Thursday, June 30th
Wednesday, July 6th
Friday, July 22nd
Monday, July 25th
Thursday, July 28th
Friday, July 29th
Sunday, July 31st
Wednesday, August 3rd
Thursday, August 4th
Friday, September 2nd
Saturday, September 17th
Thursday, October 6th
Saturday, October 8th
Thursday, October 13th
Sunday, November 6th
Saturday, November 12th
Sunday, November 13th
Monday, November 14th
Thursday, November 17th
Monday, December 5th
Wednesday, December 14th
Monday, December 19th
Sunday, December 25th
Monday, December 26th
Wednesday, December 28th
Sunday, January 15th
Sunday, January 29th
Wednesday, February 1st
Thursday, February 2nd
Friday, February 3rd
Saturday, February 4th
Monday, February 6th
Thursday, February 9th
Saturday, February 11th
Wednesday, February 15th
Friday, February 17th
Thursday, February 23rd
Wednesday, February 29th
Wednesday, March 7th
Monday, March 12th
Tuesday, March 20th
Sunday, March 25th
Saturday, July 7th
Wednesday, August 1st
Friday, August 24th
Monday, September 3rd
Saturday, September 8th