View Full Version : PRIArray Replication native?
Dark[NSF]
12-02-2007, 05:45 PM
I was making a dynamic array on my mod's GRI class (i know that they aren't easily replicated), and I was hoping it would replicate the same way as the PRIArray in GameReplicationInfo.uc
Is the PRI Array replicated natively?
Is there any way around this? Like taking a dynamic array and returning a static array?
thanks in advance
Pfhoenix
12-02-2007, 07:48 PM
The PRIarray is not replicated at all. If you look carefully, you'll see that every PRI adds itself to the local GRI copy's PRIarray list.
Dark[NSF]
12-02-2007, 08:13 PM
it seems like to me if it isn't replicated i wouldn't be able to have an exec client side that prints values for each pri. ^_^
edit: wait, so i think i understand does it have to do with ownership of the pri?
edit #2: i see, it looks like the addPRI function is simulated.
this works:
/**
* Display ROM player list
*
*
*
*/
exec function getROMPlayerList()
{
local ROMPlayerReplicationInfo ROMPRI;
ClientMessage("ROM PLAYER LIST: " $(WorldInfo.GRI.PRIArray.Length) );
foreach WorldInfo.GRI.PRIArray(ROMPRI)
{
if (!ROMPRI.bBot)
ClientMessage( ROMPRI.PlayerName$ ", ID=" $ROMPRI.PlayerID );
}
}
this does not: (AltInfo extends ReplicationInfo)
/**
* Display ROM alt list
*
*
*
*/
exec function getROMAltList()
{
local ROMGameReplicationInfo ROMGRI;
local AltInfo Alt;
ROMGRI = ROMGameReplicationInfo(WorldInfo.GRI);
ClientMessage("ROM ALT LIST: " $(ROMGRI.AltInfoArray.Length) );
foreach ROMGRI.AltInfoArray(Alt)
{
if (Alt.isActive)
ClientMessage( Alt.AltName );
}
}
Pfhoenix
12-03-2007, 09:13 AM
I'll say it again :
The GRI is replicated to all clients. Each PRI is replicated to all clients. Whenever a PRI first hits a client (in simulated PostBeginPlay), it adds itself to the local GRI's PRIarray. PRIArray is not replicated in any fashion.
Dark[NSF]
12-03-2007, 09:29 AM
The PRIarray is not replicated at all. If you look carefully, you'll see that every PRI adds itself to the local GRI copy's PRIarray list.
ah, I think I understand what you are saying. So everytime a PRI is added to the GRI, the GRI adds that PRI to a local list of PRIs for each player. Wow.. that is a mouth full.
if ( CurrentGameData == None )
{
InitializeGameDataStore();
}
if ( CurrentGameData != None )
{
CurrentGameData.AddPlayerDataProvider(PRI);
}
Dark[NSF]
12-03-2007, 09:35 AM
It looks like I can extend CurrentGameDataStore.uc and add 2 functions to add and remove elements in my dynamic array.
Pfhoenix
12-03-2007, 10:54 AM
;25141870']ah, I think I understand what you are saying. So everytime a PRI is added to the GRI, the GRI adds that PRI to a local list of PRIs for each player. Wow.. that is a mouth full.
It may be a mouthful, but that's not quite what I'm saying.
The GRI exists on all clients. Because PRIArray is a dynamic array, it is not replicated. This means that any modifications done to PRIArray are done locally to the machine that makes the modification. The way Epic gets around this is by having every PRI tell the local GRI to add itself to the PRIArray when the PRI shows up to the client (ala simulated PostBeginPlay).
There is no "PRI is added to the GRI". The GRI maintains PRIArray, which it can only do by the cooperation of the PRI object letting the GRI know to add the PRI to its list. Hopefully this is clear enough, because I don't know how else to explain it the same way three times and get it any clearer.
Dark[NSF]
12-03-2007, 11:04 AM
It may be a mouthful, but that's not quite what I'm saying.
The GRI exists on all clients. Because PRIArray is a dynamic array, it is not replicated. This means that any modifications done to PRIArray are done locally to the machine that makes the modification. The way Epic gets around this is by having every PRI tell the local GRI to add itself to the PRIArray when the PRI shows up to the client (ala simulated PostBeginPlay).
There is no "PRI is added to the GRI". The GRI maintains PRIArray, which it can only do by the cooperation of the PRI object letting the GRI know to add the PRI to its list. Hopefully this is clear enough, because I don't know how else to explain it the same way three times and get it any clearer.
yes, i understand. i don't see why you have to have an attitude. i also don't understand how you can say:
There is no "PRI is added to the GRI"
and then say:
PRI object letting the GRI know to add the PRI to its list
right afterwards, the local GRI DOES contain a list of all of the PRIs, which is exactly what I was saying. The only part I didn't quite understand was the local GRI coming into play.
Thanks for your help.
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.