Help with an online issue

Discussions about Coding and Scripting
Post Reply
User avatar
>@tack!<
Adept
Posts: 338
Joined: Sat Apr 17, 2010 4:51 pm
Personal rank: lol?

Help with an online issue

Post by >@tack!< »

I have a online problem with my sniperbeamFX offline it works perfectly
like this
Image
online though it is kinda fked, you can see that the seperate beams rotate to the HitLocation but they go the wrong way.
Image
My guess is that the vector named MoveAmount is fked or something

Code: Select all

in the sniperclass

simulated function SpawnEffect(vector HitLocation, vector SmokeLocation)
{
	local SniperEffect Smoke;
	local Vector DVector;
	local float NumPoints;
	local rotator SmokeRotation;

	DVector = HitLocation - SmokeLocation;
	NumPoints = VSize(DVector)/32;
	if ( NumPoints < 2.5 )
		return;
	SmokeRotation = rotator(DVector);
	
	Smoke = Spawn(class'VRNSniper.SniperEffect',,,SmokeLocation,SmokeRotation);
	Smoke.MoveAmount = DVector/NumPoints;
	Smoke.NumPuffs = NumPoints - 1;
	if(Affector.IsA('UDamage'))
	Smoke.Texture = Texture'VRNSniper.PlasmaRifle.SniperBeam2';
}

Code: Select all

class SniperEffect expands Effects;

var vector MoveAmount;
var int NumPuffs;
replication
{
	// Things the server should send to the client.
	unreliable if( Role==ROLE_Authority )
		MoveAmount, NumPuffs;
}

simulated function Tick( float DeltaTime )
{
	if ( Level.NetMode  != NM_DedicatedServer )
	{
		ScaleGlow = (Lifespan/Default.Lifespan)*0.6;
		AmbientGlow = ScaleGlow * 210;
	}
}


simulated function PostBeginPlay()
{
	if ( Level.NetMode != NM_DedicatedServer )
		SetTimer(0.005, false);
}

simulated function Timer()
{
	local SniperEffect r;
	
	if (NumPuffs>0)
	{
		r = Spawn(class'VRNSniper.SniperEffect',,,Location+MoveAmount,Rotation);
		r.RemoteRole = ROLE_None;
		r.NumPuffs = NumPuffs -1;
		r.MoveAmount = MoveAmount;
		r.Texture = Texture;
	}
}

Well i think the moveamount is different online cuz they spawn the wrong way, also i saw this
Vectors and Rotators: To improve bandwidth efficiency, Unreal reduces the accuracy of vectors and rotators slightly, a process known as quantizing. The X, Y, Z components of vectors are converted to 16-bit signed integers before being sent, thus any fractional values or values out of the range -32768..32767 are lost. The Pitch, Yaw, Roll components of vectors are converted to bytes, of the form (Pitch8)&255. So, you need to be careful with vectors and rotators. If you absolutely must have full precision, then use int or float variables for the individual components; all other data types are sent with their complete precision.
does this confirm my thoughts?
and can someone help me how i should write the code to
If you absolutely must have full precision, then use int or float variables for the individual components; all other data types are sent with their complete precision.
thx in advance
User avatar
Shadow
Masterful
Posts: 743
Joined: Tue Jan 29, 2008 12:00 am
Personal rank: Mad Carpenter
Location: Germany
Contact:

Re: Help with an online issue

Post by Shadow »

Yes, vectors and rotators are indeed reduced to 16 bit integer accuracy, dunno if it helps but you could write yourself a function that takes each vectors component independently like:

Code: Select all

static final vector function Vect2(float x, float y, float z)
{
    local vector v;

    v.x = x;
    v.y = y;
    v.z = z;

    return v;
}
or you may directly access the vector's components like in the function where you need it, but it could also be that the engine still uses integer accuracy online
Image
User avatar
>@tack!<
Adept
Posts: 338
Joined: Sat Apr 17, 2010 4:51 pm
Personal rank: lol?

Re: Help with an online issue

Post by >@tack!< »

nice the beams are all going to the hitlocation now but their rotation or maybe their startlocation are still fked up, but i think i can fix this now thx :)
User avatar
>@tack!<
Adept
Posts: 338
Joined: Sat Apr 17, 2010 4:51 pm
Personal rank: lol?

Re: Help with an online issue

Post by >@tack!< »

PERFECT i did the same with the rotation and now its just the same as online yayayayayay me gusta :)
User avatar
Shadow
Masterful
Posts: 743
Joined: Tue Jan 29, 2008 12:00 am
Personal rank: Mad Carpenter
Location: Germany
Contact:

Re: Help with an online issue

Post by Shadow »

Pretty nice :D
I wrote that function for the SDK for exact that issue because I already knew vector/rotators have decreased accuracy online... didn't test it so I'm kinda surprised it actually worked^^
Image
User avatar
EvilGrins
Godlike
Posts: 9729
Joined: Thu Jun 30, 2011 8:12 pm
Personal rank: God of Fudge
Location: Palo Alto, CA
Contact:

Re: Help with an online issue

Post by EvilGrins »

This may be a stupid question: Do you see it screwed up like that when you're online on somebody else's server or your own?
http://unreal-games.livejournal.com/
Image
medor wrote:Replace Skaarj with EvilGrins :mrgreen:
Smilies · viewtopic.php?f=8&t=13758
User avatar
>@tack!<
Adept
Posts: 338
Joined: Sat Apr 17, 2010 4:51 pm
Personal rank: lol?

Re: Help with an online issue

Post by >@tack!< »

i simply run a dedicated server and then start another ut.exe to access it
User avatar
>@tack!<
Adept
Posts: 338
Joined: Sat Apr 17, 2010 4:51 pm
Personal rank: lol?

Re: Help with an online issue

Post by >@tack!< »

hmm well it works but i have some issues and i thought hey the pulsegun also uses the same concept as what i use so i checked there and it uses a different method which i will try now

edit: nope pulsegun didnt help but i still fixed EVERYTHING YAY with the individual variables, i just had a problem with the first cyan spriteFX in the screenshots but now it works, making the arena and replacementmutator for it now.
Post Reply