An open API service indexing awesome lists of open source software.

https://github.com/freddysae0/threejs-aim-trainer

Aim trainer, made in three js
https://github.com/freddysae0/threejs-aim-trainer

Last synced: about 2 months ago
JSON representation

Aim trainer, made in three js

Awesome Lists containing this project

README

          

# Aim trainer for shooters, (in ThreeJS)

๐ŸŽฎ Game Preview


Preview

## How to install

```bash
npm install
```

## How to run

```bash
npm run dev
```

## How to build

```bash
npm run build
```

## How to preview

```bash
npm run preview
```

---

## ๐ŸŽฎ Gameplay & Controls

| Action | Key/Mouse |
|--------|-----------|
| Move Forward / Back | `W` / `S` |
| Strafe Left / Right | `A` / `D` |
| Shoot | `Left Click` |
| Crouch | `C` (hold) |
| Jump | `Space` |
| Lock Pointer | `Click` inside canvas |
| Start Round | `Space` |

Use the **sensitivity slider** in the start screen to fine-tune mouse sensitivity. The value is stored in `localStorage` so your preference persists across sessions.

## โœจ Features

* Three target presets (3, 8, 50) for quick warm-ups.
* Procedurally generated colored cubes that become shootable one at a time.
* Animated target absorption effect when hit.
* Die-cut cell-shaded pistol model that follows camera rotation.
* FPS-style WASD movement with adjustable sensitivity and inertia.
* Built-in timer that stops automatically when the last target disappears.
* Post-processing pipeline (`EffectComposer`, FXAA pass) ready for expansion.
* Fully written in **TypeScript** + **Three.js** and bundled with **Vite**.

## ๐Ÿ—‚๏ธ Project Structure

```text
three-shooter/
โ”œโ”€โ”€ public/ # Static assets (models, textures, iconsโ€ฆ)
โ”œโ”€โ”€ src/
โ”‚ โ”œโ”€โ”€ core/ # Engine wrappers (Camera, Renderer, Loop, App)
โ”‚ โ”œโ”€โ”€ objects/ # 3D objects & generators (Cube, Pistol โ€ฆ)
โ”‚ โ”œโ”€โ”€ scenes/ # Three.js scenes (MainScene)
โ”‚ โ”œโ”€โ”€ systems/ # Behaviour modules (ControlsWithMovement)
โ”‚ โ”œโ”€โ”€ ui/ # DOM-based UI overlays (StartScreen)
โ”‚ โ””โ”€โ”€ main.ts # Vite entry point
โ”œโ”€โ”€ index.html # Game container & UI markup
โ”œโ”€โ”€ package.json # NPM scripts & deps
โ””โ”€โ”€ tsconfig.json # TypeScript configuration
```

## ๐Ÿ› ๏ธ Tech Stack

* **Three.js** โ€“ WebGL abstraction layer for 3D rendering.
* **TypeScript** โ€“ Static typing for safer code.
* **Vite** โ€“ Lightning-fast dev server & bundler.
* **Post-processing Addons** โ€“ `EffectComposer`, `RenderPass`, `FXAAShader`.

## ๐Ÿ”ง Configuration

| Option | Location | Description |
|--------|----------|-------------|
| Mouse sensitivity | `localStorage` key `mouseSensitivity` | Set via slider on start screen. Multiplies base rotation speed. |
| Renderer quality | `src/core/Renderer.ts` | Change antialias, pixel ratio, post FX. |
| Target counts | `src/scenes/MainScene.ts` | `level1/2/3()` generate different numbers of cubes. |

## ๐Ÿ“œ Available NPM Scripts

| Script | Purpose |
|--------|---------|
| `npm run dev` | Local dev server on `localhost:5173`. |
| `npm run build` | Production build to `dist/`. |
| `npm run preview` | Preview the production build locally. |

## ๐Ÿ“ฆ Assets

* `public/models/pistol.glb` โ€“ Low-poly pistol model.
* `preview.gif` โ€“ Gameplay preview used in this README.
* `controls.png` โ€“ Legend for keyboard controls shown in HUD.

## ๐Ÿš€ Deployment

The final build is static and can be deployed to any static host (Netlify, GitHub Pages, Vercelโ€ฆ).

```bash
npm run build
# copy dist/ to your preferred host
```

## ๐Ÿ‘ค Author

*Freddy Sae*

Feel free to open issues or PRs!

## ๐Ÿ“ License

This project is released under the **MIT License** โ€“ see [`LICENSE`](LICENSE) for details.