Search Unity

Simple "network" game. What are the options ?

Discussion in 'Multiplayer' started by EskAere, Sep 5, 2019.

  1. EskAere

    EskAere

    Joined:
    Jan 11, 2017
    Posts:
    7
    Hello everyone :)

    I'm trying to play with network and for that i've designed a really simple game.
    I'm looking for tips to lead me towards the right direction.

    Here is what i try to achieve.

    Game can be launched on desktop or mobile (Android only is fine. iOs is a nice to have)

    A device can host the game OR be a controller.

    The host device is then the server. It receives commands from controller devices.
    At first, it is totally fine to only have client to server communications. No feedback from the server is mandatory on the controller devices.

    Ideally, no internet would be required as it would be a LAN game (either via wifi hotspot or bluetooth). But if an internet connection is necessary, it's ok.

    Does it make sense ? What do you think about that and what are my possibilites ? Do you know if Mirror, PUN, Forge... can be of any help ?

    Thank you !
     
  2. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    That doesn't sound simple. All of the Photon flavors require internet access. If you want your clients to automatically find the server, or if you want to manually type in IP addresses will be a question you need to answer. Unet had called this feature something like network discovery. Most network API's don't implement a similar feature, and Unet's implementation wasn't entirely reliable based on threads I've seen on the topic (I've never personally used it). Also there were certain Android devices where it simply wouldn't work.

    You can try to find old threads on the network discovery issues topic, but it hasn't been brought up as much lately since Unet was deprecated over a year ago.

    Also, communication only from client to server isn't really a thing as far as any of the available network API's. I'd assume on your "controllers" you'd want to at least tell the player they have successfully connected, which requires 2 way communication.

    I'd go with a lower level API where you're sending messages and handling them yourself, since this doesn't sound like a typical syncing the game world to clients use case.
     
  3. EskAere

    EskAere

    Joined:
    Jan 11, 2017
    Posts:
    7
    Fisrt, thank you for you reply !

    Indeed, i'd like it to be as simple as possible to use, so no IP to type manually.
    That's the reason i thought of :
    - Bluetooth : Close devices would automatically connect to an existing game/host, if there is one.
    Let's not consider the multiple host edge case for now.
    - Or wifi hotspot (no need to expose IP to players in that case, am i correct ?)

    Bluetooth seems under used, so i can't find docs about it. In consequence, I'll probably have to go with wifi hotspot. Still, hard to find docs about it too.

    I may be wrong, but i feel like i can avoid the (complex) exploration of network discovery ?


    Concerning the client to server only, you are right. I definitely need a 2 way communication. But once i'm connected, i believe i merely have to play with RPC (the controller devices could be blank screens).

    So the tricky part would be the establishment of the connection.
     
  4. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    As I mentioned in another thread today, you'll probably have to do your own investigation into whether the hotspot implementations on your target devices allow for opening a port accessible to connected wifi clients for use with your game. That's not exactly a Unity or network API issue, but a question of how the hotspot implementation and firewall works on the device. It might just work, might not allow such a thing, no idea. I'm not aware of any network API advertising specific support for this either.

    If you're not typing in an IP address, and you're not using something like network discovery to automatically find the IP address, what is your plan for the client to get the IP address of the host? Just assuming the host is the same IP as the default gateway might work, if you're only going to support a host as the one hosting the hotspot I suppose.
     
  5. EskAere

    EskAere

    Joined:
    Jan 11, 2017
    Posts:
    7
    I'll give a try with Forge :)
    They offer network discovery in case i need it

    Thank you for your time Joe !