An open API service indexing awesome lists of open source software.

https://github.com/diangogav/edopro-server-ts

Welcome to Evolution Server, a versatile platform for creating Yu-Gi-Oh! matches, fully compatible with EDOPro, Koishi, and YGO Mobile! But this time, we focus on the scalability of the code, allowing for easy implementation of new features related to the data generated during the duels.
https://github.com/diangogav/edopro-server-ts

cpp hacktoberfest nodejs typescript ygopro

Last synced: 1 day ago
JSON representation

Welcome to Evolution Server, a versatile platform for creating Yu-Gi-Oh! matches, fully compatible with EDOPro, Koishi, and YGO Mobile! But this time, we focus on the scalability of the code, allowing for easy implementation of new features related to the data generated during the duels.

Awesome Lists containing this project

README

          

๐ŸŽฎ Evolution Server



A Yu-Gi-Oh! game server built with TypeScript

Host duels for EDOPro, Koishi, and YGO Mobile โ€” all from one server.

[![PR Pipeline](https://github.com/diangogav/EDOpro-server-ts/actions/workflows/pipeline.yaml/badge.svg)](https://github.com/diangogav/EDOpro-server-ts/actions/workflows/pipeline.yaml)

Evolution Server runs two independent game engines side by side, so you can support both ecosystems from a single server โ€” or pick just one.

| Engine | Clients | Protocol | Port |
|--------|---------|----------|------|
| ๐Ÿ–ฅ๏ธ **EDOPro** | EDOPro desktop client | EDOPro protocol | `7911` |
| ๐Ÿ“ฑ **YGOPro** | Koishi, YGO Mobile, YGOPro | YGOPro-compatible (srvpro2) | `7711` |

---

## โœจ What can it do?

- ๐Ÿฐ **Room creation** through the EDOPro lobby or YGOPro-compatible clients
- ๐Ÿ”€ **Cross-client duels** between different platforms *(experimental)*
- ๐Ÿ”Œ **Automatic reconnection** after disconnection or crash
- ๐Ÿ“Š **Match data collection** for rankings and analytics
- ๐Ÿงช **Isolated duel cores** โ€” each match runs in its own process

---

## ๐Ÿš€ Quick Start (Docker)

The fastest way to get running. Three commands and you're dueling:

```bash
git clone https://github.com/diangogav/EDOpro-server-ts
cd EDOpro-server-ts
docker compose -f docker-compose.prod.yaml up -d
```

That's it! ๐ŸŽ‰ Both engines start automatically with PostgreSQL and Valkey included.

> ๐Ÿ’ก Connect with EDOPro on port `7911` or with Koishi/YGO Mobile on port `7711`.

---

## ๐Ÿ› ๏ธ Manual Installation

For when you want full control, or Docker isn't an option.

### ๐Ÿ“‹ Prerequisites

- [Node.js](https://nodejs.org) >= 24
- [CMake](https://cmake.org/download/) >= 3.18
- A C++ compiler (g++ or clang++)

On Ubuntu/Debian, the provided script installs everything you need:

```bash
sudo bash install_dependencies.sh
```

### ๐Ÿ“ฆ Step by step

```bash
# 1๏ธโƒฃ Clone the project
git clone https://github.com/diangogav/EDOpro-server-ts
cd EDOpro-server-ts

# 2๏ธโƒฃ Clone card scripts, databases, and banlists
bash clone_repositories.sh

# 3๏ธโƒฃ Organize everything into resources/
bash setup_resources.sh

# 4๏ธโƒฃ Build the C++ duel core (used by the EDOPro engine)
bash build_core_integrator.sh

# 5๏ธโƒฃ Install Node.js dependencies
npm install

# 6๏ธโƒฃ Configure environment
cp .env.example .env
```

Now choose which engine(s) you want to run ๐Ÿ‘‡

---

### ๐Ÿ–ฅ๏ธ Running the EDOPro engine only

Players connect using the EDOPro desktop client.

**What you need:**
- โœ… The CoreIntegrator binary (built in step 4)
- โœ… Card databases and scripts from ProjectIgnis
- โœ… Banlists from ProjectIgnis and/or Evolution

**Minimum `.env` configuration:**

```env
HOST_PORT=7911
HTTP_PORT=7922
WEBSOCKET_PORT=4000
```

**Resource structure used:**

```
๐Ÿ“‚ resources/edopro/
โ”œโ”€โ”€ ๐Ÿ“œ scripts/ # ProjectIgnis/CardScripts
โ”œโ”€โ”€ ๐Ÿ—„๏ธ databases/ # ProjectIgnis/BabelCDB
โ”œโ”€โ”€ ๐Ÿ“‹ banlists-ignis/ # ProjectIgnis/LFLists
โ””โ”€โ”€ ๐Ÿ“‹ banlists-evolution/ # Evolution community banlists
```

```bash
npm run dev
```

> ๐ŸŽฏ Connect with EDOPro to `your-server-ip:7911`

---

### ๐Ÿ“ฑ Running the YGOPro engine only

The YGOPro engine uses srvpro2-compatible protocol. Players connect using Koishi, YGO Mobile, or any YGOPro-compatible client.

**What you need:**
- โœ… Card scripts and databases from ygopro-scripts
- โœ… Ban lists and alternative format resources
- โœ… The `YGOPRO_FOLDERS` environment variable pointing to your resource directories
- โœ… (Optional) The `YGOPRO_EXTRA_DB_FOLDERS` environment variable for pre-release and art card databases

**Minimum `.env` configuration:**

```env
YGOPRO_PORT=7711
HTTP_PORT=7922
WEBSOCKET_PORT=4000
YGOPRO_FOLDERS=./resources/ygopro/base
```

**Resource structure used:**

```
๐Ÿ“‚ resources/ygopro/
โ”œโ”€โ”€ ๐Ÿ“œ base/ # Core scripts + lflist + cards.cdb (loaded by all modes)
โ”œโ”€โ”€ ๐ŸŒ ocg/ # OCG-specific banlist
โ”œโ”€โ”€ ๐Ÿƒ alternatives/ # Format variants (Edison, GOAT, HAT, etc.)
โ”œโ”€โ”€ ๐Ÿ†• prereleases-cdb/ # Pre-release card databases (extra DB)
โ””โ”€โ”€ ๐ŸŽจ cards-art/ # Custom card art databases (extra DB)
```

**Standard card pool** (`YGOPRO_FOLDERS`) is loaded for all rooms. **Extra databases** (`YGOPRO_EXTRA_DB_FOLDERS`) are only available in rooms that use PRE or ART formats โ€” standard rooms cannot use those cards.

To enable all formats and pre-releases, set:

```env
YGOPRO_FOLDERS=./resources/ygopro/base,./resources/ygopro/ocg,./resources/ygopro/alternatives
YGOPRO_EXTRA_DB_FOLDERS=./resources/ygopro/prereleases-cdb,./resources/ygopro/cards-art
```

```bash
npm run dev
```

> ๐ŸŽฏ Connect with Koishi or YGO Mobile to `your-server-ip:7711`

---

### ๐Ÿ”ฅ Running both engines

Just set both ports in your `.env`:

```env
HOST_PORT=7911
YGOPRO_PORT=7711
HTTP_PORT=7922
WEBSOCKET_PORT=4000
YGOPRO_FOLDERS=./resources/ygopro/base,./resources/ygopro/ocg,./resources/ygopro/alternatives
YGOPRO_EXTRA_DB_FOLDERS=./resources/ygopro/prereleases-cdb,./resources/ygopro/cards-art
```

```bash
npm run dev
```

Both engines run in the same process, sharing the HTTP API and WebSocket server. ๐Ÿ’ช

---

## ๐Ÿ—‚๏ธ Card Database Architecture

The YGOPro engine maintains **two separate card pools** in memory:

| Pool | Loaded from | Available to |
|------|-------------|--------------|
| **Standard** | `YGOPRO_FOLDERS` | All rooms |
| **Extended** | `YGOPRO_FOLDERS` + `YGOPRO_EXTRA_DB_FOLDERS` | PRE/ART rooms only |

When a player creates a room with a format like `PRE`, `TCGPRE`, `OCGPRE`, `TCGART`, or `OCGART`, the server uses the **extended** card pool for both deck validation and the duel engine. Standard rooms (`M`, `TCG`, `OT`, `GOAT`, etc.) use only the **standard** pool โ€” any card not in that pool is rejected as unknown.

Both pools are loaded at startup and refreshed every 10 minutes if the underlying `.cdb` files change.

---

## โš™๏ธ Environment Variables

| Variable | Description | Default |
|----------|-------------|---------|
| `HOST_PORT` | EDOPro server port | `7911` |
| `YGOPRO_PORT` | YGOPro server port | `7711` |
| `HTTP_PORT` | HTTP API port | `7922` |
| `WEBSOCKET_PORT` | WebSocket port | `4000` |
| `YGOPRO_FOLDERS` | Comma-separated resource directories (standard card pool) | *(empty)* |
| `YGOPRO_EXTRA_DB_FOLDERS` | Comma-separated extra DB directories (pre-releases, art cards) โ€” only loaded for PRE/ART room formats | *(empty)* |
| `RANK_ENABLED` | Enable ranking system (requires PostgreSQL) | `false` |
| `POSTGRES_HOST` | PostgreSQL host | `localhost` |
| `POSTGRES_PORT` | PostgreSQL port | `5432` |
| `POSTGRES_DB` | PostgreSQL database name | `evolution` |
| `POSTGRES_USER` | PostgreSQL username | `evolution` |
| `POSTGRES_PASSWORD` | PostgreSQL password | *(required if ranking enabled)* |
| `USE_REDIS` | Enable Redis/Valkey for session management | `false` |
| `REDIS_URI` | Redis/Valkey connection URI | *(required if redis enabled)* |

---

## ๐Ÿ—๏ธ Project Architecture

```
src/
โ”œโ”€โ”€ ๐Ÿ–ฅ๏ธ edopro/ # EDOPro engine (EDOPro protocol)
โ”œโ”€โ”€ ๐Ÿ“ฑ ygopro/ # YGOPro engine (srvpro2-compatible)
โ”œโ”€โ”€ ๐Ÿค shared/ # Shared domain logic (rooms, decks, cards, clients)
โ”œโ”€โ”€ ๐Ÿ”Œ socket-server/ # TCP socket servers for both engines
โ”œโ”€โ”€ ๐ŸŒ http-server/ # REST API
โ””โ”€โ”€ ๐Ÿ“ก web-socket-server/ # WebSocket server for real-time updates
```

Both engines share the same room management, player handling, and match lifecycle โ€” but use different protocols, card databases, and deck validation rules.

---

## ๐Ÿ™ Acknowledgments

- [Multirole](https://github.com/DyXel/Multirole) by @Dyxel โ€” the reference for the EDOPro engine
- [srvpro2](https://github.com/purerosefallen/srvpro) โ€” the reference for the YGOPro engine
- The [Project Ignis](https://github.com/ProjectIgnis), [MyCard](https://mycard.moe/), and [Evolution](https://github.com/evolutionygo) communities

---


Made with โค๏ธ by the Evolution community