Lua suggestion: Ability to send raw messages to other clients
(Note: My knowledge of the netcode is almost void, I have no idea if this is possible)
Currently, communicating clientside information to the server or other players is done through forcing the client to execute a console command with a specific set of arguments, communicating the results to everybody in the server.
This isn't particularly optimal, and sometimes trying to send special symbols can result in failure due to the console parsing the input. In addition, there may be times one would like to create a custom password system, which would inadvertently communicate the raw password to everyone in the server. A normal user wouldn't notice it, but someone with enough time in their hands can figure out a way to extract this.
With the introduction of 2.2.10's ability to detect keypresses and mouse input directly, and other factors, I would like to suggest the ability to send custom information to other clients:
- Having a command named
NetSend(to, ...)
.
The field to
would be filled with the target(s) of the message, where for a client, options available are either just the server
or all players
, while serverside they choose what client to send this to, whether one, multiple, or all. (Maybe specifying player numbers with a table, or flags, or... some other way?)
Optimally each client would be able to cherrypick who gets the message, but given the structure of the server (not P2P and it's many-clients-to-server) and the address of each connected player being hidden from each other, that might not be possible and potentially a security risk(?).
As for ...
, the original idea was to be able to send any value of any type, and as many arguments as wanted. Though this could probably be simplified to just being a table with everything in it.
- Having a hook for a
NetReceive
event, with arguments(from, ...)
.
This would capture every Lua NetSend
message received by this client.
Upon event call, the event would be called with from
, being the player number from where this message originates from, followed by all arguments entered in NetSend
.
If multiple hooks for NetReceive
exist, returning anything that coerces to false
(even nothing at all) continues running subsequent hooks, while returning true
stops propagating the message across hooks, just like how it works with searchBlockmap
.
Having these two would allow a client/server to communicate more raw information with each other without having to communicate it to everyone and without having to pass through the console. An example of things that could be made with it are:
- A login system where only client and server communicate and no other client can listen to
- Responsive clientside menus where only important changing actions are communicated to everyone (Navigating through the menu wouldn't be communicated, while changing a player/server setting or executing object actions would)
- Making something grid based? Only communicate the client-calculated click positions
- Phase out clientside info sending actions that require calling a secret console command, which could be hijacked by someone who knows the format it expects
- I have kind of encompassed a massive amount of possibilities in the second point - About any grid based game fits as a "menu" lol
yea