Search Unity

Help: My entire program is generated at run time, how can I show a client?

Discussion in 'Multiplayer' started by A1A_PW, Oct 15, 2019.

  1. A1A_PW

    A1A_PW

    Joined:
    Sep 5, 2018
    Posts:
    8
    Hello,
    I work on a simulator that creates every object at run time based on data sent from a website. This ranges from primitives to complex 3D models and CAD data. Here's what I need:

    1. A client that can login and just simply has a controllable camera in the scene.
    2. Can see all the run time generated objects that were created by the host.
    3. There is no possible way to prefab the thousands (or more) of possible objects

    Clients logging in will need to be stuck in place with a controllable camera so they can look around the area they are in. How can I get them to see what the host sees without using the prefab spawning system?

    Thank you in advance for your time!
     
  2. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,443
  3. A1A_PW

    A1A_PW

    Joined:
    Sep 5, 2018
    Posts:
    8
    Thanks. I'll look into that now. Would I create a client controlled camera in the scene that streams data back to the client and fakes the feeling that you are in the scene? Would this work in VR?

    One thing I am trying, is I generate the scene local for each client before the host client begins input. Then I spawn ghost objects that place themselves as parents of object in that scene. That way I can perform transformational actions. This would work great, except I have an object on a rope (Imagine a crane with a load) and unfortunately the rope adheres to chaos theory and has a different reaction on collisions for each client. If there was a way to enforce the same reactions across clients then I'd done. :p
     
  4. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,443
    yeah, i'd test that "remote camera".. to see if its fast enough for vr.
     
  5. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,070
    The best way to approach this (imo) is to make the world/object generator deterministic. Instead of showing what someone else generated, re-generate the same thing on another machine. You just exchange the seed value and data and everything else falls in place.

    It's a bit tricky to get right but once you did, you no longer need to transfer anything but a simple initial value.
    You only need to worry / sync changes to this world, if that's allowed.

    We got a very very simple demo of that in our PUN 2 package. It generates a "world" on all clients, based on a shared seed. It's available for free and without obligation, so feel free to have a look as inspiration.
     
    Munchy2007 and Joe-Censored like this.
  6. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,443
    primitives/simple meshes would be easy to generate from parameters,
    but he mentioned (imported) 3d and cad models, and apparently doesn't want to transfer that mesh data to client..

    if photon had "remote streaming" that could be nice & easy : )