Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Home-hosted online multiplayer?

Discussion in 'Multiplayer' started by LoveeVixen, Oct 10, 2022.

  1. LoveeVixen

    LoveeVixen

    Joined:
    Jun 24, 2014
    Posts:
    18
    Hello!

    This is a question that has been on my mind for a while and I'm finally getting around to asking as I'm not sure what words to use to search up tutorials for what I'm wanting to learn.

    So around last year I recently got an understanding of how to make online multiplayer games using Photon PUN 2, and it's easy to make online multiplayer games using this package which makes me happy. Recently however I've been thinking to myself how of course Photon works using a online service to have clients connect together and that one day probably many years in the future Photon services could go down which I'm assuming would mean any games that use Photon PUN will no longer have online multiplayer? I don't like the thought of my multiplayer games no longer having multiplayer because a service has gone down, and I usually like to become as independent as I can on games I'm developing rather than using asset packages on my projects, which is why I have this question!

    How would I go about making a online multiplayer game where players can host a room/server from home, and where could I possibly find tutorials on how to do this kind of thing? The only example I can really think of would be Minecraft Java Edition and how you would have to port-forward and download software. I'm assuming Minecraft Java Edition doesn't use a online service to do online multiplayer? It would also be good to have more independent control over how online multiplayer works on my games.

    I hope I explained this clearly, however I'll be happy to elaborate on anything if needed. Thank you for reading and I look forward to seeing your responses!
     
  2. CodeSmile

    CodeSmile

    Joined:
    Apr 10, 2014
    Posts:
    5,533
    I have not enough experience with Photon but I believe all of their services require an API key to work, so you have a lock-in into their services.

    I know Netcode for GameObjects (Unity) and Fish-Net both can be hosted locally respectively on your own dedicated webserver. However, you will definitely need some sort of NAT punch-through or port forwarding (either manually configured by user or automatic using UPnP if the router supports it).

    Again, there are open source solutions that do not require a relay service such as Unity Relay.

    Anyhow, you'll have to do a lot more DIY to get to what you want and you can still do that when you have a game that's popular, so maybe make the game first, and then upgrade the tech. ;)
     
    LoveeVixen likes this.
  3. LoveeVixen

    LoveeVixen

    Joined:
    Jun 24, 2014
    Posts:
    18
    Ah, this sounds helpful and makes me feel a lot better. Thank you for your help!
     
  4. r31o

    r31o

    Joined:
    Jul 29, 2021
    Posts:
    460
    I would use a steam transport for Netcode or Fish-Net, its a relay like the one of PUN, but its free, and makes players life a lot easier.
    And if it Valve shuts doun the relay, you can always change the transport to the defaut one.