Main

Forums

Wiki

Downloads

Tutorials

Walkthrough

Unreal-netiquette

Links

Submit-News

Oldunreal's hosted:
UnrealReference

Usermaps

Real-CTF

Donate for Oldunreal:

Oldunreal Donation
Oldunreallogo
  Welcome, Guest. Please Login or Register
 
  HomeHelpSearchLoginRegister  
 
 
Player velocity replication (Read 482 times)
Age
God Member
*****
Offline



Posts: 843
Gender: male
Player velocity replication
03/02/12 at 12:27:22
 
When I try to add velocity to player, it always gives damn lag spikes online. How I get rid of them?

Best I could do so far:
http://pastebin.com/J7FV3eR7
Back to top
« Last Edit: 03/02/12 at 12:28:11 by Age »  
 
IP Logged
 
[UDHQ] Pcube
Ex Member


Re: Player velocity replication
Reply #1 - 03/05/12 at 01:03:09
 
Code:
function Tick(float DeltaTime)
{      
        DeltaTime = FMin(DeltaTime, 0.014);
        SimTick(DeltaTime);
}

simulated function SimTick(float DeltaTime)
{ 



1.) Calling a simulated function from a non-simulated function will never work on the client. Clients need a simulated function event as an entry point for simulation.
2.) Why not just make Tick itself simulated?
3.) Why are you doing FMIN?
4.) You are not calling super.tick. This causes strange behavior online sometimes.
Back to top
« Last Edit: 03/05/12 at 01:03:41 by N/A »  
 
IP Logged
 
Age
God Member
*****
Offline



Posts: 843
Gender: male
Re: Player velocity replication
Reply #2 - 03/05/12 at 11:49:16
 
Quote:
1.) Calling a simulated function from a non-simulated function will never work on the client. Clients need a simulated function event as an entry point for simulation.
2.) Why not just make Tick itself simulated?
3.) Why are you doing FMIN?
4.) You are not calling super.tick. This causes strange behavior online sometimes.

1. I see.
2. Changed.
3. It's used to limit velocity if FPS got around 1. I just forgot to use it.
Code:
NewVelocity = RepOwner.Velocity + vector(RepOwner.ViewRotation)*1000*DeltaTime; // Move forward. 


4. Added.

Anyway I still see no difference:


code: http://pastebin.com/EjWXNUT3
Back to top
« Last Edit: 03/05/12 at 11:49:34 by Age »  
 
IP Logged
 
.:..:
Developer Team
Offline



Posts: 1239
Finland
Gender: male
Re: Player velocity replication
Reply #3 - 03/06/12 at 17:16:20
 
To put it simple, this is all you need:
Code:
class VelocityTest extends Inventory;

simulated function Tick(float DeltaTime)
{
	Super.Tick(deltatime);
	if( Owner!=None && (Level.NetMode!=NM_Client || (PlayerPawn(Owner)!=None && Viewport(PlayerPawn(Owner).Player)!=None)) )
		MovePlayer(DeltaTime);
}
simulated function MovePlayer(float DeltaTime)
{
	if( Owner.Physics != Phys_Flying )
		Owner.SetPhysics(Phys_Flying);
	Owner.Velocity = Owner.Velocity + vector(Pawn(Owner).ViewRotation)*1000; // Move forward.
}
function BecomeItem()
{
	bHidden       = true;
	bCarriedItem  = true;
	NetPriority   = 2;
	SetCollision( false, false, false );
	SetPhysics(PHYS_None);
	SetTimer(0.0,False);
	AmbientGlow = 0;
}

defaultproperties
{
	RemoteRole=ROLE_SimulatedProxy
} 

Back to top
 
.:..: 345236034 mhulden  
IP Logged
 
Bleeder91[NL]
God Member
*****
Offline


Personal Text:

Posts: 780
Location, Location, Location.
Gender: male
Re: Player velocity replication
Reply #4 - 03/06/12 at 17:20:04
 
Just throwing this out there, simpler is
Pawn(Owner).AddVelocity(vector(Pawn(Owner).ViewRotation)*1000*DeltaTime);
? Titan script :3
Back to top
« Last Edit: 03/06/12 at 17:21:27 by Bleeder91[NL] »  
WWW WWW Bleeder91[NL]  
IP Logged
 
(Moderators: Smirftsch, TCP_Wolf, Smartball, pÍtßűll, DieHard SCWS)