Skip to content

Management

Francisco Dias edited this page Feb 9, 2024 · 8 revisions

Management

These are functions to manage the Steamworks API.

Functions

This module offers a collection of functions designed to address specific tasks and provide utilities for various purposes. Explore the available functions to make the most of the functionalities provided by this module.



Back To Top

steam_init

This function initialises the Steam APIs.

Note

This function is already configured to be called at Game Start by the extension, and should not be called from your game code.


Syntax:

steam_init()

Returns:

N/A


Example:

steam_init();

The above code initialises the Steam API.




Back To Top

steam_update

This function updates the Steam APIs.

Warning

This function is required to be called in order for the Steamworks extension to work. Certain async events are only triggered when you call this function. We recommend you place this function in a persistent controller object that calls it inside its Step Event.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Steam Async Event.


Syntax:

steam_update()

Returns:

N/A


Triggers:

Steam Async Event

This event is triggered when Steam Deck has resumed from suspend.

Key Type Description
event_type String The string value "app_resuming_from_suspend"

This event is triggered when a local file changes. You can use the functions steam_get_local_file_change_count and steam_get_local_file_change to get the actual change data.

Key Type Description
event_type String The string value "remote_storage_local_file_change"

Example:

steam_update();

The above code will update the Steam APIs.




Back To Top

steam_shutdown

This function shuts down the Steamworks API, releases pointers and frees memory.

Warning

This function is required to be called in order for the Steamworks extension to work. We recommend you place this function in the Game End Event of a controller object. You need to check if this is not a game_restart.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Steam Async Event.


Syntax:

steam_shutdown()

Returns:

N/A


Triggers:

Steam Async Event

This event is triggered when the Steam client is about to shutdown, usually you have a few seconds to finish things.

Key Type Description
event_type String The string value "steam_shutdown"

Example:

global.is_game_restarting = true;
game_restart();

The code above should be used when you want to restart your game. We set the is_game_restarting global variable to true announcing the game being restarted to true (this global variable should already be declared at the begining of your game and be set to false by default). Now inside our Game End Event we can use the following code:

if (global.is_game_restarting == false) {
    steam_shutdown();
}
global.is_game_restarting = false;

First we check if the game is not restarting and in that case we know we are actually ending so we call the steam_shutdown method.