A proximity-based voice chat plugin for Hytale with 3D spatial audio, occlusion, and Opus codec support.
- Proximity-based voice chat - Voice volume decreases with distance
- 3D Spatial audio - Directional audio based on player position
- Opus codec - High-quality, low-latency audio compression
- Multiple voice modes - Normal, whisper, and shout modes
- Occlusion system - Voice muffling through walls and blocks
- Rate limiting - Prevents packet flooding attacks
- Automatic banning - Temporarily bans abusive clients
- Packet validation - Size and format validation
- JSON-based config - Easy to read and modify
- Hot-reload support - Changes apply without restart
- Per-player settings - Individual volume, mute, deafen controls
- common - Shared code between client and server
- server - Server-side plugin for Hytale
- client - Client-side mod for Hytale
VoiceServer- UDP server for receiving voice packetsVoicePacketRouter- Routes packets to nearby playersPlayerVoiceManager- Manages player voice statesOcclusionEngine- Calculates voice occlusionRateLimiter- Security and rate limiting
VoiceClient- UDP client for sending/receiving voiceMicrophoneCapture- Captures audio from microphoneAudioPlayback- Plays received voice audioOpusEncoder/Decoder- Audio compression
BasePacket- Base class for all packetsVoicePacket- Voice data packetVoiceBroadcastPacket- Broadcast packet with spatial dataProximityCalculator- Distance-based volume calculation
{
"network": {
"voicePort": 24454,
"maxPacketSize": 2048,
"keepAliveInterval": 5000
},
"audio": {
"normalDistance": 64,
"whisperDistance": 8,
"shoutDistance": 128,
"fadeStartPercent": 0.5,
"bitrate": 24000
},
"occlusion": {
"enabled": true,
"maxBlocksChecked": 16,
"attenuationPerBlock": 0.15
},
"performance": {
"maxPlayersPerPacket": 50,
"updateInterval": 50,
"cacheExpirationMs": 10000
},
"security": {
"enableRateLimiting": true,
"maxPacketsPerSecond": 100,
"banDuration": 300000
}
}{
"audio": {
"inputVolume": 1.0,
"outputVolume": 1.0,
"voiceActivationThreshold": 0.05,
"microphoneDevice": "default",
"speakerDevice": "default"
},
"activation": {
"mode": "VOICE_ACTIVATION",
"pushToTalkKey": "V"
},
"ui": {
"showVoiceIndicator": true,
"showPlayerNames": true,
"hudPosition": "TOP_LEFT",
"hudScale": 1.0
},
"network": {
"serverAddress": "localhost",
"serverPort": 24454,
"autoConnect": true
},
"advanced": {
"enableNoiseGate": true,
"noiseGateThreshold": 0.02,
"enableEchoCancellation": false,
"audioBufferSize": 960
}
}# Build all modules
./gradlew build
# Build specific module
./gradlew :server:build
./gradlew :client:build
./gradlew :common:build
# Run tests
./gradlew test- HytaleServer.jar - Download from official Hytale sources
- Place
HytaleServer.jarin thelibs/directory - Java 25 JDK installed
- Build the plugin:
./gradlew :server:build
- Copy
server/build/libs/voicechat-server-1.0.0.jartoplugins/folder - Start the server
- Configure
plugins/VoiceChat/config.jsonas needed - Restart or reload the server
- Build the client:
./gradlew :client:build
- Copy
client/build/libs/voicechat-client-1.0.0.jartomods/folder - Start Hytale
- Configure settings in-game or edit
config/voicechat/client.json
The plugin is structured to work with the Hytale API. Some integration points need completion:
- ✅ Plugin structure (JavaPlugin)
- ✅ Command registration (CommandBase)
- ✅ Manifest.json configuration
- ⏳ Event listeners (player join/quit)
- ⏳ Position tracking (scheduled task)
- ⏳ Block occlusion (world API)
- ⏳ Player lookup (server API)
See HYTALE_API_INTEGRATION.md for detailed integration guide.
- Concentus - Pure Java Opus codec implementation
- Gson - JSON serialization
- Hytale API - Server and client APIs (when available)
- Hytale API integration (waiting for official API)
- GUI implementation for client settings
- Test suite and unit tests
- Documentation and API docs
- Group/party voice channels
- Admin commands (/voicechat mute, /voicechat reload, etc.)
- Metrics and monitoring
- Voice recording/playback features
Client (Sending)
- Microphone captures PCM audio (48kHz, 16-bit, mono)
- OpusEncoder compresses to ~24kbps
- VoicePacket created with compressed data
- Packet serialized and sent via UDP
Server (Routing)
- VoiceServer receives UDP packet
- RateLimiter checks for abuse
- PacketDeserializer deserializes packet
- VoicePacketRouter calculates proximity
- OcclusionEngine applies wall muffling
- VoiceBroadcastPacket sent to nearby players
Client (Receiving)
- VoiceClient receives broadcast packet
- OpusDecoder decompresses audio
- Volume applied based on distance
- AudioPlayback plays through speakers
All packets use a simple binary format:
- 1 byte: Packet type ID
- 4 bytes: Packet length
- N bytes: Packet data (serialized with Gson)
- All managers use
ConcurrentHashMapfor thread-safe storage - Volatile flags for state management
- Executor services for async operations
- Defensive copies where needed
- UDP for low-latency voice transmission
- Opus codec for efficient compression (24kbps)
- Spatial audio calculations cached
- Rate limiting prevents server overload
- Configurable update intervals
MIT License - See LICENSE file for details
- Opus codec: Concentus library
- Hytale Plugin Template: realBritakee/hytale-template-plugin
- Inspired by Simple Voice Chat mod for Minecraft
- Hytale modding community for documentation and support