Obi Official Forum
Help Obi Rope Photon Unity Networking2 - Printable Version

+- Obi Official Forum (https://obi.virtualmethodstudio.com/forum)
+-- Forum: Obi Users Category (https://obi.virtualmethodstudio.com/forum/forum-1.html)
+--- Forum: General (https://obi.virtualmethodstudio.com/forum/forum-5.html)
+--- Thread: Help Obi Rope Photon Unity Networking2 (/thread-2142.html)

Pages: 1 2


Obi Rope Photon Unity Networking2 - ammannagari - 05-04-2020

Hi,
I am using ObiRope in my project where the movement of the obi rope needs to synchronize between two clients and the server. We are using Photon unity networking for networking. 
I am able to see the rope in the server(laptop) but unable to see the rope in the phones. I have added the observed component to both ObiSolver and ObiRope.

Please let me know if I am doing anything wrong. 

Looking for some help with this.


RE: Obi Rope Photon Unity Networking2 - josemendez - 05-04-2020

(05-04-2020, 12:08 AM)ammannagari Wrote: Hi,
I am using ObiRope in my project where the movement of the obi rope needs to synchronize between two clients and the server. We are using Photon unity networking for networking. 
I am able to see the rope in the server(laptop) but unable to see the rope in the phones. I have added the observed component to both ObiSolver and ObiRope.

Please let me know if I am doing anything wrong. 

Looking for some help with this.

Photon won't automagically synchronize rope physics, as it knows nothing about it. You will need to serialize and pass particle data back and forth, probably implementing PUN's IPunObservable interface. This is something that should be asked to PUN's developers, tough.


RE: Obi Rope Photon Unity Networking2 - Navvv - 19-11-2020

(05-04-2020, 01:48 PM)josemendez Wrote: Photon won't automagically synchronize rope physics, as it knows nothing about it. You will need to serialize and pass particle data back and forth, probably implementing PUN's IPunObservable interface. This is something that should be asked to PUN's developers, tough.

How performant would this be for mobile? I am considering purchasing the asset but only if it is performant over the network for my multiplayer mobile game.


RE: Obi Rope Photon Unity Networking2 - josemendez - 20-11-2020

(19-11-2020, 08:41 PM)Navvv Wrote: How performant would this be for mobile? I am considering purchasing the asset but only if it is performant over the network for my multiplayer mobile game.

Entirely depends on what you want to do with it. Generally speaking, Obi is very performant on all platforms as it is fully multithreaded and makes extensive use of vectorization.


How performant it is over the network depends on how you implement networking, not on the physics engine. Obi does not include any networking features as it’s just a physics engine, not a networking layer.


With more info about your particular use case, I can get into further detail. cheers!


RE: Obi Rope Photon Unity Networking2 - Navvv - 21-11-2020

(20-11-2020, 05:47 PM)josemendez Wrote: Entirely depends on what you want to do with it. Generally speaking, Obi is very performant on all platforms as it is fully multithreaded and makes extensive use of vectorization.


How performant it is over the network depends on how you implement networking, not on the physics engine. Obi does not include any networking features as it’s just a physics engine, not a networking layer.


With more info about your particular use case, I can get into further detail. cheers!

Ah ok, thanks for the info! My use case is fairly simple I think. I just have a ball attached to a singular rope which 2 players hit to each other back and forth. Do you think it would be possible to hit 60fps on most mobile devices for something like this (disregarding all other variables of course)?


RE: Obi Rope Photon Unity Networking2 - josemendez - 21-11-2020

(21-11-2020, 12:07 AM)Navvv Wrote: Ah ok, thanks for the info! My use case is fairly simple I think. I just have a ball attached to a singular rope which 2 players hit to each other back and forth. Do you think it would be possible to hit 60fps on most mobile devices for something like this (disregarding all other variables of course)?

Yes, this will hit more than 60 fps on most mobile devices.


RE: Obi Rope Photon Unity Networking2 - Navvv - 21-11-2020

(21-11-2020, 09:06 PM)josemendez Wrote: Yes, this will hit more than 60 fps on most mobile devices.

Fantastic, purchasing soon!


RE: Obi Rope Photon Unity Networking2 - TheMunk - 10-08-2021

Hi there, quick question;
How does one disable simulation on a client but retain particles? I.e. read particle positions from the networked host but still do the rendering using Obi. Disabling the updater removes any particles. I found that disabling all constraints and gravity in the solver and particle attachments on the rope was the only way. Am I missing something?


RE: Obi Rope Photon Unity Networking2 - josemendez - 10-08-2021

(10-08-2021, 09:09 AM)TheMunk Wrote: Hi there, quick question;
How does one disable simulation on a client but retain particles? I.e. read particle positions from the networked host but still do the rendering using Obi. Disabling the updater removes any particles. I found that disabling all constraints and gravity in the solver and particle attachments on the rope was the only way. Am I missing something?

Usually, there's no point in updating rope/cloth/softbody/fluid meshes and rendering particles if the simulation is not running: the current mesh -in whatever state it was left after the last update- is used for rendering.

All updater components update and render in sync. However the ObiUpdater class is meant to be extended in any way you need. You can easily create your own Updater component that can independently perform solving and update rendering. As an example, here's a modified ObiFixedUpdater with a "solve" toggle that lets you disable simulation only, but keeps particle rendering going:

Code:
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System;

namespace Obi
{
    /// <summary>
    /// Updater class that will perform simulation during FixedUpdate(). This is the most physically correct updater,
    /// and the one to be used in most cases. Also allows to perform substepping, greatly improving convergence.
                 
    [AddComponentMenu("Physics/Obi/Obi Fixed Updater", 801)]
    [ExecuteInEditMode]
    public class ObiFixedUpdater : ObiUpdater
    {
        /// <summary>
        /// Each FixedUpdate() call will be divided into several substeps. Performing more substeps will greatly improve the accuracy/convergence speed of the simulation.
        /// Increasing the amount of substeps is more effective than increasing the amount of constraint iterations.
        /// </summary>
        [Tooltip("Amount of substeps performed per FixedUpdate. Increasing the amount of substeps greatly improves accuracy and convergence speed.")]
        public int substeps = 4;
        public bool solve = true;

        private float accumulatedTime;

        private void OnValidate()
        {
            substeps = Mathf.Max(1, substeps);
        }

        private void Awake()
        {
            accumulatedTime = 0;
        }

        private void OnDisable()
        {
            Physics.autoSimulation = true;
        }

        private void FixedUpdate()
        {
            if (solve)
            {
                ObiProfiler.EnableProfiler();

                BeginStep(Time.fixedDeltaTime);

                float substepDelta = Time.fixedDeltaTime / (float)substeps;

                // Divide the step into multiple smaller substeps:
                for (int i = 0; i < substeps; ++i)
                    Substep(Time.fixedDeltaTime, substepDelta, substeps - i);

                EndStep(substepDelta);

                ObiProfiler.DisableProfiler();

                accumulatedTime -= Time.fixedDeltaTime;
            }
        }

        private void Update()
        {
            ObiProfiler.EnableProfiler();
            Interpolate(Time.fixedDeltaTime, accumulatedTime);
            ObiProfiler.DisableProfiler();

            if (solve)
                accumulatedTime += Time.deltaTime;
        }
    }
}



RE: Obi Rope Photon Unity Networking2 - JungleEd - 17-08-2021

Is there anyone working on adding a network layer to obi rope or obi fluids?

Would moving a particle(synching) during the simulation break the simulation?