Publishers of technology books, eBooks, and videos for creative people

Home > Articles

  • Print
  • + Share This
  • 💬 Discuss

This chapter is from the book

Thank You, National Enquirer

Some months before, while waiting in a supermarket checkout line, I observed that the headlines in the National Enquirer appeared to be designed by a combinatorial algorithm using standard components such as Elvis, flying saucers, revolutionary new diet plans, freakish babies, secret things, etc. Reflecting further, I realized that indeed a great many headlines have a formulaic quality to them. Perhaps, I mused, someday I would write a headline generator program for harried editors.

Now that fantasy came back to me, and I realized that I could put that crazy idea to work in my design. I could have a headline generator that would present events to the player in terms of news stories generated by combinatorial algorithms. The basic form of my sentence template looked like this:

Subject Verb Direct Object Degree

Here, Subject referred to the country that was taking the action, Verb was the nature of the action taken, Direct Object was the country upon whom the action was being performed, and Degree was the intensity of the action. Thus,

USA offers $100 million in economic aid to Panama.

would have USA as the subject, Panama as the direct object, "offer economic aid" as the verb, and "$100 million" as the degree. Of course, internally these were represented by simple numbers: index values for the countries, verbs, and degrees.

Over the course of time, I embellished the headline generator. First came embellishments to the presentation of the subject. There were two of these: leader name and capital name. The code could substitute "Washington" or "President Reagan" for "USA." Naturally, I made these substitutions available for the direct object. Extending the idea, I added the name of the insurgencies of every country.

Representing degrees of action was easy in most cases: I needed strings for how much money, how many troops, or what kind of treaty was being signed. However, there was one kind of headline that posed more complex problems: the headline describing domestic events. For example, it was important to provide information on the progress of the insurgency. For such headlines, the basic template was this:

{Insurgency of country X} {is in this state of development}

In other words, it was just a subject and a statement of degree. This, I found, could quickly become boring. "Panamanian insurgency grows more powerful" just doesn't make for exciting reading. So I developed a scheme for providing some variety and color. Here's an example:

    0*Anti-government guerrillas*Forces opposed to the government*% fighters*Members of the %*

    0* launch a series of attacks on* fight with government troops in* carry out attacks on* take control of*

    1* isolated villages* several remote towns* two provincial capitals* the outskirts of @*

    3*. *

Here's how the system works:

  • The first character, a numeral, denotes the method by which one of the succeeding text segments is to be selected.

  • A value of 0 says that the segment is to be chosen randomly.

  • A value of 1 indicates that the segment is to be chosen based on the rank index passed to the headline routine.

  • A value of 3 indicates that there is no choice to make, and that the first and only segment is to be used.

  • Segments, it should be obvious, are delimited by asterisks.


Fantasize. Play what-if games. Ask silly questions. Why aren't cows green like grass?


There are also text variables that are replaced by strings specific to the country. For example, the percent sign (%) indicates that name of the insurgency, while the ampersand (@) indicates the name of the capital. Thus, if we use Peru as our example, then we might get any of the following headlines:

    Members of the Sendero Luminoso fight with government troops in several remote towns.

    Anti-government guerrillas carry out attacks on the outskirts of Lima.

    Sendero Luminoso fighters launch a series of attacks on two provincial capitals.

Pretty cute, huh? But even this became tiresome after a while, so I added a provision for multiple templates for each situation. This did the job; the headlines had enough freshness and color to achieve the needed sense of realism.

The sentence generator proved to be one of the most important ideas to emerge from the Balance of Power project. In particular, the text variables concept proved amenable to considerable elaboration. I developed and refined this technology through many of my projects, especially for Siboot. It later became the basis for the concept of substories that I developed for my work in interactive storytelling. It also set me thinking about the nature and role of language, which has been a fruitful line of inquiry for my research. And it all started from a whimsical fantasy in a supermarket checkout line.


Read! Read! Read!


  • Segments, it should be obvious, are delimited by asterisks.

Fantasize. Play what-if games. Ask silly questions. Why aren't cows green like grass?

There are also text variables that are replaced by strings specific to the country. For example, the percent sign (%) indicates that name of the insurgency, while the ampersand (@) indicates the name of the capital. Thus, if we use Peru as our example, then we might get any of the following headlines:

Members of the Sendero Luminoso fight with government troops in several remote towns.

Anti-government guerrillas carry out attacks on the outskirts of Lima.

Sendero Luminoso fighters launch a series of attacks on two provincial capitals.

Pretty cute, huh? But even this became tiresome after a while, so I added a provision for multiple templates for each situation. This did the job; the headlines had enough freshness and color to achieve the needed sense of realism.

The sentence generator proved to be one of the most important ideas to emerge from the Balance of Power project. In particular, the text variables concept proved amenable to considerable elaboration. I developed and refined this technology through many of my projects, especially for Siboot. It later became the basis for the concept of substories that I developed for my work in interactive storytelling. It also set me thinking about the nature and role of language, which has been a fruitful line of inquiry for my research. And it all started from a whimsical fantasy in a supermarket checkout line.

Read! Read! Read!

  • + Share This
  • 🔖 Save To Your Account
Chris Crawford on Game Design

This chapter is from the book

Chris Crawford on Game Design

Discussions

comments powered by Disqus