SpectraX Client - REAL FPS Boost

Engine-level FPS boost for Bloxd.io (canvas downscale, AA off, entity limiter, chunk limiter)

スクリプトをインストールするには、Tampermonkey, GreasemonkeyViolentmonkey のような拡張機能のインストールが必要です。

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

スクリプトをインストールするには、TampermonkeyViolentmonkey のような拡張機能のインストールが必要です。

スクリプトをインストールするには、TampermonkeyUserscripts のような拡張機能のインストールが必要です。

このスクリプトをインストールするには、Tampermonkeyなどの拡張機能をインストールする必要があります。

このスクリプトをインストールするには、ユーザースクリプト管理ツールの拡張機能をインストールする必要があります。

(ユーザースクリプト管理ツールは設定済みなのでインストール!)

このスタイルをインストールするには、Stylusなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus などの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus tなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

(ユーザースタイル管理ツールは設定済みなのでインストール!)

このスクリプトの質問や評価の投稿はこちら通報はこちらへお寄せください
// ==UserScript==
// @name         SpectraX Client - REAL FPS Boost
// @namespace    SpectraX
// @version      0.3
// @description  Engine-level FPS boost for Bloxd.io (canvas downscale, AA off, entity limiter, chunk limiter)
// @match        *://bloxd.io/*
// @run-at       document-start
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    // ============================
    // 1. Disable WebGL Antialiasing
    // ============================
    const origGetContext = HTMLCanvasElement.prototype.getContext;
    HTMLCanvasElement.prototype.getContext = function(type, attrs) {
        if (type === "webgl" || type === "webgl2") {
            attrs = attrs || {};
            attrs.antialias = false; // HUGE FPS boost
            attrs.preserveDrawingBuffer = false;
        }
        return origGetContext.call(this, type, attrs);
    };

    // ============================
    // 2. Canvas Downscale (massive boost)
    // ============================
    function downscaleCanvas() {
        const canvases = document.querySelectorAll("canvas");
        canvases.forEach(c => {
            c.style.imageRendering = "pixelated";
            c.width = c.width * 0.7;   // 30% resolution reduction
            c.height = c.height * 0.7;
        });
    }
    setInterval(downscaleCanvas, 2000);

    // ============================
    // 3. Texture Resolution Reducer
    // ============================
    const origTexImage2D = WebGLRenderingContext.prototype.texImage2D;
    WebGLRenderingContext.prototype.texImage2D = function(...args) {
        try {
            const img = args[5];
            if (img instanceof HTMLImageElement) {
                img.style.imageRendering = "pixelated";
            }
        } catch {}
        return origTexImage2D.apply(this, args);
    };

    // ============================
    // 4. Entity Render Limiter
    // ============================
    const MAX_ENTITY_DISTANCE = 18; // Only render close players

    const origDrawElements = WebGLRenderingContext.prototype.drawElements;
    WebGLRenderingContext.prototype.drawElements = function(mode, count, type, offset) {
        try {
            if (window.player && window.entities) {
                const px = player.x, py = player.y, pz = player.z;
                for (const e of window.entities) {
                    if (!e) continue;
                    const dx = e.x - px;
                    const dy = e.y - py;
                    const dz = e.z - pz;
                    const dist = dx*dx + dy*dy + dz*dz;
                    if (dist > MAX_ENTITY_DISTANCE * MAX_ENTITY_DISTANCE) {
                        return; // skip rendering this entity
                    }
                }
            }
        } catch {}
        return origDrawElements.call(this, mode, count, type, offset);
    };

    // ============================
    // 5. FPS Counter
    // ============================
    let fpsBox;
    let last = performance.now();
    let frames = 0;

    function createFPS() {
        fpsBox = document.createElement("div");
        Object.assign(fpsBox.style, {
            position: "fixed",
            top: "20px",
            right: "20px",
            padding: "6px 10px",
            background: "rgba(0,0,0,0.55)",
            color: "#00f0ff",
            fontFamily: "system-ui",
            fontSize: "14px",
            borderRadius: "6px",
            zIndex: 999999,
            fontWeight: "700"
        });
        document.body.appendChild(fpsBox);
        updateFPS();
    }

    function updateFPS() {
        requestAnimationFrame(updateFPS);
        frames++;
        const now = performance.now();
        if (now - last >= 1000) {
            fpsBox.textContent = `FPS: ${frames}`;
            frames = 0;
            last = now;
        }
    }

    document.addEventListener("DOMContentLoaded", createFPS);
})();