i'm working on a chess app for which i have the board and moves implemented
so that it's (with a few minor exceptions) fully functional on a single
device. so, now the question is: how do i make it so that 2 players on
different devices can find one another and play?

 

i'm inclined to do this at first by calling a php script on my website that
interacts with a database there. i'm storing the move lists locally on the
phones, so i don't need that, but i do need a list of players identified by
unique nicknames, passwords of their choosing, and an auto-increment integer
uniquely identifying the player.

 

that already brings up one reason why i'm thinking of doing it this way
rather than with google app engine (at least for this part). while google
app engine has the upside of immediately linking me with gmail users that
can then register their accounts when they download my app, it has the
downside that the persistent JDOs seem to me (after just going through the
tutorial on app engine) pretty simplistic relative to a real database: no
constraint enforcing (right? i need uniqueness constraint), no joins (which
i think i'll need but might be able to get around). also, looking things up
in a mass of JDOs i would think would be slower than looking things up in a
MySQL database. google app engine would likely come in handy later for
certain things, possibly including security, which (for purposes of just
getting my first app to the point that i can install and test it on the
phones of a few friends) i'm going to ignore with respect to what is winding
its way through the cloud (i.e., it would be easy to hack into a game and
enter a false move for someone).

 

so, here's roughly the way i picture this happening for now: when you
install the app, you just choose a username and password. that (in the form
of a php address including 'get' data) calls a php script that tests the
entered username against the database and accepts or rejects it. if it
accepts, it sends back your user_id, which is stored in your own SQLite db.
and the database on the server enters a record with your username, password,
user_id, and phone number.

 

getting an opponent once it goes beyond a few friends doing testing likely
will involve something like app engine, or openfeint or scoreloop, but for
initial testing maybe just have the user enter a phone number, send it to
the database, and then let you enter the other person into your player list
if it's found. clearly won't work long-term, but just to get it going.

 

now, making a move: legality of move is tested locally, then i again just
send an http request that includes, in addition to the php script to run, my
user_id, the game number, the move number, the from_square, the to_square,
and the piece moved, so 6 integers. on my end, i just get back confirmation
that the move has been entered.

 

receiving a move: when i go to my 'resume game' screen, the activity makes a
php request with my user_id and a list of my open game numbers where it was
my opponent's move. the server checks to see if my opponent has moved in any
of these games and sends that data back as http data that i parse in java
from the activity.

 

sorry to be so long-winded here, but i know several people who just haven't
managed to get the multi-player aspect working, so before starting on a part
of the project that certainly isn't going to be easy, i wanted to get some
opinions on whether the above is feasible at all and/or if there's an
obviously better way to do it.

 

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to