Project Overview
Ballistics Toolkit is a client-side web-based ballistics calculator and simulation suite for long-range shooting. Built with WebAssembly and Three.js, it provides trajectory calculations with atmospheric, wind, and spin effects, load comparison, Performance Matrix analysis, Monte Carlo target simulation, hit simulation, wind visualization, interactive steel target simulator, an interactive F‑Class match simulator, and a printable target generator, all running in your browser without any software installation.
Tools in the Suite
Ballistics Toolkit currently includes a set of calculators and simulators that share the same WebAssembly ballistics engine:
- 📊 Ballistic Calculator - trajectory tables with G1/G7 drag models, atmosphere, wind, and optional spin effects.
- ⚖️ Load Comparison - side-by-side comparison of two loads (drop, drift, velocity, energy, time).
- 🎛️ Performance Matrix - BC/MV grid showing wind drift, drop, velocity, energy, and MV sensitivity with color-coded cells.
- 🎯 Target Simulator - Monte Carlo target simulations with modeled accuracy and wind variability.
- 🎲 Hit Simulator - Monte Carlo hit probability against custom circle or rectangle targets with dispersion statistics (CEP, mean radius, group size).
- 🌬️ Wind Generator - standalone view of the curl-noise wind field that powers the simulators.
- 🎮 F-Class Simulator - interactive 3D F-Class match simulator (300-1000 yards) with mirage and flags; configurable String Fire matches and two-player Pair Fire mode, plus Remote Play (Beta) to stream a match to another player over a peer-to-peer connection.
- 🔩 Steel Target Simulator - interactive steel range with reactive targets, mirage, hunting mode, and impact visuals.
- 🖨️ Target Generator - generate printable competition targets at 1:1 scale (print at Actual Size) with tiling layouts.
How It Works
The summary below lists the technology behind the suite. For a full, illustrated walkthrough of the ballistics model itself (drag tables, numerical integration, atmosphere, spin effects, and the curl-noise wind field, with equations and diagrams), see the dedicated How It Works page.
- WebAssembly: Emscripten compilation for fast performance
- Algorithms: 2nd-order Runge-Kutta (RK2) integration for trajectory calculations
- Drag Models: G1 and G7 standard drag functions
- Atmosphere: Uses temperature, humidity, and altitude inputs. Atmospheric pressure is calculated from altitude using the ISA power-law barometric formula.
- Spin Aerodynamics: Modified point-mass trajectory with spin drift and crosswind jump from Bryan Litz's empirical (fitted) formulas, driven by the gyroscopic stability factor. Spin drift is applied continuously along the trajectory; the crosswind jump is generalized to wind changes met downrange, an engineering approximation beyond Litz's muzzle figure.
- Wind Modeling: 2D curl field from time varying 3D Simplex noise with multi-octave components.
- Focus: Depth-of-field style blur in the scope view, using a depth texture and a thin‑lens model (objective diameter and focus distance set the defocus) to weight a separable Gaussian blur.
- Mirage: Post-process shimmer shader composed of independent atmospheric slabs along the line of sight, sampling one shared 4D simplex field (three spatial axes plus time). Each slab samples the wind at its own depth with EMA smoothing and its own drift and attenuation; near-shooter slabs naturally read as larger soft features and target-end slabs as crisp small features, mirroring the depth-of-field behavior of a focused scope. Intensity is selectable (or off) per session.
- Three.js & Shaders: WebGL rendering built on Three.js with custom materials and post-processing passes for scopes, mirage, and particle effects.
- Remote Play (Beta): Browser-native WebRTC streams the host's live view and audio peer-to-peer to a remote player; connections are negotiated with the PeerJS library (broker signaling plus public STUN servers). No backend server of our own.
- Steel Target Physics: Hanging targets with simple rigid-body style motion (momentum transfer, damping, and rotation), so center impacts swing and edge hits induce spin.
- Impact & Dust Effects: Instanced impact marks on steel and ground plus particle-based dust clouds whose visibility responds to impact location, zoom, and environment.
- Scopes: Pointer-lock rifle and spotting scopes with FFP reticles (Steel) or SFP/FFP selection (F‑Class), and angular units matched to the underlying ballistics (MRAD/MOA).
- Shared Engine: Calculators, simulators, and the Performance Matrix all use the same underlying ballistics core so results stay consistent between tools.
Why Ballistics Toolkit
Plan & Train: Explore trajectory tables, visualize wind effects, and practice match flow from 300–1000 yards.
Fast & Portable: Runs entirely in the browser, no login, no install.