gamedig / rust-gamedig

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

Add generic programmatic game interface #42

Closed Douile closed 1 year ago

Douile commented 1 year ago

Deletes src/games/mod.rs and generates it using build.rs

This then requires each game module to export an INFO that implements the trait GameInfo which currently has name, description, and query.

query expects a response that implements the GenericResponse trait which currently has server_name, and server_map.

Currently only implemented for tf2 and aliens.

I'm not sure traits is the best way to go for the generic response it might be better to marshal each response type into one GenericResponse struct type.

Also the generic interface is currently a function that returns a HashMap of all the games, instead of a function it might be better to have a static map using phf as discussed in #36

Douile commented 1 year ago

I've improved this by using a proper codegen library, and basing the output on games.toml.

CosminPerRam commented 1 year ago

Closed due to being superseeded by #45