Monday, May 3, 2021

Game 254: Hamurabi

Download my VB.NET port of Hamurabi here:
 

I knew we'd be getting here eventually. There aren't many pre-Pong games that could really be considered foundational to major genres, but Hamurabi, a 1968 resource management sim responsible for inspiring a host of clones and expanded versions, is clearly one of them, and possibly the last such game I'll cover. A simplistic exercise in managing grain, land, and people, Hamurabi is cited as the ancestor of city management sims and their cousins business management sims, so it was only a matter of time before I ran into a such a game, and my next whale, M.U.LE., is exactly that - a business management game with a simulated economy and an emphasis on resource management, which had been likened to Hamurabi by contemporary critics.

Hamurabi - said to be spelled that way due to an 8-character filename limitation - charges you, as an administrator of ancient Sumeria, to manage the city's grain supply. The annual harvest can be wildly unpredictable; most of the time, a properly managed city will yield a surplus which can be invested in more land, but sometimes it will come up short no matter what you do, and there will be famine if you haven't got enough in reserve. Random disasters - plagues and grain-eating rats - can strike without warning too.

Like most early mainframe games, Hamurabi exists in many versions, being nearly as easy to modify and expand as it was to distribute. There are modern versions today, coded in languages like Javascript and PHP and playable online. The most influential version was undoubtedly David Ahl's BASIC conversion published in 1973, which added some flavor text, a 10-year performance assessment, and the possibility of impeachment should you perform extremely badly in any given year. As is my usual policy, I intend to play Hamurabi in the closest representation of its original incarnation as possible, which usually means seeking out the earliest extant version.

The roots of Hamurabi date back to 1964, when elementary schoolteacher Mabel Addis co-wrote and directed The Sumerian Game as an educational exercise. Aided by slide-projected images and instructions on cassette tape, The Sumerian Game isn't so much a computer game as it is a classroom game aided by a computer. Even if it were possible to run the program today, it wouldn't be meaningful without the multimedia presentation or a human administrator to coordinate them and run the game. The program itself is lost, as are most of the slides, the audio, source code, and what printouts still exist only cover the first of three stages, representing a dynastic reign.

The original version of Hamurabi is a FOCAL program written by DEC employee Doug Dyment, who adapted the managerial concept of The Sumerian Game. DEC would list it in a 1969 catalog as The Sumer Game, and list a code printout in 1970 as King of Sumeria, the latter of which is the source I've chosen, and which Ahl's BASIC conversion is likely based on. This game, I want to stress, is not a conversion of Addis' program, but an original game inspired by the idea behind it. It's also comparatively much simpler; the presentation and narrative elements weren't possible to convey in a 4KB FOCAL program, and the gameplay elements are pretty basic, with little to do but decide how you're going to allocate your grain on a year-to-year basis.

Hamurabi isn't the first FOCAL game I've covered; over two years ago I did the 1969 version of Lunar Lander. Today, as was the case then, there's no way to run FOCAL programs, so I wrote my own VB.NET conversion, re-using the classes that I created for my Lunar conversion. Unlike that game, randomness makes it difficult to verify conversion accuracy by looking at original printouts of the FOCAL program, but I did my best.


Hamurabi is all about managing grain. All you can do is trade grain for land, feed your people grain, and seed your land with grain. Success requires understanding its internal rules:

  • Every person requires 20 bushels of grain per year. Those not fed will starve to death.
  • Every seeded acre produces grain the following year.
  • Every two acres that you seed costs one bushel.
  • You may not seed more than ten acres per person in the city.
  • On the next turn, a random number between 1-5 is generated. Every seeded acre produces that many bushels.
 
 

There are other rules, but they're less important. The price of land fluctuates, but buying low and selling high is not a winning strategy - the meager gains are outweighed by risk of rats eating your grain reserves, so it's best to spend all of your leftover grain on land.

Hamurabi's turn-flow starts by asking you how much land to buy or sell, but in reality, this is probably the last thing you should decide. Here's my thought process for the above turn:

  • I own 1000 acres.
  • I want to seed as many acres as possible.
  • With 100 people, I could potentially seed all 1,000 of my acres, but if I buy more they'll be unworked.
  • I do not know whether I will need to sell land to achieve my goals, so I will for now pretend I am going to sell all of them, which gets me 20,000 bushels.
  • Combined with the 2800 bushels in store, I would have a maximum of 22,800 bushels to play with.
  • I want to feed everyone. This will cost 2,000 bushels, leaving me with 20,800.
  • I want to seed as much land as possible. The upper limit is 1,000, due to my population.
  • Seeding a single acre costs 20.5 bushels. 20 to buy back the acre, 0.5 to seed it.
  • My 20,800 bushes are enough to seed the limit, so I "buy" back the 1,000 I sold, cancelling out the 1,000 that I sold, leaving me with 800 bushels for seed.
  • Seeding 1,000 acres will cost 500 bushels, leaving me with 300.
  • These 300 can be spent on 15 acres of land which will remain fallow. Better to do this than risk letting rats eat them.
  • Final decisions - buy 15 acres, feed 2000 bushels to my people, seed 1000 acres.
  • This costs 300 bushels for land, 2000 bushels for food, and 500 bushels for seed - exactly what I have to spend.
 

A lot of those steps may seem unnecessary - in order to reach the conclusion that I don't want to sell any land this turn, I had to first pretend I was selling all of them, only to conclude I'd buy them all back halfway down the list of steps. But sometimes you do need to sell land to accomplish your goals, and the same thought process helps me know.

The second turn had a poor yield - nothing you can do to prevent this from happening - and I'd definitely have to sell some land to prevent starvation. My thought process here:

  • I own 1015 acres.
  • My 109 people could seed up to 1090 acres.
  • My land could be sold for 22,330 bushels.
  • Combined with the 1000 bushels in store, my city is worth 23,330 bushels.
  • I want to feed everyone. This will cost 2,180 bushels, leaving me with 21,150.
  • Seeding a single acre costs 22.5 bushels. I can only seed 940 of them.
  • I will sell 75 acres, so that I have exactly 940 acres left. This gets me as many bushels as I'll need to feed everyone, seed all 940 acres, and have 20 left over.
  • Final decisions - sell 75 acres, feed 2180 bushels to my people, seed 940 acres.
  • This gets me 1650 bushels for the land and costs me 2180 for food and 470 for seed. Net cost of 1000 bushels, exactly what I have.
 

 

You might think feeding everyone all the time is a good idea. Turns out this will definitely cause problems down the line. Poor yields will force you to sell land to make the difference, and less land means less grain to harvest from them, which will spiral until you simply don't have enough land to feed people no matter how good the yield per acre is. Harsh as it may seem, you've got to starve your people sometimes.

I employed a new, fiscally conservative-approved strategy - only people with jobs get to eat. Got 117 people, but only 940 acres? Too bad - I'll buy another 21 acres, and have exactly enough grain left over to seed 960 acres and feed the 96 people it takes to work them, but the rest can starve to death. Most of the time I could afford to feed everyone, but when the harvest was bad, I had to downsize both my land and my people in proportion.

With this strategy, my acreage and population stabilized within a turn and grew steadily. Some people had to starve, but within two turns I was back to a population of 117, and with an acreage of 1182. Mediocre yields made me sell some of it, but not so much that anyone had to starve. On turn 10, my city grew to 1396 acres and 150 people, but poor yields forced me to sell 102 acres and starve a bunch of my citizens.

The turn after that, plague struck, cutting my population in half. On the bright side, this meant no more starvation until the population regrew itself beyond what the land could support.

Over the next ten turns, grain harvest was below average, and I got hit by more plagues. At the end of turn 20, I had suffered three plagues in total, and the city had 77 people, but 1418 acres.

I'm pretty sure my city growth would trend upward if I continued, but this was getting boring. Then I had an idea - you can't feed everyone all of the time, but what happens if you never feed anyone? I restarted, and what happens was... interesting.


 

Everybody starves to death every turn, but an empty city full of land repopulates very quickly, and with so much grain saved by not feeding people, you can afford to buy more and more land. One year you have a population that starves to death while farming, giving you a big windfall. The next year, you don't get much farming done because everyone's dead, but you spend what you've got on land. And the year after that, huge immigration waves arrive, letting you repeat the process, for bigger and bigger gains each turn. Plagues aren't even that big a problem, because you were just going to let them starve anyway.

818 immigrants come to a land where nobody ever gets to eat.
 

By the end of turn 20, I had almost tripled my city size - far outperforming the 42% growth when I played with a "feed everyone most of the time" strategy. Every other turn was guaranteed to produce city growth, regardless of bad luck. Strong harvests during turns where I had people helped, of course, but even poor ones were beneficial.

So, I think I "won" Hamurabi, but at what cost? This might be the most depraved evil I've ever done in a computer game. This strategy, by the way, will not work in Ahl's BASIC conversion, as letting too many people starve in a single turn will immediately end the game.

GAB rating: Average. Hamurabi is seminal, but like most mainframe computer games, rather basic. It is interesting, though, that despite the simplicity, there are multiple viable strategies to "success," depending on how you define that.

6 comments:

  1. "I employed a new, fiscally conservative-approved strategy - only people with jobs get to eat."

    You're using the wrong kind of politically inflammatory rhetoric. This is a left-wing strategy. The 1936 Constitution of the USSR:

    ‘He who does not work, neither shall he eat’.

    ReplyDelete
    Replies
    1. I'm using the right kind. I don't think I need to prove that modern welfare critics are firmly aligned with fiscal conservatism, multiple of whom have used that exact quote in recent years to rationalize SNAP cuts, and have espoused the general sentiment ever since the New Deal. Cherry-picking from the USSR Constitution only shows they have more in common than they'd care to admit.

      Delete
  2. Meh. The right, the left... they're all crazy. join the darkside, they have cookies!

    ReplyDelete
  3. Do you have the source on this one?

    whose creators claimed Hamurabi as an influence.

    Dani's old personal page mentions Cartels & Cutthroats, which is a pretty direct line but not Hamurabi specifically, but I'm guessing there's other interviews where it might have come up?

    ReplyDelete
    Replies
    1. I could have sworn I read something definitive, but all I can find now is sources asserting this as fact, while linking to, at best, contemporary critical comparison. A case of citogenesis, perhaps. Will try to reword things to be more responsible.

      Delete
  4. What a great post! Made me laugh out loud. Don't know what that says about me, though.

    ReplyDelete

Most popular posts