SpectraX Client - REAL FPS Boost

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

이 스크립트를 설치하려면 Tampermonkey, Greasemonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey와 같은 확장 프로그램을 설치해야 합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Userscripts와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 유저 스크립트 관리자 확장 프로그램이 필요합니다.

(이미 유저 스크립트 관리자가 설치되어 있습니다. 설치를 진행합니다!)

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

(이미 유저 스타일 관리자가 설치되어 있습니다. 설치를 진행합니다!)

// ==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);
})();