f5b8aeb39d057b9283484d8b4d5e3b0a0870c54a
Odinsea Elixir
An Elixir/OTP port of the Odinsea Java MapleStory private server.
Project Status
Current Phase: Foundation Complete, Networking In Progress
Overall Progress: ~15%
See PORT_PROGRESS.md for detailed progress tracking.
Architecture
Odinsea Elixir
├── Login Server (port 8584) - Authentication & character selection
├── Channel Servers (ports 8585+) - Game world (multiple channels)
├── Cash Shop (port 8605) - Item purchasing
├── World Services - Cross-server state (parties, guilds)
└── Database - MySQL/MariaDB via Ecto
Quick Start
Prerequisites
- Elixir 1.17+
- MySQL/MariaDB
- Redis
Setup
# Install dependencies
mix deps.get
# Configure database (edit config/runtime.exs or use env vars)
export ODINSEA_DB_HOST=localhost
export ODINSEA_DB_NAME=odin_sea
export ODINSEA_DB_USER=root
export ODINSEA_DB_PASS=
# Run database migrations
mix ecto.setup
# Start the server
mix run --no-halt
Environment Variables
| Variable | Default | Description |
|---|---|---|
ODINSEA_NAME |
Luna | Server name |
ODINSEA_HOST |
127.0.0.1 | Server host |
ODINSEA_LOGIN_PORT |
8584 | Login server port |
ODINSEA_CHANNEL_COUNT |
2 | Number of game channels |
ODINSEA_DB_HOST |
localhost | Database host |
ODINSEA_DB_NAME |
odin_sea | Database name |
ODINSEA_REDIS_HOST |
localhost | Redis host |
Project Structure
lib/odinsea/
├── application.ex # Main supervisor
├── constants/ # Game constants
│ ├── game.ex # Game mechanics constants
│ └── server.ex # Protocol constants
├── database/
│ └── repo.ex # Ecto repository
├── login/ # Login server
│ ├── listener.ex # TCP listener
│ └── client.ex # Client handler
├── channel/ # Game channel servers
│ ├── supervisor.ex # Channel supervisor
│ ├── server.ex # Individual channel
│ └── client.ex # Channel client handler
├── shop/ # Cash shop server
│ ├── listener.ex # TCP listener
│ └── client.ex # Client handler
├── world/ # Cross-server services
│ ├── supervisor.ex # World supervisor
│ ├── world.ex # World state
│ ├── party.ex # Party management
│ ├── guild.ex # Guild management
│ ├── family.ex # Family management
│ ├── expedition.ex # Expedition management
│ └── messenger.ex # Messenger/chat
└── net/ # Networking
├── opcodes.ex # Packet opcodes
├── hex.ex # Hex utilities
└── packet/
├── in.ex # Packet decoder
└── out.ex # Packet encoder
Client Compatibility
- Version: GMS v342
- Patch: 1
- Revision: 1
Key Differences from Java
- Concurrency: Elixir processes instead of Java threads
- State: GenServer/ETS instead of mutable fields
- Networking: gen_tcp instead of Netty
- Database: Ecto instead of raw JDBC
- Hot Reloading: Native Elixir code reloading
Development
Running Tests
mix test
Code Quality
# Linting
mix credo
# Type checking
mix dialyzer
# Formatting
mix format
Packet Testing
# Decode a packet
packet = Odinsea.Net.Packet.In.new(<<0x01, 0x00, 0x05, 0x00>>)
{opcode, packet} = Odinsea.Net.Packet.In.decode_short(packet)
# Encode a packet
packet = Odinsea.Net.Packet.Out.new(0x00)
packet = Odinsea.Net.Packet.Out.encode_string(packet, "Hello")
binary = Odinsea.Net.Packet.Out.to_binary(packet)
Roadmap
See PORT_PROGRESS.md for the complete roadmap.
Immediate Next Steps
- Implement AES encryption (
lib/odinsea/net/cipher/aes.ex) - Port login handlers (
lib/odinsea/login/handler.ex) - Create database schemas
- Implement login packet responses
Contributing
This is a port of the Java Odinsea server. When implementing features:
- Reference the Java source in
/home/ra/lucid/src/ - Follow Elixir/OTP best practices
- Update PORT_PROGRESS.md
- Add tests where applicable
License
Same as the original Odinsea project.
Acknowledgments
- Original Odinsea Java developers
- MapleStory community
- Elixir/OTP team
Description