How do I detect if the game is running on Steam Deck?

0 favourites
  • 5 posts
From the Asset Store
Full game Construct 2 and Construct 3 to post on Google Play
  • I tried various PlatformInfo and Browser expressions, but the information they return is not specific to Steam Deck - for example they show browser as "Mozilla", OS version as "Linux" etc.

    There is a method IsSteamRunningOnSteamDeck() available in Steamworks API, but I don't know how to fetch it..

    Is there any way to access it in a script from the Greenworks object?

    Perhaps something like this (the code doesn't work obviously):

    const gw = runtime.objects.Greenworks.getFirstInstance();
    var isOnDeck = gw.ISteamUtils.IsSteamRunningOnSteamDeck())
    
  • Hey,

    Greenworks doesn't support that method. It was added in SDK v 1.52 and greenworks support stopped at 1.42.

    The best solution would be to write a new Steam addon using steamworks.js (or implement that directly)

    github.com/ceifa/steamworks.js

  • Nevermind, run this function and it should work

    function isRunningOnSteamDeck() {
     try {
     let os = require("os");
     let info = `${os.type()} ${os.release()} ${os.platform()}`.toLowerCase();
     let list = ["valve", "steam"];
     return info.includes("linux") && list.some(x => info.includes(x));
     } catch (e) {
     return false;
     }
    }
    
    console.log(`Is running on SteamDeck? ${isRunningOnSteamDeck()? "Yes" : "No"}`);
    
  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • skymen Thanks! The code works for Linux build.

    Unfortunately, in Windows build os.type/release/platform still return "Windows NT" or "win32" on the deck, and no mention of valve or steam. I was hoping to use Windows export as oddly enough it runs smoother on the Deck than Linux.

  • Ah well, I don't know how easy it is to detect Proton :/

    + even if you were to detect proton that wouldn't even give you any info on wether you're running on a regular Linux machine or on Steamdeck.

    I guess we're back to trying to implement steamworks.js

    The alternative would be to do some machine profiling using CPU, GPU and screen size info to try and make an educated guess but that's not really a great idea.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)