I'm a complete newbie with regards to developing for Android, and for starters I'm trying to develop a simple card game that can be played multiplayer over a local network. I'm having trouble finding a starting point for how I would go about this, I can find plenty of things for communicating across the internet but not having much luck seeing how you communicate directly between two devices over a LAN.
It's a major part of my plan for this app that it be multi-platform and that iOS devices and Android devices can play against each other, so I'm looking for a method that supports this. I know it's possible as I can see there are other apps that have this functionality.
I don't need a detailed implementation (although the more help the better!) but if anyone could just point me in the right direction for how to go about something like this, I'd be really grateful.
I think u need a connection peer to peer, android implements Wifi Direct
Look android dev site. http://developer.android.com/guide/topics/connectivity/wifip2p.html
For a card game I recommend using client-server.
Electrotank is a good server that provides a framework that helps you create a game of this type, with rooms, chat, friends list and connect to Android and iOS. U can write server plugins in Java.
http://www.electrotank.com/es5.html.
Another good server solution is SmartFox.
Or you can create a turn-based game, creating a database to save data and a counter on each client, where you will limit the time for each move, from this time you send data to the server and your opponent query this data the server.
I was working on the exact same thing. You'll want to use sockets to open up connections between multiple instances the same app.
I created an example app that demonstrates how to do this which I link to and explain in great detail here: http://brendaninnis.ca/connect-nearby-devices-part-2.html
I have an example for both Android and iOS that communicate with each other.
Related
I am creating a multiplayer game for android which will be like: you choose a character, you get an oponnent and during this player versus player "fight", they only click in buttons which are the "attacks".
Though at first it seemed like a simple task I am not quite sure how to do the communication between the users of which attack was selected by the opponent, but I've come up with two possibilities: Sockets and Databases.
Sockets seemed like the best option, however, what I've found is that they only work on the same network, what definetly doesn't serve my purpose.
About Database I am not sure if it is a good idea, as making so many requests to check whether the other player has already chosen would make the game laggy I think. I have even created an Firebase account, as their Realtime Database seemed much more reasonable to use, but I couldn't find any way in which I could integrate Firebase with LibGDX (which I am using for this app).
To sum up, the answer is: what is the best way to exchange data quickly? How could I implement it using LibGDX?
I am using Android Studio if it helps anything and am on 0$ budget.
Because of the $0 budget then getting a VPS (virtual private server) is out of the question. So you need another alternative. Run your server from home, from your own PC.
Your next step would be to get a free dns service which will redirect a web address to your home routers IP address and from there you can setup your router to redirect ports directly to your PC. These can be web ports, or ports for TCP use.
You will then have a choice of what to use:
1 - Web sockets which can be used by various languages that will run on the server.
2 - TCP/IP server which is less overhead than web sockets and is direct communication via TCP to your server.
Both of the above will have their strengths, but it is up to you where you start. The server software itself can be written in many languages, including Java which will be more compatible with your current Android project.
There's no way I can explain in depth any further without other questions being raised. So from here, it's a lot of research in the various technologies.
I'm working on a research project for my company. My goal is to make a mobile web app that uses mobile bluetooth to send data to others mobiles that use the same web app.
I did some research and I found that Chrome for iOS and Android supports an API to use device Buetooth with LE profil: https://developers.google.com/web/updates/2015/07/interact-with-ble-devices-on-the-web?hl=en
If I understood well, it's absolutely not suitable to transfer heavy data. The final goal of my project is to implement something like Hadoop for mobiles phones across a web app: Mobiles will share replicated databases and will perform MapReduce operations on datas.
I'm beginner in development and I don't really know how to find solutions. I think the only solution is to make a native or cordova app.
Do you have some advices on how to perform research on such things when, I guess, nobody did it yet ? Do you have any ideas to achieve this goal ?
My friends and I are developing a rails app (ruby), iOS app (swift), and android app (java). We are trying to figure out the best way to connect them all.
From our current research, we are under the impression that an API will need to be created with rails and the mobile apps will then have to communicate with that. Is this the only solution? I am also understand that apps can "pull" data from an api, but what about the other way around? We would like each application to be congruent with each other... for example, a record is created in the iOS app. As soon as this happens, the record should also be able to found on the rails app.
When thinking about it, it seems like all we would need is one database, and then have all of the apps connected to it. Would something like this work?
Having trouble finding solid information regarding this. If you know of any documentation, please pass it my way.
The best way is to host database in cloud and access to that common database from all applications. If you host your database with any hosting provider, they will give you a connection string using which you can access from any application. See Amazon AWS for example.
As I understand it, the popular way to interface with your database would be to expose it through a REST framework. Doing this, it doesn't matter how many apps you want to be able to interact with the data, or what platform they are on.
Also, check out Kivy as an option for your mobile implementation, as it allows you to deploy to iOS and Android from a single code base. Of course, you may need to account for differences in hardware APIs, etc... But that would be easier, IMO, than maintaining multiple code bases.
I have a simple two-player android game (like Chess), and I want to add some functionality for users to play against each other online. I would prefer to make this as simple as possible (so no complex website where users meet each other and maintain a rating, etc.; instead, just the ability to somehow "look-up" your buddy and have a quick game against him or her).
First of all, is there any way to do this peer-to-peer? From my research, it looks like no, or at least there is no "easy" peer-to-peer method. Admittedly, I haven't looked much into p2p for Android in a while...
The other way then, would be to set up a server, but I have no idea how to do this. Does anyone have some links, info, etc. about how to set up a simple server for enabling online gaming like this?
Thanks!
The problem with p2p is going to be discovery i.e how do players discover each other or their address for communication. The other problem with p2p is that players phones are often going to be behind NATs and if both are behind a NAT then they will need a intermediary between them for communication. These are two common reasons why a server is required even for the simplest of multiplayer games.
Is your game an asynchronous turn based game like words with friends?
There are options of using cloud service for such a game as well so that you just do Android development and access a webservice for storing game data and sending push notifications to update the other player of his/her turn. You can take a look at this https://github.com/shephertz/App42-Tic-Tac-Toe sample on how to do it.
I am trying to develop multiplayer turn based android game which will be coordinated using a remote server. I want to use couchbase nosql server with java sdk. I do not understand how data will be moved from mobile to database and back. Could you please help me ? Do I need to use jetty or tomcat ? Is there any other way ? Mostly I have worked on client side only so I am not able to figure this out.
You need to get started with socket programmming in java , the most primary thing you should know when developing a network app.
You should consider a REST-ful interface between the client and server instead of sockets, especially if it's a slow paced game (like Words with Friends or Draw Something)
The basic idea is that the mobile devices post data on various pages you have set up using a server:
http://mygame.com/mobile/api/submitMove?id=123&player=1&move=KnightA4
the server will then read the arguments, figure out if it's valid using a database, and respond back accordingly.
If you want to learn about servers and develop the server from scratch, I can relate to that BUT as a client developer it may take you a lot of time to configure, develop, test, run, host, maintain, scale the server side (and ofcourse it may cost you a great deal of money). If you are looking to release your game as quickly as possible I would propose another solution. I am from Skiller and we have SDK that should shorten the time it will take you to get your game on the market. You can use built in turn based simple API to create or join existing game, challenge players, send messages and much more...
Check our wiki pages or our Skiller website for more info.
Will be glad to get your input.