how to make Multiplayer Game [closed]
Asked Answered
K

3

30

I already knew the basic of android programming, especially the one at game. now I want to try multiplayer game. but I dont have any background about multiplayer game. so I want have a number of question :

  1. What is the basic of multiplayer programming?
  2. how is the communication method for multiplayer? should it bluetooth? or maybe client-server ? or maybe peer to peer? if the game that I want to make required 2 android handset near each other?
  3. what should I know in order to understand this multiplayer?
  4. is there any basic tutorial about how to make multiplayer game?
  5. can an android handset acted as a Server?

I don't plan to make any sophisticated game yet. may be just multiplayer tic tac toe is alright for me. the most important is that I understand the basic of multiplayer game programming. :)

Katharinakatharine answered 16/4, 2011 at 15:40 Comment(0)
S
17

I would give this series of articles a read:

http://gafferongames.com/networking-for-game-programmers/

It's mostly in C/C++, but you can translate it to Java. Learn about UDP sockets in Java, for example:

http://download.oracle.com/javase/tutorial/networking/datagrams/index.html

This should be enough to get you going. I would probably do client-server setup. You can do P2P but it's harder from what I've heard.

Synovia answered 16/4, 2011 at 15:44 Comment(3)
I updated number 2 question. :) , its not mass multiplayer, just 2 player game played near each other.Katharinakatharine
anyway. great article there. :)Katharinakatharine
The articles I linked to aren't only for MMO games, just for anything over a network. If you wanted to have the game only for handsets near each other, I am not the person to ask :P . I think it would be bluetooth, but don't take my word for it. I'm sure somebody will come post with the answer.Synovia
S
20

There are couple of ways to do multiplayer game:

  1. Multiplayer on the same device: Make multiplayer logic for your game and allow multi touch controller for both players on the same screen. It can be turn based or simultaneous. For this game you do not have any dependency but the players should be near each other.

  2. Bluetooth game: This the next stage of multiplayer games. A little bit trickier but can be done. The controller need to get and synchronize the game between two devices that are near each other. A short review of the Bluetooth android API and you are good to go.

  3. Score comparison: This is not a real multiplayer but you can upload scores of the users and compare with other users. You can do it yourself with server side that will store all the scores for each user or use existing services that allow score comparison like Skiller SDK or scorelop SDK.

  4. Real multiplayer games: This is the best one from my opinion. Everybody can play with everybody else in real time (as far as latency allows :D). This one is pretty difficult, if you want to do all by yourself. Here you will need a strong server side and a lot of server logic. But again you can use existing services that handle the server side for you. I went with the Skiller multiplayer SDK. Good support and monetization features.

Whatever multiplayer implementation you choose, give your game to your friends first so that they could review it and tell you what can be improved. It will help you A LOT!!!

Good luck.

Sexton answered 5/7, 2011 at 13:45 Comment(4)
Three of your four answers promote the Skiller SDK. If you're associated with them, please make sure you properly disclose this.Ovate
Nope Brad :), just new to this forum and because i found many solutions for my questions here i felt like contributing with something of my own. For some time i am trying to add competition aspect to my game and although there are some solutions available i did not find a proper multiplayer tools without having to build my own server side logic, skiller is the solution i found for this but if you have other solutions i will be more than happy to check and post my opinion here. By the way, my additional recommendation would be andengine. Very easy to integrate and build a 2d physics game.Sexton
@Sexton Just to save you some time and hassle later on, Stack Overflow prides itself on not being a "forum" per se.... Some users are very vehement about pointing that fact out, so I'd just like to give you a word of caution :)Eusebioeusebius
It doesn't look like Skiller exists anymore. You have to dig for it in google and links to the website seem to be dead.Newhall
S
17

I would give this series of articles a read:

http://gafferongames.com/networking-for-game-programmers/

It's mostly in C/C++, but you can translate it to Java. Learn about UDP sockets in Java, for example:

http://download.oracle.com/javase/tutorial/networking/datagrams/index.html

This should be enough to get you going. I would probably do client-server setup. You can do P2P but it's harder from what I've heard.

Synovia answered 16/4, 2011 at 15:44 Comment(3)
I updated number 2 question. :) , its not mass multiplayer, just 2 player game played near each other.Katharinakatharine
anyway. great article there. :)Katharinakatharine
The articles I linked to aren't only for MMO games, just for anything over a network. If you wanted to have the game only for handsets near each other, I am not the person to ask :P . I think it would be bluetooth, but don't take my word for it. I'm sure somebody will come post with the answer.Synovia
R
2

Looking up the APIs for android would defiantly help. client server would be the easiest to set up. Or, something that i am doing in a game i am making, is to have a web server and your application hit the web server for updates and whatnot. This is working really well with a turned based game I am making. Might take more capital up front, ie. Hosting your own web server, but since android supports SQLlite, you are good to go. :)

Robbierobbin answered 24/12, 2011 at 8:21 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.