Home > Articles > Programming > Games

This chapter is from the book

The World of Computer Games

People have been playing games on computers for almost as long as electronic computers have existed, and a rich variety of games has been invented. In her book Reality Is Broken, Jane McGonigal says that most games have four attributes:

  • A goal: Games clearly define a goal for the players to achieve. It's important that the goals be challenging, yet achievable. Ideally, players are always playing at the leading edge of their ability. Goals give the players a sense of purpose in playing the game.
  • Rules: Games have rules that all the players agree to follow. The rules often make achievement of the goal difficult, which in turn encourages players to be creative.
  • Feedback: A game has to tell the players how they are doing. Indeed, an interesting, creative feedback system is key to making a game enjoyable.
  • Voluntary participation: It just isn't a game unless you really want to play. This aspect of games implies the players' acceptance of the goal, rules, and feedback system.

Before we create a new game, we want to think about which types of games exist, as well as which types work well on mobile devices and which don't. We also want to take a look at the components that are common to all computer games.

Game Genres

Game developers didn't start out categorizing their games, and there is no standard list of categories. Nevertheless, over time games have been grouped into classes by different people in different ways. The categories identified in this section are not meant to be canonical, and they admittedly overlap in a number of areas. The exact categorization really isn't important—the point is that numerous types of games can be developed.

Skill or Action Games

Action game players typically have to use some real-time skill (e.g., jump a barrel at the right time, shoot at a moving target) to be successful. Subtypes with some examples include the following:

  • Maze games
  • Platform games where the player moves platforms around either to get somewhere or to stop adversaries
  • Tower defense games: the player defends something (the tower) from an oncoming horde of bad guys
  • Shooters: with the playing field either fixed, sliding, or scrolling
  • One-on-one fighting games: where two opponents battle it out
  • One-to-many fighting games: where the player fights through a gang of opponents (often martial arts related)
  • First-person shooters (FPS): where the player's view is that of the shooter
  • Third-person shooters: same as FPS, but the point of view is that of a third person

Strategy Games

Strategy games are less about reacting to real-time events, and more about devising and implementing a strategic plan to overcome obstacles. They include the following types of games:

  • Turn-based games: including traditional board games
  • Timed strategy games: where each move occurs in a fixed time
  • Massively multiplayer online role-playing games (MMORPs): an extension of the old Dungeons and Dragons genre, in which players assume roles and play against others online

Adventure or Storytelling Games

Adventure and storytelling games are built around a rich storyline, with well-developed characters and a story that defines the player's purpose in playing the game.

  • Simpler 2D story games often involve mazes and interactions with other game entities.
  • Complex 3D story games can show different points of view as the game is played and the story spun. Some have been turned into Hollywood movies.

Simulation Games

Typically, simulation games depict some real situation, such as a vehicle that the player can operate. The games reproduce the physics of the real situation and can be good enough to use for instruction as well as for just playing a game. They include the following types of games:

  • Sports simulators
  • Flight or space simulators
  • Driving or racing simulators
  • Boat or submarine simulators
  • Life simulators (overlap with strategy games)

Puzzle Games

Many puzzle games are direct translations of printed puzzles (e.g., crosswords), but the genre also includes matching and hidden object games. Complex games often include smaller puzzle games to solve as part of the larger game. Examples of puzzle games include those based on the following concepts:

  • Word based (e.g., crosswords)
  • Number/math based (e.g., Sudoku)
  • Visual matching
  • Hidden object (e.g., Minesweeper)
  • Construction from a set of pieces

Augmented-Reality Games

It's fine to play games just for the fun of it, but sometimes there's a bigger motive. As Jane McGonigal's Reality Is Broken points out, some games are intended to augment reality in such a way that our real lives are made easier. Examples of augmented-reality games (ARGs) include the following games:

  • Jetset: a game that simulates the security line at an airport (to help you pass the time while you wait in the real line)
  • Chore Wars: a game that turns household chores into creative competition
  • World Without Oil: a game that encourages energy conservation by simulating a world where oil products are in very short supply

Games for Mobile Phones

With this rich variety of game types to choose from, we need to focus on those that are most appropriate for mobile platforms such as phones and tablets. We also need to focus on those games whose development by a small group of people is feasible.

Given the potential size of the mobile device games market, it's not surprising that a substantial amount of research and thought have been put into what makes a good mobile game. The usual principles of good computer game design still apply, along with special characteristics of good mobile games:

  • Don't waste the player's time.
  • Provide help on playing the game.
  • Make the game goals easy to understand.
  • Show game status clearly.
  • Mobile users typically play games in short sessions.
  • Players need to easily pause and resume a game, and the phone should be able to pause and resume games when necessary (e.g., for an incoming call).
  • Players should be able to make game progress in a short period of time.
  • Mobile devices have physical constraints that affect games:

    • Small screen size and a variety of screen sizes, resolutions, and pixel densities
    • Variety of user input methods (e.g., one- and two-handed operation, touch, keypad, multi-touch, keyboard, Dpad, trackball)
    • Limited computational power
    • Limited battery (a factor that limits power-intensive graphics and computing)

Even if you had the development resources to create a really snazzy 3D first-person shooter game like Halo, players are unlikely to sit with their smartphone and play it for hours the way they might with the XBox version. Users are much more likely to play mobile games in short sessions, pausing and resuming the game perhaps days later.

Speaking of resources, what does it take to create a commercial game? A typical console game for a single console can easily take $10 million to develop, and two or three times that amount for multiple-console development (it has been estimated that some complex games cost as much as $100 million to create). The software development kit (SDK) and license to create a console game alone can cost thousands of dollars. If you think about what goes into a professional 3D console game, it's easy to see where the costs mount up—3D artwork, motion capture, animation, game play, user testing, and software development are all both time consuming and expensive.

This book is about you and maybe one or two friends creating your own mobile game for the Android platform. The Android SDK is free, and as of this writing, it costs only $25 to sign up for Android Market and sell your game to anyone with an Android device. We'll stick to 2D (two-dimensional) games, which makes the artwork and the programming simpler. As you'll see, the basic game structure and components of any 2D game are pretty much the same no matter what the genre, but we need to pick one as an example.

Components of a Typical Game

Before we look at the specifics of the example game, let's examine the general components that we need to work into the game and implement in the code. Here are some components that will be part of our game.

Opening (Splash) Screen

To maximize performance as the game is being played, the graphics needed for a game level are often loaded before the level is started. During the loading process, which can take several seconds, you don't want to leave the user with a blank screen, so you display a splash screen. It lets the user know that the game is working as it should. Splash screens are optional, but we'll include one in our game, just to show how it's done.

Menu Screen

Once the game is ready to run, we'll need a place for the user to enter various options (e.g., turn the sound on/off, get help in playing the game). This is typically done with a graphical menu screen that presents the options and either implements the option or calls another screen (such as Help) to do so.

Music

For most of us, music has strong emotional influence. Background music is very important for setting the mood of your game, and helping with the transitions between parts of the game.

Sound Effects

Sound effects can make a game a lot more fun. When two objects collide, players expect to hear a sound of some kind—whether it's a clang, a thud, or a boing. Our example game also incorporates sound effects for each of the game characters. Each villain has a characteristic sound effect accompanying his or her presence in a scene.

Time

Most games will incorporate time—either clock time (scoring completion of a puzzle based on the time taken to solve the puzzle) or playing against moves the computer (or computer-driven adversaries) makes in real time. In our game Virgins Versus Vampires (V3), this factor takes the form of killing the villains before they can reach the virgins.

Lives

Games have to be challenging to be fun, so the player has to fail every once in a while. Killing the player off (in a virtual way) is a convenient way to give failure a consequence. Some games give the player multiple lives per session, whereas others (and V3) give the player only one life.

Obstacles

Obstacles are used in different ways in different games. In many games, the player is trying to achieve some goal, and obstacles are thrown in the player's path. In tower defense games (and V3), it's the adversaries who are trying to reach a goal, so the player throws obstacles in their paths.

Levels

Challenging games are fun, but it's important to provide a range of challenges, so that players can start with easy challenges and gradually ramp up to higher challenges as their game-playing skills and experience improve. Levels are a proven way to achieve this effect—the player learns how to play the game in the first few levels, and his or her skills have to continue to improve as new levels are presented. This is also a great way to add some variety to the game.

Adversaries

The adversaries in a game are sometimes referred to as entities (although AndEngine uses that word to mean something else). These characters are the villains (or other players) that the player must overcome to win. They are distinct from obstacles in that they take action against the player—obstacles are more passive. We've listed the entities for V3 later in this chapter, along with an outline of their behavior.

Player

Of course, the player is the most important component of any game. The whole point is to keep the player engaged and interested so he or she will keep playing the game. The player has to be challenged by the game, but not too challenged to give up in frustration. The game has to include enough variety to maintain the player's interest, and rewards have to be doled out to recognize success in playing the game.

Scenes

If you think of the game as something like a movie, each screen that is displayed to the player is something like a movie scene. Each scene has background graphics that don't change much (although the player's point of view might change). Animated graphics are then added to the scene to implement the entities and obstacles that interact to make the game.

Virgins Versus Vampires

A popular genre on mobile devices is the tower defense. These games are fairly simple to understand (stop the bad guys), they lend themselves to interrupted playing (pause/resume), they fit well on a small screen, and they don't require a lot of computer horsepower. On the production side, the artwork for a tower defense game is relatively simple, and it makes good use of the major elements of computer game programming. We also want the game to be fun to play, of course, so we'll try to inject some humor and challenge into the genre.

We need a "tower" to protect. Offhand, I can't think of anything that's been protected more vigilantly over the course of history than virginity, so we'll make that the target of the bad guys. Vampires are the trendy bad guys these days, so we'll incorporate them as well. Maybe we can even find a way to fit in the theme of the "vampire with a heart of gold"—ambivalence always adds interest.

Figure 1.1 shows what the screen will look like during a session of our game, which we'll call Virgins Versus Vampires.

Figure 1.1

Figure 1.1 Screenshot of Virgins Versus Vampires game

The V3 game is available for free on Android Market. Take a few minutes right now to download it to an Android device and play with it for awhile. At least finish Level 1 of the game, which you should do fairly quickly, to get an idea of the flavor of the game.

We need a variety of obstacles that we can use to impede the vampires' progress. We'll use the items described next for this purpose.

Bullets

We'll have a bullet weapon that players can fire by placing it on the playing field and letting it go:

  • Kills: anything it hits
  • Life: from where it is launched until it goes off the screen
  • Scoring: not so high (per vampire), because it's easy to kill a whole line of vampires

Hatchets

The hatchet weapon is also placed by the player and thrown when they let go of it:

  • Kills: the first vampire it hits
  • Life: from launch until it hits the first vampire
  • Scoring: higher, as it kills only one vampire

Crucifix

The crucifix just stays where the player puts it, and waits for a vampire to trip over it.

  • Kills: the first vampire who runs into it
  • Life: from placement until it kills a vampire
  • Scoring: highest, as it depends on a vampire stumbling into it

The virgins will be held in Miss B's Girls' School on the left of the screen, with bad guys coming from the right. The game player's task is to throw obstacles in the way of the marauding bad guys to keep them from reaching the castle. We need to give the player a way of earning obstacles, placing obstacles, and watching the progress of the bad guys. We want multiple levels, so players can start off with easy games and progress as their strategies and talents improve. And, of course, we want to be able to assign scores and track them.

Design of V3

Once you have a game concept outlined, the next step in designing a game is to envision the scenes needed and describe the flow among them. Screenwriters and many creative writers do this by making a storyboard with pencil and paper, using an index card or drawing a rectangle for each scene, and creating a very rough sketch of the scene and a few words to describe what's going on there. You can show the transitions between scenes with an arrow and a brief description of when the transition takes place.

Figure 1.2 shows the storyboard I drew for V3, which is intentionally a very short game. The storyboard for a complete game will likely spread to multiple pages.

Figure 1.2

Figure 1.2 Preliminary game storyboard flow diagram

I also created a separate index card for each scene of the game, with a rough sketch of the graphics to be included. If you are creating your storyboard on a large piece of paper, you can just include the sketches right on the flow diagram. Figure 1.3 shows the index card for Level 1 of V3.

Figure 1.3

Figure 1.3 Index card for Level 1 of the storyboard

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.

Overview


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information


To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.

Surveys

Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.

Newsletters

If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information


Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.

Security


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.

Children


This site is not directed to children under the age of 13.

Marketing


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information


If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.

Choice/Opt-out


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information


Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents


California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure


Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.

Links


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact


Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice


We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020