Presentation is loading. Please wait.

Presentation is loading. Please wait.

Making Cell Phone Games An Overview Ray Ratelis Guild Software, Inc.

Similar presentations


Presentation on theme: "Making Cell Phone Games An Overview Ray Ratelis Guild Software, Inc."— Presentation transcript:

1 Making Cell Phone Games An Overview Ray Ratelis Guild Software, Inc.

2 Platforms BREWiPhoneJ2ME

3 Java 2 Micro Edition Configuration CLDC-1.0 (JSR30) CLDC-1.0 (JSR30) CLDC-1.1 (JSR139) CLDC-1.1 (JSR139)Profile MIDP-1.0 (JSR37) MIDP-1.0 (JSR37) MIDP-2.0 (JSR118) MIDP-2.0 (JSR118)

4 JSR? JSR is Java Specification Request. It is similar to RFC in the internet world. http://jcp.org/en/jsr

5 Connected Limited Device Configuration Defines a base set of APIs and VM features that are required for the J2ME runtime. Slightly limited subset of J2SE APIs. Some Java features such as reflection are limited or not present.

6 CLDC 1.0 No floating point No weak references Minimum total memory requirement of 160k

7 CLDC 1.1 Added floating point support and weak references Minimum total memory requirement raised to 192k

8 Mobile Information Device Profile Defines an additional set of APIs that support a narrower category of devices Networking APIs (http, https, sockets) Networking APIs (http, https, sockets) Lcdui API (Canvas, input events, rendering, images [png, jpg]) Lcdui API (Canvas, input events, rendering, images [png, jpg]) Game API (sprites, layers, tile grids, sprite collision detection) Game API (sprites, layers, tile grids, sprite collision detection) Media API (wav, au, mp3, midi, tone sequences) Media API (wav, au, mp3, midi, tone sequences)

9 MIDP 2.0 vs. 1.0 Game API Media API Authentication API

10 Optional Packages Bluetooth API SMS and SMM messaging API Others No guarantee they exist. I don’t yet know what happens when a MIDlet tries to use an API that doesn’t exist on the device.

11 MIDlets Applications written using the MIDP profile are called MIDlets. Defacto standard for downloadable cell phone games written in Java.

12 SDKs Java ME SDK 3.0 Sample apps Sample apps IDE IDE Emulator Emulator Java SE Dev Kit 1.6 or higher Java Runtime Environment Java Runtime Environment Java ME API Documentation http://java.sun.com/javame/reference/apis/jsr118/ http://java.sun.com/javame/reference/apis/jsr118/ Available on Sun’s website

13 Installation First install Java SE Dev Kit Then install Java ME SDK Run the SDK IDE Add new Java Platform Tools -> Java Platform -> Add Platform… Tools -> Java Platform -> Add Platform… Select Java ME MIDP Platform Emulator Select Java ME MIDP Platform Emulator Then choose the Java ME Platform SDK that was just installed. I think this sets up the emulator. Then choose the Java ME Platform SDK that was just installed. I think this sets up the emulator.

14 Programming Main application must subclass the MIDlet class. public class HelloMIDlet extends MIDlet public class HelloMIDlet extends MIDlet Implement startApp(), pauseApp(), destroyApp() Implement startApp(), pauseApp(), destroyApp() Usually creates a canvas and game thread and listens for commands Usually creates a canvas and game thread and listens for commands

15 Programming Create a canvas Subclass either Canvas or GameCanvas class Subclass either Canvas or GameCanvas class public class TheCanvas extends GameCanvas public class TheCanvas extends GameCanvas Implement paint(), keyPressed(), keyReleased() Implement paint(), keyPressed(), keyReleased() Must be set as the active canvas to the MIDlet display Must be set as the active canvas to the MIDlet displayDisplay.getDisplay(midlet).setCurrent(canvas)

16 Programming Create a game thread public class GameThread implements Runnable public class GameThread implements Runnable Implement run() Implement run() This is where the main game loop can reside This is where the main game loop can resideInput()Process()Render()Sleep()

17 Programming Optionally create a command listener public class cmdListener implements CommandListener public class cmdListener implements CommandListener Used to receive command events Used to receive command events Commands are created and added to the Canvas Commands are created and added to the Canvas CommandListener is added to the Canvas CommandListener is added to the Canvas canvasobject.setCommandListener(cmdlistenerobj ect)

18 Programming Commands show up as the menu along the bottom of the display exitCommand = new Command(“Exit”, Command.EXIT, 0) exitCommand = new Command(“Exit”, Command.EXIT, 0) canvasobject.addCommand(exitCommand) canvasobject.addCommand(exitCommand)

19 Run The J2ME SDK comes with an emulator that emulates a series of different mobile devices Touch phones Touch phones Clamshell phones Clamshell phones Much faster than an actual phone

20 Distribution.JAR Java ARchive Java ARchive Main app file, contains all code and resources Main app file, contains all code and resources.JAD Java Application Descriptor Java Application Descriptor Describes what configuration and profile needs to be supported by the device, the name and icon to show in the App menu, vendor, version, path to.JAR, size of.JAR Describes what configuration and profile needs to be supported by the device, the name and icon to show in the App menu, vendor, version, path to.JAR, size of.JAR

21 Distribution Put both files onto a web site.JAR.JAR mime type: application/java-archive.JAD.JAD mime type: text/vnd.sun.j2me.app-descriptor Browse to the.JAD file using the cell phone’s browser and it will ask if you want to install it

22 Distribution If available, use cell phone maker’s App Installer to install over USB or Bluetooth Not every phone has this capability (mine doesn’t as far as I can find) Not every phone has this capability (mine doesn’t as far as I can find) Email or otherwise send the files to your cell phone (I have no idea if this works)

23 Questions? Comments?


Download ppt "Making Cell Phone Games An Overview Ray Ratelis Guild Software, Inc."

Similar presentations


Ads by Google