Author Topic: ENGINE PLUGIN: AGSteam v3.4 (Windows; Linux; Mac OS X)  (Read 70988 times)

Re: ENGINE PLUGIN: AGSteam v3.4 (Windows; Linux; Mac OS X)
« Reply #160 on: 15 Jun 2020, 21:53 »
I have achievements working fine but I'm unclear on how to tell AGS2Client which leaderboard to upload scores to.

My code is:

Code: Adventure Game Studio
  1.             AGS2Client.RequestLeaderboard("Individual_Level_Top_Scores", eAGS2ClientScoresRequestGlobal);  
  2.             AGS2Client.UploadScore(HighScore1);

I have three leaderboards which I reference in code that runs every time I save the high scores, but I have no entries in the Steam leaderboards... I seem to be doing something wrong but not sure what.

 

Re: ENGINE PLUGIN: AGSteam v3.4 (Windows; Linux; Mac OS X)
« Reply #161 on: 22 Jun 2020, 17:38 »
For anyone else who runs into the issue about, it appears that the only thing I'd messed up with not adding a Wait command after AGS2Client.RequestLeaderboard - I added a "Wait(20)" after it and seems to work fine now.
 

Re: ENGINE PLUGIN: AGSteam v3.4 (Windows; Linux; Mac OS X)
« Reply #162 on: 26 Jun 2020, 03:48 »
Hi CaptainD, I'm glad that you solved your problem. Do you have any questions about leaderboards? At first, I thought that it was an exciting feature and put it in my game, then I realized players actually don't care about leaderboards. Only 5% of players have registered themselves into leaderboards in my previous game. I still think it's a cool feature though :)
Proximity Entertainment

Re: ENGINE PLUGIN: AGSteam v3.4 (Windows; Linux; Mac OS X)
« Reply #163 on: 26 Jun 2020, 11:37 »
Hi CaptainD, I'm glad that you solved your problem. Do you have any questions about leaderboards? At first, I thought that it was an exciting feature and put it in my game, then I realized players actually don't care about leaderboards. Only 5% of players have registered themselves into leaderboards in my previous game. I still think it's a cool feature though :)

I haven't released the game on Steam yet (and am likely to only get a handful of players anyway), so I have no idea how much interest there will be, but the particular game I'm working on lends itself to the leaderboard idea - arcade, short gameplay rounds, high customisability so you can make the game easy or much harder (the tougher the setting, the higher the score multipliers etc).  So will have to wait and see...  I'm not aware if the player has to do anything besides have a Steam account for the scores to upload, but will cross that bridge when I come to it!

I did alter the code based on recommendations by Denis (AGS user "Problem") to repeatedly attempt connection to the leaderboard in case it didn't sync properly the first time, I will post the code later in case anyone finds it useful.

Hope your games using the Leaderboard code eventually have more players register to use it!
 

Re: ENGINE PLUGIN: AGSteam v3.4 (Windows; Linux; Mac OS X)
« Reply #164 on: 26 Jun 2020, 14:10 »
Hi CaptainD, I'm glad that you solved your problem. Do you have any questions about leaderboards? At first, I thought that it was an exciting feature and put it in my game, then I realized players actually don't care about leaderboards. Only 5% of players have registered themselves into leaderboards in my previous game. I still think it's a cool feature though :)

I haven't released the game on Steam yet (and am likely to only get a handful of players anyway), so I have no idea how much interest there will be, but the particular game I'm working on lends itself to the leaderboard idea - arcade, short gameplay rounds, high customisability so you can make the game easy or much harder (the tougher the setting, the higher the score multipliers etc).  So will have to wait and see...  I'm not aware if the player has to do anything besides have a Steam account for the scores to upload, but will cross that bridge when I come to it!

I did alter the code based on recommendations by Denis (AGS user "Problem") to repeatedly attempt connection to the leaderboard in case it didn't sync properly the first time, I will post the code later in case anyone finds it useful.

Hope your games using the Leaderboard code eventually have more players register to use it!

I did 3 seconds loops of uploads on repeatedly_execute_always while CurrentLeaderboard isn't null. When the game calls UploadScore, it has always uploaded the score for the first time but there is no harm using repeatedly_execute to make sure. The plugin is well optimized and never slows down the engine even if you call it every loop. The only thing bothers me is when Steam Overlay is active, the mouse still controls the game cursor so I can't move the windows cursor over Steam UI.
Proximity Entertainment

Re: ENGINE PLUGIN: AGSteam v3.4 (Windows; Linux; Mac OS X)
« Reply #165 on: 21 Oct 2020, 02:36 »
Hi, I am experiencing this error: "Runtime error: unresolved import 'Steam::AddAchievement^1'."

This occurs when launching Blackwell: Deception on linux. I have no interest in the steam integration, just in launching the game without crashing.

I am running AGS v.3.5.0.27. I invoked the game with "./ags <path-to-game-directory>/'. The game directory contains several windows exes and dlls, including agsteam, but no linux executables or libraries. I would use "ldd" to check for missing libraries but there is no linux executable for me to run it on.

(When compiling AGS, I had to change the Makefile to compile libdumb and libaldmb dynamically instead of statically as this library is only available dynamically in my distro.)

Let me know if any other information would be helpful, thanks.

(The game runs poorly with wine, using 100% cpu and lagging horribly.)

Re: ENGINE PLUGIN: AGSteam v3.4 (Windows; Linux; Mac OS X)
« Reply #166 on: 21 Oct 2020, 05:26 »
I thought Wadjet Eye was providing linux builds too...

Hi, I am experiencing this error: "Runtime error: unresolved import 'Steam::AddAchievement^1'."

I do not know all about steam plugin's history, but it may be that the game was made with older version of steam plugin, and engine does not have any stub registered for this. It has stub for "AGSteam::IsAchievementAchieved^1" for example (these were names suggested by plugin author). Perhaps adding more variants to the list of stubs will resolve the issue.

These could be found in RegisterPluginStubs function (Engine/plugin/global_plugin.cpp).

Also, could you tell, what is the exact name of plugin dll (or .so if any) found with original game?


Re: ENGINE PLUGIN: AGSteam v3.4 (Windows; Linux; Mac OS X)
« Reply #167 on: 21 Oct 2020, 19:48 »
I thought Wadjet Eye was providing linux builds too...

[...] Also, could you tell, what is the exact name of plugin dll (or .so if any) found with original game?

Only the first three games had linux builds. Blackwell: Deception ships with agsteam.dll and steam_api.dll, as well as Deception.exe, acsetup.cfg, ags_shell.dll, audio.vox, desktop.ini, prog.bwd, speech.vox, steam_appid.txt, and winsetup.exe.

Are you suggesting I should edit AGS so it has some empty function with the name that is missing?

I've read elsewhere that it was made with an older version of AGS, but I could not figure out any way to determine which version I would need. It was released on 2011 Oct 12.

Re: ENGINE PLUGIN: AGSteam v3.4 (Windows; Linux; Mac OS X)
« Reply #168 on: 22 Oct 2020, 18:14 »
Only the first three games had linux builds. Blackwell: Deception ships with agsteam.dll ...

Ah, alright, the stubs are registered for "agsteam" plugin name, so only problem is that function names are different for some reason.

Are you suggesting I should edit AGS so it has some empty function with the name that is missing?

You could try, if you like, as it may be pretty straightforward: find Engine/plugin/global_plugin.cpp and copy a section of code:
Code: C++
  1.     if (is_agsteam)
  2.     {
  3.       ccAddExternalStaticFunction("AGSteam::IsAchievementAchieved^1", Sc_PluginStub_Int0);
  4.       ccAddExternalStaticFunction("AGSteam::SetAchievementAchieved^1", Sc_PluginStub_Int0);
  5.       ccAddExternalStaticFunction("AGSteam::ResetAchievement^1", Sc_PluginStub_Int0);
  6.       ccAddExternalStaticFunction("AGSteam::GetIntStat^1", Sc_PluginStub_Int0);
  7.       ccAddExternalStaticFunction("AGSteam::GetFloatStat^1", Sc_PluginStub_Int0);
  8.       ccAddExternalStaticFunction("AGSteam::GetAverageRateStat^1", Sc_PluginStub_Int0);
  9.       ccAddExternalStaticFunction("AGSteam::SetIntStat^2", Sc_PluginStub_Int0);
  10.       ccAddExternalStaticFunction("AGSteam::SetFloatStat^2", Sc_PluginStub_Int0);
  11.       ccAddExternalStaticFunction("AGSteam::UpdateAverageRateStat^3", Sc_PluginStub_Int0);
  12.       ccAddExternalStaticFunction("AGSteam::ResetStatsAndAchievements^0", Sc_PluginStub_Void);
  13.       ccAddExternalStaticFunction("AGSteam::get_Initialized", Sc_PluginStub_Int0);
  14.       ccAddExternalStaticFunction("AGSteam::get_CurrentLeaderboardName", Sc_PluginStub_NullStr);
  15.       ccAddExternalStaticFunction("AGSteam::RequestLeaderboard^3", Sc_PluginStub_Void);
  16.       ccAddExternalStaticFunction("AGSteam::UploadScore^1", Sc_PluginStub_Int0);
  17.       ccAddExternalStaticFunction("AGSteam::geti_LeaderboardNames", Sc_PluginStub_NullStr);
  18.       ccAddExternalStaticFunction("AGSteam::geti_LeaderboardScores", Sc_PluginStub_Int0);
  19.       ccAddExternalStaticFunction("AGSteam::get_LeaderboardCount", Sc_PluginStub_Int0);
  20.       ccAddExternalStaticFunction("AGSteam::GetUserName^0", Sc_PluginStub_NullStr);
  21.       ccAddExternalStaticFunction("AGSteam::GetCurrentGameLanguage^0", Sc_PluginStub_NullStr);
  22.       ccAddExternalStaticFunction("AGSteam::FindLeaderboard^1", Sc_PluginStub_Void);
  23.     }
  24.  

...and replace all instances of "AGSteam::" with "Steam::".

If that works we may add this to main repository too :).

Or later when I have more spare time I could check out the game myself.


I've read elsewhere that it was made with an older version of AGS, but I could not figure out any way to determine which version I would need. It was released on 2011 Oct 12.

When you run the game, engine should print something like "Game data version: NNN" and "Compiled with: AGS X.X.X" to console, which may give at least approximate idea.
But, I dont think knowing this will help to solve this problem, as older engines did not have any Steam stubs at all (they were added much later).
There was also a Steam stub plugin, created by AGSSteam author (https://github.com/monkey0506/ags2clientstub), but I've got a suspicion that it may have exactly same problem of having newer function names. I dont know if there's an older version of that.

Re: ENGINE PLUGIN: AGSteam v3.4 (Windows; Linux; Mac OS X)
« Reply #169 on: 22 Oct 2020, 22:17 »
Thank you for your help, it now works!

In any addition to the changes you suggested, I added

ccAddExternalStaticFunction("Steam::AddAchievement^1", Sc_PluginStub_Void);

I just guessed at "void" but the engine hasn't crashed so maybe that's fine. We'll see what happens if I get an in-game achievement.

I don't know how I missed it before (since I was looking), but on startup it says:

Game data version: 42
Compiled with: 3.2.0

Unfortunately the game no longer automatically progresses through dialog; I have to manually advance the conversation after each dialog clip is played. Maybe there's an option somewhere to change that.