Shell Shockers loads a WebAssembly module to handle some of the core game logic. WebAssembly is a low-level language. As of yolkbot 1.4.0, yolkbot has the full WebAssembly translated to JavaScript.
The following functions listed detail how to use the JavaScript translations. For the direct WebAssembly module, scroll down to the "WASM Loader" section.
The coords function allows you to get the "coords" value (which is sent to the game) given a yaw and pitch.
import { coords } from 'yolkbot/wasm';
const yaw = 0.5; // your yaw value
const pitch = 0.5; // your pitch value
const result = coords(yaw, pitch);
console.log(result); // ABCDEFGH
Coords are 8 letter strings that encode the yaw and pitch values through various bitwise shifts.
The processJS function allows you to decode the shellshock.js file.
import { processJS } from 'yolkbot/wasm';
const request = await fetch('https://shellshock.io/js/shellshock.js');
const rawBytes = await request.text();
const readableCode = await processJS(rawBytes);
console.log(readableCode); // (()=>{ ...
The validate function allows you to validate a UUID sent by the matchmaker.
import { validate } from 'yolkbot/wasm';
const input = 'test';
console.log(validate(input));
As of yolkbot 1.4.0, the WebAssembly module is not used by yolkbot (as it was in previous versions).
Loading and handling the module directly is more complex than using the JavaScript translations. Here be dragons!
To import, import the WASM class from yolkbot/wasm/legacy.
import WASM from 'yolkbot/wasm/legacy';
Then, create a new instance of the class and call the initWasm method.
const wasm = new WASM();
await wasm.initWasm();
You can then call the methods on the wasm instance. wasm.validate and wasm.coords are the same as above.
wasm.process is asynchronous and named process and not processJS.
const readableCode = await wasm.process(rawBytes);
console.log(readableCode); // (()=>{ ...
You can also use wasm.getYawPitch() and wasm.resetYawPitch() to get and reset the yaw and pitch values stored in the WASM memory.
const { yaw, pitch, coords } = wasm.getYawPitch();
console.log(yaw, pitch, coords); // 0.5 0.5 'ABCDEFGH'
You can use getImports() for the imports needed to instantiate the WASM module manually.
getStringFromWasm(ptr, len): str and passStringToWasm(str): { ptr, len } can be used to read and write strings to the WASM memory.
You can call wasm.wasm to get the raw exports from the WASM module.
Shell Shockers loads a WebAssembly module to handle some of the core game logic. WebAssembly is a low-level language. As of yolkbot 1.4.0, yolkbot has the full WebAssembly translated to JavaScript.
The following functions listed detail how to use the JavaScript translations. For the direct WebAssembly module, scroll down to the "WASM Loader" section.
The coords function allows you to get the "coords" value (which is sent to the game) given a yaw and pitch.
import { coords } from 'yolkbot/wasm';
const yaw = 0.5; // your yaw value
const pitch = 0.5; // your pitch value
const result = coords(yaw, pitch);
console.log(result); // ABCDEFGH
Coords are 8 letter strings that encode the yaw and pitch values through various bitwise shifts.
The processJS function allows you to decode the shellshock.js file.
import { processJS } from 'yolkbot/wasm';
const request = await fetch('https://shellshock.io/js/shellshock.js');
const rawBytes = await request.text();
const readableCode = await processJS(rawBytes);
console.log(readableCode); // (()=>{ ...
The validate function allows you to validate a UUID sent by the matchmaker.
import { validate } from 'yolkbot/wasm';
const input = 'test';
console.log(validate(input));
As of yolkbot 1.4.0, the WebAssembly module is not used by yolkbot (as it was in previous versions).
Loading and handling the module directly is more complex than using the JavaScript translations. Here be dragons!
To import, import the WASM class from yolkbot/wasm/legacy.
import WASM from 'yolkbot/wasm/legacy';
Then, create a new instance of the class and call the initWasm method.
const wasm = new WASM();
await wasm.initWasm();
You can then call the methods on the wasm instance. wasm.validate and wasm.coords are the same as above.
wasm.process is asynchronous and named process and not processJS.
const readableCode = await wasm.process(rawBytes);
console.log(readableCode); // (()=>{ ...
You can also use wasm.getYawPitch() and wasm.resetYawPitch() to get and reset the yaw and pitch values stored in the WASM memory.
const { yaw, pitch, coords } = wasm.getYawPitch();
console.log(yaw, pitch, coords); // 0.5 0.5 'ABCDEFGH'
You can use getImports() for the imports needed to instantiate the WASM module manually.
getStringFromWasm(ptr, len): str and passStringToWasm(str): { ptr, len } can be used to read and write strings to the WASM memory.
You can call wasm.wasm to get the raw exports from the WASM module.