[Gravity_Particles] Add a true N-body mode (softened gravity / Barnes-Hut) and a web build

Aperta
#400 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
25/100
Tipo di issue
Funzionalità
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
cmake, cpp
Ambito
game-dev

Direzione di ricerca

Start with Math_Chaos/Gravity_Particles/main.cpp:31-56 and the gravity particles documentation at docs/src/content/docs/math-chaos/gravity-particles.mdx:20. Identify how cursor attraction and particle updates currently work, then determine how the proposed integrator, Barnes-Hut option, controls, tests, and Emscripten build fit the project. Done means the acceptance criteria pass and the documentation describes the available modes.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

area: math-chaos priority: P3 size: L type: enhancement

Summary

The docs already promise N-body gravity, and raylib supports Emscripten. A real N-body mode (O(N^2) for a few thousand bodies, or Barnes-Hut for more) with optional mouse attraction would match the project name and the docs. A WASM build could be embedded in the docs site.

Location

  • Math_Chaos/Gravity_Particles/main.cpp:31-56
  • docs/src/content/docs/math-chaos/gravity-particles.mdx:20

Evidence

Currently there is only cursor attraction (main.cpp:37), with no particle-particle forces.

Expected

A toggle between “cursor” and “N-body” modes, configurable particle count, and an optional web build.

Proposed fix

  1. Add an NBody integrator (leapfrog/velocity Verlet with Plummer softening). Start with O(N^2) and add a quadtree Barnes-Hut (theta = 0.5).
  2. Add key bindings (G toggles mode, +/- changes count).
  3. Add an Emscripten CMake preset (-DPLATFORM=Web) and embed the result in the docs page.

Acceptance criteria

  • N-body mode conserves total momentum within 1e-3 over 1000 steps (test)
  • Web build runs in a browser

Repository audit, November 2026 · Phase 9 · New features · evidence: found by code reading · ref chaos-native-055


Generated by Claude Code

Lingua principale
C++
Stelle
2
Fork
1
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di ibra-kdbra/Math-Problems

Tutte le issue di ibra-kdbra/Math-Problems

Issue simili

Altre issue su C++

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.