Scoreboard time replication

Discussions about Coding and Scripting
Post Reply
iloveut99
Skilled
Posts: 231
Joined: Mon Aug 16, 2010 10:25 pm

Scoreboard time replication

Post by iloveut99 »

Hello, I am trying restore the RemainingTime in mid of a game:

Code: Select all

RemainingTime=TimeLimit*60;
It works, but the RemainingTime in scoreboard is only updated after some time, there's anything that I can do to the replication take immediately effect?
User avatar
Feralidragon
Godlike
Posts: 5493
Joined: Wed Feb 27, 2008 6:24 pm
Personal rank: Work In Progress
Location: Liandri

Re: Scoreboard time replication

Post by Feralidragon »

Yes, there's this:
NetUpdateFrequency=4.000000

Scoreboards come from Info, which have NetUpdateFrequency to 4, which means that any changes to variables in the server will be only replicated each 0.25 seconds (1/4.0). If you want it to update faster, higher that value, but at a point it's no use to higher more since the delay will also be affected by your ping.
iloveut99
Skilled
Posts: 231
Joined: Mon Aug 16, 2010 10:25 pm

Re: Scoreboard time replication

Post by iloveut99 »

Hm thanks. I have tried:

Code: Select all

NetPlayer.PlayerReplicationInfo.NetUpdateFrequency=100;
Where NetPlayer is a TournamentPlayer.

It stills only update the time in scoreboard after a minute or so. I have 10 ping. :s
User avatar
Feralidragon
Godlike
Posts: 5493
Joined: Wed Feb 27, 2008 6:24 pm
Personal rank: Work In Progress
Location: Liandri

Re: Scoreboard time replication

Post by Feralidragon »

Which classes are interacting in that process?

NetUpdateFrequency affects each actor seperatelly:
- Actor A with a NetUpdateFrequency=100
- Actor B with a NetUpdateFrequency=4

Everytime you read A, you know it's been updated in the last 1/100 of a second, while when you read Actor B, the update occurred the last 1/4 of a second.
But if you read B with A, A will be only updated when B is updated, so during 1/4 seconds A may attempt to send data each 1/100 of a second, but the actual info will be only update each 1/4 seconds.

In resume, check where you're reading that info and which actors are interacting regarding that, and the one with the lowest NetUpdateFrequency is affecting that (of course, there may be some of them).

Of course, this whole NetUpdateFrequency thing is only relevant client-side, server-side everything works like standalone (except a few things filtered with Level.NetMode).

EDIT:
iloveut99 wrote: It stills only update the time in scoreboard after a minute or so. I have 10 ping. :s
I guess you mean "after a second" and not "after a minute". I assume you are seeing the seconds doing something like this:
9, 8, 6, 4, 3, 1..
I think since it should be a constant time dilation, you shouldn't even worry with NetUpdateFrequency, just send the value once and let the client handle the count down.
iloveut99
Skilled
Posts: 231
Joined: Mon Aug 16, 2010 10:25 pm

Re: Scoreboard time replication

Post by iloveut99 »

No no, I mean 1 minute.

I'm updating the remaining time in lms scoreboard:

Code: Select all

function RestorePlayerStuff()
{
local TournamentPlayer NetPlayer;

		RemainingTime=TimeLimit*60; //Restore Time Left ,*60 is because the time limit is in minutes, while remainingTime is in seconds, so we must convert the mintutes to seconds. :)
		ElapsedTime=0; 
		foreach Level.AllActors(Class'TournamentPlayer',NetPlayer)
			NetPlayer.PlayerReplicationInfo.NetUpdateFrequency=100;
}
User avatar
Feralidragon
Godlike
Posts: 5493
Joined: Wed Feb 27, 2008 6:24 pm
Personal rank: Work In Progress
Location: Liandri

Re: Scoreboard time replication

Post by Feralidragon »

Does this happen in standalone matches too, or just in online play (works fine in standalone)?
iloveut99
Skilled
Posts: 231
Joined: Mon Aug 16, 2010 10:25 pm

Re: Scoreboard time replication

Post by iloveut99 »

Standalone is in single player match? I was testing in dedicated online remote server and dedicated local server.
User avatar
Sp0ngeb0b
Adept
Posts: 376
Joined: Wed Feb 13, 2008 9:16 pm
Location: Cologne
Contact:

Re: Scoreboard time replication

Post by Sp0ngeb0b »

Testing offline means not dedicated. Just start a practice session with your mod as mutator loaded.
Website, Forum & UTStats

Image
******************************************************************************
Nexgen Server Controller || My plugins & mods on GitHub
******************************************************************************
User avatar
Feralidragon
Godlike
Posts: 5493
Joined: Wed Feb 27, 2008 6:24 pm
Personal rank: Work In Progress
Location: Liandri

Re: Scoreboard time replication

Post by Feralidragon »

Indeed, I meant practise session (I generally say standalone because of Level.NetMode which has 4 netmodes, one of them is NM_StandAlone which means offline play, I guess I just have been coding too much latelly :ironic2: ).

I say this because if the issue keeps on practise sessions, then it isn't a replication problem, I am starting to believe that you're taking info from a variable which is only updated each minute and not each second, because even in online games it's unlikelly there's some actor making updates per minute (the minimal I saw was 1.0, which means 1 second, from actual objects which generally just send info to the client once or no info at all).
iloveut99
Skilled
Posts: 231
Joined: Mon Aug 16, 2010 10:25 pm

Re: Scoreboard time replication

Post by iloveut99 »

Hi! I tried in practice section (I lost some time because I needed to edit the script) and it works immediately there.
User avatar
Feralidragon
Godlike
Posts: 5493
Joined: Wed Feb 27, 2008 6:24 pm
Personal rank: Work In Progress
Location: Liandri

Re: Scoreboard time replication

Post by Feralidragon »

Perhaps only 1 of your variables is being replicated to the client, while the other isn't, and it's the minutes variable which is being replicated, while the seconds variable isn't, thus taking a whole minute to update the client...
Again, try to update that from client only (give the remaining time, and update it from there and not from the server itself regarding the seconds).
iloveut99
Skilled
Posts: 231
Joined: Mon Aug 16, 2010 10:25 pm

Re: Scoreboard time replication

Post by iloveut99 »

Hm how can I update remaining time directly in client? Sorry, I usually only work with serverside stuff.
User avatar
Feralidragon
Godlike
Posts: 5493
Joined: Wed Feb 27, 2008 6:24 pm
Personal rank: Work In Progress
Location: Liandri

Re: Scoreboard time replication

Post by Feralidragon »

Wait... I know what your problem is (only now I took more time to see this problem a bit deeper, I thought you were using another class as well). I wasn't quite sure where you were applying that script (my fault as well for not asking), now I am pretty sure you're doing your own class of GameReplicationInfo (I thought this was in GameType rofl).

The original GameReplicationInfo has this:

Code: Select all

replication
{
    reliable if ( Role == ROLE_Authority )
        RemainingMinute, bStopCountDown, GameEndedComments,
        NumPlayers;

    reliable if ( bNetInitial && (Role==ROLE_Authority) )
        GameName, GameClass, bTeamGame, ServerName, ShortName, AdminName,
        AdminEmail, Region, MOTDLine1, MOTDLine2, 
        MOTDLine3, MOTDLine4,RemainingTime, ElapsedTime;
}
So what the above means? Simple: RemainingMinute will be ALWAYS replicated to the client when a change occurs, however the RemainingTime and ElapsedTime will be only replicated to the client ONCE (bNetInitial). That's why the time is only updated once per minute, since only the RemainingMinute is being replicated to client when there's a change (when the minutes are updated, once per minute of course).

In order for that to work in your script, RemainingTime would have to be also in the "reliable if ( Role == ROLE_Authority )" block, however you can't redefine its replication in subclasses (replication of variables is defined only once per main class). So the only way is creating a new variable, let's say "RealRemainingTime", and replace all your "RemainingTime" references from the parent class in your script by "RealRemainingTime".

Also, you will have to place "RealRemainingTime" in a replication block, so it will look like this:

Code: Select all

replication
{
    reliable if ( Role == ROLE_Authority )
        RealRemainingTime;
}
After that done, everything should work "exactly" as expected online.
iloveut99
Skilled
Posts: 231
Joined: Mon Aug 16, 2010 10:25 pm

Re: Scoreboard time replication

Post by iloveut99 »

Seems I got it thanks. I will touch it soon I hope. :tu:
iloveut99
Skilled
Posts: 231
Joined: Mon Aug 16, 2010 10:25 pm

Re: Scoreboard time replication

Post by iloveut99 »

Feralidragon wrote:I thought you were using another class as well). I wasn't quite sure where you were applying that script (my fault as well for not asking), now I am pretty sure you're doing your own class of GameReplicationInfo
I was applying it indeed in a custom gametype subclass of DeathMatchPlus. Do I need to create a new GameReplicationInfo class (and update players pawns to use this one), or is it not necessary?
Post Reply