Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Common chat + room(game) chat using uNET

Discussion in 'UNet' started by novaVision, Mar 16, 2016.

  1. novaVision

    novaVision

    Joined:
    Nov 9, 2014
    Posts:
    492
    Currently I am researching, is it possible to implement functionality I need using Unity Network.
    I have checked plenty of resources and tutors, but still didn't find an answer for that.
    What I need is:

    Home scene chat. Player connect to common lobby automatically after running standalone client. That lobby must have common chat (currently with a single channel)
    Game scene chat. After creating a game room and load the scene, user got access to room chat at the battlefield.

    That is a basic what I need. Is it possible?

    Additionally I would like to add functionality to switch between Home and Game scenes in case if player pushed escape in Game scene, and keep the chat history inside them so player can check what was happened in Home scene chat while he was playing.
    What about it? Can I implement it using standard Unity tools?

    Would be happy to any advice,
    Thanks
     
  2. thegreatzebadiah

    thegreatzebadiah

    Joined:
    Nov 22, 2012
    Posts:
    836
    I want to say "yes" but I haven't actually done it myself so I can't say for sure. Unity does provide some tools to achieve what you want though. I think the SpecialConnectionConfigs on HostTopology might be what you're looking for. I'm not entirely sure how you would go about using it but this quote seems promising:
    I'm fairly certain that you can achieve what you want with the LLAPI at least. If you've got a 'global' chat channel then I assume that's hosted on some server somewhere. So you can just connect to that using the LLAPI and keep all the global chat stuff completely separate from the rest of the networking. The in game chat can be done using the HLAPI over the normal server / client connections. There's no reason both connections can't be open at the same time so it seems like it should all be possible.
     
  3. novaVision

    novaVision

    Joined:
    Nov 9, 2014
    Posts:
    492
    Thanks for reply,

    That sounds promising. I will check in details those methods.
    One more thing which can be a problem here - open Home scene inside Game scene. How I know uNET load new scene connecting to the game room. I think it is not possible to implement fast scene switching without loading process. So if user push "Escape" and want to open game main menu (Home lobby) I need to add that UI Canvas to Game scene... In that case if user decide to connect to another room, Game scene need to load it self (Game scene also)... that looks like a mess..
     
  4. novaVision

    novaVision

    Joined:
    Nov 9, 2014
    Posts:
    492
    After several seeking I found information, that LLAPI (to use it for global chat) can't run in dedicated cloud server, only if setup my own server with Unity client running and make a automatically connect user on game client start. That is too complicated.
    I get another idea - implement common chat in Photon cloud, but multiplayer will work in uNET HLAPI.
    Will it be possible? Could be any conflicts using both networking systems?
     
  5. Christoph_DonopInteractive

    Christoph_DonopInteractive

    Joined:
    Sep 24, 2013
    Posts:
    3
    You can do multiple connections from one client with UNet HLAPI. Just use the IP direct connection by using:

    Code (CSharp):
    1. NetworkClient client = new NetworkClient();
    2. client.Connect( ServerIpAddress, ServerPort);
    In parallel, the same computer can just be a host or client by using the NetworkManager:
    Code (CSharp):
    1. StartHost()
    2. StartClient()
    For sure, the Chat server should be hosted by your own, but ther are a lot of free code in the internet, so you dont just need to code it.

    Photon and UNet should be work in parallel, the use different protocol, but, both have a CCU concept you need to pay for.
     
  6. novaVision

    novaVision

    Joined:
    Nov 9, 2014
    Posts:
    492
    Thanks, I didn't know that.
    Anyway, need a dedicated server with Unity game client running, same as using LLAPI.
    If uNET and Photon can work together, that will be the best solution. In my case I develop prototype, so not a lot CCU will be used.