Hey there,
I would like my users (clients) to share pictures from their local disk.
Seems like a simple problem enough, but i have been working my *** off to do that, couldn’t succeed, so here am i.
I have a function that makes a UTexture2D from any (jpg, bmp, png…) file on disk. This is made through a TArray<uint8>.
It works locally.
Next task is to send the picture to other clients.
I tried to simply replicate the texture but got this message:
LogNetPackageMap:Warning: FNetGUIDCache::SupportsObject: Texture2D /Engine/Transient.Texture2D_2 NOT Supported.
Then i tried to share the TArray but i got this message:
LogNetTraffic:Error: SerializeProperties_DynamicArray_r: ArrayNum > MAX_ARRAY_SIZE (RawFileData)
LogNet: Error: Can't send function 'ServerSetTexture' on 'BP_YagCharacter_C /Game/maps/UEDPIE_4_WelcomeMap.WelcomeMap:PersistentLevel.BP_YagCharacter_C_20': RPC bunch overflowed (too much data in parameters?)
So i tried to recompile the editor with a modified MAX_ARRAY_SIZE. I changed it from the original 2048 to a more comfortable 1048576 (to allow 1 Mo pictures transfer).
Unfortunately this causes a loss of connection:
LogNetPartialBunch:Warning: Channel[14] - Actor=BP_YagCharacter_C /Game/maps/UEDPIE_4_WelcomeMap.WelcomeMap:PersistentLevel.BP_YagCharacter_C_11 (Role=2 RemoteRole=3)State=open. Reliable partial bunch overflows reliable buffer!
LogNetPartialBunch:Warning: Num OutgoingBunches: 262. NumOutRec: 0
LogNetTraffic:Warning: -------------------------
LogNet: UNetConnection::Close: Name: IpConnection_2, Driver: GameNetDriver IpNetDriver_3, PC: BP_YagPlayerController_C_5, Owner: BP_YagPlayerController_C_5, Channels: 15, RemoteAddr: 127.0.0.1:7777, Time: 2014.12.14-17.24.48
LogNet: UChannel::Close: Sending CloseBunch. ChIndex == 0. Name: ControlChannel_2
LogNet: UChannel::ReceivedSequencedBunch: Bunch.bClose == true. ChIndex == 0. Calling ConditionalCleanUp.
LogNet: UChannel::CleanUp: [GameNetDriver] [BP_YagPlayerController_C_2] [BP_YagPlayerController_C_2]. ChIndex == 0. Closing connection.
LogNet: UNetConnection::Close: Name: IpConnection_5, Driver: GameNetDriver IpNetDriver_0, PC: BP_YagPlayerController_C_2, Owner: BP_YagPlayerController_C_2, Channels: 15, RemoteAddr: 127.0.0.1:59691, Time: 2014.12.14-17.24.48
LogNet: UChannel::Close: Sending CloseBunch. ChIndex == 0. Name: ControlChannel_5
LogNet:Warning: Network Failure: GameNetDriver[ConnectionLost]: Your connection to the host has been lost.
LogNet:Warning: Network Failure: GameNetDriver[ConnectionLost]: Your connection to the host has been lost.
LogNet:Warning: Network Failure: GameNetDriver[ConnectionLost]: Your connection to the host has been lost.
LogNet: NetworkFailure: ConnectionLost, Error: 'Your connection to the host has been lost.'
LogNet: DestroyNamedNetDriver IpNetDriver_3 [GameNetDriver]
LogExit: GameNetDriver IpNetDriver_3 shut down
I could split the giant TArray into little 2048 sized TArrays, then make a TArray of TArray (possibly pushing up to the 3rd dimension in case i need pictures > 4 Mo (2048x2048)), but i get the feeling that it’s becoming really ugly.
Another possible way would be to send the image file itself to the server/other clients in a normalized dir and then use rpcs to send everybody instructions to reconstruct the texture, but i tried every keywords i could think of in google, tried to search the API doc for some sort of file sending function, i found nothing.
At last resort i could follow Rama’s sockets tut:
and try to make my own transfer lib, but besides the fact that it would be over my current skills and would require a lot of time for me, that would also mean asking my users to open a second port, which i would prefer not. I would like to remain as standard as possible.
So could anyone point me to any walkable path ? Should the sharing be done at texture level, TArray level or file level ?
Sharing avatar picture can’t be that difficult right ?
Cheers