Birds fly. Sun shines. And brother? Brutes shoot people.

GameType in *.ini [Solved] Replication help need [PLZ]

For questions and discussion about UnrealEd, UnrealScript, and other aspects of Unreal Engine design.

Moderators: Semfry, ividyon

User avatar UArchitect
Skaarj Lord Skaarj Lord
Posts: 182
Joined: 18 Nov 2007, 21:22

Subject: Re: GameType in *.ini [Solved] Replication help need [PLZ]

Post Posted: 12 Apr 2011, 17:45

its hard to tell just by looking
start logging values on the client and the server so you can compare side by side to see where the differences lie
if theres visible jerkyness" on the client then you can probably find out where error is being introduced by doing alot of logging

Z-enzyme
White Tusk White Tusk
Posts: 2136
Joined: 13 Nov 2007, 20:01

Subject: Re: GameType in *.ini [Solved] Replication help need [PLZ]

Post Posted: 12 Apr 2011, 18:36

I'll try then. Thanks.

User avatar Core
Skaarj Assassin Skaarj Assassin
Posts: 106
Joined: 15 Mar 2010, 17:16
Location: ../System/
Contact:

Subject: Re: GameType in *.ini [Solved] Replication help need [PLZ]

Post Posted: 14 Apr 2011, 01:23

It's not clear to me what you mean with "Server Move - No glitch" and "client move - (Rotation.Roll jumps)". Works as listen server but not as client on a dedicated server?

PlayerPawn coding can indeed be complex, there could be many reasons why something doesn't work the way intended.

From what I remember working on a custom playerpawn, the movement code in playerwalking state roughly looks something like this (UT):

Code: Select all

//Main tick event, called through native code (on client/stand alone/listenserver host)
playertick
   //If bUpdatePosition
   ->Clientupdateposition //called when server wants us to correct our position because of lag/significant misprediction..
      -->MoveAutonomous
         --->ProcessMove
   //Normal situation
   ->PlayerMove
      -->UpdateRotation
         //Role < authority (client) - then save this move and replicate it
         --->ReplicateMove //Replicate this client's desired movement to the server (executed on client)
            ---->ProcessMove //simulate the movement locally (client)
            ---->ServerMove //Send movement to Server (executed on server)
               ----->clientadjustposition //Send to client, if accumulated a noticeable positional error (executed on client)

         //Role == authority (standalone / listenServer host)
         --->ProcessMove


The other playerpawns you see in your view don't execute any state code on your end, just on their end and on the server. On your end they remain in InvalidState, eventually executing global simulated functions/events, and moving through a combination of replicated variables, native physics updates and animation notifications.

Have a look at the updaterotation function mentioned above. It could be that your roll value is adjusted in that function. Also check for other places where setrotation is called.

Unlike pitch & yaw, the roll component of a PPawn's rotation is compressed to a byte and sent to the server that way, so the precision drops from 65536 to 256 units per 360°. But that shouldn't affect your own local rotation, just the ones of the other players in your view. It could also be that other code in the playerpawn class or native physicscode is adjusting the rotation, depending on the PHYS_ mode you use.


Though less likely related, if the player's prediction differs too much from the serverside position (accumulated error), the server will force the client to update its position/rotation, possibly discarding & replaying some saved moves in rapid succession, causing some "jerkiness" (see clientadjustpos & clientupdatepos).

Keep an eye on the replication conditions of the variables you use to see when and to who they are replicated.

These are just a few tips for what they're worth, could save you some troubleshooting. I'd particularly watch for that throttle variable you have there. Is it being modified on the server? On the client? On both? and check for conflicting rotation code. Sometimes you'll just have to log the crap out of things to pinpoint the problem.

You may want to check the TVPlayer class in olextras.u, to see how the integrated ONP jet's roll is dealt with, and the TVVehicle class in that package contains alot of useful functions either. I also remember seeing alot of vehicle code & even hovercraft code (probably never used) in spatialfear's SFVehicle.u, may also contain useful vehicle related functions.

also note that it's possible to create a seperate state and have that as your ppawn's playerrestartstate, instead of modifying playerwalking.


It would be great to see this sorted out. That concept and the vids you showed are pretty cool. Perhaps ask on beyondunreal too if you get stuck, there are some experienced users out there.

Z-enzyme
White Tusk White Tusk
Posts: 2136
Joined: 13 Nov 2007, 20:01

Subject: Re: GameType in *.ini [Solved] Replication help need [PLZ]

Post Posted: 15 Apr 2011, 18:21

Uaa, thanks a lot Core.
As it comes to the roll rotation I fixed that by removing ALL of the roll rotation code from the ppawns script and just changing the rotationrate.roll in the playepawn's properties. so it uses a native rotation and looks pretty good.
Now what I don't get, how should I know that a variable/functio/state is executed on the playerside or serverside? Basically it should be simualted on the client then sent to the server and executed there.

I feel like being in a black hole searching for a power switch without a flashlight as it comes to replication.

One more thing. which actors are updated first? I mean, playerpawn's spawning an actor and traces it down as a ground distance floor. then it adjusts its velocity to the position of this node. What I've noticed is that the node 'stays behind' when the player is moving and thus the ppawn adjusts it's position to node's old position. In other words, the node is always one tick behind. should the node be before the playerpawn in the actor list or should it have it's own tick (which would be a waste of powah and net bandwich) or th function updating the node should be called after playerpawns position update (which I feel totally unlogical)?

Again, writing on my n900, sorry for any type-(f)oes...

User avatar UArchitect
Skaarj Lord Skaarj Lord
Posts: 182
Joined: 18 Nov 2007, 21:22

Subject: Re: GameType in *.ini [Solved] Replication help need [PLZ]

Post Posted: 16 Apr 2011, 11:19

actors are ticked in order of their creation, so if A spawns B, a is ticked, followed by B
if you have a tick function in A that tells B to set its rotation and location to A's rotation and location, it will always be one tick behind and created a slight "dragging", but if you put the tick function in B instead, it will be perfectly precise without the 1-tick delay

as for replication, it can be overwhelming at first but theres a few simple rules (and a few not-so-simple rules)

first you need to get to grips with authorities, the authoritive machine is usually the machine that spawned an actor
if you spawn an actor server-side (like a projectile) the server has authority, so the actors role is role_authority on the server, and its remoterole is whatever you set in the default properties
if you spawn an actor on the client then the client has authority instead

if a machine has authority over an actor it can execute any functions and states regardless of if they are simulated or not
if a machine does not have authority over an actor it can only execute things based on the remoterole
if remoterole==simulatedproxy then non-authoritive machines can execute simulated code

i really suck at explaining things though so maybe core can clean up after me :P......or not
if you are really serious about getting into and understanding replication (its worth it) seriously read all of these:

http://wiki.beyondunreal.com/Legacy:Int ... eplication
http://wiki.beyondunreal.com/Legacy:Replication
http://wiki.beyondunreal.com/Legacy:Rep ... bfuscation

http://wiki.beyondunreal.com/Legacy:Relevance
http://wiki.beyondunreal.com/Legacy:Role
http://wiki.beyondunreal.com/Legacy:NetMode

http://wiki.beyondunreal.com/Legacy:Simulated_Function
http://wiki.beyondunreal.com/Legacy:Replicated_Function

and last but not least, just keep experimenting!

User avatar Core
Skaarj Assassin Skaarj Assassin
Posts: 106
Joined: 15 Mar 2010, 17:16
Location: ../System/
Contact:

Subject: Re: GameType in *.ini [Solved] Replication help need [PLZ]

Post Posted: 20 Apr 2011, 18:25

The above links contain most things you'd want to know about replication. If you have time, I recommand you to also read this:
http://unreal.epicgames.com/Network.htm

There's a shitload of replication information on the public UDN articles also and eventhough they're mainly for UE2 & UE3, a big part of it can be used for UE1 as well.

I'm thinking of writing an introductory tutorial/summary one of these days to discuss variable/function replication & code execution in a network game (UT) from a more practical point of view.

As for the tick thing, either your framerate was rather low or you must have very good eyes to notice the difference withing a single frame or between two frames lol, at least if that happened in a standalone game. If it's a replicated actor in a network game, it could also be the difference between that actor's replicated location, and the clientside predicted location of your PlayerPawn (think ping latency). Though everything depends on how & where you update that actor's location taking into account all the replication related stuff. Here's a tut that explains some of the variables that can affect the tickrate in an online game: http://wiki.unrealadmin.org/Netspeed_Tutorial_(UT)

Is it not possible to achieve what you want by tracing from the playerpawn itsself instead?

User avatar UArchitect
Skaarj Lord Skaarj Lord
Posts: 182
Joined: 18 Nov 2007, 21:22

Subject: Re: GameType in *.ini [Solved] Replication help need [PLZ]

Post Posted: 24 Apr 2011, 00:36

1-tick lag is definitely noticable even at normal/high framerates, especially if the parent of the attached objectis moving at a decent pace, the best solution i know for this is to use phys_trailer instead of setlocation/tick or to put the setlocation code in the slave actor instead

like core, i am also wondering why you have a second actor rather than just doing your traces or whatnot from the playerpawn

Z-enzyme
White Tusk White Tusk
Posts: 2136
Joined: 13 Nov 2007, 20:01

Subject: Re: GameType in *.ini [Solved] Replication help need [PLZ]

Post Posted: 24 Apr 2011, 12:09

UArchitect wrote:like core, i am also wondering why you have a second actor rather than just doing your traces or whatnot from the playerpawn

...
SHIT! *facepalm*

I made a second actor as a result of Trace(blabla) (I traced it's location then set its location and then did accelerates do the location of the second actor) and now It hit me that I don't have to make a referance to an actor but to the Trace(blabla) function itself. LOL, now you see how stupid scripter I am.

Previous

Who is online

Users browsing this forum: No registered users and 31 guests

Copyright © 2001-2024 UnrealSP.org

Powered by phpBB® Forum Software © phpBB Limited