Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

2 persons playing together on mobile without Internet connection, how can i do this ?

Discussion in 'Multiplayer' started by jessica1986, May 14, 2013.

  1. jessica1986

    jessica1986

    Joined:
    Feb 7, 2012
    Posts:
    621
    Hi,

    I want to make a network game and want that 2 persons ca play it, may be like peer to peer.

    But i want the connection to be established in 2 ways

    1. Not via Web connection as it will demand a faster web connection
    2. How can they play if they are sitting together in some room without any internet ?
     
  2. Uncasid

    Uncasid

    Joined:
    Oct 5, 2012
    Posts:
    193
    You will always need a network connection to network, lol.. but, you don't need an internet connection.

    If you are both on the same network, ie: Wireless Router, or direct connect (via crossover cable), you will be able to do it

    Each device has an IP address, usually a 192.168 or a 10.0 address. You can implement connecting directly to an IP (don't do this), or do a port listening sort of thing as well.

    http://docs.unity3d.com/Documentation/ScriptReference/Network.InitializeServer.html

    This goes through a lot of the programming methods
    http://3dgep.com/?p=4609
     
    Last edited: May 14, 2013
  3. kasulogamestudio

    kasulogamestudio

    Joined:
    Mar 22, 2012
    Posts:
    130
  4. Ashkan_gc

    Ashkan_gc

    Joined:
    Aug 12, 2009
    Posts:
    1,127
    Jessica, You can use qualcomm's AllJoint or uLink with it's LAN discovery feature. The former is psecificly made for peer to peer networking and is more tailered to your needs and is both free and open source. The later is mainly made for big multiplayer games and supports the feature of finding servers in your current local network but does not support finding others in proximation in other networks and many other peer to peer feature of AllJoint ... The disadvantage of AllJoint is that you can not extend it to be able to play from internet. Maybe you can create a wrapper for your networking layer to be able to use different systems easily in required later on.

    https://developer.qualcomm.com/mobile-development/mobile-technologies/peer-peer-alljoyn
    http://www.muchdifferent.com
     
  5. Uncasid

    Uncasid

    Joined:
    Oct 5, 2012
    Posts:
    193
    You sure do a lot of advertising, without actually helping..

    What kind of game are you planning on making, Jessica?
     
  6. Ashkan_gc

    Ashkan_gc

    Joined:
    Aug 12, 2009
    Posts:
    1,127
    I'm not affiliated nor with qualcomm which i've recommend for this project and am not owning any shares in MuchDifferent. I'm a good friend with many of them and have their certificate and love their product but never did not advertise them. If someone is making something which can benifit from their products i recommend it but in other places i just say other stuff might suite better. I think if you read some of my threads then you come to this conclusion. It's not advertisement if someone asks you about a good processor and you recommend word, is it? AllJoint is exactly made for needs like what jessica says , peer to peer applications in different kinds of networks, and uLink has LAN discovery but not recommended fully for this. I've taken a look and it seems TNET and lidgren have LAN discovery as well. What part of it looks like an ad, can i ask?
     
  7. Uncasid

    Uncasid

    Joined:
    Oct 5, 2012
    Posts:
    193
    I didn't intend to threadjack.. Just pointing out what I have seen from your posts.. do me a favor and look at your profile.. count how many times you suggest ulink. You are advertising.

    It is pretty obvious that ulink is not needed in her case, why did you bring it up?
     
  8. Ashkan_gc

    Ashkan_gc

    Joined:
    Aug 12, 2009
    Posts:
    1,127
    Well i think we are missing the main point of the thread by discussing this, but uLink can be useful if she is converting from a built in networking project, and it has LAN discovery like TNET and lidgren so to some extent can do what she wants, however as i clearly said AllJoint is the recommended solution for her. I talked about the reason of recommending uLink. I did not recommend it to people which did not benifit and recommended smartfox, roarengine, badumna and lidgren as well. see the article below my signature (how to choose your networking middleware to understand how i look at it if you are interested)
     
  9. jessica1986

    jessica1986

    Joined:
    Feb 7, 2012
    Posts:
    621
    I want to make a game which can be played by 2 or 3 people sitting together somewhere together
     
  10. Uncasid

    Uncasid

    Joined:
    Oct 5, 2012
    Posts:
    193
    What kind of game though? How many networked game objects? How complex is the game logic? Is this something that will require a authoritative server? Are you using physics? I suppose I should also ask if it is 3d or 2d? What kind of mobile devices?
     
  11. Ashkan_gc

    Ashkan_gc

    Joined:
    Aug 12, 2009
    Posts:
    1,127
    If you are making a game that you want it's players to connect to each other based on the fact that they are sitting in the same place (so you want to use any available network to somehow connect them), so AllJoint is the solution exactly made for this. ah and I'm telling this from lots of experience. In many situations some of the questions that Uncasid asked are important but in your case it's not cause AllJoint can be used both inside unity and in normal .NET apps and in other languages, being 2D or 3D has nothing to do with your networking lib and there is not much meaning for being authoritative when some people gather around and without internet and servers player together (so no one is not superior) and even if important, authoritativeness can be implemented using AllJoint. I don't want to be offensive but just am trying to make your job easier.
     
  12. Uncasid

    Uncasid

    Joined:
    Oct 5, 2012
    Posts:
    193
    Just trying to get her to open up a bit. We don't have enough info to really help right now.
     
  13. Jtbentley_v2

    Jtbentley_v2

    Joined:
    Sep 5, 2012
    Posts:
    174
    Bluetooth!

    Prime31 has a bluetooth plugin that might be good enough to get you started. We heavily modified it for MMR.
     
  14. kasulogamestudio

    kasulogamestudio

    Joined:
    Mar 22, 2012
    Posts:
    130
    Jtbentley_v2 is right ;)
    That was I said, lol
     
  15. Ashkan_gc

    Ashkan_gc

    Joined:
    Aug 12, 2009
    Posts:
    1,127
    Well guys, AllJoint has bluetooth support as well and hide all complexity of use what available local network bluetooth/wifi/... from user. each app just advertise it's service in all available networks and also can connect to others advertised services.
     
  16. Dan2013

    Dan2013

    Joined:
    May 24, 2013
    Posts:
    200
    Hi, Ashkan_gc. Why the uLink guys do not implement a networking function over bluetooth? A possible good idea is to implement it on top of AllJoint. Then uLink becomes a more comprehensive networking solution.
     
  17. DryTear

    DryTear

    Joined:
    Nov 30, 2012
    Posts:
    312
    bluetooth isnt integrated into unity3d, (yes ashkan, i really dont know if allJ has one), and u cant play a multiplayer game(LAN or WAN, dosnt matter) without internet connection, if you arent connected to an access point your ip is 0.0.0.0, meaning no one can communicate wirelessly with you. your ip cannot be null, so the application has no idea dfaq who were connecting to, offcourse you can also register an ip address as 0.0.0.0 lol
     
  18. Ashkan_gc

    Ashkan_gc

    Joined:
    Aug 12, 2009
    Posts:
    1,127
    @Dan2013 I am not a part of MuchDifferent so you should ask them for your request. But the fact is that their solution is not for smaller games using bluetooth, they even don't support more common peer to peer approaches fully yet. Bluetooth gaming can really be done with AllJoint so what's the point of creating another solution for it, AllJoint is free and open source.

    @DryTear I don't understand what you want to say much but allJoint works like this, Connect the app to all available networks and looks for services which the app is interested in and/or advertises some services. Then interested parties can connect to each other. Hope this helps.
     
  19. Dan2013

    Dan2013

    Joined:
    May 24, 2013
    Posts:
    200
    @ @Dan2013 I am not a part of MuchDifferent so you should ask them for your request. But the fact is that their solution is not for smaller games using bluetooth, they even don't support more common peer to peer approaches fully yet. Bluetooth gaming can really be done with AllJoint so what's the point of creating another solution for it, AllJoint is free and open source.

    The point is that developers may implement the same logic for both bluetooth-based and WiFi-LAN-based games. Developers will be pretty happy if uLink can provide such a common abstraction for all kinds of LAN gaming techniques.
     
  20. sefli

    sefli

    Joined:
    Jun 1, 2013
    Posts:
    2
    What about wifi? ;)
     
  21. DryTear

    DryTear

    Joined:
    Nov 30, 2012
    Posts:
    312
    u mean, Wireless Fidelity, which is exactly what were discussing about, and connecting to LAN wifi is needed
     
  22. User340

    User340

    Joined:
    Feb 28, 2007
    Posts:
    3,001
    Just use unity's built-in networking, it works great for LAN games. Just ignore the MasterServer part.
     
  23. holokaust

    holokaust

    Joined:
    Nov 17, 2009
    Posts:
    18
    I think what Jessica wants is what i want too.

    I will be simple and clear:

    Imagine a room with a wifi router and everyone connected to it. We start a new game and everyone joins the lobby. Then the game starts and the first card is put on game.
    Now each player choose a card in his turn and everyone see it.

    What i want:
    - Make a 2D with no physics card game where each player can choose a card each turn.
    - Make it cross-platform like iOS x iOS --- iOS x Android --- Android x Android if possible
    - Peer-to-peer connection (LAN)

    What I don`t want
    - That it require a internet connection (I don't want it)

    Question:
    - Will the AllJoyn with 3.3.0 work for this?
    - If no, what solutions could i have?

    Does this work for what i said up there?


    Thanks in advance everyone!
     
  24. Uncasid

    Uncasid

    Joined:
    Oct 5, 2012
    Posts:
    193
    unity networking will work just fine!

    use lockstep method, but without the rts style implementation. i think if you do a turn counter, then wait for all players input before going to next turn, you will be just fine. best part, you dont really need to watch bandwidth, as it is event driven data :)
     
  25. Dan2013

    Dan2013

    Joined:
    May 24, 2013
    Posts:
    200
    To implement your idea, Bluetooth is a better choice than WiFi.

    With WiFi, all the players need to connect to an established AP router (e.g. like a home router with SSID and password) that provides WiFi connection.
    With Bluetooth, all the players can connect to each others without an external AP router.


     
  26. velocitigames

    velocitigames

    Joined:
    Jun 3, 2013
    Posts:
    6
    Bluetooth Crossover cable. :)