How does WiFi Lobby of Pocket Tanks work? - android

There's a game called Pocket Tanks. What it offers is that 2 players can connect to same WiFi Network (like in home) and play the game together. Its different from internet multiplayer. It just needs common WiFi. I want to know how to implement such a system in my android game. I've tried to search it on Google but no helpful results. Any idea where do I even begin?
Thanks.

The app probably has a socket open listening on a certain port.
Then when it searches for other phones, it just tries to connect to other IP addresses on that port.

Related

Android P2P Wifi Direct / Bluetooth

I am developing currently an Android application that will communicate with other Android devices per Wifi. The Wifi will also provide the online connection. There is no server in this Wifi environment.
The idea was that the devices will discover each other with UDP multicast messages. But we noticed that UDP multicast often does not work on the devices. Sometimes it does, sometimes not.
To work around this issue we implemented a mechanism where the devices will store the local Ips online so that other devices will be able to retrieve them.
But this, of course, does only work if the Online State is available, which sometimes is not.
My question is, if there are other techniques with what the devices are able to connect per Wifi to the each other without knowing it´s Ip in the first place. Is there an easy way to forward the addresses per Bluetooth for example? Or could Wifi Direct be an option?
Every idea is welcome. Thanks for all of your help.
A zero configuration networking solution might work for you. There is a Nuget package called zeroconf that should work with Xamarin:
https://www.nuget.org/packages/Zeroconf/
Source code:
https://github.com/onovotny/Zeroconf

Multiplayer game on local network without internet

I am creating a multiplayer android game as a part of my coursework. This is my first game. I intended to allow users to connect to the game over a simple network. I don't want to use internet at all hence I wont be using the android game services. How do I go about this. I have no clue at all. I have tried various tutorials but all of them are using a central game server. I just want to create a simple Client - Server network. One user will host a game and others will join.
it's my first time answering a question here. I usually just read here in stackoverflow. I'm also currently working on my first game. It connects devices using wifi peer-to-peer or WifiDirect (without a wifi hotspot). It requires high version of android OS (4.0 or 4.1?) but I believe you can also try the other way on which the devices needs to connect in the same wifi hotspot for lower OS version requirements. The latter, I haven't tried yet.
After I connect the devices on the same network (peer-to-peer), I use sockets to exchange data between them. I use serializable objects for sending data. I don't know if it's the best way but it works for me.
My game can connect more than two players in wifi peer-to-peer. One device acts as the network owner (and also the game server).
See android's tutorial/documentation for WifiDirect connection :
http://developer.android.com/training/connect-devices-wirelessly/wifi-direct.html
Be sure to read also the adjacent lessons.
Also, Sockets must be used with Threads so you also need to read about it if haven't.
Hope I helped ^^
I finally got the solution and made the Android application. Simply used java socket programming. It works on Hotspot. This works on client - server framework.
Please find the code here and contact me if you require any assistance.
https://github.com/rohitramkumar308/GameOfCards
and this is the link to the app
https://play.google.com/store/apps/details?id=srk.syracuse.gameofcards
Hope this helps you.

Android: Pure P2P chat application

I've started to develop a chat application for Android. This app is supposed to function without internet and, most importantly, without an access point; It has to connect Android devices in a pure P2P manner.
However I've followed the following tutorials posted in android developers guide:
http://developer.android.com/training/connect-devices-wirelessly/nsd.html
http://developer.android.com/training/connect-devices-wirelessly/wifi-direct.html#fetch
Afterwards, I've tested my app on 3 devices, the problem is one of the devices acts as an access point, preventing other devices from connecting with each other if they are connected to it.
This doesn't work for my app, because I want each user to be able to connect to multiple users at the same time.
What do you suggest I do in order to achieve pure P2P connection for my Android app?
Does the group owner acts as an access point?
EDIT
After I've done some research I found the WiFi Direct is not suitable for my project since it has to assign a device as an access point, what I'm looking for is WiFi ad hoc mode or (IBSS) in Android Anybody got any suggestion on how to start working on that?
By using bt and wifi simultaneously, you can try to extend the network further. This will require some kind of packet routing.
Also, it seems android ignores wlan cards connected to usb otg - just plugging in extra wlan dongles could allow easy extension of network.

Is Google glass wireless stable and reliable?

I made a google glass app which receives some data (wireless) from a laptop
and use the data to visualize something. The network connection is simple
UDP or TCP, but I noticed that google glass often miss some data and stop
visualization for a few or several second and continue.
So I'm wondering if Google Glass's wireless network connection is stable
and reliable. Did anyone experience similar or other network problem
with own apps (glassware)?
Thanks!
Not really. You cannot expect it to perform as your laptop or phone because instead of full-circuit card that supports 802.11 b/g/n with several antennas, Glass has only one wireless module on its board. That is from a Taiwanese company with module number WM-BN-BM-04 .
You can see the details about that module here or you can even buy it from Alibaba for $10 ;) . Thus in your case, you should minimize your data or use/implement an ACKing protocol. But a bigger problem about Glass Wifi is that it only supports WEP -hackable by high school students- and WPA/WPA2. No enterprise. You can have a WIFI connection at home but unfortunately not at university, work etc. So with this in mind, you should probably design only at-home applications with WIFI.

Android p2p GPS app

I am looking to implement a cloud application that allows one to save contacts and if the contact also has the app on, see on a map where the contact is (if in close proximity to you).
I've been looking around towards how to do so and the first step is to establish a connection.
For my purposes, a centralized server to which apps connect and fetch repeatedly updated database information about other users is unsatisfactory as this is too "centralized" for a cloud app.
I've some experience with Bluetooth but in my opinion and experience, bluetooth is not practical as the two devices must then be in very very close proximity with each other.
Thus my question is this, how do android phones connect p2p without the use of local wifi? If that is even possible?
Thank you for your time
Thus my question is this, how do android phones connect p2p without the use of local wifi? If that is even possible?
Yes, via Bluetooth where available, but it will probably not meet your needs. So, in practice, the answer to your question is no. You will need the local wifi.
That being said, you could attempt multicast on the LAN to detect other connected devices enabled with your application. If you want more than LAN, you will need a fully fledge solution including super peers and a P2P framework, like JXTA

Categories

Resources