Author Topic: ENGINE PLUGIN: AGSteam v3.4 - Mac OS X!  (Read 40023 times)

JSH

  • Founder of Clifftop Games
    • JSH worked on a game that was nominated for an AGS Award!
      JSH worked on a game that won an AGS Award!
Re: ENGINE PLUGIN: AGSteam - Now for Linux! - 5 April 2014
« Reply #40 on: 06 Sep 2015, 05:39 »
Is there a way to detect if the steam overlay is open? I'd like to pause the game when that happens, since right now the game responds to mouse clicks and keyboard input when I chat with a friend using the overlay.

My first idea was just to simply intercept the shift+tab key combination in AGS but apparently the shortcut can be rebound in the steam settings...

*edit Not to mention, the overlay can be disabled altogether in the game options in steam too.
« Last Edit: 06 Sep 2015, 09:39 by JSH »

Dave Gilbert

  • Mittens Vassal
  • AGS Baker
  • Hi. Our names are FRIGGING ADORABLE.
    • Lifetime Achievement Award Winner
    •  
    • Dave Gilbert worked on a game that was nominated for an AGS Award!
      Dave Gilbert worked on a game that won an AGS Award!
Re: ENGINE PLUGIN: AGSteam - Now for Linux! - 5 April 2014
« Reply #41 on: 06 Sep 2015, 12:11 »
The Steam overlay has been one of our biggest issues so far (third only to save game compatibility on updates and the inability to change resolution from within the game). AGS games react in really unpredictable ways when the overlay is activated. The game freezes, or dialog zooms by really fast, or any number of things. My theory, and it's only a theory, is that you are running the game natively in a very small resolution? The overlay is in a higher resolution, so displaying both at the same time tends to have unpredictable results. I've noticed that the higher resolution I run a game in (using the "max nearest neighbor filter" in the later versions of AGS) the fewer problems there are.

As for pausing the game when the overlay is active, I am unsure! It pauses fine when I use the overlay, but as I said the results tend to be unpredictable.

monkey0506

  • AGS Project Tracker Admins
  • SEND PIZZA.
    • Best Innovation Award Winner 2017, for his work to help AGS games reach the widest possible audience - through popular distribution platforms (Steam, Galaxy) as well as other operating systems (Android, Linux)
    •  
Re: ENGINE PLUGIN: AGSteam - Now for Linux! - 5 April 2014
« Reply #42 on: 15 Sep 2015, 22:56 »
As far as the Steam overlay goes, the latest version of the Steam plugin uses the following code (released as part of the open-source stub):

AGSteamMain.cpp:162
Code: C++
  1. int AGS_EngineOnEvent(int event, int data)
  2. {
  3.     if (event == AGSE_FINALSCREENDRAW)
  4.     {
  5.         // use this as main_game_loop
  6.         // the screen is drawn every actual game loop anyway
  7.         AGSteam::Stub::GetAGSteam()->Update();
  8.     }
  9.     else if (event == AGSE_KEYPRESS)
  10.     {
  11.         typedef int (*IsKeyPressed_t)(int);
  12.         IsKeyPressed_t IsKeyPressed = reinterpret_cast<IsKeyPressed_t>(engine->GetScriptFunctionAddress("IsKeyPressed"));
  13.         bool isShift = ((data == 403) || (data == 404)); // is pressed key shift
  14.         bool isTab = (data == 9); // is pressed key tab
  15.         bool isShiftTab = ((data == 0x00001111) || // shift+tab as a single key
  16.             ((isShift) && (IsKeyPressed(9) != 0)) || // key is shift and tab is held
  17.             ((isTab) && ((IsKeyPressed(403) != 0) || (IsKeyPressed(404) != 0)))); // key is tab and shift is held
  18.         return isShiftTab; // Claim (Shift+Tab), ignore other keys
  19.     }
  20.     return 0;
  21. }

I added this when working on Al Emmo. I don't recall if Chris said this definitely fixed everything, but it attempts to force the engine to ignore the Steam overlay being opened and closed. As I recall, that seemed to be enough to stop AGS from going crazy in the background. If not, then I might consider having the plugin keep track of whether the overlay is open, but I was afraid of that somehow getting out of sync and causing worse problems. Just to be sure, you are using the latest version of the plugin linked in the first post?

P.S. As you obviously are a Steam developer, I could give you access to the full source code of the plugin if needed.

FNGames

    • I can help with animation
    •  
    • I can help with backgrounds
    •  
    • I can help with characters
    •  
    • I can help with making music
    •  
    • I can help with voice acting
    •  
Re: ENGINE PLUGIN: AGSteam - Now for Linux! - 5 April 2014
« Reply #43 on: 18 Sep 2015, 21:38 »
My adventure game, Absent, was released on Steam recently!
http://store.steampowered.com/app/398450

Any chance you could add that one to the list on the front page?

I've updated the games' credits and put you in there for designing the plugin too. :)

JSH

  • Founder of Clifftop Games
    • JSH worked on a game that was nominated for an AGS Award!
      JSH worked on a game that won an AGS Award!
Re: ENGINE PLUGIN: AGSteam - Now for Linux! - 5 April 2014
« Reply #44 on: 27 Sep 2015, 12:26 »
P.S. As you obviously are a Steam developer, I could give you access to the full source code of the plugin if needed.

Thanks a ton for the source code, it has saved so much time on my end! :)

Re: ENGINE PLUGIN: AGSteam - Now for Linux! - 5 April 2014
« Reply #45 on: 15 Nov 2015, 21:53 »
If i understood, i don't have to write nothing in the code of my game only copy and paste the .dll library in the main proyect folder, ┬┐that's correct?.

m0ds

  • Guest
Re: ENGINE PLUGIN: AGSteam - Now for Linux! - 5 April 2014
« Reply #46 on: 28 Dec 2015, 15:16 »
I am hearing of new issues with our game, in places where it has worked fine previously on Linux - is it possible the .so files are out of date compared to latest versions of Linux? Not knowing how Linux stuff really goes, thats the best I can come up with..

monkey0506

  • AGS Project Tracker Admins
  • SEND PIZZA.
    • Best Innovation Award Winner 2017, for his work to help AGS games reach the widest possible audience - through popular distribution platforms (Steam, Galaxy) as well as other operating systems (Android, Linux)
    •  
Re: ENGINE PLUGIN: AGSteam - Now for Linux! - 5 April 2014
« Reply #47 on: 09 Jan 2016, 03:06 »
Sorry for the unresponsiveness folks. Latest binaries are up with some significant changes. AGSteam now supports unified builds by default (agsteam.dll). If you want to continue using the Steam-specific struct name of "AGSteam" in your game scripts, feel free to use the "disjoint" plugin (agsteam-disjoint.dll) instead. All this really changes is how you call the Steam functions, but the two versions (unified and disjoint) generally shouldn't be used together (theoretically they won't conflict, but there's just no reason to have both since they do the same thing).

@Neo_One: You don't have to even initialize the Steam API to release a game on Steam. A lot of Steam games don't use Steamworks, have no achievements, etc. You only need to use this plugin if you have achievements, and as such, you do have to tell the plugin when the achievements (etc.) should be set. You do this with some simple function calls, such as:

Code: Adventure Game Studio
  1. AGS2Client.SetAchievementAchieved("ACHIEVEMENT_01");

Where "ACHIEVEMENT_01" is the API name of your achievement (as set up on the Steamworks backend website). This is how Steam knows that the achievement has been unlocked. You would call this function whenever the player triggers the action that unlocks the achievement.

@Mark: Not sure, I'll look into it. I know Linux has been an on-going issue for you. I will contact you.

Dualnames

  • Local Moderator
  • Rottwheelers
  • Pretty Badass
    • Dualnames worked on a game that was nominated for an AGS Award!
      Dualnames worked on a game that won an AGS Award!
Re: ENGINE PLUGIN: AGSteam - Unified builds! - 8 January 2016
« Reply #48 on: 08 Feb 2016, 23:18 »
Script link failed: Runtime error: unrersolved import 'ASG2Client::SetAchievementAchieved^1'

Some of my users (others have no problems) get this, being unable to run the game at all. I'm using the AGSSteam Plugin only (Windows), any thoughts? It's driving me crazy.

No more military army stuff. I'm alive and back.

Dualnames

  • Local Moderator
  • Rottwheelers
  • Pretty Badass
    • Dualnames worked on a game that was nominated for an AGS Award!
      Dualnames worked on a game that won an AGS Award!
No more military army stuff. I'm alive and back.

Dualnames

  • Local Moderator
  • Rottwheelers
  • Pretty Badass
    • Dualnames worked on a game that was nominated for an AGS Award!
      Dualnames worked on a game that won an AGS Award!
Re: ENGINE PLUGIN: AGSteam - Unified builds! - 8 January 2016
« Reply #50 on: 09 Feb 2016, 03:23 »
Forgot to say that, the users having the problem are all on Windows, some even have the same exact Windows I'm using, and the issue happens regardless of whether Steam is up and running, or even installed at all. I run the game perfectly fine with Steam closed.
No more military army stuff. I'm alive and back.

monkey0506

  • AGS Project Tracker Admins
  • SEND PIZZA.
    • Best Innovation Award Winner 2017, for his work to help AGS games reach the widest possible audience - through popular distribution platforms (Steam, Galaxy) as well as other operating systems (Android, Linux)
    •  
Re: ENGINE PLUGIN: AGSteam - Unified builds! - 8 January 2016
« Reply #51 on: 09 Feb 2016, 19:29 »
I think it's probably this problem. Unfortunately there's no way for the plugin to know which version(s) of the Visual C++ Runtime any given user may have installed, though the engine itself does currently rely on the VC++2008 32-bit Runtime, so that probably would be the safest bet. I will take a look at recompiling all 6 plugins (AGSteam, AGSteamStub, AGSGalaxy, plus the "disjoint" builds of each) later today (hopefully) with VS2008 instead of VS2015.

Re: ENGINE PLUGIN: AGSteam - Unified builds! - 8 January 2016
« Reply #52 on: 18 Mar 2016, 15:15 »
Hi. Are Steam Achievements one time thing or do i need to supply them with extra variables to ensure that they are triggered only once ?

For example :

Code: Adventure Game Studio
  1. function repeatedly_execute_always() {
  2.     int doitonce=0;
  3.     if (score == 100) {
  4.         if (doitonce == 0) {
  5.             doitonce=1;
  6.             AGS2Client.SetAchievementAchieved("ACHIEVEMENT_01");
  7.         }
  8.     }
  9. }
  10.  

or is this just enough ? :

Code: Adventure Game Studio
  1. function repeatedly_execute_always() {
  2.     if (score == 100) {
  3.         AGS2Client.SetAchievementAchieved("ACHIEVEMENT_01");
  4.     }
  5. }
Proximity Entertainment

monkey0506

  • AGS Project Tracker Admins
  • SEND PIZZA.
    • Best Innovation Award Winner 2017, for his work to help AGS games reach the widest possible audience - through popular distribution platforms (Steam, Galaxy) as well as other operating systems (Android, Linux)
    •  
Re: ENGINE PLUGIN: AGSteam - Unified builds! - 8 January 2016
« Reply #53 on: 20 Mar 2016, 07:03 »
Well a function-local variable would always be reset every time the function is called anyway. :P

However, Steam doesn't have any issues with you "setting" an already set achievement, so there's no harm in calling the function more than once. If you're worried about the unnecessary callbacks, you could try to cache the results in-game, but that could easily get out of sync. A more efficient solution might be to use the engine's built-in scoring system, using game.score and GiveScore. You could then have something like:

Code: Adventure Game Studio
  1. function on_event(EventType event, int data)
  2. {
  3.   if (event == eEventGotScore)
  4.   {
  5.     if ((game.score >= 100) && (Game.DoOnceOnly("ACHIEVEMENT_01")))
  6.     {
  7.       AGS2Client.SetAchievementAchieved("ACHIEVEMENT_01");
  8.     }
  9.   }
  10. }

Then whenever you call GiveScore and the score exceeds or equals 100, the achievement is set, without having to poll for it every single game loop.

Re: ENGINE PLUGIN: AGSteam - Unified builds! - 8 January 2016
« Reply #54 on: 21 Mar 2016, 02:27 »
Well a function-local variable would always be reset every time the function is called anyway. :P

However, Steam doesn't have any issues with you "setting" an already set achievement, so there's no harm in calling the function more than once. If you're worried about the unnecessary callbacks, you could try to cache the results in-game, but that could easily get out of sync. A more efficient solution might be to use the engine's built-in scoring system, using game.score and GiveScore. You could then have something like:

Code: Adventure Game Studio
  1. function on_event(EventType event, int data)
  2. {
  3.   if (event == eEventGotScore)
  4.   {
  5.     if ((game.score >= 100) && (Game.DoOnceOnly("ACHIEVEMENT_01")))
  6.     {
  7.       AGS2Client.SetAchievementAchieved("ACHIEVEMENT_01");
  8.     }
  9.   }
  10. }

Then whenever you call GiveScore and the score exceeds or equals 100, the achievement is set, without having to poll for it every single game loop.

:grin::grin::grin: No no no :cheesy: I just gave an example to specify what doitonce is. In fact, I was planning to use global variables for that which are easy to use and recognised by all scripts. Additionally, I'm using a bit different scoring system; floats keep track of characters' stats in percent form. So, if calling an unlocked achievement causes no trouble to game-play, i can easily make this :

Code: Adventure Game Studio
  1. function repeatedly_execute_always() {
  2.    if (charstat > 99.99) {
  3.      AGS2Client.SetAchievementAchieved("ACHIEVEMENT_01");
  4.    }
  5. }

Thanks for the help monkey0506. That will save me from creating unnecessary variables. I have already tons of them and i wouldn't want to add any if it isn't absolutely necessary.
Proximity Entertainment

Re: ENGINE PLUGIN: AGSteam - Unified builds! - 8 January 2016
« Reply #55 on: 15 May 2016, 12:38 »
At last i'll use the plugin to insert achievement. But i have a question. Wich plugin of the list i  have to download to use it?.

Re: ENGINE PLUGIN: AGSteam - Unified builds! - 8 January 2016
« Reply #56 on: 20 Jul 2016, 07:58 »
RESOLVED - I MANAGED TO WORK THIS OUT. I missed a checkbox when setting the game up on Steamworks.

I've just released A Date on the Park on Steam, using this plugin. Quite a lot of users are reporting that the game doesn't run - please see this pic for the error report -



Any help is much appreciated! I've looked through the forum and seen that it could be an issue with DLL conflicts or Visual C++ Redistributable for Visual Studio 2015. Do you know if this is the case?

Many thanks,
Shaun
« Last Edit: 21 Jul 2016, 17:47 by shaun9991 »
Support Cloak and Dagger Games on Patreon: https://www.patreon.com/user?u=460039

Crimson Wizard

  • AGS Project Tracker Admins
    • Best Innovation Award Winner 2013, for spearheading the AGS 3.3.0 project
    •  
    • Lifetime Achievement Award Winner
    •  
    • Crimson Wizard worked on a game that was nominated for an AGS Award!
      Crimson Wizard worked on a game that won an AGS Award!
Re: ENGINE PLUGIN: AGSteam - Unified builds! - 8 January 2016
« Reply #57 on: 29 Jul 2016, 01:08 »
shaun9991, the error itself means that the AGS2Client plugin was not able to load (hence the game cannot use its script commands).

The question is why it happened. I would try to find out whether this plugin has any dependencies, like particular VisualC redistributable package has to be installed.

EDIT: Well, I could not find such information anywhere in this thread, or AGSClient thread (although maybe I missed it, a lot of text there).
However, since you know which plugin dll you are using, you can use dependency walker utility to find out which libraries it requires. Or tell us where we may download the plugin DLL, so that we could investigate.
« Last Edit: 29 Jul 2016, 01:14 by Crimson Wizard »

Dualnames

  • Local Moderator
  • Rottwheelers
  • Pretty Badass
    • Dualnames worked on a game that was nominated for an AGS Award!
      Dualnames worked on a game that won an AGS Award!
Re: ENGINE PLUGIN: AGSteam - Unified builds! - 8 January 2016
« Reply #58 on: 29 Jul 2016, 05:43 »
From personal tests, it's the redistributables. I had my game installed on various OS and when i managed to replicate the problem, it was solved by installing VC libraries.
No more military army stuff. I'm alive and back.

Re: ENGINE PLUGIN: AGSteam - Unified builds! - 8 January 2016
« Reply #59 on: 31 Jul 2016, 22:06 »
Hi guys, thanks for your messages.

When I initally released the game on Steam, I had overlooked the fact that I needed to include VC redistributables. When I fixed this it solved 90% of the problems, however, some people are still reporting the same error, and a couple have reported this error: "The program can't start because api-ms-win-crt-runtime-|1-1-0.dll is missing from your computer. Try Reinstalling the program to fix this Problem"

I've packaged the game to automatically download VC2015 and 2008, as well as the latest .NET framework. Is there some other redistributables I should be including here?

Here's a link to the agssteam.dll file the game uses: https://www.dropbox.com/s/3wfys2vpp4j0e8j/AGSteam.dll?dl=0

I ran it through the Dependency checker but I'm not too sure what I'm doing... any help much appreciated!

Thanks
Shaun
Support Cloak and Dagger Games on Patreon: https://www.patreon.com/user?u=460039