Search Unity

How to do you access a client/collider "use" variable on the server-side to trigger events?

Discussion in 'FPS.Sample Game' started by AggressiveMastery, Feb 24, 2019.

  1. AggressiveMastery

    AggressiveMastery

    Joined:
    Nov 19, 2018
    Posts:
    206
    Hello Modders!

    I want an opening door, I want an enter-able car, I want interactions!

    I know that the server is authoritative, and so the client send movement into to the server, and I know the Character_X server-side prefab holds some replicated data points for "action" of attack, melee, jump, ect.

    Can you tell me what string I should use, to access the "use" or "f" key entered by a client, and transferred to the server, so I can have the server-side scripts scrub against colliders to it, and then see if that collider is pressing "use/f" to trigger a server side function?

    I've been playing with GetComponent and transform.parent on the collider with limited success... and hope someone here has figured this out already?

    Thank you,
    Micah
     
    keeponshading likes this.
  2. Aquastar

    Aquastar

    Joined:
    Jul 17, 2013
    Posts:
    29
    As far as I know, there are two ways that the client could send commands to the server. One is ClientGameLoop.CmdRunAtServer. This is available even when the client owns no entity. Another one is UserCommand which will be processed by ClientGameWorld.PredictionUpdate.
    If you want to trigger server-side scripts and prediction is not your concern, you could use CmdRunAtServer .
     
  3. Journeythedev

    Journeythedev

    Joined:
    Oct 19, 2016
    Posts:
    18
    Senpai, could we get a verbose tutorial on this once you have it mastered?
     
    AggressiveMastery likes this.
  4. AggressiveMastery

    AggressiveMastery

    Joined:
    Nov 19, 2018
    Posts:
    206
    ahahahha, yes!

    Come on guys, this was supposed to be my "easy out" :D

    I am kind of waiting on Unity here... 2019 fixes terrains not freaking meshing... I want that feature. Plus, the FPS Team mentioned releasing 'how to's and I am sure one will give me all the steps for the ECS job system to check for "use" keys on all colliders and then execute any "use" scripts on them...

    But that stuffs not here yet maaa
     
    Journeythedev likes this.
  5. AggressiveMastery

    AggressiveMastery

    Joined:
    Nov 19, 2018
    Posts:
    206
    hmm, maybe that CmdRunAtServer for "use-scripts-on-coliiders" would act as a on-demand job until I figure thoes out better. :D