Announcement

Collapse
No announcement yet.

Replicating physics-simulated objects

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Replicating physics-simulated objects

    Hello,

    I am fairly new to unreal, and I am in the process of creating a game, similar to that of the Counter Strike Source mod, Smash. Here is a gameplay video to show what I am talking about:

    https://www.youtube.com/watch?v=OrIWFfg73uo

    I have achieved everything I am required, physics objects, a projectile spawner that will shoot boulders upwards at a random horizontal velocity and fixed vertical velocity, third person template converted to first person with sprinting and such.
    However, I am unable to figiure out how to replicate the physics of the boulder, and to replicate all the physics objects (platforms and such). How can I go about this?

    Thanks in advance

    #2
    There is no simple method for this. Replicating physics will not work ever for gameplay.
    With physics thing is that even 1ms delay in when event started results in different outcome.
    For eg that second player running and failing, if he was there 1ms earlier he would rotate platform in different direction, thus falling somewhere else.

    With lots of code (you go here against what unreal assumes) you probably can cheat the system.
    - create all physic objects server side only.
    - create replicated copies of server object, do replication in your code (ie. get location and rotation of object).
    - server should read on tick rotation and location of physics object then replicate it to client.
    - on clients you disable physics objects, and put their non physics replicated copies in same spots, then apply rotation and location.

    So first make 2 boxes, one red one blue.
    Place red box on server. make server send (replicate that box transformation) to clients.
    Then make clients replace red box with their blue replicated copies.
    Best for this would be first person template it has those physics boxes you can shoot.
    If you cannot make that hiding and switching boxes then you will not create rest.

    I tried several times to go against what unreal wants and every time i did it, in another place some other problem surfaced caused by my unusual implementation of first thing.
    So be prepared for pain down the road. And better make whole physics part of gameplay before you go further.

    Comment


      #3
      Originally posted by Nawrot View Post
      There is no simple method for this. Replicating physics will not work ever for gameplay.
      What about now?

      Comment


        #4
        Nothing has changed. They still have no plans to do physics replication. Its something that is complicated with how UE4 is setup.

        Comment


          #5
          Originally posted by CowboyWoody37 View Post
          What about now?
          I think it will be never done... you can replicate few bouncing projectiles... but replicating fot example destructible mesh with 200 chunks ... its like DDOS...
          For what you need to replicate physics?
          I wanted to have in my game physical destructible chunks with collision... but i ended with no collision chunks and its fine...

          Comment


            #6
            The trick is not replicating physics, its getting it to sync nicely on the client.
            This requires some form of physics prediction.
            Rule#21: Be polite, be professional, but have a plan to kill everyone you meet.

            Comment

            Working...
            X