gamedig / rust-gamedig

Game Server Query Library.
https://crates.io/crates/gamedig
MIT License
38 stars 11 forks source link

[Games] Update game definitions to match node-gamedig names #100

Closed Douile closed 11 months ago

Douile commented 11 months ago

I wrote a small script to compare our game definitions to those of node-gamedig's. And updated anything that I found, this takes us from 8% of node-gamedig's games to 16% :tada: (#99)

There are some that still don't match: minecraft, counter-strike, (The forest?)

NOTE: aliases in rust-gamedig unfortunately means repeating the game definition with different keys.

Closes #98

Games definitions we have that are not found in node-gamedig ``` ('mc', 'Minecraft', '25565', 'Minecraft') Was not found in node Similar: ('minecraft,minecraftping', 'Minecraft (2009)', 'minecraft', '25565') ('minecraftpe,minecraftbe', 'Minecraft: Bedrock Edition (2011)', 'minecraft', '19132') ('mc-java', 'Minecraft (java)', '25565', 'Minecraft') Was not found in node Similar: ('minecraft,minecraftping', 'Minecraft (2009)', 'minecraft', '25565') ('mc-bedrock', 'Minecraft (bedrock)', '19132', 'Minecraft') Was not found in node Similar: ('minecraftpe,minecraftbe', 'Minecraft: Bedrock Edition (2011)', 'minecraft', '19132') ('mc-legacy-1.6', 'Minecraft (legacy v1.6)', '25565', 'Minecraft') Was not found in node Similar: ('minecraft,minecraftping', 'Minecraft (2009)', 'minecraft', '25565') ('mc-legacy-1.4', 'Minecraft (legacy v1.4-1.5)', '25565', 'Minecraft') Was not found in node Similar: ('minecraft,minecraftping', 'Minecraft (2009)', 'minecraft', '25565') ('mc-legacy-b1.8', 'Minecraft (legacy vB1.8-1.3)', '25565', 'Minecraft') Was not found in node Similar: ('minecraft,minecraftping', 'Minecraft (2009)', 'minecraft', '25565') ('asrd', 'Alien Swarm: Reactive Drop', '2304', 'Valve') Was not found in node ('cs', 'Counter-Strike', '27015', 'Valve') Was not found in node Similar: ('cs15', 'Counter-Strike 1.5 (2002)', 'goldsrc', '27015') ('cs16', 'Counter-Strike 1.6 (2003)', 'valve', '27015') ('cscz', 'Counter-Strike: Condition Zero (2004)', 'valve', '27015') ('css', 'Counter-Strike: Source (2004)', 'valve', '27015') ('csgo', 'Counter-Strike: Global Offensive (2012)', 'valve', '27015') ('haloce', 'Halo: Combat Evolved', '2302', 'Gamespy') Was not found in node ('insurgencymic', 'Insurgency: Modern Infantry Combat', '27015', 'Valve') Was not found in node ('ohd', 'Operation: Harsh Doorstop', '27005', 'Valve') Was not found in node ('tf', 'The Forest', '27016', 'Valve') Was not found in node Similar: ('sonsoftheforest', 'Sons Of The Forest (2023)', 'valve', '8766') ```
Python script to compare game definitions ```python #!/bin/env python3 import re RE_RUST_GAME = re.compile('"(.+)"\s*=>\s*game!\(\s*"(.+)",\s*([0-9]+)\s*,\s*Protocol::(\w+).*\)') RE_NODE_GAME = re.compile('^([^#|\s][^|]*)\|([^|]+)\|([^|]+)\|(?:port=(\d+))?', re.MULTILINE) with open("./src/games/definitions.rs", "r") as file: rust_games = RE_RUST_GAME.findall(file.read()) with open("../node-gamedig/games.txt", "r") as file: node_games = RE_NODE_GAME.findall(file.read()) for game in rust_games: key, name, port, protocol = game found = False similar = [] for node_game in node_games: node_key, node_name, node_protocol, node_port = node_game if node_key == key: found = True break if node_name.lower().find(name.lower()) > -1: similar.append(node_game) continue if node_protocol.strip().lower() == protocol.strip().lower() and node_port == port and node_protocol != "valve": similar.append(node_game) continue if not found: print(game, "Was not found in node") if len(similar) > 0: print("Similar:") for node_game in similar: print("\t", node_game) ```
CosminPerRam commented 11 months ago

Thanks bunch, I think game file names also needs renaming to be more inline with the ones in definitions.rs.

We should maybe rename mc to minecraft and minecraft-ping, and mc-bedrock to minecraftbe and minecraftpe

Agreed.

I'm not sure if rust-gamedig's "The Forest" is the same as node-gamedig's "Sons of The Forest"

They are different, surprised node doesnt have it, will add support.

For counter-strike we should maybe add both cs15, cs16 as aliases to cs

Not sure, will check immediately (also for the others that are missing for node).

CosminPerRam commented 11 months ago

[...] I think game file names also needs renaming to be more inline with the ones in definitions.rs.

Actually, in protocols/valve/types.rs too: https://github.com/gamedig/rust-gamedig/blob/1a60a0496fb4219166526bff751a51e1ac15450e/src/protocols/valve/types.rs#L252-L259 Cause we use them in that enum.

CosminPerRam commented 11 months ago

Woah, someone added support for Insurgency: Modern Infantry Combat (node-GameDig#369), Operation: Harsh Doorstop (node-GameDig#368) and The Forest (node-GameDig#367). Maybe just to make that new badge number higher, who knows. Also, apparently, Halo: Combat Evolved is the first Halo game (when I added it I thought they were different).

Douile commented 11 months ago

Maybe just to make that new badge number higher, who knows.

When node adds more games the number goes down, because we implement a lower percent of them :joy:

Douile commented 11 months ago

I'm not sure with the new name I gave 7 days to die, I've ended up with sd2d because rust modules can't start with numbers but the node name is 7d2d.

CosminPerRam commented 11 months ago

I would say that we could also rename some of gamedig's ids (those that begin with a number), the next release is a breaking so it wouldn't be that bad I guess (?).

Douile commented 11 months ago

I would lean towards adding aliases, could keep old name(s) as alias so nothing breaks, but change the main "preferred" name which we use in code. (I'm biased because changing the name for me would require running a script on database to look for old names and replace with new).

CosminPerRam commented 11 months ago

Sorry, here too: https://github.com/gamedig/rust-gamedig/blob/14c3f4525bc777cd2620b9f6d09bf1e4f5e0d597/GAMES.md?plain=1#L5-L8 Also, please add the renames to the CHANGELOG file.