A simple Steamworks API wrapper to be used as native extension for Adobe AIR applications. This allows you to implement Steam achievements, leaderboards, cloud storage, workshop support and much more in your AIR application - on Windows, OS X and Linux.
I forked this project to both extend available Steamworks API and output 64-bit capability for Windows. All of the Ventero instructions/examples/tests should still work (see below, under "Ventero"), but as of this writing I have not yet updated the Ventero tests to reflect the new API.
A working ANE for Windows/macOS can be downloaded here. The version prior to April 2024 has been renamed to FRESteamWorks_2022.ane if you would prefer that one.
The Linux SWC has not been updated, as I do not have a Linux machine. You'll have to build it yourself if you need Linux support.
The steam API docs can be found here. Below is just the new Steam stuff. For a full list of the available API, you can view lib/API.txt.
April 2024 additions (using Steam sdk 1.59):
[modified]
getAuthSessionTicket(ticket:ByteArray, steamID:String)
- steamID is now required (you can just use getUserID())
- see https://partner.steamgames.com/doc/api/ISteamUser#GetAuthSessionTicket for more insight as to why
setPlayedWith(steamID:String) : Boolean
- Register a steam player to your "recently played with" list
getCoplayFriendCount() : int
- Gets the number of players that the current user has recently played with, across all games.
getCoplayFriend() : String
- Gets the Steam ID of the recently played with user at the given index (must call getCoplayFriendCount() first)
getServerRealTime : uint
- Returns the Steam server time in Unix epoch format. (Number of seconds since Jan 1, 1970 UTC)
getSecondsSinceAppActive : uint
- Returns the number of seconds since the application was active.
getEarliestPurchaseUnixTime(appId:String) : uint
- Gets the time of purchase of the specified app in Unix epoch format (time since Jan 1st, 1970).
isSteamRunningOnSteamDeck : Boolean
- Is this game currently running on Steam deck?
Previous additions:
setRichPresence(key:String, value:String):void
clearRichPresence():void
isSteamInBigPictureMode():Boolean
isAchievementEarned(achName:String):Boolean // same as isAchievement(), but clearer to its purpose
getAchievementAchievedPercent(achName:String):Number
getAchievementDisplayAttribute(achName:String, attribute:String):String
getAchievementIcon(achName:String):BitmapData
getAchievementName(achIndex:int):String
getNumAchievements():int
getLargeFriendAvatar(friendID:String):BitmapData
getIPCountry():String
setOverlayNotificationInset(hInset:int, vInset:int):void
overlayNeedsPresent():Boolean
Don't worry about this section if you only plan to copy the ANE as-is to your game. You can download it here
Project has been updated to VS2019
A new SDKPaths.props file has been added to help specify your own Air + Steam SDK install directories. Edit this file directly, or use the VS Properties Manager
Outputting FRESteamWorks DLLs:
- Build > Batch Build...
- Check both Win32 + x64 Releases
- Click Build (or Rebuild)
The original post-build event will continue to copy DLLs to the ../lib/bin folder and attempt to run compileANE.bat as expected, but can/will trigger twice since its building two different DLLs. As such, compileANE.bat has been updated to check for the existence of both 32+64 bit DLLs before continuing, to prevent potential errors. It is what it is.
Ventero instructions should still apply, but the deployment target has been updated to macOS 10.10 due to the latest libsteam_api.dylib from Valve also being built for 10.10.
This project initially started as a fork of FRESteamWorks by Oldes/Amanita Design.
If you want to contribute to this project, please take a look at the contributing guide.
For a list of changes, see the changelog.
Pre-built cross-platform ANEs (for both Windows and OS X), as well as Linux SWCs can be found on http://dump.ventero.de/FRESteamWorks/. The Linux wrapper binary has to be built manually, see the Linux section for more details.
For a full list of all supported functions with some accompanying documentation, see lib/API.txt. In general, the FRESteamWorks API functions try to be a close representation of the native Steamworks SDK functions. Thus, for detailed documentation, see the Steamworks SDK docs.
The objects returned by certain API functions are plain data structures. For a list of available properties, see the corresponding source files.
For Windows/OS X builds, you'll only have to include the ANE in your project like
any normal SWC, add the extension to your application descriptor and include
extendedDesktop
in the list of supported profiles. For an example, see
the application descriptor of the FRESteamWorks test application.
Testing your application is a bit more complicated and depends on how your project is built. For detailed information, see below. For general information regarding the testing of Steam applications, please refer to the Steamworks SDK documentation.
Since the AIR runtime on Linux doesn't support native extensions, an external binary is used to communicate with the Steamworks API. For more information on how to build and include this tool, see the Linux section.
Due to a bug in old versions of the AIR runtime, the runtime will crash as soon
as a function is called that returns any of the com.amanitadesign.steam.*
objects.
For this reason, FRESteamWorks should only be used with AIR runtimes >= 3.7.
Flash Builder 4.6 seems to have an issue with detecting classes that implement
interfaces inside an ANE, which results in the FRESteamWorks
class not being
visible inside the ANE within Flash Builder when using earlier builds (older than
v0.4-19) of the ANE. This issue is also fixed in Flash Builder 4.7.
With older versions of the ANE (older than v0.4-19), running an application including that ANE is not possible in Flash Builder 4.6 on OS X. To fix this issue, simply download to a more recent ANE.
To include the ANE in your Flash Builder project, simply add it to the list of
"Native Extensions" under "ActionScript Build Path" in your project's properties.
Make sure it gets packaged when building your application by checking the "Package" box
in the "Native Extensions" tab under "ActionScript Build Packaging". The extension
will automatically be added to your application descriptor, but you still might have
to add extendedDesktop
to the list of supported profiles.
Since by default, Flash Builder uses its installation path as working directory when running applications, this however isn't enough to test your application in Flash Builder. This can be fixed by either adding the library's directory to the dynamic linker's search path (see the AIR/Flex SDK section on how to do this), or by creating a new shortcut to Flash Builder where the working directory is set to your project's directory and adding the dynamic library to your project (this does not work on OS X).
Just include the native Steamworks library at the top level of your project so that it gets included when packaging your application.
For projects built with the AIR/Flex SDKs, the ANE can be included by simply
adding the ANE path to the external library path (either by adding it to your
build config file, or by adding -external-library-path+=/path/to/FRESteamWorks.ane
to your mxmlc
/compc
compiler flags). The SWF you're has to be at least version 11.
To run your application with the AIR Debug Launcher (adl
), you will have to first
unpack the ANE. To do this, rename FRESteamWorks.ane
to FRESteamWorks.zip
,
then unzip it and rename the generated folder to FRESteamWorks.Unpacked.ane
.
Now you can add -extdir /path/to/folder
to the adl
command line flags. Here,
folder
refers the parent folder of the unzipped extension (i.e. the folder that
contains FRESteamWorks.Unpacked.ane
).
Since the native library included in the ANE is dynamically linked against the
Steamworks library, you'll also have to make sure that the dynamic linker can find
the Steamworks library. When testing, this is easiest done by adding the folder containing
the Steamworks library to your %PATH%
environment variable on Windows
(example),
DYLD_FALLBACK_LIBRARY_PATH
on OS X (example)
or the library itself to LD_PRELOAD
on Linux (example).
For packaged builds, you'll simply have to include the native Steamworks libraries
in the top level of your build and add the path to a directory containing the
FRESteamWorks.ane
as -extdir
to adt
. For an example, see the test application's
packaging script.
First of all, make sure that your project's target is set to "AIR 3.0 for Desktop" (or any more recent AIR version). Then, in the AIR preferences (wrench icon next to target project's target), check the "Extended Desktop" profile and select "Output as: Application with runtime embedded".
To include the ANE, go to the "Advanced ActionScript 3.0 Settings" (wrench icon
next to the project's script settings), and in the "Library path" tab,
click the native extension button and select FRESteamWorks.ane
.
See the Flash Builder section on running the application.
See the Flash Builder section on packaging the application.
FDT is very similar to Flash Builder. The main differences
are that the ANE is automatically added to the project and packaged when copying
it into the project's lib
folder, so that the steps described in
Flash Builder's building section are not necessary. However, when adding
the native Steamworks libraries, you have to make sure that they're packaged with
the application by opening the project's properties and adding them under
"FDT AIR Properties" -> "Desktop" -> "Package Contents".
Please also make sure to follow the steps described in the running section to debug your application from within FDT and see the list of known issues.
The AIR runtime on Linux doesn't support native extensions. Instead, you'll have
to compile your AS3 application against FRESteamWorksLibLinux.swc
and compile
a wrapper binary that handles the communication between AIR and the Steamworks API.
For details on how to do that, please contact me directly (email address see profile).
There shouldn't be any reason for you to manually build the FRESteamWorks.ane, as pre-built ANEs can be downloaded from http://dump.ventero.de/FRESteamWorks/. If you need a more recent version than the builds that are available on that site, you can create an issue in the bug tracker.
If you still want to build the ANE yourself (or build the test application), a few simple steps have to be followed.
-
Create a config file by copying
config_example.sh
toconfig.sh
on OS X, orconfig_example.bat
toconfig.bat
and correctly setting up the values within. -
Open the Visual Studio solution or XCode project (both inside
src/
) and fix up the include paths (for the Adobe AIR SDK as well as the Steamworks SDK). -
Build the project in either debug or release mode. This compiles the native library and automatically builds an ANE for the current platform containing that library.
-
Optionally, build the test application by running
build.{bat,sh}
insidetest/bin-debug/
and run it withrunMac.sh
orrunWin.bat
. This automatically uses the ANE built in step 3.
To build a cross platform ANE, you'll have to compile the native library on both
Windows and OS X and then create an ANE that includes both of those. This is easiest
done by first running mkdir.sh
in builds/
, building FRESteamWorks.dll on Windows,
copying it over to the directory created on OS X and then running compile.sh
and build.sh
in that order.
For more details, please see the contributing guide.
See LICENSE.