Search Unity

  1. The 2022.1 beta is now available for testing. To find out what's new, have a look at our 2022.1 beta blog post.
    Dismiss Notice
  2. Welcome to the Unity Forums! Please take the time to read our Code of Conduct here to familiarize yourself with the rules and how to post constructively.

uSurvival Official Thread - Unity Multiplayer Survival Asset

Discussion in 'Assets and Asset Store' started by vis2k, May 14, 2018.

  1. Vaupell

    Vaupell

    Joined:
    Dec 2, 2013
    Posts:
    259
    aw... f..* wish i saw this before buying the asset..

    Anyone know if we can resell the assets? Kinda useless for me to own.
     
  2. antsonthetree

    antsonthetree

    Joined:
    May 15, 2015
    Posts:
    95
    @vis2k - I see in CharacterController2k that there is a requirement for a Rigidbody. However the only thing it seems to do is set it to isKinematic = true and useGravity = false. Then it never uses it. Question - why not just ditch it completely? Is it used somewhere else?
     
  3. vis2k

    vis2k

    Joined:
    Sep 4, 2015
    Posts:
    4,045
    It's needed for collision detection only.
    Collider<->Collider alone won't do
     
    antsonthetree likes this.
  4. vis2k

    vis2k

    Joined:
    Sep 4, 2015
    Posts:
    4,045
    V1.80 pending review
    2021-02-20_11-42-21@2x.png
     
    umcherrel and DJ_Design like this.
  5. vis2k

    vis2k

    Joined:
    Sep 4, 2015
    Posts:
    4,045
    V1.81 pending review:
    2021-03-06_16-54-44@2x.png
     
    maniak_001 likes this.
  6. iraway

    iraway

    Joined:
    Dec 2, 2015
    Posts:
    12
    Having a problem where clients connected to a server are unable to move -- they keep snapping back to their original point where they spawned. Any idea why this might happen?
     
  7. vis2k

    vis2k

    Joined:
    Sep 4, 2015
    Posts:
    4,045
    - does it happen in a fresh usurvival project?
    - if yes, how to reproduce?
    Can't see your screen from here :)
     
  8. iraway

    iraway

    Joined:
    Dec 2, 2015
    Posts:
    12
    I'll try a fresh project tomorrow, getting a bit late here. Was hoping it'd be something obvious but I know you're not telepathic! ;)

    I did track it down to this bit in PlayerMovement.cs around line 1052-1063, which is being fired constantly even with no user input (so seems odd there'd be too many pending moves):

    Code (CSharp):
    1.  
    2.             // apply next pending move if we have at least 'minMoveBuffer'
    3.             // moves pending to make sure that we also still have one to apply
    4.             // in the next FixedUpdate call.
    5.             // => it's better to apply 1,1,1,1 move instead of 2,0,2,1,0 moves.
    6.             if (pendingMoves.Count > 0 && pendingMoves.Count >= minMoveBuffer)
    7.             {
    8.                 // too many pending moves?
    9.                 // (only the server has authority to reset!)
    10.                 if (isServer && pendingMoves.Count >= maxMoveBuffer)
    11.                 {
    12.                     // force reset
    13.                     Warp(transform.position);
    14.  
    That probably doesn't narrow it down much though.
     
    Last edited: Mar 21, 2021
  9. iraway

    iraway

    Joined:
    Dec 2, 2015
    Posts:
    12
    It seems like a fresh project with just uSurvival imported does work as expected.

    Checked for differences in my NetworkManager vs the fresh project and don't see any differences except I am using TelepathyTransport component instead of KcpTransport (the Kcp one didn't seem to work in my project for some reason I could not figure out).

    Checked for differences from a Player object spawned in my project vs the fresh project and only see these differences (in my Player):
    A
    - Character Controller 2k Script: Collision controller layer mask is set to mixed -> with everything selected except Nothing and Everything (rather than set to Everything)
    - Additional component: uSurvivalBuilderBehaviourReflector

    What else should I check?
     
  10. iraway

    iraway

    Joined:
    Dec 2, 2015
    Posts:
    12
    Tried KcpTransport again and it has a similar issue, but then the client auto disconnects after not getting any messages for 10000ms.

    upload_2021-3-21_18-53-53.png

    (I added log calls to log the number of pending moves in the buffer.)
     
  11. vis2k

    vis2k

    Joined:
    Sep 4, 2015
    Posts:
    4,045
    Please post issues on the issue tracker with as much detail as possible so they don't get lost:
    https://github.com/vis2k/uSurvival/issues
     
  12. kiugetski

    kiugetski

    Joined:
    Dec 24, 2012
    Posts:
    36
    hey ... ive bought usurvival but i see there is no tutorial to be found anywere except a basic guide so where and how can i learn this tool ...
     
  13. vis2k

    vis2k

    Joined:
    Sep 4, 2015
    Posts:
    4,045
    V1.82 pending review:
    2021-03-27_18-44-32@2x.png
     
  14. vis2k

    vis2k

    Joined:
    Sep 4, 2015
    Posts:
    4,045
    Please check out the documentation, play around with the example scene and join our discord for a helpful community :)
     
  15. iSleepzZz

    iSleepzZz

    Joined:
    Dec 23, 2012
    Posts:
    184
    Hi there @vis2k ! Hopefully you are doing well :)

    I noticed on the latest mirror and usurvival package it comes with the kcp transport which is looking really good so far!
    However, I noticed now for the network visibility, instead of the grid system we now are using "spatial hashing interests" which I guess is pretty close to the same thing which is a great network bandwidth saving technique.
    However, I have a little problem with it, I would like to optimize the bandwidth even further by being able to identify network visibility that is different from object-to-object rather than a static visibility range.
    Would you not agree we could save even more network bandwidth if it was like this?

    As a quick example for usurvival, in a giant open world survival game. You SHOULD be able to see players from far away with binoculars to scope out that town close by (so players would have network visibility of like 400m)
    While on the other hand, item drops on the ground don't really need to be seen from that far, such as maybe 50m or so.

    The current solution would have me change the static range to 400m and now I will be seeing a TON of networked objects which are completely not need.

    Is this planned in mirror or is this something you guys do not want to implement on purpose for a reason that I'm missing? And would it even be possible for me to implement this by myself using mirror?
    Any information on this would be awesome, thanks!
     
  16. vis2k

    vis2k

    Joined:
    Sep 4, 2015
    Posts:
    4,045
    Spatial hashing is for max performance with lots of entities.
    There's also distance interest management.
    If you need anything else, feel free to implement your own interest management.
    That's why in Mirror, InterestManagement class is abstract. We want you to modify if needed :)
     
    iSleepzZz likes this.
  17. iSleepzZz

    iSleepzZz

    Joined:
    Dec 23, 2012
    Posts:
    184
    Okay awesome! I will definitely be looking into this a lot more and tinkering with this!
    However, my end goal would be the exact same Spatial Hashing however with per-object visibility range.
    Can I just attach the "Spatial Hashing" component to different networked objects? Or will this cause issues?
     
  18. vis2k

    vis2k

    Joined:
    Sep 4, 2015
    Posts:
    4,045
    Spatial hashing requires same distance for everyone.
    What you gain is performance though.

    It sounds like you need DistanceInterestManagement instead.
     
    iSleepzZz likes this.
  19. ruis_software

    ruis_software

    Joined:
    Feb 19, 2019
    Posts:
    1
    can you please fix uSurvival for 2020.2.6 or higher like the 2020.3 LTS? You stated that LTS should work and that higher versions than 2019.4 works, but it don't. I want to use several nature assets on hdrp that uses at least 2020.2.6, but any version after 2020.1.17 don't work. I tried almost all versions after 2020.1.17 but they give all the same errors. Just import uSurvival and build it, you will see what i mean
     
  20. vis2k

    vis2k

    Joined:
    Sep 4, 2015
    Posts:
    4,045
    What's the error?
    uSurvival only uses standard shader. If HDRP breaks then please report it to Unity.
    As far as I understand, a lot of people are upset about HDRP/URP stability right now.
     
  21. vis2k

    vis2k

    Joined:
    Sep 4, 2015
    Posts:
    4,045
    V1.83 pending review! Bug fix release.
    2021-07-10_19-42-55@2x.png
     
  22. RelajoSoft

    RelajoSoft

    Joined:
    Apr 29, 2018
    Posts:
    23
    Hello guys, I invite you to see my addons store for the uSurvival series, don't waste time and advance your game easily by adding hundreds of functions with just a few clicks. I leave the link here
    Best regards

    RelajoSoft Team

    https://relajosoftweb.com/store/productlistcat/16
     
  23. johny256

    johny256

    Joined:
    Mar 3, 2015
    Posts:
    240
     
  24. johny256

    johny256

    Joined:
    Mar 3, 2015
    Posts:
    240
    Update player camera for first person
     
  25. SirTwistedStorm

    SirTwistedStorm

    Joined:
    Sep 20, 2015
    Posts:
    191
    It has 1st person, use the mouse scroll wheel and scroll down.
     
  26. pepito233

    pepito233

    Joined:
    Oct 5, 2020
    Posts:
    7
    Buenos días. Tengo un problema de sincronización con los clientes.

    El servidor muestra la animación de los clientes, pero los clientes no ven la animación de los otros clientes ni la suya propia. Solo ocurre con la animación asociada al bool ("zoom").

    Necesito ayuda, gracias.

    //////////////////////////////////////////////////// //////////////

    usando System.Collections;
    utilizando System.Collections.Generic;
    usando UnityEngine;
    usando Mirror;

    clase pública ActivarMiraArma: NetworkBehaviour
    {
    Cámara pública cámaraArma;
    Cámara pública cámaraM4;
    Cámara pública cámaraBeretta92;
    Cámara pública cámaraBayesta;
    anim animador público;
    [SyncVar] public bool zoom = false;
    public float tiempoProgramado = 0.25f;
    tiempo de flotación pública;
    jugador de GameObject público;
    público GameObject Arma;


    inicio vacío público ()
    {
    jugador = this.transform.gameObject;
    }


    public void Update()
    {
    if (isLocalPlayer)
    {
    if (tiempo > 0)
    tiempo -= Time.deltaTime;
    if (anim == null)
    anim = transform.GetComponent<Animator>();
    Arma = GameObject.FindWithTag("ArmaMontada");
    if (Arma == null) return;
    if (Arma.name == "M4")
    {
    cámaraArma = cámaraM4;
    activarCámaraM4();
    }
    if (Arma.name == "Beretta92")
    {
    cámaraArma = cámaraBeretta92;
    activarCámaraBeretta92();
    }
    if (Arma.name == "Crossbow")
    {
    cámaraArma = cámaraBayesta;
    activarCámaraBayesta();
    }
    if (Input.GetMouseButton(1))
    {
    if (zoom == true) return;
    CmdZoomTrue();
    }
    else
    {
    CmdZoomFalse();
    anim.SetBool("Zoom", false);
    zoom = false;
    }
    if (Input.GetMouseButton(0))
    {
    anim.SetBool("Ratón Izquierdo", true);
    }
    else anim.SetBool("Ratón Izquierdo", false);
    }

    }


    [Command]
    void CmdZoomTrue()
    {
    anim.SetBool("Zoom", true);
    zoom = true;
    }
    [Command]
    void CmdZoomFalse()
    {
    anim.SetBool("Zoom", false);
    zoom = false;
    }


    public void activarCámaraBeretta92()
    {
    if (isLocalPlayer)
    {
    cámaraBayesta.enabled = false;
    cámaraM4.enabled = false;
    cámaraBeretta92.enabled = false;

    if (zoom == true)
    {
    temporizador();
    }
    else
    {
    cámaraArma.enabled = false;
    tiempo = tiempoProgramado;
    }
    }
    }


    public void activarCámaraM4()
    {
    cámaraBayesta.enabled = false;
    cámaraM4.enabled = false;
    cámaraBeretta92.enabled = false;
    if (zoom == true)
    {
    temporizador();
    }
    else
    {
    cámaraArma.enabled = false;
    tiempo = tiempoProgramado;
    }
    }


    public void activarCámaraBayesta()
    {
    cámaraBayesta.enabled = false;
    cámaraM4.enabled = false;
    cámaraBeretta92.enabled = false;
    if (zoom == true)
    {
    temporizador();
    }
    else
    {
    cámaraArma.enabled = false;
    tiempo = tiempoProgramado;
    }
    }


    public void temporizador()
    {
    if (tiempo <= 0)
    {
    cámaraArma.enabled = true;
    tiempo = 0;
    }
    }
    }
     
  27. vis2k

    vis2k

    Joined:
    Sep 4, 2015
    Posts:
    4,045
    I can't speak spanish, sorry.
     
  28. Kennth

    Kennth

    Joined:
    Aug 11, 2017
    Posts:
    115
    This reminds me of the story about a man drowning in a deep well.... a man comes along and shouts
    down into the well, In his language " Do you need Help ? " a language that the drowning man does not know.... The drowning man shouts back " I Don't understand you!, Come Back when you can speak ENGLISH! " ... So the man left and NEVER came back.

    This guy is asking for your help

    " I need help, thank you. "
    https://translate.google.ca/ or https://www.deepl.com/translator#zh/en/.
    From Goggle Translate

    Good Morning. I have a synchronization problem with clients.

    The server shows the animation of the clients, but the clients do not see the animation of the other clients or their own. It only happens with the animation associated with the bool ("zoom").

    I need help, thank you.

    //////////////////////////////////////////////////// // //////////////

    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    using Mirror;

    public class ActivateMiraArma: NetworkBehaviour
    {
    Public camera cameraArma;
    Public chamber chamberM4;
    Public chamber chamberBeretta92;
    Public camera Bayesta camera;
    public entertainer;
    [SyncVar] public bool zoom = false;
    public float scheduledTime = 0.25f;
    public float time;
    public GameObject player;
    public GameObject Weapon;


    public void start ()
    {
    player = this.transform.gameObject;
    }


    public void Update ()
    {
    if (isLocalPlayer)
    {
    if (time> 0)
    time - = Time.deltaTime;
    if (anim == null)
    anim = transform.GetComponent <Animator> ();
    Weapon = GameObject.FindWithTag ("Assembled Weapon");
    if (Weapon == null) return;
    if (Weapon.name == "M4")
    {
    cameraArma = cameraM4;
    activateCameraM4 ();
    }
    if (Arma.name == "Beretta92")
    {
    cameraArma = cameraBeretta92;
    activateBeretta92Cam ();
    }
    if (Arma.name == "Crossbow")
    {
    cameraArma = cameraBayesta;
    activateBayestaCamera ();
    }
    if (Input.GetMouseButton (1))
    {
    if (zoom == true) return;
    CmdZoomTrue ();
    }
    else
    {
    CmdZoomFalse ();
    anim.SetBool ("Zoom", false);
    zoom = false;
    }
    if (Input.GetMouseButton (0))
    {
    anim.SetBool ("Left Mouse", true);
    }
    else anim.SetBool ("Left Mouse", false);
    }

    }


    [Command]
    void CmdZoomTrue ()
    {
    anim.SetBool ("Zoom", true);
    zoom = true;
    }
    [Command]
    void CmdZoomFalse ()
    {
    anim.SetBool ("Zoom", false);
    zoom = false;
    }


    public void activateCameraBeretta92 ()
    {
    if (isLocalPlayer)
    {
    cameraBayesta.enabled = false;
    cameraM4.enabled = false;
    cameraBeretta92.enabled = false;

    if (zoom == true)
    {
    timer ();
    }
    else
    {
    cameraArma.enabled = false;
    time = Scheduled time;
    }
    }
    }


    public void activateCameraM4 ()
    {
    cameraBayesta.enabled = false;
    cameraM4.enabled = false;
    cameraBeretta92.enabled = false;
    if (zoom == true)
    {
    timer ();
    }
    else
    {
    cameraArma.enabled = false;
    time = Scheduled time;
    }
    }


    public void activateBayestaCamera ()
    {
    cameraBayesta.enabled = false;
    cameraM4.enabled = false;
    cameraBeretta92.enabled = false;
    if (zoom == true)
    {
    timer ();
    }
    else
    {
    cameraArma.enabled = false;
    time = Scheduled time;
    }
    }


    public void timer ()
    {
    if (time <= 0)
    {
    cameraArma.enabled = true;
    time = 0;
    }
    }
    }

    -----------------------------------------------------------------------------------------------------------------------

    From DeepL Translate

    Good morning. I have a synchronization problem with the clients.

    The server shows the animation of the clients, but the clients do not see the animation of the other clients nor their own. It only happens with the animation associated with the bool ("zoom").

    I need help, thanks.

    //////////////////////////////////////////////////// //////////////

    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    using Mirror;

    public class ActivateMirrorWeapon: NetworkBehaviour
    {
    Public camera cameraArm;
    public camera cameraM4;
    Public camera camera cameraBeretta92;
    public camera camera cameraBayesta;
    { public animator animator;
    [SyncVar] public bool zoom = false;
    public float timeProgrammedTime = 0.25f;
    public float time;
    public GameObject player;
    public GameObject Arma public;


    public empty start ()
    {
    player = this.transform.gameObject;
    }


    public void Update()
    {
    if (isLocalPlayer)
    {
    if (time > 0)
    time -= Time.deltaTime;
    if (anim == null)
    anim = transform.GetComponent<Animator>();
    Weapon = GameObject.FindWithTag("MountedWeapon");
    if (Arma == null) return;
    if (Arma.name == "M4")
    {
    cameraWeapon = cameraM4;
    activateCameraM4();
    }
    if (Weapon.name == "Beretta92")
    {
    cameraArm = cameraBeretta92;
    activateCameraBeretta92();
    }
    if (Arma.name == "Crossbow")
    {
    cameraArm = cameraBayesta;
    activateCameraBayesta();
    }
    if (Input.GetMouseButton(1))
    {
    if (zoom == true) return;
    CmdZoomTrue();
    }
    else
    {
    CmdZoomFalse();
    anim.SetBool("Zoom", false);
    zoom = false;
    }
    if (Input.GetMouseButton(0))
    {
    anim.SetBool("Left Mouse", true);
    }
    else anim.SetBool("Left Mouse", false);
    }

    }


    [Command]
    void CmdZoomTrue()
    {
    anim.SetBool("Zoom", true);
    zoom = true;
    }
    [Command]
    void CmdZoomFalse()
    {
    anim.SetBool("Zoom", false);
    zoom = false;
    }


    public void activateCameraBeretta92().
    {
    if (isLocalPlayer)
    {
    cameraBayesta.enabled = false;
    cameraM4.enabled = false;
    cameraBeretta92.enabled = false;

    if (zoom == true)
    {
    timer();
    }
    else
    {
    cameraArm.enabled = false;
    time = timeProgrammed time;
    }
    }
    }


    public void activateCameraM4()
    {
    cameraBayesta.enabled = false;
    cameraM4.enabled = false;
    cameraBeretta92.enabled = false;
    if (zoom == true)
    {
    timer();
    }
    else
    {
    cameraArm.enabled = false;
    time = timeProgrammed time;
    }
    }


    public void activateCameraBayesta().
    {
    cameraBayesta.enabled = false;
    cameraM4.enabled = false;
    cameraBeretta92.enabled = false;
    if (zoom == true)
    {
    timer();
    }
    else
    {
    cameraArm.enabled = false;
    time = timeProgrammed time;
    }
    }


    public void timer()
    {
    if (time <= 0)
    {
    cameraArm.enabled = true;
    time = 0;
    }
    }
    }

    Translated with www.DeepL.com/Translator (free version)
     
    Last edited: Jul 30, 2021
  29. Razmot

    Razmot

    Joined:
    Apr 27, 2013
    Posts:
    323
    Hi there,

    I'm trying to use my own voxel cubic terrain with usurvival :

    - do you have any client-server architecture tips to share ?
    - maybe you would be open to sharing your old deprecated voxl package (just to look at the sources) ?

    What I wonder is how to efficiently send the current "voxel terrain" state to clients when they connect :

    A. generate procedural terrain on server, send each and all generated voxel chunk (in my specific case, a stream of 4096 bytes for each voxel chunk)
    or B. generate on client + server + server keeps track and sends the delta of user modified voxels

    and then for implementation, messaging, rpc, directly with network writers ?
     
  30. iSleepzZz

    iSleepzZz

    Joined:
    Dec 23, 2012
    Posts:
    184
    I'm not an expert by any means just wanted to give my $0.02 here.
    I've never used voxels but I can totally see how the network bandwidth could get a lot really quick since there is most likely constant change on the terrain haha
    However, if you algorithm for the generation is exactly repeatable with some sort of "seed" system then I would recommend to do as much generation all client-sided and have the server only send differences (deltas).
     
unityunity