I have a fully constructed Arma game server launcher I have developed in C# WPF. It will work with any Steam / Steamworks API game, but I have targeted Arma games for this launcher.
To the point:
- When I query the Steamworks API for the Rules for Arma 3, they come back like this example:
{ "Name": "\u0001\u0002", "Value": "\u0002\u0001\u0002\u0007\u0001\u0002\u0001\u0001k<f\u0012\u0015>\u0006d\u0019\u00040\"\u0019CUP Terrains - Maps 1.1.0A\u001e\u001f\u0004q\"\u0019CUP Terrains - Core 1.1.0mҹ\u0004sL \u0012CUP Vehicles - 1.3\u0004ڷ" }
The code to get the game rules looks like this:
internal string ReadString() { string str = string.Empty; int temp = 0; CurrentPosition++; temp = CurrentPosition; while (Data[CurrentPosition] != 0x00) { CurrentPosition++; if (CurrentPosition > LastPosition) throw new ParseException("Unable to parse bytes to string."); } str= Encoding.UTF8.GetString(Data, temp, CurrentPosition - temp); return str; }
The line from above:
str= Encoding.UTF8.GetString(Data, temp, CurrentPosition - temp);
...is the part that decodes the byte[] to the string result.
If I change the Game Directory filter from 'arma3' to 'arma2arrowpc', the same code above returns this decoded result example for the Rules:
{ "Name": "modNames:0-1", "Value": "Arma 2: British Armed Forces (Lite);Arma 2: Private Military Company (Lite);Arma 2;Arma 2: Operation Arrowhead;" }
If I switch the Game Directory filter to an entirely different game (ARK: Survival Evolved), I get the following example for the Rules:
{ "Name": "GameMode_s", "Value": "TestGameMode_Genesis_C" }
The Arma 3 Steamswork API Rules do not seem to be working properly when querying Steamworks API. I have looked all over for help and used other Steamworks API query tools. All examples are showing the same Rules bytes[] decoding issue.
Another test -
If I convert the byte[] to char by char and exclude the limit it to these char types only, 'Char.IsLetterOrDigit(c) || Char.IsPunctuation(c) || Char.IsSeparator(c) || Char.IsWhiteSpace(c)'...
...this mod param Steam rule:
"\avvDQH\f@ExileServer\b\tExile Modx._Ryan's Zombies & Demons"
...turns into this:
"EvvÉDQH\f@ExileServerÌ\tExile Modx._Ryan's Zombies & Demons"
Here is the test logic:
var test = string.Empty; foreach (var b in Data) { char c = Convert.ToChar(Char.ConvertFromUtf32(b)); if (Char.IsLetterOrDigit(c) || Char.IsPunctuation(c) || Char.IsSeparator(c) || Char.IsWhiteSpace(c)) { test += c; } }
References and my simple sample Console Application program that will reproduce what I have described above.
- https://community.bistudio.com/wiki/STEAMWORKSquery
- See section: Comparsion of the current STEAMWORKS implementation to GameSpy
- https://developer.valvesoftware.com/wiki/Server_queries
- See section: A2S_RULES
- http://querymaster.codeplex.com/SourceControl/latest
- PLEASE CONTACT ME DIRECTLY FOR A FULL EXAMPLE CONSOLE APPLICATION WITH TESTS INCLUDED.
For all tests listed above, I am using this sample Steam Query tool "QueryMaster".