• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
moeen k

android bluetooth or wifi connection multiplayer

7 posts in this topic

hi. i made a simple game for android by eclipse but i want to make it a multiplayer. i dont want internet connection. just sending and recieving data through bluetooth or wifi. first i have to ask which one is better for this? does it work like server client system? all i search for it is just about pairing files for bluetooth and wifi. how can i do it for sending data like number or string?

thank you for helping

1

Share this post


Link to post
Share on other sites

@Frob: *Insert Morpheus Meme* What if i told you ... that wifi is not just internet */Insert Morpheus Meme*

I think he meant with Wifi just Wireless LAN, which as the name states is just an LAN, where you can establish socket connections.

 

I didn't made anything with Android yet, but used both methods on Windows Phone, so i'm referencing to how it is made on Windows Phone. But i think it will be similiar on Android. However i will list you the features and cons/pros of both methods so you can decide on your own, wich fits best.

 

  • Bluetooth: As said you have a range up to 10m, so your players have to sit next to each other. Both smartphones will publish something like a service to find each other and then establish a Bidirectional Stream Socket like connection. This means you can send data in both directions asynchron. The connection will be peer to peer, without anything in between.
  • Wifi/WLAN: For WLAN both devices have to be in the same network. So an access point is required, or one smartphone has to provide a wireless network. However this has to be done before they get into you game. Then it acts like a normal LAN, so you have to use sockets, connect via IPs and so on (There might be some API that provides automatic connection like this one http://developer.android.com/training/connect-devices-wirelessly/nsd.html). But the difference to Bluetooth is, you will have something like a server and a client. The server has to listen for incomming connection and the client has to connect to you server. Your range depends on the network, so both player could sit in different rooms. 

I think in the end either way you will get just an data socket, where you can read write you data form and to. I didn't mentioned the data rate, but for a game that shouldn't matter at all. Only if you have to transfer very big amout of data, like images or sounds.

 

Best way for a customer would be to have both ways. So either they can choose what they want to use or you make automatic system, which decides what to use. Something like, first check if both user are on the same Wireless network, if so, use it. Then try to establish a Bluetooth connection, if it fails prompt the user to create a local wireless network.

 

And for wifi, there is a new feature called Wifi Direct, which lets you connect two devices via WLAN but without a network (like Bluetooth but uses WLAN adapter). But that is not supported on all devices, mostly only on newer ones.

 

For the "how do i programm it" you can look into the android documentation. Start at Bluetooth or Wifi and move along the links through connecting until sockets, where you can finally send data. 

2

Share this post


Link to post
Share on other sites
Since android 4.0 Google introduced the wifip2p API.
http://developer.android.com/guide/topics/connectivity/wifip2p.html

Since android 4.1, it even allows you to use wifi service discovery :
http://developer.android.com/training/connect-devices-wirelessly/nsd-wifi-direct.html

Unfortunatly not all devices support it. (Nexus4&5 support it, Samsung galaxy > s2 support it also, don't know about other phones)
2

Share this post


Link to post
Share on other sites

thank you all. i made most part of my multiplayer game and now im on debugging. maybe its compeletely diffrent question but i think its better to ask it here. i know many basic features of network games like using peer to peer system or client server and waht is the diffrence of tcp and udp but i want to start to learning it practically. i want to know what is the best library to start learning it? i know for windows and xbox best choice is directx and networking libraries is some part of it. and windows has it own networking socket programing libraries. but what is best cross platform library that i an use in linux platforms? thank you for helping

0

Share this post


Link to post
Share on other sites

There are several libraries available, but I'm not sure what is currently the most recommended.

 

You would be best by asking that question in a new thread in the Networking forum

1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0