Game Programming
       by
      J2ME


            By
      Hamada Zahera
  hamada.zahera@mufix.org
Outline
•    Java is Everywhere !!
•    Introduction to J2ME: features & Application
•    Your First J2ME Application (Demo#1)
•    Game Design & Architecture
•    Design your first game (Demo#2)
•    Deploying your application


 ٢                  MUFIX Community © 2010
Java Is Everywhere !
• The Power of Java : it can be used not only for
  PC but also many different electronic devices as




 ٣                  MUFIX Community © 2010
Java Editions !!
• J2SE (Java 2 standard edition) is for developing
  desktop applications, GUI and Database
  Application (see J2SE API)

• J2EE (Java 2 enterprise edition ) for Client serve
  applications , for example web sites.

• J2ME (Java 2 micro edition) for applications which
  run on resource constrained devices (small scale
  devices) like cell phones, for example games.


 ٤                     MUFIX Community © 2010
J2ME: (Java 2 Micro Edition)
• J2ME is a java platform which is customized for developing
  applications for embedded devices like Mobile , IPhones ,
  PDAs ,….., etc.




  ٥                    MUFIX Community © 2010
J2ME Architecture
• Basically , J2ME Applications run on a platform which
  is already support by almost of Mobile phones
• By default , there are build-in Packages which support
  common functionality like GUI , I/O ,Bluetooth, Game
  API ,etc . These package called “MIDP”
• Mobile phones are different in hardware configurations
  and resources like memory and feature
• We have two configuration layer of
Embedded Devices : Device with higher
resources : set-top Boxes use CDC and
Device with limited resources use CDLC

  ٦                    MUFIX Community © 2010
MIDP
- Mobile Information Device Profile (MIDP) is a key
  element of J2ME.
- When combined with the Connected Limited
  Device Configuration (CLDC), MIDP provides a
  standard Java runtime environment for today's
  most popular mobile information devices, such as
  cell phones and PDAs

- We have MIDP 1.0 , MIDP 2.0

      Runtime Environment = MIDP+CDLC

 ٧                  MUFIX Community © 2010
CDCL vs CDC
J2ME Connected, Limited Device Configuration (CLDC)
- specifies the Java environment for mobile phone, pager and wireless devices
- CLDC devices are usually wireless
- 160 - 512k of memory available for Java
- typically has limited power or battery operated
- network connectivity, often wireless, intermittent, low-bandwidth (9600bps or
       less)


J2ME Connected Device Configuration (CDC)
- describes the Java environment for digital television set-top boxes, high end
      wireless devices and automotive telematics systems.
- device is powered by a 32-bit processor
- 2MB or more of total memory available for Java
- network connectivity, often wireless, intermittent, low-bandwidth (9600bps or
      less)
٨                             MUFIX Community © 2010
J2ME Features
    JSR   Name                     Description
    75    File Connection          File system, contacts,
          and PIM                  calendar, to-do
    82    Bluetooth                Wireless connections

    135   Mobile Media API         Audio, video,
          (MMAPI)                  multimedia
    184   Mobile 3D                High level 3D graphics
          Graphics
    179   Location API             GPS

٩                     MUFIX Community © 2010
Demo#1 :Your First application
 • Prerequisites :
   - JDK 1.5
   - Install NetBeans with mobility Pack




 ١٠              MUFIX Community © 2010
Game Design
You have to concern with the following :
      – Logic
      – Characters
      – Graphics
      – Sounds




 ١١                  MUFIX Community © 2010
Game Elements
• 1.Sprite : game object like car , ball ,
  persons which has some attributes
  like X,y coordinates and weight ,
  width




 ١٢                MUFIX Community © 2010
Game Elements .. (cont)
• 2.Tiled Layers: dividing the game background
  into small cells to save memory and allow
  other spaces for game objects




 ١٣              MUFIX Community © 2010
e.g. Tiling Game Background




 ١٤          MUFIX Community © 2010
Game Elements .. (cont)
• 3. Layer Manager : it’s a container layer
  which group all game object together ,
  game background so we can manage a
  series of layers simplifying the rendering
  process




 ١٥               MUFIX Community © 2010
Demo#2 : Game app




١٦         MUFIX Community © 2010
Resources
• Books




• Links:
           www.j2meforums.com
١٧            MUFIX Community © 2010
Thank you




١٨    MUFIX Community © 2010

Game Programming By J2me

  • 1.
    Game Programming by J2ME By Hamada Zahera [email protected]
  • 2.
    Outline • Java is Everywhere !! • Introduction to J2ME: features & Application • Your First J2ME Application (Demo#1) • Game Design & Architecture • Design your first game (Demo#2) • Deploying your application ٢ MUFIX Community © 2010
  • 3.
    Java Is Everywhere! • The Power of Java : it can be used not only for PC but also many different electronic devices as ٣ MUFIX Community © 2010
  • 4.
    Java Editions !! •J2SE (Java 2 standard edition) is for developing desktop applications, GUI and Database Application (see J2SE API) • J2EE (Java 2 enterprise edition ) for Client serve applications , for example web sites. • J2ME (Java 2 micro edition) for applications which run on resource constrained devices (small scale devices) like cell phones, for example games. ٤ MUFIX Community © 2010
  • 5.
    J2ME: (Java 2Micro Edition) • J2ME is a java platform which is customized for developing applications for embedded devices like Mobile , IPhones , PDAs ,….., etc. ٥ MUFIX Community © 2010
  • 6.
    J2ME Architecture • Basically, J2ME Applications run on a platform which is already support by almost of Mobile phones • By default , there are build-in Packages which support common functionality like GUI , I/O ,Bluetooth, Game API ,etc . These package called “MIDP” • Mobile phones are different in hardware configurations and resources like memory and feature • We have two configuration layer of Embedded Devices : Device with higher resources : set-top Boxes use CDC and Device with limited resources use CDLC ٦ MUFIX Community © 2010
  • 7.
    MIDP - Mobile InformationDevice Profile (MIDP) is a key element of J2ME. - When combined with the Connected Limited Device Configuration (CLDC), MIDP provides a standard Java runtime environment for today's most popular mobile information devices, such as cell phones and PDAs - We have MIDP 1.0 , MIDP 2.0 Runtime Environment = MIDP+CDLC ٧ MUFIX Community © 2010
  • 8.
    CDCL vs CDC J2MEConnected, Limited Device Configuration (CLDC) - specifies the Java environment for mobile phone, pager and wireless devices - CLDC devices are usually wireless - 160 - 512k of memory available for Java - typically has limited power or battery operated - network connectivity, often wireless, intermittent, low-bandwidth (9600bps or less) J2ME Connected Device Configuration (CDC) - describes the Java environment for digital television set-top boxes, high end wireless devices and automotive telematics systems. - device is powered by a 32-bit processor - 2MB or more of total memory available for Java - network connectivity, often wireless, intermittent, low-bandwidth (9600bps or less) ٨ MUFIX Community © 2010
  • 9.
    J2ME Features JSR Name Description 75 File Connection File system, contacts, and PIM calendar, to-do 82 Bluetooth Wireless connections 135 Mobile Media API Audio, video, (MMAPI) multimedia 184 Mobile 3D High level 3D graphics Graphics 179 Location API GPS ٩ MUFIX Community © 2010
  • 10.
    Demo#1 :Your Firstapplication • Prerequisites : - JDK 1.5 - Install NetBeans with mobility Pack ١٠ MUFIX Community © 2010
  • 11.
    Game Design You haveto concern with the following : – Logic – Characters – Graphics – Sounds ١١ MUFIX Community © 2010
  • 12.
    Game Elements • 1.Sprite: game object like car , ball , persons which has some attributes like X,y coordinates and weight , width ١٢ MUFIX Community © 2010
  • 13.
    Game Elements ..(cont) • 2.Tiled Layers: dividing the game background into small cells to save memory and allow other spaces for game objects ١٣ MUFIX Community © 2010
  • 14.
    e.g. Tiling GameBackground ١٤ MUFIX Community © 2010
  • 15.
    Game Elements ..(cont) • 3. Layer Manager : it’s a container layer which group all game object together , game background so we can manage a series of layers simplifying the rendering process ١٥ MUFIX Community © 2010
  • 16.
    Demo#2 : Gameapp ١٦ MUFIX Community © 2010
  • 17.
    Resources • Books • Links: www.j2meforums.com ١٧ MUFIX Community © 2010
  • 18.
    Thank you ١٨ MUFIX Community © 2010