YaLTeR / OpenAG

An open-source reimplementation of Adrenaline Gamer's client library.
https://j.mp/OpenAG
Other
131 stars 42 forks source link

Add cvars to ignore certain messages #150

Closed fireblizzard closed 2 years ago

fireblizzard commented 2 years ago

With the next version of AG an extra byte will be sent on the TextMsg event. This byte tells what type of message it is. For the moment I have added 2 message types, and I'm planning a few more in the future, like a type for name and/or team changing messages. This makes it possible to ignore certain types of messages easily in the client, without relying on server configuration or checking what kind of text the message has.

This byte will be: -1: if absent (that's what READ_BYTE() returns if it ran out of bytes to read) 0: if it's a spawn message 1: if it's a damage message

A spawn message is sent as soon as a practice bot respawns, telling the spot number where it spawned. A damage message tells how much damage you dealt to a practice bot.

New cvars:

As I mentioned there will be more types, for name/team changes, as some players have requested the ability to ignore those because some spectators like to change their name/model to distract players during a match, or to give unfair advantage to one of them telling the opponent's location.

Any suggestion is very welcome, regarding anything really (cvar names, coding, ignoring strategy, etc.). My C++ knowledge is very limited as you know :)

fireblizzard commented 2 years ago

Yeah, I tested these combinations, they are all good:

The test was just triggering different messages by saying random stuff, changing model, changing name, killing several times a bot that shows the spawn and damage messages, and replaying demos on HLKZ. Also changing the implemented cvar values to ignore one message type, then the other, then both; it worked fine.

YaLTeR commented 2 years ago

Sounds great, thanks!