Skip to content

Soham1803/TPS-Controls

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

28 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐ŸŽฎ Third-Person Shooter Controls

A modern, web-based third-person shooter game built with React Three Fiber, TypeScript, and Rapier Physics. Experience smooth gameplay with advanced camera controls, realistic physics, and immersive 3D graphics - all running in your browser!

Demo TypeScript React Three.js

โœจ Features

  • ๐ŸŽฏ Smooth Third-Person Camera System with intelligent collision detection
  • ๐Ÿƒ Realistic Movement Controls - Walk, run, strafe, jump, and crouch
  • ๐Ÿ”ซ Dynamic Shooting System with muzzle flash effects and recoil
  • ๐ŸŽจ Advanced Animation System using FBX animations with smooth transitions
  • ๐ŸŒ Physics-Based Gameplay powered by Rapier physics engine
  • ๐Ÿ“ฑ Responsive Controls supporting both keyboard and potential gamepad input
  • ๐Ÿ—๏ธ Modular Architecture with clean separation of concerns

๐Ÿš€ Quick Start

Prerequisites

  • Node.js 16+ and pnpm (recommended) or npm/yarn
  • Modern web browser with WebGL support

Installation

  1. Clone the repository

    git clone https://github.com/Soham1803/third-person-shooter-controls.git
    cd third-person-shooter-controls
  2. Quick setup (recommended)

    pnpm run setup

    Or install dependencies manually:

    pnpm install
    # or alternatively
    npm install
    # or
    yarn install
  3. Start the development server

    pnpm run dev:watch    # Recommended: Auto-rebuilds package + demo
    # or alternatively
    pnpm run dev          # Just demo
    # or
    npm run dev
    # or
    yarn dev
  4. Open your browser and navigate to http://localhost:5173

Controls

Key Action
W/A/S/D Move forward/left/backward/right
F (hold) Run
Space Jump
Mouse Look around
Right Click (hold) Zoom/Aim
Left Click Shoot

๐Ÿ—๏ธ Project Structure

โ”œโ”€โ”€ package/                    # ๐Ÿ“ฆ NPM Package Source
โ”‚   โ”œโ”€โ”€ src/
โ”‚   โ”‚   โ”œโ”€โ”€ Player.tsx          # Main player component
โ”‚   โ”‚   โ”œโ”€โ”€ index.ts            # Package entry point
โ”‚   โ”‚   โ””โ”€โ”€ modules/player/     # Modular player systems
โ”‚   โ”‚       โ”œโ”€โ”€ constants.ts    # Game configuration
โ”‚   โ”‚       โ”œโ”€โ”€ types.ts        # TypeScript interfaces
โ”‚   โ”‚       โ”œโ”€โ”€ camera.ts       # Camera positioning & collision
โ”‚   โ”‚       โ”œโ”€โ”€ movement.ts     # Player movement logic
โ”‚   โ”‚       โ”œโ”€โ”€ jump.ts         # Jump mechanics
โ”‚   โ”‚       โ”œโ”€โ”€ shooting.ts     # Weapon system
โ”‚   โ”‚       โ”œโ”€โ”€ recoil.ts       # Camera recoil effects
โ”‚   โ”‚       โ”œโ”€โ”€ muzzleFlash.ts  # Visual effects
โ”‚   โ”‚       โ”œโ”€โ”€ physics.ts      # Physics integration
โ”‚   โ”‚       โ”œโ”€โ”€ textures.ts     # Texture utilities
โ”‚   โ”‚       โ””โ”€โ”€ useAnimationSetup.ts # Animation management
โ”‚   โ”œโ”€โ”€ dist/                   # Built package files
โ”‚   โ”œโ”€โ”€ package.json            # Package configuration
โ”‚   โ””โ”€โ”€ README.md               # Package documentation
โ”œโ”€โ”€ demo/                       # ๐ŸŽฎ Live Demo Application
โ”‚   โ”œโ”€โ”€ src/
โ”‚   โ”‚   โ”œโ”€โ”€ App.tsx             # Demo app component
โ”‚   โ”‚   โ””โ”€โ”€ CustomPlayerExample.tsx # Usage examples
โ”‚   โ”œโ”€โ”€ public/
โ”‚   โ”‚   โ”œโ”€โ”€ models/             # 3D models (.glb)
โ”‚   โ”‚   โ”œโ”€โ”€ animations/         # Animation files (.fbx)
โ”‚   โ”‚   โ”œโ”€โ”€ sfx/                # Sound effects
โ”‚   โ”‚   โ”œโ”€โ”€ vfx/                # Visual effect textures
โ”‚   โ”‚   โ””โ”€โ”€ svgs/               # UI assets
โ”‚   โ””โ”€โ”€ package.json            # Demo app configuration
โ”œโ”€โ”€ docs/                       # ๐Ÿ“š Documentation
โ”‚   โ”œโ”€โ”€ getting-started.md      # Quick start guide
โ”‚   โ””โ”€โ”€ asset-integration.md    # Asset customization guide
โ”œโ”€โ”€ package.json                # Workspace configuration
โ”œโ”€โ”€ pnpm-workspace.yaml         # pnpm workspace setup
โ””โ”€โ”€ README.md                   # This file

๐Ÿค Contributing

We welcome contributions from developers of all skill levels! Whether you're fixing bugs, adding features, improving documentation, or sharing ideas, your contributions make this project better.

Ways to Contribute

  • ๐Ÿ› Bug Reports - Found something broken? Let us know!
  • โœจ Feature Requests - Have ideas for cool new features?
  • ๐Ÿ”ง Code Contributions - Fix bugs or implement new features
  • ๐Ÿ“š Documentation - Help improve our docs
  • ๐ŸŽจ Assets - Contribute 3D models, animations, or sound effects
  • ๐Ÿงช Testing - Help test the game on different devices/browsers

Getting Started

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Make your changes
  4. Test your changes thoroughly
  5. Commit your changes (git commit -m 'Add amazing feature')
  6. Push to your branch (git push origin feature/amazing-feature)
  7. Open a Pull Request

Development Guidelines

  • ๐Ÿ“ Code Style: We use ESLint and TypeScript for code quality
  • ๐Ÿงช Testing: Test your changes across different browsers
  • ๐Ÿ“– Documentation: Update documentation for new features
  • ๐ŸŽฏ Performance: Keep performance in mind, especially for real-time features
  • ๐Ÿ—๏ธ Architecture: Follow the existing modular structure

Code of Conduct

We are committed to providing a welcoming and inclusive environment for all contributors. Please be respectful, constructive, and helpful in all interactions.

๐Ÿ› ๏ธ Built With

๐ŸŽฏ Roadmap

  • ๐ŸŽฎ Gamepad/Controller support
  • ๐ŸŽต Enhanced audio system
  • โœจ Enhanced VFX - bullet trails, hit sparks, improved muzzle flash
  • ๐Ÿ”ซ Additional weapon compatibility and variety
  • ๐Ÿ† Achievement system
  • ๐Ÿ“ฑ Mobile controls
  • ๐ŸŽจ More character models and animations
  • ๐Ÿ”ง Settings/options menu

๏ฟฝ Troubleshooting

Common Issues

Installation Problems:

# If you encounter lock file errors
pnpm run reset

# If packages seem outdated
pnpm install --force

Development Issues:

# If changes aren't reflected
pnpm run dev:watch

# If build fails
pnpm run build

For more detailed troubleshooting, see CONTRIBUTING.md

๏ฟฝ๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ™ Acknowledgments

๐Ÿ“ฌ Contact

  • GitHub Issues: For bug reports and feature requests
  • Discussions: For questions and community chat

Ready to contribute? Check out our issues page for beginner-friendly tasks or propose your own ideas! ๐Ÿš€

About

Third Person Shooter controls for @react-three/fiber using rapier physics engine

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published