Best approach to create online game?

689 Views Asked by At

I have developed a simple card game based on Scopy. Now I want to upgrade my application for 1 vs 1 online game. I'm not new to Java, I know sockets. I was wondering if there is a better way to start this work.

EDIT: it is a turn game, the players just exchange a string that represent a card.

2

There are 2 best solutions below

2
On BEST ANSWER

If its a turn game, you don't necessary need socket, socket is meant for real time interaction. And its way easier to setup normal http request's than socket.

If you choose to go for socket, you will need a node.js server and there are some plugins for handling android socket connection. Basically these plugins create a listener that receive messages from server and run a callback (that you define) based on the name of the message.

Another way to go, thats not so pro, but its easier, is use GCM (android notification service) or parse.com. This way you skip the server setup, these apis basically run a node.js server and you can define some custom messages, then just handle the messages with a socket plugin like i said.

EDIT

Using GCM you can send messages directly from your device, using a internal (on device) java server. There are some examples in android official dev site. By the way, you can implement socket without node.js too

0
On

I would do it with a RESTful webservice. To do it with a socket is too much in my opinion. And with a RESTful webservice, you get an easy option to implement your game for other plattforms like iOS or WP.

best regards