Talk:Types

From Unreal Wiki, The Unreal Engine Documentation Site
Jump to navigation Jump to search

Strings and replication

I have just done some testing in UT2004 (ie Unreal Engine 2.5) concerning Strings and replication. My test included a server to client replicated string variable I filled on the server in PostBeginPlay and replicated (reliably) if bNetInitial. I output its length client-side in PostNetBeginPlay and each Tick.

Strings longer than 390 characters took one Tick before they were replicated completely, ie at PostNetBeginPlay, the client-side length was still zero, in the first Tick it had the correct length.

Strings longer than 496 characters did not get replicated at all, not even truncated. The client-side length remained zero.

If anybody can confirm or clarify this, this might be useful information in the String section.

--Pd 06:36, 5 May 2011 (UTC)

Strings with a length greater than 255 can not be replicated. --Eliot 10:19, 5 May 2011 (UTC)
I expected something like that, but string up to 384 to 390 worked very well for me, so that can't really be true. Or is that just the official statement (similar to UE3 doesn't support dynamic bool arrays while in fact it does)? --Pd 16:05, 5 May 2011 (UTC)
The reason for the observed behavior is that any replicated variable (especially long strings and large structs) must fit into a single packet in order to be replicated. UE does not split replication bunches across packets. Either it fits or it won't replicate. The delay for the 390 chars string is caused by the string not fitting into the initial packet along with the other replicated data. It is replicated later in a separate packet. That 496 chars string not being replicated at all is caused by the same issue: The string won't even fit in a packet if nothing else is added to it. The maximum packet size depends on MTU settings along the route from your computer to the game server. The maximum Ethernet MTU is 1500, but IPv4 typically operates on 576. That's the raw payload size of the IP packet, i.e. UDP header, UE networking header data and the actual replicated variable value need to fit into that. Note that there's actually no built-in size limit for replicated values in the Unreal Engine. If MTU is large enough, you could even replicate 1k char strings —Wormbo 16:40, 5 May 2011 (UTC)

hint to concatenate strings

Of course there may be more possibilities to concatenate strings than '@', but please allow then a link to a page where handling of strings is described. I was searching for the name of this operator (I know similar from other programming languages) and started my search of course with "string". So at least a link to string operations would be useful there. --SeriousBarbie (talk) 11:13, 29 August 2015 (EDT)

Well, there is a dedicated Operators page, and it is linked in the navigation box at the bottom of every UnrealScript reference page. However, I agree that searching for "string" or "string operators" should bring up more results than just the short string type description. —Wormbo 14:22, 29 August 2015 (EDT)

That was the info I was looking for, thanks. :D --SeriousBarbie (talk) 22:08, 30 August 2015 (EDT)