Austinb / GameQ

A PHP Gameserver Status Query Library
https://austinb.github.io/GameQ/
GNU Lesser General Public License v3.0
403 stars 136 forks source link

ArmA 3 server query returns incomplète / misformated Rules #299

Closed Memphis017 closed 7 years ago

Memphis017 commented 8 years ago

Rules packets seems to have changed recently, makes rules unusable :

capture

$servers = [ [ 'id' => 'ArmA3', 'type' => 'Armedassault3', 'host' => '212.83.134.164:2302', ]];

Austinb commented 8 years ago

Did arma3 update their servers recently? Is this a vanilla install of the aram3 server you are running?

Memphis017 commented 8 years ago

Yes, bug occured since the last update (V 1.56.134627). It is Vanilla server, sometimes started with additionnal mods. Bug is present even when server is started without some. Server rules must return mod started with and key installed for these.

Austinb commented 8 years ago

At first glace it appears the server version 1.56 has broke the protocol standard for source (a2s) - https://developer.valvesoftware.com/wiki/Server_queries#Response_Format_3. I have no idea what that data is that is being returned. The response is supposed to be a string of key:value pairs separated by \x00 to delineate the strings. May need to make the devs for arma3 aware.

Are there any servers running the 1.54 version? Last tests I have are from 1.38 where it was still using the old format. Did 1.54 work as before?

Memphis017 commented 8 years ago

I don't know for sure if 1.54 was working, but it's a pretty recent change. I will search in bohemia's tracker to see if it's already reported. Thx

Opened a "ticket" on Bohemia's forum, since their tracker is down : https://forums.bistudio.com/topic/188864-source-protocol-problem-when-querying-servers/

Austinb commented 8 years ago

I checked your forum post. What is the tracker link they use that is not online? I found something via google but said it was possibly breached. I suppose this could be taking priority which is why no response to your request yet.

Memphis017 commented 8 years ago

You were at the right place, their tracker was taken down because of a possible security breach. I'm gonna repost the issue in server section which seems more appropriate for our concern. Will do this in few days if there is still no answers.

Memphis017 commented 8 years ago

Reposted in Server category : https://forums.bistudio.com/topic/189090-source-protocol-problem-when-querying-servers/

Austinb commented 8 years ago

I see someone replied to your thread. I don't understand why they just wouldn't add more entries in the same format as the existing protocol. Maybe there is a fixed packet length they can not go over? They also have the EDF flag in the details response they could leverage.

Austinb commented 8 years ago

FYI I wrote a response in that thread.

firefly2442 commented 8 years ago

Still broken in Arma 3 v1.6, perhaps the new Apex expansion will fix it here at the end of June.

Torndeco commented 8 years ago

Not broken they changed how the protocol works.... Updated documentation at https://community.bistudio.com/wiki/Arma_3_ServerBrowserProtocol2

Memphis017 commented 8 years ago

Cool ! This is exactly what Austinb needs to restore Arma's compatibility with GameQ !

Thanks Torndeco !

Austinb commented 8 years ago

@Torndeco I have started on this and gotten to the first section of processing the split packets into one. My confusion starts on how do I tell which mods are enabled? When I pull the 1 byte for the DLC flag I get an integer. Is this a 0 indexed list from left to right as defined in the docs? Is it power of 2? Essentially when I get a value of 2 for the DLC flag what does that mean? The same question applies to the other 1 byte flags that have multiple definitions like difficulty and general flags.

zacwebb commented 8 years ago

Was this issue resolved or are ARMA3 queries still not working @Austinb ? Thanks

Memphis017 commented 8 years ago

@webbzac : query is working, only the rules packet is missing. @Austinb : I can help you with that. Provide me your new code and i will run some tests on my server for you.

Austinb commented 8 years ago

@Memphis017 I have nothing pushed up yet because it is incomplete. I can push up a branch of what I have but as of right now it is just a bunch of dumps to see what the data is looking like.

Austinb commented 8 years ago

@Memphis017 See https://github.com/Austinb/GameQ/tree/v3-features/arma3-rules-fix. It is very incomplete...

Memphis017 commented 8 years ago

No problem, will look into it, since I have a working server at my disposal it's easier to debug

Austinb commented 8 years ago

@Memphis017 Thanks. To be clear I got the code working (I believe) to recombine the sections into one string. The issue I am having is with the definitions for the different DLCs because depending on the number of DLCs the length between the first 6 bytes and the "number of mods" byte can vary. As an example a value of 2 from the 3rd byte (DLC values) means what? Does that mean 2 DLC addons in some predefined order? Is it a power of 2? Example for power of 2 with K=1, M=2, H=4, ...: A value of 2 would mean "M" whereas a value of 3 would be "K" and "M" and so on...

Basically I need to know the number of DLC addons for the next section so I can determine how many 4-byte blocks to read. Once at the "number of mods" byte the rest is straight forward.

Thanks for the help and let me know if you have any questions.

zacwebb commented 8 years ago

Thanks for the help @Memphis017 and thanks for keeping this up-to-date @Austinb

Memphis017 commented 8 years ago

From the doc you could see DLC Flags are encoded in one single byte. On my server we have all three DLC + APEX expansion so the result should be at least 23, 00010111 in bits which match the first column table from the doc : from right to left : Karts / Marksmen / Helicopter / Empty or not used / Expansion. 0 means you haven't, 1 you have the DLC installed.

Problem is that it seems to have much more information in the rules packet than in the doc, I don't know what are these for the moment. Still investigating...

Memphis017 commented 8 years ago

Also according to the doc there is some escaped values that can't be transfered through Steam server, sequence have been replaced like this : 0x01 0x01 replaced value was 0x01 0x01 0x02 replaced value was 0x00 0x01 0x03 replaced value was 0xFF

So we need to check for these before processing the rules buffer (perhaps even before recombining sections)

Austinb commented 8 years ago

@Memphis017 Thanks for the help. Couple questions: 1 - What is the "Z" mods name? Or is that the APEX you are talking about in your earlier comment? 2 - How is the difficutly bit laid out? Example I am getting a value of 147. Does that mean first digit = Difficulty, second digit = AI diff, third digit is what?

Memphis017 commented 8 years ago

1 - it isn't documented yet, I suppose it's a dummy bit for another DLC, Apex is bit 4 (from 7 to 0 left to right) "E" for Expansion. 2 - According to the doc : 0/1/2 bits difficulty level, 3/4/5 AI level, 6 advanced flight model, 7 3rd person camera enabled. So if you got 147 => 10010011 : (from left to right)

I'm assuming that difficulty is coded like this :

And for AI level :

But these are just guesses by now, I need to check on this to confirm.

Austinb commented 8 years ago

Please checkout latest commit on that branch. I have pulled in all the info and got the difficulty minus what the different levels are. For now they are just integers which maybe good enough if you are right about them going from easiest to hardest (0-4).

What I need now is feedback on the layout of the rules result array in terms of the keys themselves. Also any bug fixes for the actual code.

Memphis017 commented 8 years ago

Ok seems to work pretty good already. My guesses were almost rights, here are the tested levels :

Difficulty :

AI Level :

Integers seems fine to retrieve labels.

You have to correct some DLC names though : "Marksmen" instead of "Marksman" "Helicopters" instead of Helicopter"

Tested with 10 mods and 12 signatures without problems. Might be interesting to have mod count and signatures count in results as well.

firefly2442 commented 8 years ago

So, I tried 9a973bcaa98c09e9407cfe0db13ade3978717700, however it seems to have broken `armedassault2oa' and 'dayz'? Or perhaps they were already broken? Arma3 is looking good though.

Austinb commented 8 years ago

@firefly2442 If the responses for those servers have changed please open new issues for each game. Right now only Arma3 has been changed to "fix" the rules and this issue is for arma3 only as well. Thanks

Austinb commented 8 years ago

@Memphis017 Thanks for the feedback. Will make changes and push out release candidate changes. Anyone else have any testing feedback?

Austinb commented 7 years ago

Merged in latest v3 and updated outstanding issues. Sorry for the delay have not had a lot of time to work on this lately. Please test this last release candidate and let me know of any bugs/changes. I will push into v3 in about a week.

Memphis017 commented 7 years ago

Seems pretty good to me, I created a pull request to correct the mod names though.

Austinb commented 7 years ago

Ahh sorry I misread your comments from Aug 7th. Will pull and correct any tests. Anything else wrong?

Memphis017 commented 7 years ago

So far so good, signatures are well reported, mods & DLC too. Every values reported by my server are correct.

Maybe you should correct the name of the game/protocol as it is not really "Armed Assault 3", just "Arma 3" (since Arma 2).

Ready to launch !

Austinb commented 7 years ago

Brought into v3 stream in 8b0263898bda6ba1b58d6d407962814d61b684f6. Please open new issues for any problems arising from this merge.

rverschuren commented 7 years ago

Hello everyone, this issue helped me. I was just wondering if you knew what the signatures fields are. Thank you :)