interactive games, and MIDP

Hi !

I have a few questions :

1.

Suppose I wanted to develop a chess/tic-tac-toe/etc kind of interactive game for use on MIDP devices, where people can play games with each other. A central servlet stores the state of each game, and acts as a general controller for each MIDP client. So, if my opponent plays a move I need to be informed of this.

Is periodic polling of the central servlet the only way to accomplish this with the current CLDC/MIDP specs ? (I understand that sockets are not supported by all devices).

2.

Another question, and this is possibly a dumb one ?

In terms of "time online" for a MIDP client, if I open a HttpConnection object and then close it later after retrieving some information from a URL, am I charged (by my mobile phone network) only for the time online between opening and closing the connection?

Alternatively, am I paying for a connection from the moment I call up the MIDlet application? If so, if I wanted to think for a long time about my next move, could I choose to manually intervene and disconnect while I think about the move?

Thanks in advance for any responses,

Roger

[1203 byte] By [rogmen] at [2007-9-26 1:30:58]
# 1

Hi I'm not so sure about question 1 but as for question 2

You pay for the time from when you open the connection in your application to the time you close the whole application.

You cannot intervence and manually disconnect while you think about your next move as you have to close your application first unless you record your previous move in memory, disconnect, go back to application, think about move. make move and connect again.

axlrose82 at 2007-6-29 1:29:49 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 2

>Hi I'm not so sure about question 1 but as for question 2

>You pay for the time from when you open the >connection in your application to the time you close >the whole application.

even if I issue a close() on the connection object, the connection still stays open, and I am charged for it?

(please don't get the idea I am obsessed by money - i'm just trying to get the idea of this!)

I guess my question boils down to : on a normal PC and phone socket modem, I have to first dial-up, and then after that, until I disconnect, every URL I connect to comes "for free" - or it doesn't make any different to my bank account, whether I make any connections over the internet or not.

is it the same deal with mobile phones? do I have to do the equivilent of dialing-up, and then I am "online" (until I disconnect, or loose the signal) ?

surely, it must be possible to manually disconnect in the software ?

>You cannot intervence and manually disconnect while >you think about your next move as you have to close >your application first unless you record your previous >move in memory, disconnect, go back to application, >think about move. make move and connect again.

suppose, I was using my mobile phone on a train, and I start thinking about my move. then the train travels through a long tunnel, and gets disconnected. do I get automatically re-connected, or does my phone connect again, only when I make a move ?

rogmen at 2007-6-29 1:29:49 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 3

Yes, even if you issue a close() on the connection object you are still charged for it.

It is the same with your mobile phone.

Well I'd guess to manually disconnect in the software, you'd have to work with the manufacturer.

If you are on a train, and you get disconnected, you will have to reconnect manually.

axlrose82 at 2007-6-29 1:29:49 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 4

Hi I took a look at your question 1 again. For your application you don't actually have to use sockets.

You can use a HTTP Connection instead of sockets.

But for periodic polling of the MIDP client, I believe that you'd have to do so as unless, there is a way to find the current IP address of the palm.

If there is a way to find the IP address of the palm, here's the psudocode of how you can do it.

1 )Have 2 threads on the server. 1 for playerOne and 1

for playerTwo

2) While playerOne is making his move, player2 thread

sleeps.

3) When playerOne has finished making his move,

playerTwo thread awakes and playerOne thread

sleeps.

4) playerTwo thread contacts playerTwo device based

on the IP address and client side device processes

axlrose82 at 2007-6-29 1:29:49 > top of Java-index,Java Mobility Forums,Java ME Technologies...