60fps bugfix

Literally the best mod ever made. Makes 60fps not only playable, it feels exactly the same as 240fps while *reducing* lag and ping instead of increasing it. Fullscreen recommended. Keywords: starblast.io starblast dueling mod fps bypass unlock uncap if you want more than 60fps, please instead use this mod, it'll solve all your problems.

  1. // ==UserScript==
  2. // @name 60fps bugfix
  3. // @namespace http://tampermonkey.net/
  4. // @version 2.113
  5. // @description Literally the best mod ever made. Makes 60fps not only playable, it feels exactly the same as 240fps while *reducing* lag and ping instead of increasing it. Fullscreen recommended. Keywords: starblast.io starblast dueling mod fps bypass unlock uncap if you want more than 60fps, please instead use this mod, it'll solve all your problems.
  6. // @author ✨Stardust™
  7. // @match *://starblast.io/*
  8. // @exclude *://starblast.io/modding.html*
  9. // @exclude *://starblast.io/shipeditor*
  10. // @grant none
  11. // @license MIT
  12. // ==/UserScript==
  13.  
  14. (function() {
  15. 'use strict';
  16.  
  17. // URL for your modified index.html file
  18. const modifiedIndexUrl = 'https://raw.githubusercontent.com/StardustSDF/60fps-bugfix-starblast/main/index.html';
  19. // The above URL includes lowercase name mod, as well as the following altercation to the game code:
  20. // e.prototype.lII0O=function(t){var e,i,s;let now=Date.now();if(now-lastTime<1000/20){clearTimeout(this.stopTimer);this.stopTimer=setTimeout(()=>{i=(t.clientX-this.element.offsetLeft)*this.l01II,s=(t.clientY-this.element.offsetTop)*this.l01II,this.mousepressed?this.O01lI(i,s,"mouse"):this.mouseMove(i,s,"mouse"),this.control_listener&&this.control_listener.mouseMove(i,s,t);},50);return!1;}lastTime=now;t.preventDefault(),i=(t.clientX-this.element.offsetLeft)*this.l01II,s=(t.clientY-this.element.offsetTop)*this.l01II,e=this.mousepressed?this.O01lI(i,s,"mouse"):this.mouseMove(i,s,"mouse"),e||null!=this.control_listener&&this.control_listener.mouseMove(i,s,t),clearTimeout(this.stopTimer),this.stopTimer=setTimeout(()=>{i=(t.clientX-this.element.offsetLeft)*this.l01II,s=(t.clientY-this.element.offsetTop)*this.l01II,this.mousepressed?this.O01lI(i,s,"mouse"):this.mouseMove(i,s,"mouse"),this.control_listener&&this.control_listener.mouseMove(i,s,t);},50),!1},
  21. // and let lastTime = 0; at the beginning of the main js for the game
  22. function applyModifiedIndex() {
  23. fetch(modifiedIndexUrl)
  24. .then(response => {
  25. if (response.ok) {
  26. return response.text();
  27. } else {
  28. throw new Error('An error? In my userscript?!');
  29. }
  30. })
  31. .then(html => {
  32. document.open();
  33. document.write(html);
  34. document.close();
  35. applyCustomCursor();
  36. })
  37. .catch(error => {
  38. console.error('An error? In my userscript?!:', error);
  39. });
  40. }
  41.  
  42. function applyCustomCursor() {
  43. const cursorTrailCount = 2;
  44. const trailElements = [];
  45. const trailDelay = 5;
  46. const edgeThreshold = 3;
  47.  
  48. for (let i = 0; i < cursorTrailCount; i++) {
  49. const trail = document.createElement('div');
  50. trail.style.position = 'fixed';
  51. trail.style.width = '24px';
  52. trail.style.height = '24px';
  53. trail.style.backgroundImage = 'url(https://raw.githubusercontent.com/StardustSDF/60fps-bugfix-starblast/main/crosshair4.png)';
  54. trail.style.backgroundSize = 'contain';
  55. trail.style.pointerEvents = 'none';
  56. trail.style.opacity = '1';
  57. trail.style.transform = 'translate(-50%, -50%)';
  58. trail.style.zIndex = '69420';
  59. document.body.appendChild(trail);
  60. trailElements.push(trail);
  61. }
  62.  
  63. let mouseX = 0, mouseY = 0;
  64. let trailPositions = Array(cursorTrailCount).fill({ x: 0, y: 0 });
  65.  
  66. function updateCursorTrail() {
  67. trailPositions = [{ x: mouseX, y: mouseY }, ...trailPositions.slice(0, cursorTrailCount - 1)];
  68.  
  69. trailElements.forEach((trail, index) => {
  70. setTimeout(() => {
  71. trail.style.left = `${trailPositions[index].x}px`;
  72. trail.style.top = `${trailPositions[index].y}px`;
  73.  
  74. if (
  75. trailPositions[index].x <= edgeThreshold ||
  76. trailPositions[index].x >= window.innerWidth - edgeThreshold ||
  77. trailPositions[index].y <= edgeThreshold ||
  78. trailPositions[index].y >= window.innerHeight - edgeThreshold
  79. ) {
  80. trail.style.opacity = '0';
  81. } else {
  82. trail.style.opacity = '1';
  83. }
  84. }, index * trailDelay);
  85. });
  86.  
  87. requestAnimationFrame(updateCursorTrail);
  88. }
  89.  
  90. updateCursorTrail();
  91.  
  92. window.addEventListener('mousemove', (event) => {
  93. mouseX = event.clientX;
  94. mouseY = event.clientY;
  95. });
  96.  
  97. const style = document.createElement('style');
  98. style.innerHTML = `
  99. * {
  100. cursor: none !important;
  101. }
  102. .sbg-crosshair {
  103. visibility: visible !important;
  104. }
  105. `;
  106. document.head.appendChild(style);
  107. }
  108.  
  109. window.addEventListener('load', applyModifiedIndex);
  110. })();