Functions | Game Server Stats

Here is a list of all the functions available in the GodotSteam module. The descriptions are pulled from the official Steamworks SDK documentation with modifications made to fit GodotSteam's implementation of the functions. Naturally, any GodotSteam-specific functions will be noted as such.


clearUserAchievement( int steam_id, string name ) clearUserAchievement( uint64_t steam_id, string name )

  • Resets the unlock status of an achievement for the specified user. This is primarily only ever used for testing. You must have called requestUserStats and it needs to return successfully via its callback prior to calling this. This call only modifies Steam's in-memory state and is very cheap. To submit the stats to the server you must call storeUserStats.
  • Note: This will work only on achievements that game servers are allowed to set. If the "Set By" field for this achievement is "Official GS" then only game servers that have been declared as officially controlled by you will be able to set it. To do this you must set the IP range of your official servers in the Dedicated Servers section of App Admin.
  • Returns a bool.

serverGetUserAchievement( int steam_id, string name ) serverGetUserAchievement( uint64_t steam_id, string name )

  • Gets the unlock status of the Achievement.
  • Returns a dictionary:
    • result (bool)
    • user (int) as Steam ID
    • name (string)
    • unlocked (bool

serverGetUserStatFloat( int steam_id, string name ) serverGetUserStatFloat( uint64_t steam_id, string name )

  • Gets the current value of the a stat for the specified user.
  • Returns a float.

serverGetUserStatInt( int steam_id, string name ) serverGetUserStatInt( uint64_t steam_id, string name )

  • Gets the current value of the a stat for the specified user.
  • Returns an int. Returns an uint32_t.

serverRequestUserStats( int steam_id ) serverRequestUserStats( uint64_t steam_id )

  • Asynchronously downloads stats and achievements for the specified user from the server. These stats will only be auto-updated for clients currently playing on the server. For other users you'll need to call this function again to refresh any data.
  • Triggers a stats_received call result.
  • Returns nothing; void.

setUserAchievement( int steam_id, string name ) setUserAchievement( uint64_t steam_id, string name )

  • Unlocks an achievement for the specified user.
  • Returns a bool.

setUserStatFloat( int steam_id, string name, float stat ) setUserStatFloat( uint64_t steam_id, string name, float stat )

  • Sets / updates the value of a given stat for the specified user. You must have called requestUserStats and it needs to return successfully via its callback prior to calling this. This call only modifies Steam's in-memory state and is very cheap. To submit the stats to the server you must call storeUserStats.
  • Note: These updates will work only on stats that game servers are allowed to edit. If the "Set By" field for this stat is "Official GS" then only game servers that have been declared as officially controlled by you will be able to set it. To do this you must set the IP range of your official servers in the Dedicated Servers section of App Admin.
  • Returns a bool.

setUserStatInt( int steam_id, string name, int stat )

  • Sets / updates the value of a given stat for the specified user. You must have called requestUserStats and it needs to return successfully via its callback prior to calling this. This call only modifies Steam's in-memory state and is very cheap. To submit the stats to the server you must call storeUserStats.
  • Note: These updates will work only on stats that game servers are allowed to edit. If the "Set By" field for this stat is "Official GS" then only game servers that have been declared as officially controlled by you will be able to set it. To do this you must set the IP range of your official servers in the Dedicated Servers section of App Admin.
  • Returns a bool.

storeUserStats( int steam_id ) storeUserStats( uint64_t steam_id )

  • Send the changed stats and achievements data to the server for permanent storage for the specified user. If this fails then nothing is sent to the server. It's advisable to keep trying until the call is successful. This call can be rate limited. Call frequency should be on the order of minutes, rather than seconds. You should only be calling this during major state changes such as the end of a round, the map changing, or the user leaving a server. If you have stats or achievements that you have saved locally but haven't uploaded with this function when your application process ends then this function will automatically be called. You can find additional debug information written to the %steam_install%\logs\stats_log.txt file.
  • Triggers a stats_stored callback.
  • Returns nothing; void.

updateUserAvgRateStat( int steam_id, string name, float this_session, double session_length ) updateUserAvgRateStat( uint64_t steam_id, string name, float this_session, double session_length )

  • Updates an AVGRATE stat with new values for the specified user.
  • Returns a bool.