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

Multiplayer-Sharing Score with networking Between Mobile and PC app

Discussion in 'Multiplayer' started by NejoFTW, May 9, 2017.

  1. NejoFTW

    NejoFTW

    Joined:
    Aug 11, 2016
    Posts:
    6
    Hi all!

    First of all,I am very new to networking and I have a (what i thought it would be) a simple task.
    I am making a AR game where you (first part) scan and get points using your phone and finding targets, the second part of the application is kind of a screensaver for a desktop computer, which spawns the image target on different locations of the screen. So basically, the user scores points with scanning targets on the desktop's screen with his phone. I managed to do both apps with not much effort.

    The tricky part is to display the same score both in the phone app and also on the "screensaver" app for the desktop. I have to share the score data between the apps using networking but currently I have no idea how to tackle the problem as there is not much posts regarding this issue...I tried with [SyncVar] and global variables but with no success(like I said, I suck at networking, not the best programmer either)...
    For now the application is just for 1 player but later it could go in the many players(phones) scanning the target on one monitor direction, but for now it's just 1 phone and the Pc that will act as the server and run the screensaver(and of course show the players score).
    Currently the phone app and desktop app are in separate scenes but if the solution is easier with a single scene I can merge them with very little effort so it's not a problem.
    Any help is appreciated, thanks for your time guys!
     
  2. aabramychev

    aabramychev

    Unity Technologies

    Joined:
    Jul 17, 2012
    Posts:
    574
    I guess you should start with simple application which deliver some sort of data from PC client to PC client. Without any mobile AR and other things. As far as You be able to deliver data you will understand what are you need.

    Make sense?
     
  3. NejoFTW

    NejoFTW

    Joined:
    Aug 11, 2016
    Posts:
    6
    Yes. This is exactly what I am doing, in the AR part of the app i made a simple button which increases the score by calling a command on the server. if i press that button in the app as the server, the client sees clearly that the score was increased, but when I press it as a client i get no results... And like I said, that AR part was easy, its the networking that causes me headaches :)
     
  4. aabramychev

    aabramychev

    Unity Technologies

    Joined:
    Jul 17, 2012
    Posts:
    574
    can you repro this problem with 2 pc only? (one client another server)?