Pawn.DieCount vs. PlayerReplicationInfo.Deaths

Discussions about Coding and Scripting
Post Reply
User avatar
Barbie
Godlike
Posts: 2802
Joined: Fri Sep 25, 2015 9:01 pm
Location: moved without proper hashing

Pawn.DieCount vs. PlayerReplicationInfo.Deaths

Post by Barbie »

Can anyone explain why there are two different variables for the same property? I assume that only PlayerPawns or Bots can die multiple times and therefore it makes senses to count their deaths. But why are there two variables for it?

A search over the full UC source of UT showed that "DieCount" is set in function ScoreKill() of CTFGame and GameInfo and not used anywhere else:

Code: Select all

function ScoreKill(pawn Killer, pawn Other) {
	Other.DieCount++;
	...
PlayerReplicationInfo's "Deaths" is set by function Killed() in GameInfo only:

Code: Select all

function Killed( pawn Killer, pawn Other, name damageType ) {
	...
	Other.PlayerReplicationInfo.Deaths += 1;
and is evaluated in ChallengeHUD, TournamentGameInfo and TournamentScoreBoard.
"Multiple exclamation marks," he went on, shaking his head, "are a sure sign of a diseased mind." --Terry Pratchett
User avatar
sektor2111
Godlike
Posts: 6410
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: Pawn.DieCount vs. PlayerReplicationInfo.Deaths

Post by sektor2111 »

Barbie wrote:Can anyone explain why there are two different variables for the same property?
False...
One refers to data stored into Replication used by players, other one is Pawn related. Replication and Pawn are not the same thing even if they head to the same goal. Not all pawn has ReplicationInfo so it needs to store deaths somewhere, but ReplicationInfo must have a pawn owner. It's about Pawn Player Types and Non Players which is not the same thing.
Of course we have some... goofing around. If pawn non "player" has been killed, it is not supposed to respawn so it's pointless to track "DieCount" for such case.
User avatar
Barbie
Godlike
Posts: 2802
Joined: Fri Sep 25, 2015 9:01 pm
Location: moved without proper hashing

Re: Pawn.DieCount vs. PlayerReplicationInfo.Deaths

Post by Barbie »

Found now the same for Pawn.bIsFemale and PlayerReplicationInfo.bIsFemale. I understand that the PRIs are replicated to all players in order to give them the possibility to evaluate other players or bots properties like score, team, etc. But does code exclusively running on server need the PRIs or can it use the Pawns properties directly? Assumed they are in sync with the PRI data.

Another thought has come into my mind: Was the early version of the Unreal engine able to support network play? If the networking code was added later, then the Pawns properties doubled in PRI might be a legacy issue and could have been kept to keep compatibility.
"Multiple exclamation marks," he went on, shaking his head, "are a sure sign of a diseased mind." --Terry Pratchett
User avatar
sektor2111
Godlike
Posts: 6410
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: Pawn.DieCount vs. PlayerReplicationInfo.Deaths

Post by sektor2111 »

Barbie wrote:Another thought has come into my mind: Was the early version of the Unreal engine able to support network play? If the networking code was added later, then the Pawns properties doubled in PRI might be a legacy issue and could have been kept to keep compatibility.
I think it was - I didn't checked deeper else presence of an IpDrv file would make no sense. I was playing NetGames from 1995 so would be a shame to not have Net Support in a later time. Anyway if I'm looking more careful I see... tests, presumptions here and there and... I cannot understand well all natives which I have because I'm not familiarized with C++, but I can figure "//fixme" remarks which are proving "bubbles" even in natives. So we can have a joy in UT by testing and tweaking correctly the stuff. I could see hidden issues (no accessed nones but neither functionality), and yes, this engine should be rewritten and everything would be more cute, clear, faster, safer. But who is in charge for this ? UTPG went at sleep since 2004 and no life sign has been detected - they failed mission anyway... We don't need "new features" (new bugs untested) we need major fixes and valid documents about natives, what they do, what is not recommended, which way is better optimized, even Wiki lacks some explanations because nobody has find/wrote any original document and then I suspect other things about this engine - looks like it was bought and modified without an entire knowledge about it, in hoping to wrong here... or it was a "trade secret" addressing who ?
Post Reply