BlitzMax

BlitzMax

  • Downloads
  • Docs
  • API
  • Resources
  • About

›SteamSDK

BlitzMax API

  • Introduction

BRL

    Audio

    • Introduction
    • TChannel
    • TSound

    AudioSample

    • Introduction
    • TAudioSample
    • TAudioSampleLoader

    Bank

    • Introduction
    • TBank

    BankStream

    • Introduction
    • TBankStream

    Base64

    • Introduction
    • TBase64

    Blitz

    • Introduction
    • TArrayBoundsException
    • TBlitzException
    • TNullFunctionException
    • TNullMethodException
    • TNullObjectException
    • TOutOfDataException
    • TRuntimeException
  • BRL.BMPLoader
  • Clipboard

    • Introduction
    • TClipboard
    • TClipboardOpts
    • TWin32ClipboardOpts
    • TX11ClipboardOpts
  • BRL.D3D7Max2D
  • BRL.D3D9Max2D
  • BRL.DirectSoundAudio
  • BRL.EndianStream
  • Event

    • Introduction
    • TEvent
  • BRL.EventQueue
  • BRL.FileSystem
  • BRL.FreeAudioAudio
  • BRL.GLGraphics
  • BRL.GLMax2D
  • BRL.GNet
  • BRL.Graphics
  • BRL.Hook
  • IO

    • Introduction
    • MaxIO
  • BRL.JPGLoader
  • BRL.KeyCodes
  • LinkedList

    • Introduction
    • TList
    • TListEnum
    • TLink

    Map

    • Introduction
    • TMap
    • TIntMap
    • TIntKey
    • TPtrMap
    • TPtrKey
    • TStringMap
  • BRL.Math
  • Matrix

    • Introduction
    • SMat2D
    • SMat2F
    • SMat2I
    • SMat3D
    • SMat3F
    • SMat3I
    • SMat4D
    • SMat4F
    • SMat4I

    Max2D

    • Introduction
    • TImage

    MaxLua

    • Introduction
    • TLuaClass
    • TLuaObject
  • BRL.OGGLoader
  • BRL.OpenALAudio
  • ObjectList

    • Introduction
    • TObjectList
    • TObjectListEnumerator
    • TObjectListReverseEnumerator

    Pixmap

    • Introduction
    • TPixmap
    • TPixmapLoader
  • BRL.PNGLoader
  • BRL.PolledInput
  • Quaternion

    • Introduction
    • SQuatD
    • SQuatF
    • SQuatI
  • BRL.RamStream
  • Random

    • Introduction
    • TRandom

    Reflection

    • Introduction
    • TTypeId
    • TMember
    • TConstant
    • TField
    • TGlobal
    • TFunction
    • TMethod
  • BRL.Retro
  • BRL.Socket
  • BRL.SocketStream
  • BRL.StandardIO
  • Stream

    • Introduction
    • TCStream
    • TIO
    • TStream
    • TStreamException
    • TStreamFactory
    • TStreamReadException
    • TStreamWrapper
    • TStreamWriteException

    StringBuilder

    • Introduction
    • TStringBuilder
    • TSplitBuffer
  • BRL.System
  • BRL.SystemDefault
  • BRL.TextStream
  • BRL.TGALoader
  • ThreadPool

    • Introduction
    • TRunnable
    • TThreadPoolExecutor

    Threads

    • Introduction
    • TThread
    • TThreadData
    • TMutex
    • TSemaphore
    • TCondVar

    Timer

    • Introduction
    • TChrono
  • BRL.TimerDefault
  • Vector

    • Introduction
    • SVec2D
    • SVec2F
    • SVec2I
    • SVec3D
    • SVec3F
    • SVec3I
    • SVec4D
    • SVec4F
    • SVec4I

    Volumes

    • Introduction
    • TVolume
  • BRL.WAVLoader

Text

    CSV

    • Introduction
    • TCsvParser
    • TCsvHeader
    • TCsvRow
    • TCsvOptions
    • SCsvColumn

    Format

    • Introduction
    • TFormatter

    Ini

    • Introduction
    • TIni
    • TIniProperty
    • TIniSection

    JConv

    • Introduction
    • TJConv
    • TJConvBuilder
    • TJConvSerializer

    Json

    • Introduction
    • TJSON
    • TJSONObject
    • TJSONString
    • TJSONInteger
    • TJSONReal
    • TJSONBool
    • TJSONArray
    • TJSONNull
    • TJSONError
    • TJSONNumber

    Regex

    • Introduction
    • TRegEx
    • TRegExMatch
    • TRegExOptions
    • TRegExException

    TOML

    • Introduction
    • ETomlNodeType
    • TToml
    • ITomlNode
    • STomlDate
    • STomlDateTime
    • STomlTime
    • TTomlArray
    • TTomlInteger
    • TTomlString
    • TTomlTable
    • TTomlBoolean

    Xml

    • Introduction
    • TxmlDoc
    • TxmlNode
    • TxmlAttribute

MaxGUI

  • MaxGUI.MaxGUI
  • MaxGUI.Drivers
  • MaxGUI.Localization
  • MaxGUI.ProxyGadgets
  • MaxGUI.CocoaMaxGUI
  • MaxGUI.Win32MaxGUIEx

PUB

  • Pub.FreeJoy
  • Pub.FreeProcess
  • Pub.Glad
  • Pub.Glew
  • Joystick

    • Introduction
    • TJoystickDriver
  • Pub.Lua
  • Pub.OpenAL
  • Pub.OpenGLES
  • Pub.xmmintrin
  • Pub.ZLib

Crypto

    Digest

    • Introduction
    • TMessageDigest
    • TDigestRegister
    • TNoSuchAlgorithmException

    Cipher

    • Introduction
    • TCipher
    • TCipherMode
    • Crypto.AESCipher
    • Crypto.AnubisCipher
    • Crypto.BlowfishCipher
    • Crypto.CamelliaCipher
    • Crypto.Cast5Cipher
    • Crypto.DESCipher
    • Crypto.IdeaCipher
    • Crypto.KasumiCipher
    • Crypto.KhazadCipher
    • Crypto.KSeedCipher
    • Crypto.NoekeonCipher
    • Crypto.SerpentCipher
    • Crypto.SkipjackCipher
    • Crypto.TwofishCipher
    • Crypto.XTeaCipher

    CBCMode

    • Introduction
    • TCBCCipherMode

    CFBMode

    • Introduction
    • TCFBCipherMode

    CTRMode

    • Introduction
    • TCTRCipherMode

    ECBMode

    • Introduction
    • TECBCipherMode

    F8Mode

    • Introduction
    • TF8CipherMode

    LRWMode

    • Introduction
    • TLRWCipherMode

    OFBMode

    • Introduction
    • TOFBCipherMode

    XTSMode

    • Introduction
    • TXTSCipherMode

    Blake2BDigest

    • Introduction
    • TBlake2B_512
    • TBlake2B_384
    • TBlake2B_256
    • TBlake2B_160

    CRC32

    • Introduction
    • TCRC32

    MD5Digest

    • Introduction
    • TMD5

    Ripemd320Digest

    • Introduction
    • TRipemd320

    Ripemd356Digest

    • Introduction
    • TRipemd256

    Ripemd160Digest

    • Introduction
    • TRipemd160

    Ripemd128Digest

    • Introduction
    • TRipemd128

    SHA1Digest

    • Introduction
    • TSHA1

    SHA256Digest

    • Introduction
    • TSHA256

    SHA512Digest

    • Introduction
    • TSHA512

    SHA3Digest

    • Introduction
    • TSHA3_512
    • TSHA3_384
    • TSHA3_256
    • TSHA3_224

    TigerDigest

    • Introduction
    • TTiger

    WhirlpoolDigest

    • Introduction
    • TWhirlpool

    Crypto

    • Introduction
    • TCryptoRandom
    • TCryptoSecretBox
    • TCryptoHash
    • TCryptoSign
    • TCryptoKeyExchange
    • TCryptoKey
    • TCryptoHashKey
    • TCryptoSecretBoxKey
    • TCryptoSignature
    • TCryptoExchangeKeyPair
    • TCryptoSessionKeyPair
    • TCryptoNPacket
    • TCryptoKK1Packet
    • TCryptoKK2Packet
    • TCryptoXX1Packet
    • TCryptoXX2Packet
    • TCryptoXX3Packet
    • TCryptoExchangeState
    • TCryptoPWHashMasterKey
    • TCryptoPWHashStoredKey
    • TCryptoPasswordHash

SDL

    SDL

    • Introduction
    • TSDLStream

    SDLSystem

    • Introduction
    • TSDLMultiGesture

    SDLVideo

    • Introduction
    • TSDLDisplay
    • TSDLDisplayMode
    • TSDLGLContext
    • TSDLWindow

    SDLRender

    • Introduction
    • TSDLRenderer
    • TSDLTexture

    SDLTimer

    • Introduction
    • TSDLTimer

    SDLHaptic

    • Introduction
    • TSDLHaptic
    • TSDLHapticCondition
    • TSDLHapticConstant
    • TSDLHapticCustom
    • TSDLHapticDirection
    • TSDLHapticEffect
    • TSDLHapticLeftRight
    • TSDLHapticPeriodic
    • TSDLHapticRamp

    SDLSensor

    • Introduction
    • TSDLSensor
  • SDL.SDLFreeAudio
  • SDL.GLSDLMax2D
  • SDL.GL2SDLMax2D
  • SDL.D3D9SDLMax2D
  • SDLVirtualJoystick

    • Introduction
    • TVirtualJoystick

Steam

    SteamSDK

    • Introduction
    • TSteamClient
    • TSteamUtils
    • TSteamUserStats
    • TSteamFriends
    • TSteamUGC
    • ISteamFriendsListener
    • ISteamUGCListener
    • ISteamUserStatsListener
    • ISteamUtilsListener
    • EItemPreviewType
    • EPersonaChange
    • EPersonaState
    • ERemoteStoragePublishedFileVisibility
    • EUGCMatchingUGCType
    • EUGCQuery
    • EUserRestriction
    • EUserUGCList
    • EWorkshopFileType
Edit

Steam.SteamSDK

Overview

The Steamworks API allows your game to take full advantage of Steam by accessing all of the underlying systems provided through the API. This includes things such as pausing your game when the user opens the Steam Overlay, inviting friends to play, allowing players to unlock Steam Achievements, letting players compete on the Steam Leaderboards and much more.

The Steamworks API Reference catalogs and documents every interface, function, callback, and type supported in the API.

Integration with the Steamworks API is never required to ship your product on Steam, but it is highly recommended as it allows you to accomplish many interactions that Steam users expect.

Initialization and Shutdown

SteamInit

After you have the Steamworks API set up within your project you can start using it by calling SteamInit function to initialize the API. This will set up the global state and populate the interface pointers which are accessible via the global functions which match the name of the interface. This MUST be called and return successfully prior to accessing any of the Steamworks Interfaces!

The Steamworks API will not initialize if it does not know the App ID of your game. When you launch your app from Steam itself then it will automatically have the App ID available. While developing you will need to hint this to Steam with a text file. Create the a text file called steam_appid.txt next to your executable containing just the App ID and nothing else. This overrides the value that Steam provides. You should not ship this with your builds. Example:

480

A return of False indicates one of the following conditions:

  • The Steam client isn't running. A running Steam client is required to provide implementations of the various Steamworks interfaces.
  • The Steam client couldn't determine the App ID of game. If you're running your application from the executable or debugger directly then you must have a steam_appid.txt in your game directory next to the executable, with your app ID in it and nothing else. Steam will look for this file in the current working directory. If you are running your executable from a different directory you may need to relocate the steam_appid.txt file.
  • Your application is not running under the same OS user context as the Steam client, such as a different user or administration access level.
  • Ensure that you own a license for the App ID on the currently active Steam account. Your game must show up in your Steam library.
  • Your App ID is not completely set up, i.e. in Release State: Unavailable, or it's missing default packages.
  • If you're running into initialization issues then see the Debugging the Steamworks API documentation to learn about the various methods of debugging the Steamworks API.

SteamRestartAppIfNecessary

SteamRestartAppIfNecessary checks if your executable was launched through Steam and relaunches it through Steam if it wasn't.

This is optional but highly recommended as the Steam context associated with your application (including your App ID) will not be set up if the user launches the executable directly. If this occurs then SteamInit will fail and you will be unable to use the Steamworks API. If you choose to use this then it should be the first Steamworks function call you make, right before SteamInit.

If this returns true then it starts the Steam client if required and launches your game again through it, and you should quit your process as soon as possible. This effectively runs steam://run/<AppID> so it may not relaunch the exact executable that called this function (for example, if you were running from your debugger). It will always relaunch from the version installed in your Steam library folder.

Otherwise, if it returns False, then your game was launched by the Steam client and no action needs to be taken. One exception is if a steam_appid.txt file is present then this will return False regardless. This allows you to develop and test without launching your game through the Steam client. Make sure to remove the steam_appid.txt file when uploading the game to your Steam depot!

NOTE: If you use the Steam DRM wrapper on your primary executable file, this check is unnecessary as the DRM wrapper will perform this internally.

SteamShutdown

When you are done using the Steamworks API you should call SteamShutdown to release the resources used by your application internally within Steam. You should call this during process shutdown if possible.

This will not unhook the Steam Overlay from your game as there's no guarantee that your rendering API is done using it.

Types

TypeDescription
TSteamClientProvides an interface to a steam instance.
TSteamUtilsProvides access to a range of miscellaneous utility functions.
TSteamUserStatsProvides methods for accessing and submitting stats, achievements, and leaderboards.
TSteamUGCSteam UGC API
TSteamFriendsInterface to access information about individual users and interact with the Steam Overlay.

Interfaces

InterfaceDescription
ISteamUtilsListenerUtils listener interface
ISteamUserStatsListenerSteam User Stats listener interface
ISteamUGCListenerSteam UGC listener interface
ISteamFriendsListenerSteam Friends listener interface

Enums

EnumDescription
EPersonaStateList of states a Steam friend can be in.
EUserRestrictionUser restriction flags.
EPersonaChangeUsed in OnPersonaStateChanged, changeFlags to describe what's changed about a user.
ERemoteStoragePublishedFileVisibilityPossible visibility states that a Workshop item can be in.
EWorkshopFileTypeThe way that a shared file will be shared with the community.
EUGCMatchingUGCTypeSpecifies the types of UGC to obtain from a call to CreateQueryUserUGCRequest or CreateQueryAllUGCRequest.
EUserUGCListUsed with CreateQueryUserUGCRequest to obtain different lists of published UGC for a user.
EUGCQueryUsed with CreateQueryAllUGCRequest to specify the sorting and filtering for queries across all available UGC.
EItemPreviewTypeFlags that specify the type of preview an item has.

Functions

Function SteamInit:Int(autoRunCallbacks:Int = True)

Initialises Steam.

By default callback processing is run once every 100ms. If you'd rather control this yourself, you can set autoRunCallbacks to False, and call SteamRunCallbacks yourself.


Function SteamRestartAppIfNecessary:Int(ownAppID:UInt)

Checks if your executable was launched through Steam and relaunches it through Steam if it wasn't.

If this returns True then it starts the Steam client if required and launches your game again through it, and you should quit your process as soon as possible. This effectively runs steam://run/<AppId> so it may not relaunch the exact executable that called it, as it will always relaunch from the version installed in your Steam library folder.

If it returns False, then your game was launched by the Steam client and no action needs to be taken. One exception is if a steam_appid.txt file is present then this will return False regardless. This allows you to develop and test without launching your game through the Steam client. Make sure to remove the steam_appid.txt file when uploading the game to your Steam depot!


Function SteamShutdown()

Shuts down Steam.


Function SteamRunCallbacks()

Dispatches callbacks and call results.

It's best to call this at >10Hz, the more time between calls, the more potential latency between receiving events or results from the Steamworks API. Most games call this once per render-frame. All registered listener functions will be invoked during this call, in the callers thread context.


Consts

Const k_UGCQueryHandleInvalid:ULong = $ffffffffffffffff:ULong

Used to specify an invalid query handle.

This is frequently returned if a call fails.


Const k_UGCUpdateHandleInvalid:ULong = $ffffffffffffffff:ULong

Used to specify an invalid item update handle.

This is frequently returned if a call fails.


Const k_cchPublishedDocumentDescriptionMax:UInt = 8000

The maximum size in bytes that a Workshop item description can be.


Const k_cchDeveloperMetadataMax:UInt = 5000

The maximum amount of bytes you can set with SetItemMetadata.


Const k_cchPublishedDocumentTitleMax:UInt = 128 + 1

The maximum size in bytes that a Workshop item title can be.


Const k_cchMaxRichPresenceKeys:Int = 20

The maximum amount of rich presence keys that can be set.


Const k_cchMaxRichPresenceValueLength:Int = 256

The maximum length that a rich presence value can be.


Const k_cchMaxRichPresenceKeyLength:Int = 64

The maximum length that a rich presence key can be.


← TVirtualJoystickTSteamClient →
  • Overview
  • Initialization and Shutdown
    • SteamInit
    • SteamRestartAppIfNecessary
    • SteamShutdown
  • Types
  • Interfaces
  • Enums
  • Functions
    • Function SteamInit:Int(autoRunCallbacks:Int = True)
    • Function SteamRestartAppIfNecessary:Int(ownAppID:UInt)
    • Function SteamShutdown()
    • Function SteamRunCallbacks()
  • Consts
    • Const k_UGCQueryHandleInvalid:ULong = $ffffffffffffffff:ULong
    • Const k_UGCUpdateHandleInvalid:ULong = $ffffffffffffffff:ULong
    • Const k_cchPublishedDocumentDescriptionMax:UInt = 8000
    • Const k_cchDeveloperMetadataMax:UInt = 5000
    • Const k_cchPublishedDocumentTitleMax:UInt = 128 + 1
    • Const k_cchMaxRichPresenceKeys:Int = 20
    • Const k_cchMaxRichPresenceValueLength:Int = 256
    • Const k_cchMaxRichPresenceKeyLength:Int = 64
BlitzMax
Docs
Getting StartedDownloadsAbout
Community
ResourcesSyntaxBomb Forums
More
GitHubStarChat on Discord
Copyright © 2023 Bruce A Henderson