Eradication of bitfields

Eradication of bitfields

Requests for features in the spring code.

Moderator: Moderators

Post Reply
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Eradication of bitfields

Post by AF »

The TASServer protocol is littered with 1 major inconsistency and annoyance, bitfields.

I have had issues with bitfields implementing cookiebot and AFLobby, and I remember hollowsoul saying they where a pain. There are lots of places where bitfields and seperated fields are used interchangeably.

An example is the way team colours are stored, they're stored as a single integer using AABBGGRR in reverse order rather than the conventional RRGGBBAA. And to update 1 piece of information you have to compile a range of data into a bitfield to be sent to the server rather than just what you want to change.

Also there are numerous limitations and bottlenecks imposed by these, for example, because of bitfields you cant have more than 8 sides in a race, because side 9/10 etc is unselectable, you cant pick sides 17-32 without changing the protocol because there arent enough bits allocated.
hollowsoul
Posts: 665
Joined: 06 Jun 2006, 19:49

Post by hollowsoul »

For the record i dont like bitmasks, cause i am unable to wrap by brain around them, code / math wise.

Got other peep like author of auto-host python bot, to throw me some python code for it. Was only a few simple lines.
An example is the way team colours are stored, they're stored as a single integer using AABBGGRR in reverse order rather than the conventional RRGGBBAA. And to update 1 piece of information you have to compile a range of data into a bitfield to be sent to the server rather than just what you want to change.
After my rewrite i found it alot easier to store the battle data in an abstracted class. That contains last bitmasks, so that way when i update a bitmask value, i return only the changed values. U can find the python code in new svn in Misc/Battle.py

Also allows me to generate clients own bitmask value very easy, just foo('Ally:10') to return client new bitmask with changed ally value. Which i then send to server.

Besides only afew different bitmasks, once u get the few lines of code its not to hard. And have yet to see a mod that even has 6 sides to it let alone over 10+

As for interchanged from bitmasks to seperate fields.
Betalord made a good case why it is.
Lets say its pure bitmasks
  • 1) Player X changes their side
    2) Lets say a host forces a Player X to Ally 3.

    3) Player X client sends new bitmask value to server.
    4) Host client sends Player X's new bitmask to server.

    5) Server sends latest (Host) bitmask to everyone in battle
    6) Player X wonders why his side didnt changed !!!
note:- can also happen vice versa

Also imo, bitmasks help to reduce bandwidth usage for lobby server. And assuming memory usage aswell since it just an integer.

But if u want my 2cents of a list of possible TASServer & TASClient changes,

UTF support (atm TASClient sends over users locale character encoding (no way to detect which, just luck if u are using same locale character encoding)
TASServer then goes and only allows its own locale character encoding for Battle Descriptions replacing unknown character with '?'

Someone plz change team / ally ordering in TASServer / TASClient so that teams & ally values are sorted from lowest -> highest. And if team = player or ai it doesnt make a difference. This would allow for battles to be played with ai mixed up with players.

Change Battleopened (goes to everyone on server)
atm it sends Mod Name / Map Name / Map Checksum
to Mod Name / Mod Checksum / Map Name / Map Checksum

This way can search UF via mod checksum before allowing client to join battle, so they can download the mod. Before allowing them to join. Names of mod isnt foolproof. And getting mod checksum after joining battle makes no sense to me.

Someone for the love of god fix TASClient so it doesnt update its ClientStatus when joining a game. Just increases cpu usage for all clients for no real reason...
Atm it sends
Ingame = True AFK = False
(launches game)
Ingame = True AFK = True
(unnessarcy)
User avatar
FoeOfTheBee
Posts: 557
Joined: 12 May 2005, 18:26

Post by FoeOfTheBee »

My request is to change "team / ally" to "share units / ally".

I think every single new player gets confused about this.
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post by AF »

com shooter has 9 races/factions sides

And I understand the point with havign everythign as bitfields, btu I would rather nothign was a bitfield.

Also betalord himself has in the past said that bandwidth is minimal as it is, using it as justification for using a plaintext protocol, rather than using integer IDs, backed up by some curious comments on the size of logs and how little space in memory is taken up by #main if you leave it running for a day nonestop by P3374H.

The away status as it is is messed up anyway, you cant tell the difference between people who're away and people who're ingame so you see someone whose idle and you pm them and they snipe back that they're ingame, and then it aint always reliable.

However I agree wholeheartedly that aside from bitfields, AI ordering and character sets are big issues.
Post Reply

Return to “Feature Requests”