SmartlyDressedGames / Unturned-3.x-Community

Community portion of the Unturned-3.x repo. If you have access to the source code you can find it here:
https://github.com/SmartlyDressedGames/Unturned-3.x/
84 stars 18 forks source link

Command "/spy" bug #4394

Closed surv0013 closed 1 month ago

surv0013 commented 3 months ago

The screenshot does not occur if the player has a modal* window enabled.

*I'm talking about plugin flags.

SDGNelson commented 3 months ago

There shouldn't be any effect - Player.ReceiveTakeScreenshot and the related code don't check the plugin widget flags. Are you sure?

surv0013 commented 3 months ago

I add a UI effect and a modal flag with a blur and without a dot to the player, and then I try to take a screenshot, the screenshot does not arrive on the server.

EffectManager.sendUIEffect(id, key, SteamPlayer.transportConnection, true);
Player.setAllPluginWidgetFlags((Player.pluginWidgetFlags | EPluginWidgetFlags.Modal) & ~EPluginWidgetFlags.ShowCenterDot);
SDGNelson commented 3 months ago

I double-checked and it seemed to work fine for me. I ran the same code from the server to set the modal flag and disable the center dot flag, then I ran the spy command from the server console and the image showed up in the server folder. Could you send the client and server logs after reproducing it please? Maybe there's a related error. That said, I'm very skeptical that this is a vanilla bug because the spy functionality and UI effects + widget flags are entirely unrelated.

CyberAndrii commented 3 months ago

The screenshot gets rejected by this check. You can replicate it in singleplayer on Buak by spying yourself at this position but it will not work.

image

Also, for some reason, neither GitHub nor Imgur allows me to upload the Spy.jpg file. Even when I zip it.

surv0013 commented 3 months ago

The screenshot gets rejected by this check. You can replicate it in singleplayer on Buak by spying yourself at this position but it will not work.

Hmm, he’s right, apparently, due to the complex UI, which has many icons and colors, the file weight exceeds the maximum available.

UPD: And yet, on our server there are slightly non-standard textures that contain a deep color palette, perhaps this also indirectly affects the result.

SDGNelson commented 3 months ago

Thanks @CyberAndrii! I should add logging to the client for that case. Ideally it would be nice to have a better way to send larger packets between client and server. Internally I don't think there's limit, or at least old Steam Networking docs mentioned it was fine to send multi-megabyte buffers, but the game still assumes the message fits within a few kilobytes.

DanielWillett commented 3 months ago

Steam seems to have some kind of internal limit or buffer of around 65kb of data in the send buffer, even if the send buffer size is configured higher. Maybe I'm doing something wrong but i had to create a wrapper class to send larger packets slowly for my multiplayer map editor module. I needed to send the Map.png and Chart.png files to the server which can be quite large. You can see my implementation here if you like but its a bit messy. You could probably safely up the 30k limit to like 45k-55k without any changes though.

surv0013 commented 3 months ago

Steam seems to have some kind of internal limit or buffer of around 65kb

It may well be that the limit variable is of type ushort.

SDGNelson commented 2 months ago

In the next version it logs if the jpg size is too big. Also, I raised the limit from 30 KB to 40 KB.