UE1 - UT Replication limit for string arrays?

  • Two Factor Authentication is now available on BeyondUnreal Forums. To configure it, visit your Profile and look for the "Two Step Verification" option on the left side. We can send codes via email (may be slower) or you can set up any TOTP Authenticator app on your phone (Authy, Google Authenticator, etc) to deliver codes. It is highly recommended that you configure this to keep your account safe.

playsax

New Member
Feb 20, 2008
44
0
0
I have a string which has 20 arrays:

Code:
var string MyString[20];

Each array holds about 17 characters and is replicated to the client. On the client however, all results after the 15th array (MyString[15]) are empty! I have verified the string does contain data on the server.... So is there some limit on the amount of characters that can be replicated?

I also tried splitting up the string like so:

Code:
var string MyString[10], MyString2[10];

But that yielded the same result (MyString2 was empty after MyString2[5]).

I have also tried to reduce the amount of characters stored per string (from 17 to approx 12) and then all but one array were filled... (e.g. all is well up to MySting[18]). What's up?
 
Last edited:

playsax

New Member
Feb 20, 2008
44
0
0
I have just coded it by hand... E.g.:

String0, String1, String2, String3, etc. (up to String20).

Then assigned each string a value and execute code after that. My source file has now tripled in size due to this inefficient, frustrating and time consuming way of coding..... BUT it does work! :lol:

Still my question stands, because I'd much rather replicate the string array instead of 20 separate strings which bloats the code like nothing else.

Edit: I have just increased the string contents to 30 characters per string (x20 strings) and it starts failing again (replicating empty strings). Now this isn't an immediate problem since my strings are shorter... but it's still an uneasy feeling knowing the limitations of the UT engine are this... poor.


Edit: Spoke too soon: this also fails (read below)
 
Last edited:

Wormbo

Administrator
Staff member
Jun 4, 2001
5,913
36
48
Germany
www.koehler-homepage.de
(Static) arrays like that one should be replicated similar to individual variables. What kind of values are you trying to replicate? (long/short) What's the replication condition? How do you set the data? And finally, what are the replication-relevant values of your class?
 

playsax

New Member
Feb 20, 2008
44
0
0
(Static) arrays like that one should be replicated similar to individual variables.

You are correct. I cheered too early. The "individual variables" are empty just like the "static arrays" (quotes used so we are communicating on the same level). I didn't notice this before because the replicated strings are drawn on the HUD and since it are so many, it appeared everything was ok, but on closer inspection there were a few empty :(

What kind of values are you trying to replicate?
Each string looks like this: "<playername> <score> <ip>". These values are read from a INI file stored on the server. On the client, the string is processed to 'extract' the correct part (be it the playername, score or IP) when necessary to be drawn on the HUD.

I have verified whether replication was successful by writing the entire array (MyString[1] through MyString[19]) to the log of the server and also clientside. This way I could see that the server had correctly filled all strings, but the client received the last few empty.

What's the replication condition?
As follows:

Code:
replication
{
  reliable if ( Role == ROLE_Authority )
MyString0,MyString1,MyString2,MyString3,MyString4,MyString5,MyString6,MyString7,MyString8,MyString9,MyString10,MyString11,MyString12,MyString13,MyString14,MyString15,MyString16,MyString17,MyString18,MyString19;		
}

or for the initial example (which has preference):

Code:
replication
{
  reliable if ( Role == ROLE_Authority )
  MyString[20];		
}

How do you set the data?
Using a for loop:

Code:
for (i=0;i<20;i++)
MyString[i] = INI[i];

INI also contains 20 strings (INI[1], INI[2], etc.). An example content of an INI string, as shown before could be "<playername> <score> <ip>".

And finally, what are the replication-relevant values of your class?
I don't understand what you mean. Could you please clarify?
 
Last edited:

playsax

New Member
Feb 20, 2008
44
0
0
(!) It seems to work by setting bNetTemporary=False. (is this what you meant by "replication-relevant values"?)

I had set it to True, because the values do not change during gameplay. Will bNetTemporary=False increase bandwidth by much?
 
Last edited:

Wormbo

Administrator
Staff member
Jun 4, 2001
5,913
36
48
Germany
www.koehler-homepage.de
Yup, that's what I meant. bNetTemporary has the effect of disconnecting the data channel of the actor right after the initial data packet was sent. Your strings probably were too large to fit into a single packet, but since the connection was already cut off, the left-over data couldn't be replicated anymore.
 

Wormbo

Administrator
Staff member
Jun 4, 2001
5,913
36
48
Germany
www.koehler-homepage.de
Like I said: It terminates the server<->client connection for that specific actor as soon as the initial data of the actor has reached the client. From that point on the client has to simulate the behavior of the actor entirely on its own without any further help form the server.
This is mainly a bandwidth optimization for simple objects like non-homing Projectiles, visual effects, etc. Some visual effects save even more bandwidth by being spawned clientsidely, though simulation instead of replication.