2

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.

giuseppe trubia
  • 142
  • 1
  • 13
  • 1
    This question is too broad, and opinion-soliciting (with no single right answer). Not a good fit for StackOverflow. – David Makogon May 28 '15 at 20:58
  • Take a look here: https://stackoverflow.com/questions/29545597/multiplayer-game-in-java-connect-client-player-to-game-that-was-created-by-ot/3082a0890#30820890 And where started? Take a look here: https://stackoverflow.com/questions/30564281/xcode-mass-multiplayer-not-what-youre-probably-thinking/30818450#30818450 – tirz Jun 14 '15 at 06:43

2 Answers2

2

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

Kristy Welsh
  • 7,828
  • 12
  • 64
  • 106
BHuelse
  • 2,889
  • 3
  • 30
  • 41
1

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

Community
  • 1
  • 1
Renato Probst
  • 5,914
  • 2
  • 42
  • 45
  • I don't get how this is an accepted answer. "*You will need a node.js server*" - that's simply untrue. What you wrote is an opinion (actually more than one opinion). – David Makogon May 31 '15 at 16:27
  • You are right, you can develop a socket server using another languages/approaches, my mistake. But for the rest, i guess i give a good solution for him using GCM, and probably a lot of people will find this answer usefull because of that not so common approach – Renato Probst Jun 01 '15 at 03:24