Turn your smartphone into a motion-controlled ping pong racket. Play against friends on Android or iOS in a shared digital arena.
Insane Cross-Mobile Ping Pong is a distributed multiplayer game system. This repository contains the Mobile Controller App, which transforms your phone into a physical game controller.
Instead of tapping buttons, you swing your phone in the air. The app detects the motion, calculates the speed, and sends it to the game server in real-time. When you hit the ball, your phone vibrates and plays a sound, creating a tactile, immersive experience.
- 📱 Real-Time Motion Control: Uses the device's accelerometer to detect physical swings.
- 🤝 Cross-Platform Play: Android and iOS users can play against each other seamlessly.
- 🔊 Immersive Feedback: Instant haptic vibration and custom sound effects on "hit".
- 🌍 Global Reach: Play with friends anywhere in the world (low-latency WebSocket).
- 🎨 Dynamic Theming: Beautiful Dark/Light mode that adapts to your environment.
- 🌐 Localization: Automatic English and German language support.
The system is built on a Kotlin Multiplatform (KMP) foundation, sharing business logic across platforms while using native sensors for maximum performance.
- Language: Kotlin (100%)
- UI Framework: Compose Multiplatform (Material 3)
- Networking: Ktor (WebSockets)
- Serialization: Kotlinx Serialization (JSON)
- Sensors:
- Android:
android.hardware.SensorManager - iOS:
CoreMotionFramework
- Android:
- Audio/Haptics:
- Android:
MediaPlayer,Vibrator - iOS:
AVAudioPlayer,AudioServicesPlaySystemSound
- Android:
- JDK 17+
- Android Studio (for Android)
- Xcode (for iOS)
- Mac (required for iOS development)
./gradlew composeApp:installDebugOpen iosApp/iosApp.xcodeproj in Xcode and run on a Simulator or Device.
Or run via terminal:
./gradlew composeApp:compileKotlinIosSimulatorArm64- Launch the App: Open the app on your phone.
- Select Player: Choose "Player 1" or "Player 2".
- Connect: The app will automatically connect to the game server.
- Swing: Hold your phone firmly (
⚠️ Use a wrist strap if possible!) and swing it like a ping pong racket. - Feel the Hit: When the virtual ball hits your paddle, your phone will vibrate and play a sound!
Tap the Ladybug Icon 🐞 in the top-right corner of the Game Screen to open the Debug Overlay.
- Connection Status: See real-time WebSocket state.
- Sensor Data: View raw Accelerometer (X, Y, Z) values.
- Calibration: Re-center the controller if it drifts.
This project is created for HackaTUM 2025. Code is available under the MIT License.