Browser Game Engine Detector (+ Version)

Detects current game engine

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

You will need to install an extension such as Tampermonkey to install this script.

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

// ==UserScript==
// @name         Browser Game Engine Detector (+ Version)
// @description Detects current game engine
// @match        *://*/*
// @grant        none
// @license MIT
// @version 0.0.1.20260321154450
// @namespace https://greasyfork.org/users/1492052
// ==/UserScript==

(function() {

    function detectEngine() {
        let engine = "Unknown";
        let version = "Unknown";

        // Phaser
        if (window.Phaser) {
            engine = "Phaser";
            version = window.Phaser.VERSION || version;
        }

        else if (window.cc) {
            engine = "Cocos Creator";
            version = window.cc.ENGINE_VERSION || version;
        }

        else if (window.createUnityInstance) {
            engine = "Unity WebGL";
            if (window.Module && window.Module.unityVersion) {
                version = window.Module.unityVersion;
            } else {
                version = "Check UnityLoader.js filename";
            }
        }

        else if (window.THREE) {
            engine = "Three.js";
            version = window.THREE.REVISION || version;
        }

        else if (window.ex) {
            engine = "Excaliber.js";
            version = "Unknown";
        }

        else if (window.pc) {
            engine = "PlayCanvas";
            version = window.pc.version || version;
        }

        else if (window.BABYLON) {
            engine = "Babylon.js";
            version = window.BABYLON.Engine ? window.BABYLON.Engine.Version : version;
        }

        else if (window.Engine) {
            engine = "Godot Web";
            version = window.Engine.VERSION || version;
        }

        else if (window.gdjs) {
            engine = "GDevelop";
            version = window.gdjs.VERSION || version;
        }

        else if (window.C3 || window.runtime) {
            engine = "Construct 3";
            if (window.C3 && window.C3.version) version = window.C3.version;
        }
        else {
            const scripts = Array.from(document.scripts).map(s => s.src);
            for (let src of scripts) {
                if (/c3runtime.*\.js/i.test(src)) {
                    engine = "Construct 3";
                    const match = src.match(/c3runtime[-.]([0-9]+)\.js/i);
                    if (match) version = match[1];
                    break;
                }
                if (/c2runtime.*\.js/i.test(src)) {
                    engine = "Construct 2";
                    const match = src.match(/c2runtime[-.]([0-9]+)\.js/i);
                    if (match) version = match[1];
                    break;
                }
                if (/UnityLoader.*\.js/i.test(src)) {
                    engine = "Unity WebGL";
                    const match = src.match(/UnityLoader[-.]([0-9.]+)\.js/i);
                    if (match) version = match[1];
                    break;
                }
            }
        }

        return { engine, version };
    }

    setTimeout(() => {
        const detected = detectEngine();

        if (detected.engine !== "Unknown") {
            const badge = document.createElement("div");
            badge.innerText = `Engine: ${detected.engine} | Version: ${detected.version}`;
            badge.style.position = "fixed";
            badge.style.bottom = "10px";
            badge.style.right = "10px";
            badge.style.background = "black";
            badge.style.color = "white";
            badge.style.padding = "6px 10px";
            badge.style.fontSize = "12px";
            badge.style.zIndex = 999999;
            badge.style.borderRadius = "5px";
            badge.style.fontFamily = "monospace";
            document.body.appendChild(badge);
        }
    }, 2000);

})();