It's in progress! 🚧
A 2D platformer game built with React Three Fiber (R3F) and integrated with LDTK (Level Designer Toolkit) for level design and physics using Rapier.
(LDTK) Add IntGrid Layer Renderer- (LDTK) Add AutoLayer Renderer
- Multiple Levels & Transitions
- Animation System
- Audio System
- Dialogue System
Lighting & Shadows- Particle Effects
- Save/Load System
- Cutscenes
- Power-ups & Items
- Enemy AI (Decision Trees, Navigation)
- React Three Fiber: 3D graphics rendering with React declarative approach
- LDTK Integration: Level design using LDTK editor with custom renderers
- Physics: Realistic physics simulation using Rapier physics engine
- TypeScript: Full TypeScript support for type safety
- Component-based Architecture: Modular and reusable game components
- Entity System: Custom entity rendering system for game objects
- Tile-based Levels: Support for tile-based level design with collision detection
- React 19 - UI framework
- React Three Fiber - React renderer for Three.js
- React Three Drei - Useful helpers for R3F
- React Three Rapier - Physics integration
- Three.js - 3D graphics library
- LDTK - Level Designer Toolkit integration
- TypeScript - Type-safe development
- Vite - Fast build tool and dev server
- pnpm - Package manager
src/
├── Game.tsx # Main game component
├── App.tsx # Application entry point
├── common/
│ └── ldtk/ # LDTK integration modules
│ ├── components/
│ │ ├── LdtkMap.tsx # LDTK map renderer
│ │ ├── layers/ # Layer rendering components
│ │ └── tiles/ # Tile rendering components
│ ├── models/
│ │ └── LdtkTypes.ts # LDTK type definitions
│ └── utils/ # Utility functions
public/
└── assets/
└── ldtk/ # LDTK project files and tilesets
-
Clone the repository
git clone <repository-url> cd r3f-platformer
-
Install dependencies
pnpm install
-
Start development server
pnpm dev
-
Open your browser Navigate to
http://localhost:8080
pnpm dev- Start development serverpnpm build- Build for productionpnpm preview- Preview production build
The project includes a custom LDTK integration that allows you to:
- Load LDTK project files (
.ldtk) - Render tiles with collision detection
- Place entities with custom renderers
- Support for multiple layers and levels
Define entity renderers in the entityRendererMap:
entityRendererMap={{
"PlayerStart": ({entity, layer, layerPxOffsets, layerPxDimensions}) => {
// Custom entity rendering logic
return <YourEntityComponent />
}
}}Define tile renderers in the tileRendererMap:
tileRendererMap={{
"RECT": (props) => (
<>
<TileSprite {...props}/>
<TileRectCollider {...props}/>
</>
)
}}The game uses Rapier physics engine through @react-three/rapier:
- Rigid bodies for physics objects
- Collision detection for tiles and entities
- Debug mode available during development
- Use LDTK Editor to create levels
- Place your
.ldtkfile inpublic/assets/ldtk/ - Configure tile renderers for your tilesets
- Add entity renderers for game objects
- Fork the repository
- Create a feature branch
- Make your changes
- Add appropriate types and tests
- Submit a pull request
The project uses multiple TypeScript configurations:
tsconfig.json- Base configurationtsconfig.app.json- Application-specific settingstsconfig.node.json- Node.js build tools
Custom Vite configuration includes:
- Path aliases (
@points tosrc/) - Development server on port 8080
- React plugin for fast refresh
[Add your license here]
- LDTK for the excellent level editor
- React Three Fiber community
- Rapier physics engine