{"id":"realencryptal/hindsight","name":"hindsight","scope":"realencryptal","platform":"roblox","description":"Generalized hit detection and lag-compensated rollback for Roblox gun systems.","version":"0.2.0","latest":"0.2.0","versions":["0.1.0","0.2.0"],"license":"MIT","licenseRating":"safe","licenseCaveats":[],"licenseVerified":true,"dependencies":{},"integrity":"ca7f9dd8f6d3ba1a6b6d3403747180be1a88b9b0d920f61d25e893e3542712bd","likes":0,"downloads":0,"install":"forest install realencryptal/hindsight","url":"https://forest.dev/p/roblox/realencryptal/hindsight","files":"https://api.forest.dev/ai/package/roblox/realencryptal/hindsight/files","readme":"# Hindsight\r\n\r\n[![Docs](https://github.com/realencryptal/hindsight/actions/workflows/docs.yml/badge.svg)](https://github.com/realencryptal/hindsight/actions/workflows/docs.yml)\r\n[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)\r\n[![Wally](https://img.shields.io/badge/wally-realencryptal%2Fhindsight-orange)](https://wally.run/package/realencryptal/hindsight)\r\n\r\nA generalized hit-detection and lag-compensated rollback library for Roblox gun systems.\r\n\r\n**Docs:** https://realencryptal.github.io/Hindsight/\r\n**Writeup:** https://www.encryptal.dev/devlog/hindsight\r\n\r\nHindsight provides three primitives:\r\n\r\n1. **Projectile simulation** — a server-authoritative, parallelized projectile engine with penetration, ricochet, and snapshot-based hit detection. Same shape as a casting library, but every wiring decision (actors, containers, projectile definitions, rig hitboxes) is supplied by the caller through code.\r\n2. **Hitscan** — a single-frame, lag-compensated ray resolver. Reuses the same `ProjectileDefinition` and callback wiring as the projectile path; full ricochet and penetration parity. Runs on the main thread.\r\n3. **Standalone rollback** — the snapshot system is exposed on its own. Query a ray, retrieve a character's interpolated pose, or build melee / ability checks on top of it without touching the cast path.\r\n\r\n\r\n## Install\r\n\r\n```toml\r\n# wally.toml\r\n[dependencies]\r\nHindsight = \"realencryptal/hindsight@^0.2\"\r\n```\r\n\r\n## Quick reference\r\n\r\n```lua\r\nlocal Hindsight = require(ReplicatedStorage.Hindsight)\r\n\r\nlocal world = Hindsight.createWorld({\r\n    actorContainer    = ServerScriptService,\r\n    visualsContainer  = workspace.Bullets, -- optional\r\n    definitionsModule = ReplicatedStorage.Shared.Definitions,\r\n    threads           = 16,\r\n    rollback          = { ... },\r\n    penetration       = { ... },\r\n})\r\n\r\nworld.rollback:autoCapturePlayers()\r\n\r\nworld:cast({\r\n    caster    = player,\r\n    type      = \"Bullet\",\r\n    origin    = origin,\r\n    direction = direction,\r\n    timestamp = workspace:GetServerTimeNow(),\r\n})\r\n\r\n-- Single-frame hitscan (server-side: lag-compensated; client-side: world-only):\r\nworld:hitscan({\r\n    caster    = player,\r\n    type      = \"Laser\",\r\n    origin    = origin,\r\n    direction = direction,\r\n    timestamp = workspace:GetServerTimeNow(),\r\n})\r\n\r\n-- Standalone rollback query (server-only):\r\nlocal hit = world.rollback:queryRay(timestamp, origin, direction, 500)\r\n```\r\n\r\n## Documentation\r\n\r\n- [Getting started](https://realencryptal.github.io/Hindsight/docs/getting-started) — end-to-end setup in under five minutes\r\n- [Concepts](https://realencryptal.github.io/Hindsight/docs/concepts) — how the snapshot model, actor pool, and definitions fit together\r\n- [Wiring server and client](https://realencryptal.github.io/Hindsight/docs/wiring) — what your scripts need to do\r\n- [Defining projectiles](https://realencryptal.github.io/Hindsight/docs/defining-projectiles) — the definitions module\r\n- [Standalone rollback](https://realencryptal.github.io/Hindsight/docs/rollback) — using snapshots without projectiles\r\n- [Configuration reference](https://realencryptal.github.io/Hindsight/docs/configuration) — every `WorldConfig` knob\r\n- [API reference](https://realencryptal.github.io/Hindsight/api/Hindsight) — generated from source\r\n\r\nA complete working server + client lives in [`example/`](example).\r\n\r\n## License\r\n\r\n[MIT](LICENSE)\r\n","readmeTruncated":false}