lpradel / steam-web-api-java

:steam_locomotive: Java library to provide access to the data available from Valve's Steam API
Apache License 2.0
78 stars 16 forks source link

Problem with games #4

Closed MattFLying closed 2 years ago

MattFLying commented 8 years ago

Hello,

I started work with your code but I have a few problems, I don't understand where is the problem so I hope you can help me. So,

At the beginning I wanted test how works the game list. I did it:

public class SteamWebApiDemo {
  private static final String key = "MY_KEY";

  public static void main( String[] args ) throws SteamApiException {
    SteamWebApiClient client = new SteamWebApiClient.SteamWebApiClientBuilder( key ).build();
    GetOwnedGamesRequest req = new GetOwnedGamesRequest.GetOwnedGamesRequestBuilder( "76561198033046525" ).buildRequest();
    GetOwnedGames g = client.<GetOwnedGames> processRequest(req);

    for( com.lukaspradel.steamapi.data.json.ownedgames.Game game : g.getResponse().getGames() ) {
      System.out.println( game.getAppid() + ": " + game.getName() );
    }
}

Here I want to extract MY games list and I want to show GameId and name BUT in result I get ID's where each name is NULL:

10: null 20: null 30: null 40: null 50: null 60: null 70: null

It is my first problem - Why I can't see name of all games?


Okay this problem is resolved. Should be .includeAppInfo(true).buildRequest(); For all names but still is problem with game_count I don't know right now if it is normal in Steam Web Api because it is count of all games + DLC's. In my example it is FEAR + some dlc. Here I have some suggestion to you, maybe make in games category for DLC?


Now is next problem much strange with documentation, maybe you can explain it to me. So, I tried to use links from doc to get full list of my games:

http://api.steampowered.com/IPlayerService/GetOwnedGames/v0001/?key=MY_KEY&steamid=76561198033046525&format=json

And I receive these games but only with 2 attributes appId and playtime_forever. Here is one problem:

"response": {
        "game_count":

game_count show wrong value, in this case shows 122 games where I have 118 on steam. - What is wrong here or what I didn't understand?

The last problem is with game Id. From upper list in JSON I tried to use a few ID's. For example here, ID=10 is for Counter Strike, so I tried to use again link from doc for SchemaGame:

http://api.steampowered.com/ISteamUserStats/GetSchemaForGame/v2/?key=MY_KEY&appid=10

And in result I see this:

{
    "game": {

    }
}

For other example with other random ID I see this:

http://api.steampowered.com/ISteamUserStats/GetSchemaForGame/v2/?key=MY_KEY&appid=58610

and in result I got this:

{
    "game": {
        "gameName": "ValveTestApp58610",
        "gameVersion": "13",
        "availableGameStats": {
            "achievements": [
........

Why as the game name I got "ValveTestApp58610" not real name?

Could you explain me where is the problem or what I did wrong? For clarity, I have correct key and my profile is public on steam.

lpradel commented 8 years ago

Hi Mateusz,

let me answer your questions one by one.

Okay this problem is resolved. Should be .includeAppInfo(true).buildRequest(); For all names but still is problem with game_count I don't know right now if it is normal in Steam Web Api because it is count of all games + DLC's. In my example it is FEAR + some dlc. Here I have some suggestion to you, maybe make in games category for DLC?

From what I understand you solved the problem yourself correctly by using include_appinfo parameter. In regards to your suggestion: I can see how that would certainly be useful but currently the purpose of the library is to provide the objects given by the library "as is". If I decide to provide additional information to the objects then I will need to distinguish these "supplemented" objects from the original ones given by the library. I will consider it, thank you for the suggestion!

And I receive these games but only with 2 attributes appId and playtime_forever. Here is one problem:

This can be fixed by using the include_appinfo argument as well:

http://api.steampowered.com/IPlayerService/GetOwnedGames/v0001/?key=MY_KEY&steamid=76561198033046525&format=json&include_appinfo=1

This request yields the following:

{
"response": {
    "game_count": 122,
    "games": [
        {
            "appid": 10,
            "name": "Counter-Strike",
            "playtime_forever": 12056,
            "img_icon_url": "6b0312cda02f5f777efa2f3318c307ff9acafbb5",
            "img_logo_url": "af890f848dd606ac2fd4415de3c3f5e7a66fcb9f",
            "has_community_visible_stats": true
        },
[....]

Note that the GetOwnedGamesRequestBuilder has an argument for include_appinfo for this.

game_count show wrong value, in this case shows 122 games where I have 118 on steam. - What is wrong here or what I didn't understand?

If this is indeed wrong, then it is a problem in the Steam API that I can't fix unfortunately. My own account has > 300 games as well so it's hard to verify. Maybe they use an unintuitive method of counting: for example, some games have Windows + Mac + Linux versions that will also appear as multiple entries in your Steam client even though it is technically "one game". Other games like Left 4 Dead 2 have an additional entry for "Beta" and so forth.

The last problem is with game Id. From upper list in JSON I tried to use a few ID's. For example here, ID=10 is for Counter Strike, so I tried to use again link from doc for SchemaGame:

This is definitely an issue with their web API. To get definitive correct information about a game given the ID you need to use the storefront API like this:

http://store.steampowered.com/api/appdetails/?appids=10

Result:

{
"10":{
    "success":true,
    "data":{
        "type":"game",
        "name":"Counter-Strike",
        "steam_appid":10,
        "required_age":0,
        "is_free":false,
        "detailed_description":"Play the world's number 1 online action game. Engage in an incredibly realistic brand of terrorist warfare in this wildly popular team-based game. Ally with teammates to complete strategic missions. Take out enemy sites. Rescue hostages. Your role affects your team's success. Your team's success affects your role.",
        "about_the_game":"Play the world's number 1 online action game. Engage in an incredibly realistic brand of terrorist warfare in this wildly popular team-based game. Ally with teammates to complete strategic missions. Take out enemy sites. Rescue hostages. Your role affects your team's success. Your team's success affects your role.",
        "supported_languages":"English, French, German, Italian, Spanish, Simplified Chinese, Traditional Chinese, Korean",
        "header_image":"http:\/\/cdn.akamai.steamstatic.com\/steam\/apps\/10\/header.jpg?t=1447887426",
        "website":null,
        "pc_requirements":{ 
[...]

Unfortunately the storefront API works a little differently and I haven't gotten around to adding it to my library yet (see #2 ).

Why as the game name I got "ValveTestApp58610" not real name?

This is also an issue of the web API and can be solved in the same manner as problem 4 by using the storefront API like this:

store.steampowered.com/api/appdetails/?appids=58610

Result:

{
"58610":{
    "success":true,
    "data":{
        "type":"game",
        "name":"Wargame: European Escalation",
        "steam_appid":58610,
        "required_age":0,
        "is_free":false,
        "dlc":[
            58645,
            58646,
            58648,
            58643
        ],
        "detailed_description":"<strong>2 sides, 8 nations, and one battlefield: Europe!<\/strong><br>\t\t\t\t\t\tWargame: European Escalation is an intense and spectacular Real Time Strategy game, where realism and strategy are brought to the front lines. <br>\t\t\t\t\t\tWith a phenomenal range of vehicles and units (over 350 different models), build your army and enter a huge military campaign across Europe of the 80's, as the Cold War is about to become World War 3.<br>\t\t\t\t\t\tWith the powerful IRISZOOM \u2122, Wargame offers breathtaking graphics and battles as spectacular as they are strategic. Prepare to bring hundreds of units of all kinds--tanks, helicopters, squad Infantry, etc.--under your command in intense battles on gigantic maps stretching up to 60 square miles!<br>\t\t\t\t\t\tOnline service EugenNet\u00a9 provides a full multiplayer experience with creation of clans, organizing games, and world rankings where up to 8 players can compete simultaneously in massive battles involving hundreds of units!",
        [....]

If you habe more questions, please ask.

For now, merry x-mas to you and your family! :christmas_tree: :santa:

MattFLying commented 8 years ago

Thank you for answer :smiley:

So, I resolve problem with informations by using include_appinfo, now is okay but no enough - but as you said it is in StoreFrontApi. Actually I using your library to project on college and I unfortunatelly can't wait for your improvements BUT I'll wait for my private project in near future, I really like your library :wink:

@ About third problem with wrong games count It shows not only games but everything - games, DLC, trailers etc so I think it's problem in SteamWebApi too. Actually I don't know how to separate games than others but it's not a big problem actually - I'll try to do something when I'll finish basic operations.

@ About fourth Hmmm strange because this url doesn't work for id=10(CS 1.6) but works for oter games but not for all. I'll try use it later but only when I completly make app with current library.

Currently I made controllers for 3 requests: ownedgames, reentlygames and friends list. And they work fine, I can get names and some basic informations what is enough for me now. But I have problem with GetUserStatsForGame.

I try use this class to shows achievements of game. I can see just unlocked achievements BUT the name of achievement is in format like this: "eA_BulletsCantHurtMe" - without normal name even if I try use language "?l=english" or other, and field "game_name" is empty. And when I try use Stat then I don't see anything so there is my final question - What exactly is Stat class with fields: name and value? It doesn't work or I don't know how exactly should I use it.

Next, here is other class GetPlayerAchievements. Here I can see all achievements, if it is unlocked or not, even game_name AND here works specific language in my case "?l=polish". So, why I can't see these informations in GetUserStatsForGame but can there? In this case instead using GetUserStatsForGame I can use GetPlayerAchievements and just get only unlocked what in result is the same what I want from GetUserStatsForGame. Is it a problem in SteamWebApi too or maybe I doing something wrong? And something else about GetUserStatsForGame , when I try shows achievements for some game, sometimes I got exception code 400/500 or if game doesn't has achievements or if is problem @ Fourth when ids doesn't works for example id=10.

Thank you for your wishes and merry x-maxx too :wink:

lpradel commented 8 years ago

Hmmm strange because this url doesn't work for id=10(CS 1.6) but works for oter games but not for all. I'll try use it later but only when I completly make app with current library.

What do you mean? The request works fine for me:

http://store.steampowered.com/api/appdetails/?appids=10

{
"10":{
    "success":true,
    "data":{
        "type":"game",
        "name":"Counter-Strike",
        "steam_appid":10,
        "required_age":0,
        "is_free":false,
        "detailed_description":"Play the world's number 1 online action game. Engage in an incredibly realistic brand of terrorist warfare in this wildly popular team-based game. Ally with teammates to complete strategic missions. Take out enemy sites. Rescue hostages. Your role affects your team's success. Your team's success affects your role.",
        "about_the_game":"Play the world's number 1 online action game. Engage in an incredibly realistic brand of terrorist warfare in this wildly popular team-based game. Ally with teammates to complete strategic missions. Take out enemy sites. Rescue hostages. Your role affects your team's success. Your team's success affects your role.",
        "supported_languages":"English, French, German, Italian, Spanish, Simplified Chinese, Traditional Chinese, Korean",
        "header_image":"http:\/\/cdn.akamai.steamstatic.com\/steam\/apps\/10\/header.jpg?t=1447887426",
        "website":null,
        "pc_requirements":{
            "minimum":"\r\n\t\t\t<p><strong>Minimum:<\/strong> 500 mhz processor, 96mb ram, 16mb video card, Windows XP, Mouse, Keyboard, Internet Connection<br \/><\/p>\r\n\t\t\t<p><strong>Recommended:<\/strong> 800 mhz processor, 128mb ram, 32mb+ video card, Windows XP, Mouse, Keyboard, Internet Connection<br \/><\/p>\r\n\t\t\t"
        },
        "mac_requirements":{
            "minimum":"Minimum: OS X  Snow Leopard 10.6.3, 1GB RAM, 4GB Hard Drive Space,NVIDIA GeForce 8 or higher, ATI X1600 or higher, or Intel HD 3000 or higher Mouse, Keyboard, Internet Connection"
        },
        "linux_requirements":{
            "minimum":"Minimum: Linux Ubuntu 12.04, Dual-core from Intel or AMD at 2.8 GHz, 1GB Memory, nVidia GeForce 8600\/9600GT, ATI\/AMD Radeaon HD2600\/3600 (Graphic Drivers: nVidia 310, AMD 12.11), OpenGL 2.1, 4GB Hard Drive Space, OpenAL Compatible Sound Card"
        },
        "developers":[
            "Valve"
        ],
        "publishers":[
            "Valve"
        ],
        "price_overview":{
            "currency":"EUR",
            "initial":999,
            "final":499,
            "discount_percent":50
        },
        "packages":[
            7,
            41,
            54030,
            29198
        ],
        "package_groups":[
            {
                "name":"default",
                "title":"Buy Counter-Strike",
                "description":"",
                "selection_text":"Select a purchase option",
                "save_text":"",
                "display_type":0,
                "is_recurring_subscription":"false",
                "subs":[
                    {
                        "packageid":7,
                        "percent_savings_text":"-50%",
                        "percent_savings":0,
                        "option_text":"Counter-Strike: Condition Zero - <span class=\"discount_original_price\">9,99\u20ac<\/span> 4,99\u20ac",
                        "option_description":"",
                        "can_get_free_license":"0",
                        "is_free_license":false,
                        "price_in_cents_with_discount":499
                    },
                    {
                        "packageid":41,
                        "percent_savings_text":"-50%",
                        "percent_savings":0,
                        "option_text":"Counter-Strike 1 Anthology - <span class=\"discount_original_price\">14,99\u20ac<\/span> 7,49\u20ac",
                        "option_description":"",
                        "can_get_free_license":"0",
                        "is_free_license":false,
                        "price_in_cents_with_discount":749
                    },
                    {
                        "packageid":54030,
                        "percent_savings_text":"-50%",
                        "percent_savings":0,
                        "option_text":"Counter-Strike Complete - <span class=\"discount_original_price\">27,99\u20ac<\/span> 13,99\u20ac",
                        "option_description":"",
                        "can_get_free_license":"0",
                        "is_free_license":false,
                        "price_in_cents_with_discount":1399
                    },
                    {
                        "packageid":29198,
                        "percent_savings_text":"-75%",
                        "percent_savings":0,
                        "option_text":"Valve Complete Pack - <span class=\"discount_original_price\">92,99\u20ac<\/span> 23,24\u20ac",
                        "option_description":"",
                        "can_get_free_license":"0",
                        "is_free_license":false,
                        "price_in_cents_with_discount":2324
                    }
                ]
            }
        ],
        "platforms":{
            "windows":true,
            "mac":true,
            "linux":true
        },
        "metacritic":{
            "score":88,
            "url":"http:\/\/www.metacritic.com\/game\/pc\/counter-strike"
        },
        "categories":[
            {
                "id":1,
                "description":"Multi-player"
            },
            {
                "id":8,
                "description":"Valve Anti-Cheat enabled"
            }
        ],
        "genres":[
            {
                "id":"1",
                "description":"Action"
            }
        ],
        "screenshots":[
            {
                "id":0,
                "path_thumbnail":"http:\/\/cdn.akamai.steamstatic.com\/steam\/apps\/10\/0000000132.600x338.jpg?t=1447887426",
                "path_full":"http:\/\/cdn.akamai.steamstatic.com\/steam\/apps\/10\/0000000132.1920x1080.jpg?t=1447887426"
            },
            {
                "id":1,
                "path_thumbnail":"http:\/\/cdn.akamai.steamstatic.com\/steam\/apps\/10\/0000000133.600x338.jpg?t=1447887426",
                "path_full":"http:\/\/cdn.akamai.steamstatic.com\/steam\/apps\/10\/0000000133.1920x1080.jpg?t=1447887426"
            },
            {
                "id":2,
                "path_thumbnail":"http:\/\/cdn.akamai.steamstatic.com\/steam\/apps\/10\/0000000134.600x338.jpg?t=1447887426",
                "path_full":"http:\/\/cdn.akamai.steamstatic.com\/steam\/apps\/10\/0000000134.1920x1080.jpg?t=1447887426"
            },
            {
                "id":3,
                "path_thumbnail":"http:\/\/cdn.akamai.steamstatic.com\/steam\/apps\/10\/0000000135.600x338.jpg?t=1447887426",
                "path_full":"http:\/\/cdn.akamai.steamstatic.com\/steam\/apps\/10\/0000000135.1920x1080.jpg?t=1447887426"
            },
            {
                "id":4,
                "path_thumbnail":"http:\/\/cdn.akamai.steamstatic.com\/steam\/apps\/10\/0000000136.600x338.jpg?t=1447887426",
                "path_full":"http:\/\/cdn.akamai.steamstatic.com\/steam\/apps\/10\/0000000136.1920x1080.jpg?t=1447887426"
            },
            {
                "id":5,
                "path_thumbnail":"http:\/\/cdn.akamai.steamstatic.com\/steam\/apps\/10\/0000002540.600x338.jpg?t=1447887426",
                "path_full":"http:\/\/cdn.akamai.steamstatic.com\/steam\/apps\/10\/0000002540.1920x1080.jpg?t=1447887426"
            },
            {
                "id":6,
                "path_thumbnail":"http:\/\/cdn.akamai.steamstatic.com\/steam\/apps\/10\/0000002539.600x338.jpg?t=1447887426",
                "path_full":"http:\/\/cdn.akamai.steamstatic.com\/steam\/apps\/10\/0000002539.1920x1080.jpg?t=1447887426"
            },
            {
                "id":7,
                "path_thumbnail":"http:\/\/cdn.akamai.steamstatic.com\/steam\/apps\/10\/0000002538.600x338.jpg?t=1447887426",
                "path_full":"http:\/\/cdn.akamai.steamstatic.com\/steam\/apps\/10\/0000002538.1920x1080.jpg?t=1447887426"
            },
            {
                "id":8,
                "path_thumbnail":"http:\/\/cdn.akamai.steamstatic.com\/steam\/apps\/10\/0000002537.600x338.jpg?t=1447887426",
                "path_full":"http:\/\/cdn.akamai.steamstatic.com\/steam\/apps\/10\/0000002537.1920x1080.jpg?t=1447887426"
            },
            {
                "id":9,
                "path_thumbnail":"http:\/\/cdn.akamai.steamstatic.com\/steam\/apps\/10\/0000002536.600x338.jpg?t=1447887426",
                "path_full":"http:\/\/cdn.akamai.steamstatic.com\/steam\/apps\/10\/0000002536.1920x1080.jpg?t=1447887426"
            },
            {
                "id":10,
                "path_thumbnail":"http:\/\/cdn.akamai.steamstatic.com\/steam\/apps\/10\/0000002541.600x338.jpg?t=1447887426",
                "path_full":"http:\/\/cdn.akamai.steamstatic.com\/steam\/apps\/10\/0000002541.1920x1080.jpg?t=1447887426"
            },
            {
                "id":11,
                "path_thumbnail":"http:\/\/cdn.akamai.steamstatic.com\/steam\/apps\/10\/0000002542.600x338.jpg?t=1447887426",
                "path_full":"http:\/\/cdn.akamai.steamstatic.com\/steam\/apps\/10\/0000002542.1920x1080.jpg?t=1447887426"
            },
            {
                "id":12,
                "path_thumbnail":"http:\/\/cdn.akamai.steamstatic.com\/steam\/apps\/10\/0000002543.600x338.jpg?t=1447887426",
                "path_full":"http:\/\/cdn.akamai.steamstatic.com\/steam\/apps\/10\/0000002543.1920x1080.jpg?t=1447887426"
            }
        ],
        "recommendations":{
            "total":54470
        },
        "achievements":{
            "total":0
        },
        "release_date":{
            "coming_soon":false,
            "date":"1 Nov, 2000"
        },
        "support_info":{
            "url":"http:\/\/steamcommunity.com\/app\/10",
            "email":""
        },
        "background":"http:\/\/cdn.akamai.steamstatic.com\/steam\/apps\/10\/page_bg_generated_v6b.jpg?t=1447887426"
    }
}

}

I try use this class to shows achievements of game. I can see just unlocked achievements BUT the name of achievement is in format like this: "eA_BulletsCantHurtMe" - without normal name even if I try use language "?l=english" or other, and field "game_name" is empty. And when I try use Stat then I don't see anything so there is my final question - What exactly is Stat class with fields: name and value? It doesn't work or I don't know how exactly should I use it.

The Stat field is used for certain games that include both "achievements" and "stats" such as for example Team Fortress 2. See this example:

http://api.steampowered.com/ISteamUserStats/GetUserStatsForGame/v0002/?appid=440&key=KEY&steamid=76561197972495328

Result:

{
"playerstats": {
    "steamID": "76561197972495328",
    "gameName": "Team Fortress 2",
    "stats": [
        {
            "name": "Scout.accum.iBuildingsDestroyed",
            "value": 123
        },
[....]
            ,
    "achievements": [
        {
            "name": "TF_PLAY_GAME_EVERYCLASS",
            "achieved": 1
        },
[...]

Next, here is other class GetPlayerAchievements. Here I can see all achievements, if it is unlocked or not, even game_name AND here works specific language in my case "?l=polish". So, why I can't see these informations in GetUserStatsForGame but can there? In this case instead using GetUserStatsForGame I can use GetPlayerAchievements and just get only unlocked what in result is the same what I want from GetUserStatsForGame. Is it a problem in SteamWebApi too or maybe I doing something wrong?

I'm afraid that is a problem with the API, I don't get full description with the language argument for GetUserStatsForGame either :disappointed:

And something else about GetUserStatsForGame , when I try shows achievements for some game, sometimes I got exception code 400/500 or if game doesn't has achievements or if is problem @ Fourth when ids doesn't works for example id=10.

Apparently that's just how the API works with these games...

MattFLying commented 8 years ago

Strange I had done something wrong because now this url works fine :open_mouth:

About stats I understand now, I didn't know what exactly is Stat here but now is clear thanks for explain :wink:

I think I give up with GetUserStatsForGame and use just Player Achievements. Okay actually I think everything is clear If I had more questions Illl ask you :wink:

lpradel commented 2 years ago

I think at this point it's safe to assume that @MattFLying had no further questions 😬