A first-person shooter game demo for Android using raycasting rendering with Jetpack Compose. Think Wolfenstein 3D-style gameplay but running on a modern Android device with touch controls and ML-powered enemies.
What is Raycasting? Link to heading
Raycasting is a rendering technique used in early 3D games like Wolfenstein 3D, Doom, and Duke Nukem 3D. Instead of full 3D polygons, it casts rays from the player’s view into a 2D grid map to determine wall heights. This creates a pseudo-3D effect that runs efficiently on limited hardware.
The core idea is simple: for each vertical column of pixels on screen, cast a ray from the player’s position. The ray travels until it hits a wall, then draw the wall slice at the appropriate height based on distance. Closer walls are taller, farther walls are shorter.
Technical Stack Link to heading
- Kotlin - 93.5% of the codebase
- Jetpack Compose - Full UI framework (no traditional Views)
- Coroutines - For async rendering and parallel processing
- TensorFlow Lite - Enemy AI (experimental)
- Multi-threaded rendering - CPU-optimized with available processor cores
Key Components Link to heading
Raycaster Engine Link to heading
The heart of the engine handles:
- Ray casting from player position into the map grid
- Depth buffer for proper sprite rendering
- Wall textures with distance-based shading
- Floor and ceiling textures for atmosphere
Sprite System Link to heading
Sprites are 2D images that always face the player (like enemies, weapons). They’re sorted by distance and rendered back-to-front using the depth buffer.
AI Controller (Experimental) Link to heading
The enemy AI module demonstrates machine learning integration (currently experimental/not active in game):
- A Pathfinding* - Navigation through the map
- Line of sight - Detection of player
- TensorFlow Lite - AI decision making
Controls Link to heading
- Virtual joystick (bottom-left) - Move forward/backward/strafe
- Touch drag - Look around
- Tap / Spacebar - Shoot
- Arrow keys (external keyboard) - Movement
Visual Effects Link to heading
Post-processing shaders including glitch and noise effects for that retro aesthetic.
Sound System Link to heading
Background music and sound effects for immersive gameplay.
Rendering Pipeline Link to heading
- Cast rays for each screen column
- Calculate wall height based on distance
- Apply texture with distance-based shading
- Render floor and ceiling textures
- Sort and render sprites back-to-front
- Apply post-processing shader effects
Performance Link to heading
The engine leverages all available CPU cores for parallel ray calculation. On modern devices, it easily maintains 60 FPS while rendering at device resolution.
Source Code Link to heading
Repository: https://github.com/eziosoft/Raytracer_android_demo
This is a complete game engine demonstrating that classic rendering techniques combined with modern Android tech (Compose, TensorFlow Lite) create compelling mobile experiences.