Skip to content

Latest commit

 

History

12 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LAN Pictionary - Multiplayer Drawing & Voice Chat

A real-time multiplayer drawing application with integrated voice chat functionality, built with Java Swing. Perfect for LAN parties, office breaks, or collaborative drawing sessions with friends on the same network.

Application Banner

Table of Contents

Features

Core Functionality

  • Real-time collaborative drawing canvas
  • Synchronized drawing across all connected clients
  • Pencil and eraser tools with customizable sizes
  • Group text chat for all participants
  • One-on-one voice calls between users
  • Live user list with online status
  • Canvas clear synchronization
  • Connection ping monitor
  • Full LAN network support

Main Interface

System Requirements

Minimum Requirements

  • Operating System: Windows 7/8/10/11, macOS 10.12+, or Linux (Ubuntu 18.04+)
  • Java: JDK 11 or higher
  • RAM: 512 MB minimum (1 GB recommended)
  • Network: LAN/Wi-Fi connection
  • Microphone: Required for voice chat functionality
  • Speakers/Headphones: Required for receiving voice calls

Recommended Setup

  • Java JDK 17 or later
  • 2 GB RAM or more
  • Stable network connection with low latency
  • Quality microphone and headphones for best voice experience

Installation

Installing Java JDK

Before running the application, you need to install Java Development Kit (JDK) on your system.

Windows

  1. Download Java JDK

    • Visit the Oracle JDK Downloads page
    • Or download OpenJDK (recommended for free distribution)
    • Download the Windows x64 Installer (.exe file)
  2. Install JDK

    • Run the downloaded installer
    • Follow the installation wizard
    • Note the installation path (typically C:\Program Files\Java\jdk-17)
    • Click "Install" and wait for completion
  3. Set Environment Variables

    • Right-click "This PC" → Properties → Advanced System Settings
    • Click "Environment Variables"
    • Under "System Variables", click "New"
    • Variable name: JAVA_HOME
    • Variable value: Your JDK installation path (e.g., C:\Program Files\Java\jdk-17)
    • Find "Path" variable, click "Edit"
    • Add new entry: %JAVA_HOME%\bin
    • Click "OK" on all windows
  4. Verify Installation

    java -version
    javac -version

    Both commands should display version information.

Java Installation Windows

macOS

  1. Using Homebrew (Recommended)

    # Install Homebrew if not already installed
    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
    
    # Install Java
    brew install openjdk@17
    
    # Link Java
    sudo ln -sfn /opt/homebrew/opt/openjdk@17/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk-17.jdk
  2. Manual Installation

    • Download JDK from Oracle or Adoptium
    • Open the .dmg file
    • Follow installation instructions
    • Java will be installed to /Library/Java/JavaVirtualMachines/
  3. Set JAVA_HOME (Optional but Recommended)

    echo 'export JAVA_HOME=$(/usr/libexec/java_home)' >> ~/.zshrc
    source ~/.zshrc
  4. Verify Installation

    java -version
    javac -version

Linux (Ubuntu/Debian)

  1. Install OpenJDK

    # Update package index
    sudo apt update
    
    # Install OpenJDK 17
    sudo apt install openjdk-17-jdk -y
  2. Set JAVA_HOME

    # Find Java installation path
    sudo update-alternatives --config java
    
    # Add to ~/.bashrc or ~/.zshrc
    echo 'export JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64' >> ~/.bashrc
    echo 'export PATH=$JAVA_HOME/bin:$PATH' >> ~/.bashrc
    source ~/.bashrc
  3. Verify Installation

    java -version
    javac -version

Java Installation Linux

Downloading the Application

  1. Clone the Repository

    git clone https://github.com/madesh405/LAN_Pictionary.git
    cd LAN_Pictionary
  2. Or Download ZIP

    • Visit the GitHub repository
    • Click the green "Code" button
    • Select "Download ZIP"
    • Extract the ZIP file to your desired location
    • Navigate to the extracted folder in terminal/command prompt

Download Repository

Compiling the Source Code

Navigate to the project directory and compile the Java files:

# Compile the server
javac Server.java

# Compile the client
javac ChatClient.java

If compilation is successful, you should see Server.class and ChatClient.class files created in the directory.

Note: If you encounter any compilation errors, ensure:

  • You're in the correct directory containing the .java files
  • Java JDK is properly installed (not just JRE)
  • Your JAVA_HOME environment variable is set correctly

Compilation Success

Running the Application

Starting the Server

The server must be started first before any clients can connect.

  1. Run the Server

    java Server
  2. Server Console Output You should see:

    Server started on port 1234
    Waiting for connections...
    
  3. Find Your Server IP Address

    Windows:

    ipconfig

    Look for "IPv4 Address" under your active network adapter (e.g., 192.168.1.100)

    macOS:

    ifconfig | grep "inet "
    # OR
    ipconfig getifaddr en0

    Linux:

    hostname -I
    # OR
    ip addr show

    Your LAN IP typically starts with 192.168.x.x or 10.x.x.x

  4. Keep Server Running

    • Do not close the server terminal/command prompt window
    • The server must remain running for clients to stay connected
    • You'll see connection messages as clients join

Server Running

Connecting Clients

Once the server is running, launch clients on the same or different computers.

  1. Run the Client Application

    java ChatClient
  2. Enter Username

    • A dialog box will appear
    • Enter your desired username (e.g., "Player1", "Alice", "Bob")
    • Click "OK"

Username Dialog

  1. Enter Server IP Address
    • Another dialog will appear asking for the server IP
    • If running on the same machine as server: Enter localhost
    • If running on a different machine: Enter the server's IP address (e.g., 192.168.1.100)
    • Click "OK"

Server IP Dialog

  1. Connection Success
    • You should see the main application window open
    • Your username will appear in the users list
    • The chat will show a "connected" message
    • The server console will show your connection

Client Connected

Testing the Application

Single Device Testing

Test the entire application on one computer to ensure everything works before trying multiple devices.

  1. Open First Terminal/Command Prompt

    cd path/to/LAN_Pictionary
    java Server

    Leave this running.

  2. Open Second Terminal/Command Prompt

    cd path/to/LAN_Pictionary
    java ChatClient
    • Username: User1
    • Server IP: localhost
  3. Open Third Terminal/Command Prompt (optional)

    cd path/to/LAN_Pictionary
    java ChatClient
    • Username: User2
    • Server IP: localhost
  4. Test Features

    • ✅ Draw on one client, verify it appears on the other
    • ✅ Send chat messages between clients
    • ✅ Click "Clear Canvas" and verify both canvases clear
    • ✅ Try voice call between User1 and User2 (note: calling yourself won't work)
    • ✅ Check ping values in both clients

Single Device Testing

Expected Behavior:

  • All drawing should sync in real-time
  • Chat messages appear on all clients
  • Canvas clear affects all connected clients
  • Voice calls work between different client instances
  • Users list updates when clients connect/disconnect

Multiple Device Testing

Test the application across different computers on your LAN.

Setup Instructions

  1. Prepare Network

    • Ensure all devices are connected to the same Wi-Fi network or LAN
    • Disable any VPNs on all devices
    • Temporarily disable firewalls if connection issues occur (remember to re-enable after testing)
  2. Server Computer Setup

    # On the computer that will host the server
    cd path/to/LAN_Pictionary
    java Server
    • Note down this computer's IP address (use ipconfig, ifconfig, or hostname -I)
    • Example IP: 192.168.1.100
  3. Client Computer 1 Setup

    # On second computer
    cd path/to/LAN_Pictionary
    java ChatClient
    • Username: Alice
    • Server IP: 192.168.1.100 (use the server's actual IP)
  4. Client Computer 2 Setup

    # On third computer
    cd path/to/LAN_Pictionary
    java ChatClient
    • Username: Bob
    • Server IP: 192.168.1.100 (same as above)
  5. Client Computer 3 Setup (add as many as needed)

    • Repeat the client setup with different usernames
    • All clients use the same server IP address

Multiple Device Setup

Testing Checklist

Feature Test Steps Expected Result
Connection Launch clients from multiple devices All clients connect successfully, appear in users list
Drawing Sync Draw on one device Drawing appears on all other devices in real-time
Tool Switching Switch between pencil and eraser Tool changes work correctly, erase properly removes drawings
Canvas Clear Click Clear Canvas on one device All canvases clear simultaneously
Group Chat Send messages from different devices All messages appear on all clients with correct usernames
Voice Call Initiate call from Device A to Device B Call notification appears, audio works both ways
Call Rejection Decline an incoming call Caller notified, both clients return to normal state
Call End End an active call Both clients return to normal state, can make new calls
Disconnect Close one client Other clients updated, user removed from list
Ping Monitor Observe ping values Ping stays low (<100ms on good LAN) and updates regularly

Testing Checklist

Common Network Configurations

Home Wi-Fi Network:

  • All devices connected to same router
  • Server IP typically: 192.168.1.x or 192.168.0.x
  • Usually works without additional configuration

Office Network:

  • May require admin permissions for server
  • Firewall rules might need adjustment
  • Check with IT department for port 1234 access

Mobile Hotspot:

  • Enable hotspot on one device
  • Connect all computers to the hotspot
  • Hotspot device can also run server/client
  • Server IP is the hotspot device's IP

Direct Ethernet Connection:

  • Connect computers with Ethernet cable
  • May need to manually assign IP addresses
  • Example: Computer 1: 192.168.2.1, Computer 2: 192.168.2.2

Usage Guide

Drawing Tools

Drawing Tools

Pencil Tool

  • Click the "Pencil" button to activate drawing mode
  • Click and drag on the canvas to draw
  • All connected users see your drawings in real-time
  • Default color: Black

Eraser Tool

  • Click the "Eraser" button to activate erase mode
  • Click and drag to erase parts of the drawing
  • Erased areas become white background
  • Erasing is synchronized across all clients

Clear Canvas

  • Click the "Clear Canvas" button
  • Clears the entire canvas for all connected users
  • Cannot be undone
  • Use when starting a new drawing

Drawing Tips:

  • Draw slowly on slower networks for better synchronization
  • Use shorter strokes for more responsive drawing
  • Eraser works best with slower movements

Chat Features

Chat Interface

Sending Messages

  1. Type your message in the text field at the bottom
  2. Press Enter or click Send
  3. Your message appears in the chat with your username
  4. All connected users see the message instantly

Chat Features:

  • Message history visible in scrollable chat area
  • Timestamps for each message
  • Username prefix shows who sent each message
  • System messages for user joins/leaves
  • Auto-scroll to latest messages

Chat Etiquette:

  • Keep messages respectful
  • Use chat for coordination during drawing
  • Announce when you're clearing the canvas

Voice Call Features

Voice Call

Making a Call

  1. Locate the user you want to call in the users list
  2. Click the phone icon (:telephone_receiver:) next to their username
  3. Wait for the other user to accept or decline
  4. If accepted, the call window opens with "End Call" button

Receiving a Call

  1. A call notification dialog appears with caller's name
  2. Click "Accept" to answer the call
  3. Click "Decline" to reject the call
  4. If you accept, the call window opens

During a Call

  • Speak normally into your microphone
  • Audio is transmitted in real-time
  • Click "End Call" button to terminate the call
  • Closing the call window also ends the call

Call Limitations:

  • Only one-on-one calls supported (no conference calls)
  • Cannot call yourself
  • Can only be in one call at a time
  • Other users cannot call you while you're already in a call

Audio Tips:

  • Use headphones to prevent echo
  • Speak clearly and avoid background noise
  • Test microphone before important calls
  • Adjust system volume for best audio quality

Active Call

Additional Features

Users List

  • Shows all connected users in real-time
  • Phone icon appears next to each username
  • Click phone icon to initiate call
  • List updates when users join or leave

Ping Monitor

  • Displays current connection latency
  • Updates every few seconds
  • Lower ping = better connection
  • High ping (>200ms) may cause lag

User List and Ping

Troubleshooting

Connection Issues

Problem: Client cannot connect to server

Solutions:

  1. Verify server is running and showing "Waiting for connections..."
  2. Check IP address is correct
    • Use localhost only if on same machine as server
    • Use actual LAN IP for different machines
  3. Ensure all devices are on the same network
  4. Temporarily disable firewalls:
    • Windows: Windows Defender Firewall
    • macOS: System Preferences → Security & Privacy → Firewall
    • Linux: sudo ufw disable (remember to re-enable)
  5. Check if port 1234 is available:
    # Windows
    netstat -ano | findstr :1234
    
    # macOS/Linux
    lsof -i :1234
  6. Try restarting the server

Problem: "Connection refused" error

Solutions:

  • Server might not be running
  • Wrong IP address entered
  • Firewall blocking port 1234
  • Network isolation (guest network mode)

Drawing Issues

Problem: Drawing doesn't sync across clients

Solutions:

  1. Check network connection quality
  2. Verify all clients are connected (check users list)
  3. Try drawing more slowly
  4. Restart affected client
  5. Check server console for errors

Problem: Drawing is laggy or delayed

Solutions:

  • High network latency (check ping monitor)
  • Too many users connected
  • Server computer may be slow
  • Draw with shorter strokes
  • Close unnecessary applications

Voice Call Issues

Problem: No audio during call

Solutions:

  1. Check microphone permissions:
    • Windows: Settings → Privacy → Microphone
    • macOS: System Preferences → Security & Privacy → Microphone
    • Linux: Check PulseAudio/ALSA settings
  2. Verify microphone is not muted
  3. Test microphone in other applications
  4. Check system volume levels
  5. Restart the application
  6. Try different microphone device

Problem: Echo or feedback during call

Solutions:

  • Use headphones instead of speakers
  • Reduce microphone sensitivity
  • Increase distance between microphone and speakers
  • Lower system volume

Problem: Cannot initiate call

Solutions:

  • Verify user is online in users list
  • Ensure you're not already in a call
  • Check if target user is already in a call
  • Restart client application

General Issues

Problem: Application crashes or freezes

Solutions:

  1. Check Java version: java -version (needs 11+)
  2. Increase Java heap memory:
    java -Xmx512m ChatClient
  3. Check server console for errors
  4. Restart application
  5. Update Java to latest version

Problem: High CPU usage

Solutions:

  • Close unused client instances
  • Reduce number of connected clients
  • Clear canvas to reduce rendering load
  • Restart server periodically

Problem: Port already in use

Solution:

# Find process using port 1234
# Windows
netstat -ano | findstr :1234
taskkill /PID <process_id> /F

# macOS/Linux
lsof -ti:1234 | xargs kill -9

Firewall Configuration

Windows Firewall:

# Run as Administrator
netsh advfirewall firewall add rule name="LAN Pictionary" dir=in action=allow protocol=TCP localport=1234

macOS Firewall:

  • System Preferences → Security & Privacy → Firewall → Firewall Options
  • Add Java to allowed applications

Linux (UFW):

sudo ufw allow 1234/tcp

Technical Details

Architecture

  • Protocol: TCP/IP sockets
  • Server Port: 1234
  • Drawing Protocol: Coordinate streaming
  • Voice Protocol: Raw audio packet streaming
  • Chat Protocol: Text message broadcasting

Technologies Used

  • Java Swing for GUI
  • Java Socket Programming for networking
  • javax.sound.sampled for audio capture/playback
  • Multi-threading for concurrent connections
  • Event-driven architecture

Network Requirements

  • Bandwidth: ~10 KB/s per client (idle), ~50 KB/s during voice call
  • Latency: <100ms recommended for smooth experience
  • Ports: TCP 1234 (server), ephemeral ports (clients)

Limitations

  • Maximum recommended clients: 20 (depends on server hardware)
  • Voice calls: One-on-one only (no conference)
  • Drawing canvas: Fixed size
  • No drawing history/undo feature
  • No user authentication
  • No persistent storage

Performance Tips

  • Run server on most powerful computer
  • Use wired Ethernet when possible
  • Minimize network traffic from other applications
  • Close unnecessary background applications
  • Limit number of simultaneous voice calls

Contributing

Contributions are welcome! Here's how you can help:

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

Development Ideas

  • Color picker for drawing
  • Adjustable brush size
  • Drawing shapes (circle, rectangle, line)
  • Undo/redo functionality
  • Save/load drawings
  • User authentication
  • Conference voice calls
  • Private chat messages
  • Drawing permissions (host controls)
  • Better mobile support

License

This project is open source and available under the MIT License.

Support

If you encounter issues or have questions:

  1. Check the Troubleshooting section
  2. Review GitHub Issues
  3. Create a new issue with:
    • Detailed problem description
    • Steps to reproduce
    • System information (OS, Java version)
    • Error messages/screenshots

Acknowledgments

  • Built with Java Swing
  • Inspired by classic Pictionary gameplay
  • Created for LAN party entertainment

Enjoy drawing with friends! 🎨 📞

For updates and more projects, visit github.com/madesh405

About

Madeshwaran 24BCE5185 Ramakrishnan 24BCE5221 Aditya CVS 24BCE5191

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages