For direct access use https://forums.oldunreal.com
It's been quite a while since oldunreal had an overhaul, but we are moving to another server which require some updates and changes. The biggest change is the migration of our old reliable YaBB forum to phpBB. This system expects you to login with your username and old password known from YaBB.
If you experience any problems there is also the usual "password forgotten" function. Don't forget to clear your browser cache!
If you have any further concerns feel free to contact me: Smirftsch@oldunreal.com

Help with replicating random rotations

The section related to UnrealScript and modding. This board is for coders to discuss and exchange experiences or ask questions.
User avatar
gopostal
OldUnreal Member
Posts: 1007
Joined: Thu Jul 31, 2008 9:29 pm

Help with replicating random rotations

Post by gopostal »

First, I feel really dumb. I can't see my problem. My guess is it will take you about 5 seconds to solve, I'm just too close to the code.

My trees spawn falling leaves. It all works fine. Offline the falling leaves spawn correctly and have the proper random rotation as they drop. Online though there is no rotating. They just drop. I cannot figure it out but I know it's something simple I just don't see.

The leaves drop faster if the tree is bigger drawscale. The code:

Code: Select all

class LeafA extends Projectile;

simulated function PostBeginPlay()
{
   local rotator RandRot;
   local float Scaler;

   Super.PostBeginPlay();
   Scaler=Drawscale;

   if ( Role == ROLE_Authority )
   {
      RandRot.Pitch = FRand() * 1400 - 700;
      RandRot.Yaw = FRand() * 1400 - 700;
      RandRot.Roll = FRand() * 1400 - 700;
      Velocity = Velocity >> RandRot;
      RandSpin(50000);
      Acceleration = vect(0,0,-1);

      if ((scaler > 1) && (scaler  2) && (scaler
I don't want to give the end away
but we're all going to die one day
User avatar
Bleeder91[NL]
OldUnreal Member
Posts: 1062
Joined: Sun Oct 04, 2009 7:22 pm

Re: Help with replicating random rotations

Post by Bleeder91[NL] »

You could remove the part with the Role==ROLE_Authority in PostBeginPlay and make it bNetTemporary, since the leaves don't interact with anything, might as well make them client-side. Why not use emitters for the leaves?
Image
User avatar
Masterkent
OldUnreal Member
Posts: 1469
Joined: Fri Apr 05, 2013 12:41 pm

Re: Help with replicating random rotations

Post by Masterkent »

I can't see my problem.
RotationRate is replicated only under specific conditions:

Code: Select all

      unreliable if ( RemoteRole==ROLE_SimulatedProxy && Physics==PHYS_Rotating && bNetInitial )
            bFixedRotationDir, bRotateToDesired, RotationRate, DesiredRotation;
(see replication statements in Engine.Actor; probably, in your case Physics == PHYS_Projectile, hence RotationRate is not replicated) and even when it's replicated, the resulting client-side value may noticeably differ from the original because replication of rotators in general works in a very specific way.

As mentioned above, if your effects do not have to interact with anything server-side, the best solution would be spawning them client-side. A simultaneous replication of a bunch of newly spawned actors may produce lags in network game, so getting rid of unnecessary replications could also lead to smoother gameplay.
Last edited by Masterkent on Sat Feb 16, 2019 7:18 pm, edited 1 time in total.
User avatar
gopostal
OldUnreal Member
Posts: 1007
Joined: Thu Jul 31, 2008 9:29 pm

Re: Help with replicating random rotations

Post by gopostal »

Thanks guys, I'll do that. I had finished my revamp of the trees and just wanted to commit the update to the mod and put it on the server. I had full intentions of moving a bunch of stuff client side and swapping projectiles for emitters but was going to do it all at once a little later.

Instead I'll just pocket this update and continue on with the improvements before I commit it to the server. Appreciate the advice (as always)!
I don't want to give the end away
but we're all going to die one day

Return to “UScript Board”