P2Pong is a multiplayer ping pong game for Android devices built with Adobe AIR and ActionScript/Flex. Two players can connect over a local network and play ping pong, with each player seeing their own half of the playing field on their device.
- Multiplayer: Two players can connect and play together over a local network
- Split View: Each player sees their own half of the game field on their device
- Side Selection: Players choose whether they play on the left or right side
- Real-time Synchronization: Ball position and velocity are synchronized between devices using P2P networking
- Touch Controls: Drag the paddle up and down to hit the ball
- Install the APK: Install
P2Pong.apkon two Android devices - Connect to the same network: Both devices must be on the same local network (WiFi)
- Launch the app: Open P2Pong on both devices
- Choose sides:
- One player taps "Play Left"
- The other player taps "Play Right"
- Start playing: Once both players have joined, the game starts automatically
- Control your paddle: Drag your finger up or down on the paddle to move it
- Hit the ball: Try to hit the ball back to your opponent
- New game: If the ball goes off-screen, the left player can tap "start new game" to begin again
- Platform: Adobe AIR for Android
- Language: ActionScript 3 / MXML
- Framework: Apache Flex (Spark components)
- Networking: RTMFP (Real Time Media Flow Protocol) for P2P communication
- Minimum Android Version: Android 2.2+ (API level 8+)
The game uses RTMFP multicast networking to enable direct peer-to-peer communication between devices:
- Multicast Group:
p2pong - IP Multicast Address:
239.254.254.1:30303 - Protocol: rtmfp:// (Adobe's P2P protocol)
- The left player is responsible for ball physics and sends updates to the right player
- Each player handles their own paddle collision detection
- Ball velocity changes are communicated via
BALL_BOUNCEDevents - Player join events (
LEFT_JOINED,RIGHT_JOINED) are broadcast when sides are chosen
INTERNET- Network communicationACCESS_NETWORK_STATE- Check network connectivityACCESS_WIFI_STATE- Access WiFi informationCHANGE_WIFI_MULTICAST_STATE- Required for multicast networking
- Adobe AIR SDK (version 2.5+)
- Apache Flex SDK
- Flash Builder or command-line AIR tools
- Clone this repository
- Open the project in Flash Builder or use
amxmlccommand-line compiler - Compile
P2Pong.mxmlto generateP2Pong.swf - Package the APK using AIR Developer Tool (ADT):
adt -package -target apk-debug -storetype pkcs12 -keystore your_cert.p12 P2Pong.apk P2Pong-app.xml P2Pong.swf
P2Pong/
├── src/
│ ├── P2Pong.mxml # Main application file (working version)
│ ├── P2PongNew.mxml # Incomplete refactoring attempt
│ ├── P2Pong-app.xml # AIR application descriptor
│ ├── P2PongEvent.as # Event class for P2P messages
│ ├── Ball.as # Ball data class
│ ├── Paddle.as # Paddle data class
│ ├── Player.as # Player data class
│ ├── Game.as # Game state class
│ └── NetBus.as # Network bus (unused stub)
├── bin-debug/
│ ├── P2Pong.apk # Pre-built Android application
│ ├── P2Pong.swf # Compiled SWF
│ └── P2Pong-app.xml # Compiled app descriptor
└── README.md # This file
- RTMFP Deprecation: Adobe has deprecated RTMFP, so this may not work on newer AIR runtime versions
- Network Discovery: Devices must be on the same local network with multicast enabled
- Firewall: Some networks block multicast traffic which will prevent connection
- NAT Traversal: The game only works on local networks, not across the internet
- Ensure both devices are on the same WiFi network
- Check that multicast is enabled on your router
- Try disabling firewall temporarily
- Verify both devices have granted network permissions to the app
- Make sure both players have selected their sides (left/right)
- The left player starts the game - check that both join indicators are visible
- Verify Android version is 2.2 or higher
- Check that AIR runtime is installed on the device
- Try reinstalling the APK
This is an old educational project. Feel free to use and modify as needed.
If modernizing this project, consider:
- Migrating from RTMFP to WebSockets or WebRTC
- Updating to Apache Royale (the successor to Apache Flex)
- Converting to a modern framework (React Native, Flutter, etc.)
- Adding score tracking and game timer
- Implementing more game modes