Game Programming for Mobile Phone with J2ME - PowerPoint PPT Presentation

1 / 42
About This Presentation
Title:

Game Programming for Mobile Phone with J2ME

Description:

Step 3. Write your codes in PC, compile them into relevant file, and test it using emulator(s) ... Test them using emulator. Deploy to your phone using USB ... – PowerPoint PPT presentation

Number of Views:257
Avg rating:3.0/5.0
Slides: 43
Provided by: pin117
Category:

less

Transcript and Presenter's Notes

Title: Game Programming for Mobile Phone with J2ME


1
Introduction
  • Game Programming for Mobile Phone with J2ME
  • Pinata Winoto

2
Overview
  • Characteristics of Phones and Users
  • Overall Development Steps
  • Java Phones
  • Review of Java and Intro to J2ME

3
Characteristics of Mobile Phones
  • Hardware
  • Small GUI (e.g. 128 x 128 pixels)
  • Limited input devices (e.g. limited keyboard)
  • Slow processor speed
  • Small memory (most program lt 100KB)
  • Short battery life
  • Software/OS
  • Limited (Qualcomm BREW, Java KVM, Symbian OS, MS
    Windows Mobile)

4
Characteristics of Game Players
  • Playing for a short time (around 10 to 30
    minutes)
  • Low concentration and high interruption (e.g.
    waiting for a phone call)
  • Less muscular activity (due to small control
    device)

5
Characteristics of Game Genre
  • Puzzle or board
  • Casino or card
  • Arcade
  • Adventure

Source http//www.gameloft.com
6
Characteristics of Game Genre
  • Adventure (role playing---RPG)
  • Sport
  • Action

Source http//www.gameloft.com
7
Characteristics of Game Others
  • Single player vs Multiplayer vs Massive
    Multiplayer
  • 2D vs 3D

8
Overview
  • Characteristics of Phones and Users
  • Overall Development Steps
  • Java Phones
  • Review of Java and Intro to J2ME

9
Procedures
  • Step 1. Identify your game and target phone(s)
  • Step 2. Install appropriate SDK (Software
    Development Kit) and IDE (Integrated Development
    Environment) in your PC
  • Step 3. Write your codes in PC, compile them into
    relevant file, and test it using emulator(s)
  • Step 4. Deliver your program to the phone(s)

10
Step 1. What is the Target Phone?
  • Qualcomm BREW? Smartphone? Symbian OS? MS Win
    Mobile?
  • Java phone? MIDP1 or MIDP2?
  • Support Bluetooth, infra-red, or USB?
  • WAP service?
  • Touch screen? Numeric keypads?
  • Etc.

11
Step 2. Which Implementation Tools?
  • Directly into Symbian OS
  • Knowledge of C programming
  • IDE CodeWarrior for Symbian OS, Borland C
    Builder X, etc.
  • Running on Java Virtual Machine
  • Knowledge of Java programming
  • J2ME on the top of J2SE
  • IDE Borland JBuilder X, SunOne 5, NetBeans IDE
    4.0, etc.

12
Step 2. Which Implementation Tools? (cont)
  • Using Qualcomm BREW Platform
  • Knowledge of C/C programming
  • IDE Visual C 6.0 or .NET.
  • Using Openwave Platform
  • Knowledge of Java programming
  • IDE Visual Studio.NET, Borland JBuilder, etc.
  • Windows Mobile Smartphone
  • eMbedded VC, eMbedded VB
  • IDE Visual Studio.NET

13
Step 3. Writing and Testing Your Game
  • Use relevant SDK and IDE
  • Use other supporting tools (Photoshops, etc.)
  • Use knowledge from this workshop

14
Step 4. How to Deliver Our Game?
Upload to Internet (WAP) server
Download from Internet (WAP) server
Write your code and compile it in your computer
Download directly from computer via Bluetooth,
Infra-red or USB
15
Overview
  • Characteristics of Phones and Users
  • Overall Development Steps
  • Java Phones
  • Review of Java and Intro to J2ME

16
Why Java Phone?
  • Quick looks at others

17
Source http//www.symbian.com
18
Source http//brew.qualcomm.com
19
O P E N W A V E
Source http//developer.openwave.com
20
Which Platform?
  • BREW
  • a little bit out-of-date
  • many users (Most world-wide users use old phone!)
  • easy to sell
  • Java
  • cross platforms (but not exactly the same)
  • growing fast (largely supported)
  • easy to learn but difficult to sell (Not all
    carriers like it!)
  • Symbian
  • powerful (e.g. Nokia series 60 Smartphone)
  • up-to-date (very promising)
  • restricted market (mostly Nokia phone)

21
In This Lecture.
  • Java phone (J2ME)

Java is commonly taught in colleges (most of you
know how to write program in Java) We are not
real developers, but learners (you will only
learn basic game programming here, Java is enough
for this purpose) It can be extended to other
mobile devices (J2ME also support Palm OS, Pocket
PC, etc.) Free! (most developing tools are free)
22
Examples of Java Phones (1)
  • Nokia 7710, 9300, 9500, etc.
  • 640 x 320 or 640 x 200 pixels
  • MIDP 2.0
  • Nokia 7610, 7270, 6680, 6670, 6630, 6600, 6260,
    6230, 6020, 3230, etc.
  • 176 x 208 or 128 x 160 or 128 x 128 pixels
  • MIDP 2.0
  • Nokia 7650, 7600, 7260, 7250i, 7200, 6610, 6610i,
    6280, 6170, 3530, 3200, 3120, etc.
  • 176 x 208 or 128 x 160 or 128 x 128 or 96 x 65
    pixels
  • MIDP 1.0

23
Examples of Java Phones (2)
  • Samsung SGH-X468, SGH-X458, SGH-X108
  • 128 x 128 pixels or 128 x 160 pixels
  • Samsung SGH-E608, SGH-E708, SGH-D488 and most
    camera phones
  • 128 x 160 pixels
  • Samsung SGH-D508 and P738
  • 176 x 220 pixels

24
More Examples of Java Phones (3)
  • Motorola E680, E1000, A768i, A780, etc.
  • 240 x 320 or 240 x 240 pixels
  • MIDP 2.0
  • Motorola E398, V3, V300, V400, V500, V550, V600,
    V975, V980, T725, etc.
  • 120 x 160 or 176 x 220 pixels
  • MIDP 2.0

25
More Examples of Java Phones (4)
  • Sony Ericsson S700i, K700i, K508i, K300i, P910i
    Siemens SF65, SL65, CFX65 Panasonic X500, X800
    Alcatel OT556, OT 756, etc.
  • Various display resolutions
  • 128 x 128, 128 x 160, 132 x 176,
  • 176 x 220, 176 x 208, 240 x 320 or 208 x 320
    pixels
  • MIDP 1.0 or 2.0.

26
Overview
  • Characteristics of Phones and Users
  • Overall Development Steps
  • Java Phones
  • Review of Java and Intro to J2ME

27
J2SE
  • Applications
  • Run on the top of JVM
  • public static void main(String args)
  • Applets
  • Run on the browser inside HTML
  • public class myClass extends Applet

28
Simple Application
  • class HelloPolyU
  • public static void main(String args)
  • System.out.println(hello PolyU!")

29
Simple Applet
  • import java.applet.
  • import java.awt.
  • public class HelloPolyU extends Applet
  • public void paint(Graphics g)
  • g.drawString("Hello PolyU!", 50, 25)

ltHTMLgt ltHEADgt ltTITLEgt HelloPolyU lt/TITLEgt
lt/HEADgt ltBODYgt ltAPPLET CODE"HelloPolyU.class
" WIDTH150 HEIGHT100gt lt/APPLETgt lt/BODYgt
lt/HTMLgt
30
J2ME
Source Sun Microsystems, Inc.
31
J2ME Structure
  • CLDC (Connected Limited Device Configuration)
  • Libraries and JVM (KVM)
  • MIDP (Mobile Information Device Profile)
  • visible part to developers (MIDlet class)
  • IDE J2ME Wireless Toolkits
  • coding parts, extending MIDlet
  • MIDlet is comparable to Applet

Source Sun Microsystems, Inc.
32
CLDC 1.0
  • Release May 2000
  • Java.lang., java.util., java.io. (from J2SE),
    and javax.microedition.io. (CLDC specific)
  • No floating point support
  • No Java Native Interface (JNI)
  • No reflection features
  • No thread groups and daemon threads
  • No finalization (object.finalize( ))
  • Very limited error handling, etc.

33
CLDC 1.1
  • Release March 2003
  • Support floating point (Float and Double)!
  • Minimum memory increases from 160 KB to 192 KB
  • Only few mobile phones support it.
  • Large memory (Motorola E680, A780, etc.)
  • Better not to rely on it now!

34
MIDP 1.0
  • Release Dec. 2000
  • More useful than CLDC --- for developers
  • More classes than those defined in CLDC
  • java.util.Timer, javax.microedition.midlet,
    javax.microedition.rms, javax.microedition.lcdui
  • Closer to application development (Midlet)

35
MIDP 2.0
  • Release Nov. 2002
  • More classes, e.g.
  • javax.microedition.lcdui.game, javax.microedition.
    media
  • Require larger memory (approx. 400 KB)
  • Better for game developers

36
Simple MIDlet
  • import javax.microedition.midlet.
  • import javax.microedition.lcdui.
  • public class HelloPolyU extends MIDlet
  • private Display myDisplay
  • public HelloPolyU()
  • myDisplay Display.getDisplay(this)
  • public void startApp()
  • TextBox t new TextBox(MyMIDlet",
    "Hello PolyU ! ! ! ! ", 256, 0)
  • myDisplay.setCurrent(t)
  • public void destroyApp(boolean
    unconditional)
  • public void pauseApp()

37
Simple MIDlet
  • import javax.microedition.midlet.
  • import javax.microedition.lcdui.
  • public class HelloPolyU extends MIDlet
  • private Display myDisplay
  • public HelloPolyU()
  • myDisplay Display.getDisplay(this)
  • public void startApp()
  • TextBox t new TextBox(MyMIDlet",
    "Hello PolyU ! ! ! ! ", 256, 0)
  • myDisplay.setCurrent(t)
  • public void destroyApp(boolean
    unconditional)
  • public void pauseApp()

Must import javax.microedition.midlet.Midlet Or
javax.microedition.midlet.
38
Simple MIDlet
  • import javax.microedition.midlet.
  • import javax.microedition.lcdui.
  • public class HelloPolyU extends MIDlet
  • private Display myDisplay
  • public HelloPolyU()
  • myDisplay Display.getDisplay(this)
  • public void startApp()
  • TextBox t new TextBox(MyMIDlet",
    "Hello PolyU ! ! ! ! ", 256, 0)
  • myDisplay.setCurrent(t)
  • public void destroyApp(boolean
    unconditional)
  • public void pauseApp()

Must extend MIDlet abstract class
39
Simple MIDlet
  • import javax.microedition.midlet.
  • import javax.microedition.lcdui.
  • public class HelloPolyU extends MIDlet
  • private Display myDisplay
  • public HelloPolyU()
  • myDisplay Display.getDisplay(this)
  • public void startApp()
  • TextBox t new TextBox(MyMIDlet",
    "Hello PolyU ! ! ! ! ", 256, 0)
  • myDisplay.setCurrent(t)
  • public void destroyApp(boolean
    unconditional)
  • public void pauseApp()

Must implement startApp(), destroyApp(), and
pauseApp()
40
Simple MIDlet
  • import javax.microedition.midlet.
  • import javax.microedition.lcdui.
  • public class HelloPolyU extends MIDlet
  • private Display myDisplay
  • public HelloPolyU()
  • myDisplay Display.getDisplay(this)
  • public void startApp()
  • TextBox t new TextBox(MyMIDlet",
    "Hello PolyU ! ! ! ! ", 256, 0)
  • myDisplay.setCurrent(t)
  • public void destroyApp(boolean
    unconditional)
  • public void pauseApp()

Usually implement Constructor and also
commandAction() from CommandListener interface
(not shown here)
41
How It Work?
  • AMS (Application Management Software) instead of
    Web browser
  • Started and initialized by AMS
  • Only 3 states are controlled by the class
    Paused, Active and Destroyed
  • Paused is the initial state

Source http//developers.sun.com
42
Development
  • Design your MIDlets
  • Write your codes
  • Compile and pre-verify them
  • Package them into .jar (Java Archive) and .jad
    (Java App. Descriptor) files (e.g. a MIDlet
    suite)
  • Test them using emulator
  • Deploy to your phone using USB/infra-red or
    Internet server
Write a Comment
User Comments (0)
About PowerShow.com