Guest User

G-Rebels v0.66 extended telemetry GUESSWORK

a guest
Nov 6th, 2026
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /* Disclaimer: I've no motion rig so this is guess work at best.
  2. * I'm more looking into telemetry for a home cockpit - that means hard targeting data,
  3. * enemy position, scan status, loadout, stuff like that. Nothing of this is here :/
  4. *
  5. * This is based on the early access 0.66 of G-Rebels and uses the
  6. * *extended* Telemetry output via UDP of the ingame options and nothing else.
  7. *
  8. * AFTER this was guessed https://reakktor.com/htm/gr_telemetry.htm was released
  9. * from the official developers - that also gets updated.
  10. *
  11. * This is a demo snippet for NodeJS - just run it with 'node' and the game starts
  12. * blabbing once the extended telemetry is enabled in the game.
  13. *
  14. * Should be enough to get you started 🤓
  15. *
  16. * -- bekopharm
  17. * */
  18. const dgram = require('dgram');
  19. const server = dgram.createSocket('udp4');
  20.  
  21. const PORT = 33001;
  22. const HOST = '127.0.0.1';
  23.  
  24. // Verified fixed offsets for the G-Rebels 236-byte telemetry packet
  25. const TEXT1_START = 0;       // "api"
  26. const TEXT2_START = 8;       // "G-Rebels"
  27. const TEXT3_START = 58;      // "X-Type" (Vehicle blueprint class name)
  28. const TEXT4_START = 108;     // "BP_SECTOR_C_..." (World sector or asset ID??)
  29. const TELEMETRY_START = 160; // Start of the Float32 flight dynamics values
  30.  
  31. // Gameplay telemetry zone at the end of the packet
  32. const LASER_SHOTS_START = 212;  // Primary weapon count (Int32)
  33. const MISSILE_SHOTS_START = 216; // Missiles fired counter (Int32)
  34. const ENEMY_HITS_START = 220;    // Incoming damage hits counter from enemies (Int32)
  35. const IMPACT_START = 224;        // Wall/Environment collision counter (Int32)
  36. const SHIELD_IMP_START = 232;    // Final Float: Shield impact absorption impulse?? (Delta)
  37.  
  38. // Change tracking storage for event triggers
  39. let lastLaserCount = null;
  40. let lastMissileCount = null;
  41. let lastHitCount = null;
  42. let lastImpactCount = null;
  43.  
  44. function parseText(buffer, startOffset, maxLength) {
  45.     const segment = buffer.subarray(startOffset, startOffset + maxLength);
  46.     const nullIndex = segment.indexOf(0);
  47.     return nullIndex === -1
  48.         ? segment.toString('ascii')
  49.         : segment.subarray(0, nullIndex).toString('ascii');
  50. }
  51.  
  52. server.on('message', (msg, rinfo) => {
  53.     if (msg.length !== 236) return;
  54.  
  55.     // 1. Parse text fields
  56.     const text3 = parseText(msg, TEXT3_START, 50);  
  57.     const text4 = parseText(msg, TEXT4_START, 52);  
  58.  
  59.     // 2. Read motion dynamics (Float32 Little Endian)
  60.     const pitch = msg.readFloatLE(TELEMETRY_START + 0);
  61.     const roll  = msg.readFloatLE(TELEMETRY_START + 4);
  62.     const rawYaw = msg.readFloatLE(TELEMETRY_START + 8);
  63.    
  64.     // IN-GAME COMPASS SYNC: Map raw Unreal Engine Yaw to 0-360° HUD heading
  65.     let headingDeg = rawYaw + 86.05; // or 90? hard to tell
  66.     if (headingDeg >= 360) headingDeg -= 360;
  67.     if (headingDeg < 0) headingDeg += 360;
  68.  
  69.     // Linear acceleration (Float32 LE)
  70.     const accLongitudinal = msg.readFloatLE(TELEMETRY_START + 16); // Surge acceleration
  71.     const accLateral      = msg.readFloatLE(TELEMETRY_START + 20); // Sway acceleration
  72.     const accVertical     = msg.readFloatLE(TELEMETRY_START + 24); // Heave acceleration
  73.    
  74.     // Thrust input controls (Float32 LE, -1..+1)
  75.     const thrustForward = msg.readFloatLE(TELEMETRY_START + 40); // Forward/reverse throttle
  76.     const thrustVertical = msg.readFloatLE(TELEMETRY_START + 44); // Vertical thrust
  77.     const thrustLateral = msg.readFloatLE(TELEMETRY_START + 48); // Lateral thrust
  78.  
  79.     // Translate Unreal Engine Units (cm/s) directly into km/h
  80.     const speedCmS  = msg.readFloatLE(TELEMETRY_START + 28);
  81.     const speedKmh  = (speedCmS / 100) * 3.6;
  82.  
  83.     // Local cockpit translation/strafe forces (G-forces? little hight…)
  84.     const gSwayLocal  = msg.readFloatLE(TELEMETRY_START + 32); // Left (-) / Right (+)
  85.     const gHeaveLocal = msg.readFloatLE(TELEMETRY_START + 36); // Up (-) / Down (+)
  86.  
  87.     // 3. Read gameplay event counters
  88.     const currentLaserCount = msg.readInt32LE(LASER_SHOTS_START);
  89.     const currentMissileCount = msg.readInt32LE(MISSILE_SHOTS_START);
  90.     const currentHitCount = msg.readInt32LE(ENEMY_HITS_START);
  91.     const currentImpactCount = msg.readInt32LE(IMPACT_START);
  92.     const hitStrength = msg.readFloatLE(228);
  93.     const shieldImpulse = msg.readFloatLE(SHIELD_IMP_START);
  94.  
  95.     // Calculate event triggers for tactile hardware/shakers
  96.     const laserFired = (lastLaserCount !== null && currentLaserCount > lastLaserCount);
  97.     const missileFired = (lastMissileCount !== null && currentMissileCount > lastMissileCount);
  98.     const hitSustained = (lastHitCount !== null && currentHitCount > lastHitCount);
  99.     const wallCollision = (lastImpactCount !== null && currentImpactCount > lastImpactCount);
  100.  
  101.     // Store current state for next tick comparisons
  102.     lastLaserCount = currentLaserCount;
  103.     lastMissileCount = currentMissileCount;
  104.     lastHitCount = currentHitCount;
  105.     lastImpactCount = currentImpactCount;
  106.  
  107.     // Output formatted live console dump
  108.     console.clear();
  109.     console.log(`[G-Rebels Telemetry | Motion Rig Parser]`);
  110.     console.log(`==================================================`);
  111.     console.log(`Vehicle Class:  "${text3}"`);
  112.     console.log(`World Sector:   "${text4}"`);
  113.     console.log(`--------------------------------------------------`);
  114.     console.log(`Orientation & Navigation (HUD Synced):`);
  115.     console.log(`  Pitch (Attitude):     ${pitch.toFixed(2)}°`);
  116.     console.log(`  Roll (Bank):          ${roll.toFixed(2)}°`);
  117.     console.log(`  Compass (Heading):    ${headingDeg.toFixed(1)}°`);
  118.     console.log(`--------------------------------------------------`);
  119.     console.log(`Rig Dynamics (Direct Actuator Forces):`);
  120.     console.log(`  Flight Speed:         ${speedKmh.toFixed(0)} km/h`);
  121.     console.log(`  Acceleration:     Longitudinal: ${accLongitudinal.toFixed(2)} | Lateral: ${accLateral.toFixed(2)} | Vertical: ${accVertical.toFixed(2)}`);
  122.     console.log(`  Cockpit Strafe (G):   Sway (Lateral): ${gSwayLocal.toFixed(3)} ??`);
  123.     console.log(`                        Heave (Vert):   ${gHeaveLocal.toFixed(3)} ??`);
  124.     console.log(`  Thrust Inputs:        Forward: ${thrustForward.toFixed(2)} | Vertical: ${thrustVertical.toFixed(2)} | Lateral: ${thrustLateral.toFixed(2)}`);
  125.     console.log(`--------------------------------------------------`);
  126.     console.log(`Gameplay Counters & Game State:`);
  127.     console.log(`  Laser / Missile Fire: ${currentLaserCount} / ${currentMissileCount}`);
  128.     console.log(`  Enemy Hits / Crashes: ${currentHitCount} / ${currentImpactCount}`);
  129.     console.log(`  Hit Strength (Δ) ???:    ${hitStrength.toFixed(4)}`);
  130.     console.log(`  Shield Impulse (Δ) ??:   ${shieldImpulse.toFixed(4)}`);
  131.     console.log(`==================================================`);
  132.  
  133.     // Haptic/Motion triggers ready to map to hardware profiles
  134.     if (laserFired)   console.log(`[FEEDBACK] RECOIL: Laser gun fired!`);
  135.     if (missileFired)  console.log(`[FEEDBACK] RECOIL: Missile launched!`);
  136.     if (hitSustained) console.log(`[FEEDBACK] DAMAGE: Vehicle hit by enemy!`);
  137.     if (wallCollision)   console.log(`[FEEDBACK] IMPACT: Vehicle crashed into obstacle!`);
  138. });
  139.  
  140. server.on('listening', () => {
  141.     const address = server.address();
  142.     console.log(`G-Rebels UDP Parser actively listening on ${address.address}:${address.port}`);
  143. });
  144.  
  145. server.bind(PORT, HOST);
  146.  
Advertisement
Add Comment
Please, Sign In to add comment