# Arcturus Morningstar Extended A high-performance, open-source Habbo hotel emulator built with Java 21 and Netty. ## Features - **Modern Architecture** - Built on Netty for high-performance networking - **Database Optimization** - HikariCP connection pooling with prepared statement caching - **Efficient Collections** - Trove collections (THashMap, THashSet) for faster operations - **Async Pathfinding** - A* pathfinding with CompletableFuture for non-blocking operations - **Thread Pooling** - Optimized thread management for concurrent tasks - **In-Memory Caching** - Frequently accessed data cached at startup ## Requirements - Java 21 or higher - MySQL 8.0+ - Maven 3.8+ ## Installation 1. **Clone the repository** ```bash git clone https://github.com/your-repo/arcturus-morningstar-extended.git cd arcturus-morningstar-extended/Emulator ``` 2. **Configure the database** - Create a MySQL database - Import the SQL schema (see `database` folder) - Edit `config.ini` with your database credentials 3. **Build the project** ```bash mvn clean package ``` 4. **Run the emulator** ```bash java -jar target/Habbo-4.0.5-jar-with-dependencies.jar ``` ## Configuration Edit `config.ini` to configure: ```ini # Database db.hostname=localhost db.port=3306 db.database=habbo db.username=root db.password=yourpassword db.pool.maxsize=50 db.pool.minsize=10 # Game Server game.port=30000 # RCON rcon.port=30001 rcon.allowed=127.0.0.1 ``` ## Performance Tuning ### Database Pool Settings The emulator uses HikariCP with optimized settings: | Setting | Default | Description | |---------|---------|-------------| | `db.pool.maxsize` | 50 | Maximum connections | | `db.pool.minsize` | 10 | Minimum idle connections | | `cachePrepStmts` | true | Prepared statement caching | | `useServerPrepStmts` | true | Server-side prepared statements | | `rewriteBatchedStatements` | true | Batch query optimization | ### Thread Pool Settings Configure in `config.ini`: ```ini runtime.threads=16 ``` ## Architecture ### Core Components - **Database** - HikariCP connection pooling with query optimization - **Network** - Netty-based TCP/UDP server - **Game Engine** - Room management, user handling, items - **Pathfinding** - A* algorithm with height support - **Plugin System** - Event-driven architecture ### Key Classes - `Emulator.java` - Main entry point - `DatabasePool.java` - Connection pool management - `RoomManager.java` - Room lifecycle management - `PathfinderImpl.java` - A* pathfinding implementation - `CatalogManager.java` - Catalog and shop management - `ItemManager.java` - Furniture/items management ## Development ### Building ```bash # Development build mvn compile # Production build mvn clean package -DskipTests # Run tests mvn test ``` ### Project Structure ``` src/main/java/com/eu/habbo/ ├── database/ # Database connections and pooling ├── habbohotel/ # Core game logic │ ├── bots/ # Bot AI │ ├── catalog/ # Shop system │ ├── commands/ # Console commands │ ├── guilds/ # Guild system │ ├── items/ # Furniture/items │ ├── pets/ # Pet system │ ├── rooms/ # Room management & pathfinding │ └── users/ # User management ├── messages/ # Network messages (incoming/outgoing) ├── networking/ # Network handlers ├── threading/ # Thread management └── util/ # Utilities ``` ## Performance Optimizations ### Implemented Optimizations 1. **Database Layer** - HikariCP connection pooling - Prepared statement caching - Batch statement rewriting - Server-side prepared statements 2. **Memory & Collections** - Trove collections (faster than standard Java) - In-memory caching for static data - Object reuse where possible 3. **Networking** - Netty ByteBuf for zero-copy operations - Efficient buffer handling - Async I/O operations 4. **Pathfinding** - A* algorithm with optimization - Timeout protection for long paths - Tile state caching ### Benchmark Expectations With default settings: - Database queries: 20-40% faster with connection pooling - Memory usage: Optimized with Trove collections - Network throughput: High-performance with Netty - Pathfinding: Protected with execution timeouts ## Troubleshooting ### Common Issues **Database Connection Failed** - Check MySQL is running - Verify credentials in config.ini - Ensure database exists **OutOfMemory Errors** - Increase heap size: `java -Xmx4g -jar ...` - Reduce pool size in config.ini **Lag Issues** - Increase `runtime.threads` in config.ini - Optimize MySQL with indexes - Use SSD for database storage ### Logging Logs are written to: - Console (stdout) - `logs/` folder (file output) Configure logging in `src/main/resources/logback.xml` ## License This project is for educational purposes. This is a fork of the original Arcturus emulator. ## Credits - Original Arcturus team - Habbo Hotel (Sulake) - Netty Project - Trove Collections - HikariCP ## Support For issues and questions: - GitHub Issues: Report bugs and feature requests - Discord: Join the community --- **Version:** 4.0.5 **Java:** 21+ **Build:** Maven