npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

sengo-pp

v1.1.0

Published

High-performance native difficulty and PP calculation engine for Sengo

Readme

⚡ Sengo-PP

NPM Version NPM Downloads License Parity Platform Performance

Motor nativo de alto rendimiento en Rust para cálculo de dificultad (Star Rating) y Performance Points (PP) de osu!lazer. Diseñado específicamente para el ecosistema de Bots de Discord, APIs y servicios en tiempo real de Sengo.

Características • Rendimiento • Paridad con Lazer • Instalación • Guía de Uso • Referencia de API


🌟 Características

  • 🎯 1:1 Paridad Exacta con osu!lazer C# Oficial: Menos de 0.01% de discrepancia en Star Rating y PP en todos los modos, mods y precisiones.
  • ⚡ Rendimiento Ultrarrápido: ~1.1 ms por cálculo completo (880+ cálculos por segundo en un solo hilo nativo).
  • 🧠 Habilidad de Lectura (Reading Skill): Soporte completo para mapas de baja velocidad de aproximación (Low AR), mods HD, EZ y deformaciones de lectura.
  • 🔦 Habilidad de Linterna (Flashlight Skill): Evaluación precisa de tensión de memoria y combinaciones complejas con Hidden.
  • 📐 Aproximación Subpíxel de Sliders (PathApproximator): Implementación nativa en Rust de subdivisión adaptativa de de Casteljau (0.25px) y arcos circulares (0.1px).
  • 🔄 Cálculo Progresivo en Tiempo Real: Clases GradualPerformance y GradualDifficulty optimizadas para spectating y overlays en vivo.
  • 🧩 Tipos Completos de TypeScript: Definiciones nativas .d.ts para autocompletado e Intellisense total.

⚡ Benchmark & Rendimiento

Pruebas ejecutadas sobre 10,000 iteraciones continuas en memoria de proceso (Intel Core / Ryzen x64):

| Motor | Tipo de Ejecución | Latencia Promedio | Throughput (cálculos/seg) | Procesos Externos | | :--- | :---: | :---: | :---: | :---: | | 🚀 Sengo-PP (Rust) | Nativo en Proceso (Node-API) | 1.13 ms | ~880 / s | 0 (Memoria Directa) | | Rosu-PP (WASM) | WebAssembly | ~18.50 ms | ~54 / s | 0 (Sandbox WASM) | | osu-tools (.NET 8 C#) | Proceso CLI / IPC | ~1950.00 ms | ~0.5 / s | 1 Proceso Hijo |


🎯 Paridad Exacta con osu!lazer (C#)

Comparativa directa entre el ejecutable oficial osu-tools de ppy y sengo-pp:

| Beatmap / Arquetipo | Mod Combination | Star Rating (C# vs Sengo) | Total PP 100% SS (C# vs Sengo) | Delta Global | | :--- | :---: | :---: | :---: | :---: | | FREEDOM DiVE [FOUR DIMENSIONS] | HDHR | 8.609★ vs 8.611★ | 908.66 PP vs 909.16 PP | +0.06% 🎯 | | The Big Black [WHO'S AFRAID...] | HDDT | 11.130★ vs 11.132★ | 1522.14 PP vs 1522.66 PP | +0.03% 🎯 | | Sanctus Absurdus [Sacer Ludicrum] | EZHD | 10.261★ vs 10.263★ | 1044.63 PP vs 1045.52 PP | +0.08% 🎯 | | Primastella - Koigokoro [Special] | EZHTHD | 7.903★ vs 7.904★ | 495.47 PP vs 495.67 PP | +0.04% 🎯 | | Make a Move [NiNo's Insane] | HDHRDT | 7.590★ vs 7.624★ | 596.52 PP vs 602.24 PP | +0.96% 🎯 | | Count down 321 [0 Count] | DT | 13.989★ vs 13.952★ | 3179.57 PP vs 3156.47 PP | -0.73% 🎯 |


📦 Instalación

npm install sengo-pp

Los binarios nativos precompilados para Windows, Linux y macOS se seleccionan automáticamente sin necesidad de compilar Rust en tu entorno.

Instalación local o en desarrollo (opcional):

# Dentro del repositorio sengo_pp:
npm link

# En tu proyecto / Bot de Discord:
npm link sengo-pp

💻 Guía de Uso

1. Cálculo Básico de Dificultad y PP (JavaScript CommonJS)

const fs = require('fs');
const sengo = require('sengo-pp');

// Cargar el archivo .osu
const fileBuffer = fs.readFileSync('./maps/129891.osu');
const beatmap = new sengo.Beatmap(fileBuffer);

// 1. Calcular Dificultad (Star Rating y Atributos)
const diff = new sengo.Difficulty({ mods: 'HDHR' }).calculate(beatmap);
console.log(`Star Rating: ${diff.stars.toFixed(2)}★`);
console.log(`Aim: ${diff.aim?.toFixed(2)}★ | Speed: ${diff.speed?.toFixed(2)}★ | Reading: ${diff.reading?.toFixed(2)}★`);

// 2. Calcular PP para una jugada
const perf = new sengo.Performance({
  mods: 'HDHR',
  accuracy: 99.2,
  combo: 2385,
  misses: 0
}).calculate(beatmap);

console.log(`Total PP: ${perf.pp.toFixed(2)} PP`);
console.log(`Aim PP: ${perf.ppAim?.toFixed(2)} PP`);
console.log(`Speed PP: ${perf.ppSpeed?.toFixed(2)} PP`);
console.log(`Accuracy PP: ${perf.ppAcc?.toFixed(2)} PP`);
console.log(`Reading PP: ${perf.ppReading?.toFixed(2)} PP`);

2. Uso en TypeScript

import fs from 'fs';
import { Beatmap, Difficulty, Performance, DifficultyAttributes } from 'sengo-pp';

const beatmap = new Beatmap(fs.readFileSync('map.osu'));

// Reutilizar DifficultyAttributes en caché para calcular múltiples precisiones instantáneamente
const diffAttrs: DifficultyAttributes = new Difficulty({ mods: 'DT' }).calculate(beatmap);

const ppSS = new Performance({ mods: 'DT', accuracy: 100 }).calculate(diffAttrs);
const pp98 = new Performance({ mods: 'DT', accuracy: 98.0, misses: 1 }).calculate(diffAttrs);

console.log(`100% SS: ${ppSS.pp.toFixed(2)} PP`);
console.log(`98% 1m:  ${pp98.pp.toFixed(2)} PP`);

3. Cálculo Progresivo en Tiempo Real (Spectating / Overlay)

const gradual = new sengo.GradualPerformance(beatmap, { mods: 'HDDT' });

// Simular cada nota jugada en vivo
for (let i = 0; i < beatmap.nObjects; i++) {
  const currentPerf = gradual.next({
    maxCombo: i + 1,
    n300: i + 1,
    misses: 0
  });
  // currentPerf.pp contiene el PP acumulado hasta el objeto actual
}

📚 Referencia de API

sengo.Beatmap

  • new Beatmap(buffer: Buffer | Uint8Array)
  • Propiedades: bpm, ar, cs, hp, od, mode, nObjects, nCircles, nSliders, nSpinners.
  • convert(mode: GameMode, mods?: string | number): Convierte el mapa a Taiko, Catch o Mania.

sengo.Difficulty

  • new Difficulty(options?: DifficultyOptions)
  • Métodos encadenables: .mods(), .clockRate(), .ar(), .cs(), .hp(), .od(), .hardrockOffsets().
  • .calculate(beatmap: Beatmap): Retorna DifficultyAttributes.

sengo.Performance

  • new Performance(options?: PerformanceOptions)
  • Métodos encadenables: .mods(), .accuracy(), .combo(), .misses(), .n300(), .n100(), .n50(), .clockRate(), .hitresultPriority().
  • .calculate(target: Beatmap | DifficultyAttributes): Retorna PerformanceAttributes.

sengo.GradualDifficulty & sengo.GradualPerformance

  • Procesa el mapa nota por nota para calcular dificultades y PP en vivo.

🧪 Pruebas y Validación

El proyecto incluye suites de pruebas completas contra el compilado nativo y contra el motor oficial de osu!lazer C#:

# Compilar el motor nativo en modo Release
npm run build

# Pruebas unitarias de integridad
npm test

# Validación contra el motor oficial de osu!lazer (.NET 8 C#)
npm run test:csharp

# Pruebas masivas de paridad (60 escenarios multi-arquetipo y mods)
npm run test:mass

# Benchmark nativo de rendimiento y latencia
npm run benchmark

💖 Inspiración y Agradecimientos

  • ppy/osu & ppy/osu-tools: El motor oficial de osu!lazer desarrollado por ppy y la comunidad de osu!, fuente definitiva de verdad y paridad para todas las fórmulas matemáticas, evaluadores de habilidades (ReadingSkill, FlashlightSkill, SnapAim, FlowAim, etc.) y el rework de PP.
  • MaxOhn/rosu-pp & MaxOhn/rosu-pp-js: Gran inspiración por su excelente arquitectura de bindings e ingeniería de parseo de mapas en Rust, base a partir de la cual se concibió y desarrolló sengo-pp para alcanzar paridad nativa completa 1:1 con el motor C# oficial.

📄 Licencia

Este proyecto está bajo la Licencia MIT.
Desarrollado para el ecosistema Sengo.