Facepunch / Rust.Community

Community Entity to fill Server Side modder requests
MIT License
46 stars 21 forks source link

Add protobuf alternative to JSON #50

Open WheteThunger opened 1 year ago

WheteThunger commented 1 year ago

Problem statement

Today, server side mods (Oxide plugins, Harmony mods, etc.) can send custom UIs to clients by passing a JSON string through an RPC call. This results in multiple problems.

Proposed solution

Benefits:

Kulltero commented 1 year ago

definitely agree, ProtoBufs could massively shrink packet size when building large UIs. a question i'd have is, how much would deserializing to ProtoBuf cost if it just gets used to build the panels & components? its a better option than maintaining 2 deserialization code paths but wouldnt it add some cost to using the JSON method of adding UIs?

even when the change gets made, alot of mods using the CUI system would probably still be on the JSON system as most of them are oxide mods using the built in functionality. i'm unsure if the oxide wrapper could be transfered over to the ProtoBuf version without breaking changes for existing plugins

i do see the benefits though, hopefully it would offset some of the bulk some of My PRs would add to the JSON payload :P

TurEduard commented 6 months ago

I also wanted to write such a post. let's share the links and bring more attention to it. I would like to add that CUI also lacks functionality. For example, specify a hover color for a button (focus). The ability to cache CUI on the client side, for example during a connection, and trigger rendering at the required moment using a key. This will significantly reduce the load on the network and prevent massive DDoS when players intentionally cause rendering frequently. Fortunately, the latest update added support for scrolling.