Sign in to follow this  

[java] Mobile phone games

This topic is 4838 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, i'm interested in writing java games for mobile phones, but dont know where to start. I have experiance with javascript as well as other programming languages including (C++ and some forms of basic) I have written 2d games before for PC and even once for the Playstation2, so I dont need much help in the programming area it's self. The main things I would like to know are: 1) How do i get my games onto mobile phones once i've made them? 2) Do I need to use a special form of javascript? 3) what methord is used to interperate user inputs? 4) anything else you think might be useful, tutorials would be nice. Thanks in advance.

Share this post


Link to post
Share on other sites
First, try the "Consoles, PDAs, and Cell Phones" forum.

Quote:
Original post by Monsi
1) How do i get my games onto mobile phones once i've made them?


Typically via an IR or Bluetooth connection. With some phones you might be lucky enough to be able to get a USB data cable that lets you plug the phone directly into your computer. However, cell phone manufacturers tend not to like to make things that easy, because of concerns about piracy. If your phone is "locked" by some service provider, you might be completely SOL.

A J2ME game consists of two files: a .jar file (Java ARchive; normal J2SE applications are often distributed like this, too) and a .jad file (Java Application Descriptor, I think). The jar file is typically limited in size to either 64K or "nothing really official, but you should probably keep it under 180K or so". This depends on what model of phone you have. The jad file
is a much smaller file (a couple hundred bytes) which contains a bit of information about the jar (what size it's supposed to be, who made it, etc.)

Quote:

2) Do I need to use a special form of javascript?


As others mentioned, javascript has absolutely nothing to do with java; the naming was a dumb marketing trick by Netscape to cash in on Java's popularity at the time, and frankly I hope Sun sued them for it (although I don't really know the history).

Quote:

3) what methord is used to interperate user inputs?


Standard input doesn't really exist on cell phones; standard output and the standard error stream do (or at least, J2SE provides support for them), but you won't likely be able to see their contents. (You *can* see them on phone emulators that run on your PC, so it is still useful for debugging.)

The J2SE system therefore provides an event-oriented framework: it sets up a few internal threads that do things like watching the keypad for input, and then you implement callbacks in your code to deal with the events. Actually, this is one place where javascript knowledge may help you out: this way of programming things should be second nature to you since you're used to writing "onClick" etc. stuff, while it's a bit foreign to some programmers.

Typically, you will extend a "Canvas" class (there are other UI classes, but they're intended more for general application development than for games), and implement methods with names like "paint(Graphics)", "keyPressed(int)" and so on. The Graphics object passed to your paint method represents the screen; you can call methods on it in order to draw stuff. The integer value passed to keyPressed tells you what key was pressed. Stuff like that.

Quote:
4) anything else you think might be useful, tutorials would be nice.


The aforementioned forum.
Oh, and the Sun website. Anything you can learn about ordinary Java (except for the UI API stuff - i.e. using Swing) will be useful to some extent for J2SE; you can also look up javadoc for the platform, and get at some other useful resources.

Share this post


Link to post
Share on other sites

This topic is 4838 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this