Closed SudoHenk closed 2 years ago
Tbh i'm not familar with SDR (will look into this in the future), but as far as the library is concerened, you can still query the same information using steam's web api (see example below). Another option is to use the Steamworks SDK although this is not supported by the library, there are third-party libraries available that provides the bindings for SteamWorks like steamworks4j.
public static void main(String[] args) throws Exception {
try (SteamWebApiClient client = new SteamWebApiClient("<token>")) {
GameServersService gameServersService = new GameServersService(client);
MasterServerFilter filter = MasterServerFilter.create().hasServerIp("169.254.173.78:41744");
CompletableFuture<List<GameServer>> serverListFuture = gameServersService.getServerList(filter.toString(), 10);
int ctr = 1;
for (GameServer gameServer : serverListFuture.join()) {
System.out.printf("%03d) Name: = %s, ip = %s%n", ctr++, gameServer.getName(), gameServer.getAddr());
System.out.printf("\tAddress: %s%n", gameServer.getAddr());
System.out.printf("\tApp ID: %d%n", gameServer.getAppid());
System.out.printf("\tBots: %d%n", gameServer.getBots());
System.out.printf("\tIs Dedicated: %s%n", gameServer.getDedicated());
System.out.printf("\tGame Directory: %s%n", gameServer.getGamedir());
System.out.printf("\tGame Port: %s%n", gameServer.getGameport());
System.out.printf("\tGame Type: %s%n", gameServer.getGametype());
System.out.printf("\tMap: %s%n", gameServer.getMap());
System.out.printf("\tOperating System: %s%n", gameServer.getOs());
System.out.printf("\tPlayers: %d%n", gameServer.getPlayers());
System.out.printf("\tMax Players: %d%n", gameServer.getMaxPlayers());
System.out.printf("\tProduct: %s%n", gameServer.getProduct());
}
}
}
001) Name: = Valve Matchmaking Server (Virginia srcds2015-iad1 #35), ip = 169.254.173.78:41744
Address: 169.254.173.78:41744
App ID: 440
Bots: 0
Is Dedicated: true
Game Directory: tf
Game Port: 41744
Game Type: hidden,mvm,valve
Map: mvm_mannworks
Operating System: l
Players: 0
Max Players: 6
Product: tf
Thanks for your response, I dont think steamworks4j will work, as you probably need to authenticate as being the owner of the appid/game itself.
I was interested in the rules / playerlist itself rather than asking the masterserver, but thanks for the example :).
A while ago Valve implemented the SDR for their TF2 official gameservers, this means the servers are no longer publicly queryable for information. See https://www.teamfortress.com/post.php?id=100538
When I currently ask the TF2 gamecoordinator for a list of gameservers, the official servers are returned, but they return an IP address which is probably only accessible from inside the steam network.
Is there any way to query these Gameservers for the A2S_INFO (e.g. by logging into the steam network)?
As an example, this is an official servers, which is only available from inside the Steam network:
{"addr":"169.254.173.78:41744","gameport":41744,"steamid":"90159483364902919","name":"Valve Matchmaking Server (Virginia srcds2015-iad1 #35)","appid":440,"gamedir":"tf","version":"7182415","product":"tf","region":255,"players":0,"max_players":6,"bots":0,"map":"mvm_ghost_town","secure":true,"dedicated":true,"os":"l","gametype":"hidden,mvm,valve"}