Gamasutra.com - Mars Sucks - Can Games Fly on Google Earth?
It's free to join Gamasutra!|Have a question? Want to know who runs this site? Here you go.|Targeting the game development market with your product or service? Get info on advertising here.||For altering your contact information or changing email subscription preferences.
Registered members can log in here.Back to the home page.

Search articles, jobs, buyers guide, and more.

By Omar Rodrigues
[Author's Bio]
Mike MacPherson
[Author's Bio]
and Scott Crabtree
[Author's Bio]
Gamasutra
December 21, 2006

Mars Sucks - Can Games Fly on Google Earth?

arrowrightPage One
arrowrightPage Two
arrowrightPage Three
arrowrightPage Four




Latest Letters to the Editor:
Perpetual Layoffs by Alexander Brandon [09.21.2007]

Casual friendliness in MMO's by Colby Poulson [09.20.2007]

Scrum deals and 'What is Scrum?' by Tom Plunket [08.29.2007]


[Submit Letter]

[View All...]
  


Features

Mars Sucks - Can Games Fly on Google Earth?


Implementation: Game Architecture

We implemented Mars Sucks using the Google Earth client and server, KML, a game server, and PHP5:

  • Google Earth Client: the same Earth viewer that thousands have played with on their PCs
  • Google Earth Server: provides the data and view for all copies of Google Earth
  • Keyhole Markup Language (KML): A scripting language for Google Earth, run on the client PC to change the contents of Google Earth.
  • Game Server: A game (non Google) web server, set up to create and load dynamically generated KML to the Client.
  • PHP5: Web scripting language used to generate the dynamic KML on the Game Server

The player starts Mars Sucks by loading a single local KML file into the Google Earth client. This file makes the initial connections to the game server and loads the rest of the KML dynamically from the game server where it is processed by PHP5.
The Google Earth client makes calls to Google servers to obtain data corresponding to the region currently being viewed. These standard calls are built into the Google Earth client and require no developer involvement. We used another type of communication between the Google Earth client and a game web server that let us create a richer interactive experience. Information is sent to the game web server via asynchronous HTTP requests made using Keyhole Markup Language (KML) tags described below. On the game server, developers can make use of scripting languages to create new KML scripts. These scripts are then sent back to the client where they are executed. The client then retrieves new information from the Google server, and the process repeats. In this way the game dynamically updates itself as it is played, with only initial startup code living on the client machine.

In Mars Sucks, PHP5 is the scripting language running in the background. PHP5 was chosen (from the vast list of scripting languages) for several reasons. Features such as object-oriented capabilities, available language documentation, existing libraries/extensions, and web server independence made PHP5 the best choice.

Client Server Communication

In KML, several tags such as <refreshMode> provide the functionality of making asynchronous calls to the game server on regular intervals or based on certain events. Along with the calls, information can be sent corresponding to the viewable region. The game server processes these calls and sends new KML back to the client that updates the screen.

A specific example, is the interaction between game.kml and init.php. The file game.kml makes a call to the game server for init.php using a <NetworkLink> tag.

<NetworkLink>
 <name>Init</name>
 <Link>
  <href>http://localhost/mars_sucks/init.php</href>
 </Link>
</NetworkLink>

The file init.php is composed of more <NetworkLink> tags to load the main game components:

  • the cockpit image overlay
  • display_clues.php
  • destroy.php
  • down.php.
  • The file init.php returns content type compatible with the Google Earth client by using the PHP function header("Content-Type: application/keyhole");. The diagram below displays this interaction in a simplified manner.

 


Figure 1. Interaction diagram




join | contact us | advertise | write | my profile
news | features | companies | jobs | resumes | education | product guide | projects | store



Copyright © 2006 CMP Media LLC

privacy policy
| terms of service