Page MenuHomeFeedback Tracker

Params Read / Write context functionality
Assigned, UrgentPublic

Description

I recently wanted to try to optimize my RPCs, especially when I send a lot of data like 10k array entries and I figured out different ways how I could send the data, but there is no proper way to measure which one is the best.
I use the ScriptRPC class to write the data and I would like to have a function, which returns the byte count it would send, so I can measure how many bytes are sent.
Also a very useful function for reading RPC data would be to be able to jump back to a position to be able to read the same RPC data multiple times for example when intercepting other mods RPCs to read some data, but not break them by doing that.

Details

Severity
Feature
Resolution
Open
Reproducibility
Always
Operating System
Windows 11 x64
Category
General
Steps To Reproduce

Either have the functions for all classes implementing the Serializer or only the ScriptRPC and ParamsReadContext.

class Serializer: Managed
{
	proto bool Write(void value_out);
	proto bool Read(void value_in);

	proto native bool CanWrite();
	proto native bool CanRead();

	proto native int GetSize(); // Returns the total size of the data in bytes
	proto native int GetPosition(); // Get the current position of the data to read
	proto native void SetPosition(int position); // Set the current position to this value to go back to a previous position or to skip data
	
	protected void Serializer() {}
	protected void ~Serializer() {}
};

Event Timeline

LBmaster created this task.Jan 3 2024, 10:00 AM
Geez changed the task status from New to Assigned.Jan 3 2024, 11:14 AM

Also one big issue this would solve would be adding mods, which overwrite the onstoreload and onstorewrite methods to save their own variables, cause the whole persistence to break. Being able to rewind the buffer when it failed to read the data, would make it possible to prevent wuch issues from happening. At least when installing the mod