Commsdesign Home Register About Commsdesign Feedback Online Opportunities SpecSearch GlobalSpec




















eLibrary

EE TIMES NETWORK
 Online Editions
 EE TIMES
 EE TIMES ASIA
 EE TIMES CHINA
 EE TIMES FRANCE
 EE TIMES GERMANY
 EE TIMES INDIA
 EE TIMES JAPAN
 EE TIMES KOREA
 EE TIMES TAIWAN
 EE TIMES UK

 EE TIMES EUROPE
 ANALOG EUROPE
 INDUSTRIAL EUROPE
 AUTOMOTIVE DL EUROPE

 POWER DL EUROPE

 Web Sites
 • Audio DesignLine
 • Automotive DesignLine
 • Career Center
 • CommsDesign
 • Microwave
    Engineering
 • Deepchip.com
 • Design & Reuse
 • Digital Home DesignLine
 • DSP DesignLine
 • EDA DesignLine
 • Embedded.com
 • Embedded Internet Design
 • Elektronik i Norden
 • Green SupplyLine
 • Industrial Control
    DesignLine
 • Planet Analog
 • Mobile Handset
    DesignLine
 • Power Management
    DesignLine
 • Programmable Logic
    DesignLine
 • RF DesignLine
 • RFID-World
 • Techonline
 • Video | Imaging
    DesignLine
 • Wireless Net
    DesignLine

ELECTRONICS GROUP SITES

 • eeProductCenter
 • Electronics Supply &
    Manufacturing
 • Conferences
    and Events
 • Electronics Supply &
    Manufacturing--China
 • Electronics Express
 • Webinars


06 September 2010



Mobile Game Networking Essentials--Part IV

Here is Part IV of Chapter 14 from Beginning Mobile Phone Game Programming. Wireless network games bring with them their own unique set of problems and challenges that must be dealt with at the design level. Included in the excerpt are many techniques for solving them. For those of you who design mobile games, it's packed with great information--for the rest of you--it's an informative and fun read.

By Michael Morrison
Courtesy of Mobile Handset DesignLine
Jun 30, 2008
Print This Story Send As Email Reprints
 
Rate this article
WORSE | BETTER
1 2 3 4 5
See Part I,Part II, Part III

Building the Lighthouse Example
Many years before mobile phones and radio transmitters and receivers, a more primitive form of communication was used by seafarers. I'm talking about lighthouses, which are typically perched on the highest point of a shore, and include a light near the top that helps provide guidance and communication to ships at sea. Although today's lighthouses use modern communications technology such as radios, they still rely on a light for simple visual communication. Because mobile phones are themselves a modern form of personal communication, I thought a lighthouse theme might serve as a good example for a network MIDlet.

One way that lighthouses have been used for communications is through Morse code, which is a simple but highly effective method of communicating words and characters with sequences of "dots" and "dashes." A dot is a short visual or audible signal such as the flash of a light or a metallic click. A dash is defined as approximately three times the length of a dot, which equates to a light flash of longer duration or a longer resonating sound. You assemble sequences of dots and dashes to spell out words and sentences. Following are the alphanumeric codes that make up the International Morse Code standard:


Using these codes, you can assemble words and sentences; each letter has a brief pause between it and the next letter, whereas each sentence has a longer pause. Following is an example of the word "hello" coded in Morse:



Getting back to the Lighthouse example MIDlet, the idea is to simulate a lighthouse on a mobile phone, and use Morse code to communicate with another mobile phone by flashing the lighthouse light. It works like this: Each phone displays an image of a lighthouse. You are looking at the other person's lighthouse, while that person is looking at your lighthouse. You use the left and right directional keys to signal dots and dashes over a wireless network connection, after which the lighthouse seen by the other person resolves the dots and dashes into light flashes.

Construction Cue: An even simpler version of the Lighthouse MIDlet could rely on a single key to send both dots and dashes, in which case it would be up to the user to time them appropriately. This would more closely mimic a true telegraph, although it would make the example a bit less interesting.

The Lighthouse MIDlet is basically a high-tech simulation of a low-tech form of communication. From a mobile game programming perspective, it is very important in that it demonstrates how to establish a client-server connection between peer devices, and then send messages back and forth between them.

Designing the Client and Server
The Lighthouse MIDlet takes advantage of a client-server relationship between two mobile phones. The actual connection between the MIDlets is a datagram connection, which means that the messages sent between the phones are packaged as datagram packets. The client-server aspect of the Lighthouse design primarily has to do with which phone initiates the network connection. The following steps outline what takes place between client and server phones in the Lighthouse MIDlet:

  1. The server phone opens a datagram connection and waits for the client.
  2. The client phone opens a datagram connection with the server.
  3. With a connection established, the client and server phones send and receive messages.
  4. The client and server phones terminate the connection.


Next Page



EE Times TechCareers
Search Jobs

Enter Keyword(s):


Function:


State:
  

Post Your Resume
-----------------
Employers Area
Most Recent Posts
GE Corporation seeking Lead Systems Analyst in Van Buren Township, MI

Osram Sylvania seeking Sr Applications Engineer in Danvers, MA

Accolo, Inc. seeking User Experience Engineer in Reston, VA

Johnson Controls, Inc seeking Project Development Engineer in Pittsburg, PA

WhiteHat Security seeking User Interface Engineer in Santa Clara, CA

More career-related news, resources and job postings for technology professionals



Home  |  Register  |  About  |  Feedback  |  Contact   |  Site Map
All materials on this site Copyright © 2010 EE Times Group, a Division of United Business Media LLC All rights reserved.
Privacy Statement ¦ Terms of Service