11# MGO2 server
22
33A server implementation for Metal Gear Online 2, written in TypeScript/Deno.
4- Provides the Gate, Account, and Game Lobby TCP servers, an HTTP REST API, a DNS server
5- for domain redirection, and a PostgreSQL-backed persistence layer.
4+ Provides the Gate, Account, and Game Lobby TCP servers, an HTTP REST API, a DNS
5+ server for domain redirection, and a PostgreSQL-backed persistence layer.
66
77## Architecture
88
9- | Component | Port | Description |
10- | -----------| ------| -------------|
11- | DNS server | 53/udp | Resolves configured local domains to ` LISTENING_IP ` |
12- | HTTP API | 80/tcp | REST API for administration and game client integration |
13- | STUN server | 3478/udp | NAT traversal for peer-to-peer connections |
14- | Gate server | 5731/tcp | First connection point; delivers lobby list and news to clients |
15- | Account server | 5732/tcp | Character creation, deletion, selection, and session validation |
16- | Game lobby server | 5733+/tcp | Game room management, player sessions, and match statistics |
9+ | Component | Port | Description |
10+ | ----------------- | --------- | --------------------------------------------------------------- |
11+ | DNS server | 53/udp | Resolves configured local domains to ` LISTENING_IP ` |
12+ | HTTP API | 80/tcp | REST API for administration and game client integration |
13+ | STUN server | 3478/udp | NAT traversal for peer-to-peer connections |
14+ | Gate server | 5731/tcp | First connection point; delivers lobby list and news to clients |
15+ | Account server | 5732/tcp | Character creation, deletion, selection, and session validation |
16+ | Game lobby server | 5733+/tcp | Game room management, player sessions, and match statistics |
1717
1818## Setup with Docker
1919
20- Replace ` <YOUR_IP> ` with the public or LAN IP address that game clients should connect to:
20+ Replace ` <YOUR_IP> ` with the public or LAN IP address that game clients should
21+ connect to:
2122
2223``` sh
2324docker run -d \
@@ -30,27 +31,33 @@ docker run -d \
3031 ghcr.io/miguelripoll23/mgo2-server:main
3132```
3233
33- PostgreSQL is bundled inside the image and starts automatically. On first startup the
34- database is initialized, migrated, and seeded with the default lobby configuration.
35- Subsequent restarts skip seeding.
34+ PostgreSQL is bundled inside the image and starts automatically. On first
35+ startup the database is initialized, migrated, and seeded with the default lobby
36+ configuration. Subsequent restarts skip seeding.
3637
37- ## Configuration
38+ ## RPCS3 configuration
39+
40+ Using the custom RPCS3 build for Metal Gear Online 2, to to the ` Config `
41+ section, go to the tab ` Metal Gear Onlien 2 ` and change the DNS IP address to
42+ your listening IP.
43+
44+ ## Server configuration
3845
3946All options are set via environment variables.
4047
41- | Variable | Default | Description |
42- | ----------| ---------| -------------|
43- | ` LISTENING_IP ` | ` 0.0.0.0 ` | IP the server binds to and that DNS resolves local domains to |
44- | ` JWT_SECRET ` | — | Secret used to sign authentication tokens ** (required)** |
45- | ` DATABASE_URL ` | ` postgresql://postgres@localhost/mgo2 ` | PostgreSQL connection string |
46- | ` INSTANCE_ID ` | * (auto-generated UUID)* | Unique identifier for this server instance |
47- | ` DISABLE_DNS_SERVER ` | ` false ` | Set to ` true ` to disable the DNS server |
48- | ` LOCAL_RESOLVED_DOMAINS ` | ` mgo2pc.com,game.mgo2pc.com ` | Comma-separated domains resolved to ` LISTENING_IP ` |
49- | ` ALTERNATIVE_DNS_SERVER ` | ` 8.8.8.8 ` | Upstream DNS for non-local queries |
50- | ` ALTERNATIVE_DNS_PORT ` | ` 53 ` | Port of the upstream DNS server |
51- | ` LOBBIES_REFRESH_CRON ` | ` */15 * * * * ` | Cron schedule for refreshing the in-memory lobby cache |
52- | ` HDX_API_KEY ` | — | HyperDX API key; omit to disable OpenTelemetry telemetry |
53- | ` OTEL_EXPORTER_OTLP_ENDPOINT ` | — | OpenTelemetry Collector endpoint |
48+ | Variable | Default | Description |
49+ | ----------------------------- | -------------------------------------- | ------------------------------------------------------------- |
50+ | ` LISTENING_IP ` | ` 0.0.0.0 ` | IP the server binds to and that DNS resolves local domains to |
51+ | ` JWT_SECRET ` | — | Secret used to sign authentication tokens ** (required)** |
52+ | ` DATABASE_URL ` | ` postgresql://postgres@localhost/mgo2 ` | PostgreSQL connection string |
53+ | ` INSTANCE_ID ` | _ (auto-generated UUID)_ | Unique identifier for this server instance |
54+ | ` DISABLE_DNS_SERVER ` | ` false ` | Set to ` true ` to disable the DNS server |
55+ | ` LOCAL_RESOLVED_DOMAINS ` | ` mgo2pc.com,game.mgo2pc.com ` | Comma-separated domains resolved to ` LISTENING_IP ` |
56+ | ` ALTERNATIVE_DNS_SERVER ` | ` 8.8.8.8 ` | Upstream DNS for non-local queries |
57+ | ` ALTERNATIVE_DNS_PORT ` | ` 53 ` | Port of the upstream DNS server |
58+ | ` LOBBIES_REFRESH_CRON ` | ` */15 * * * * ` | Cron schedule for refreshing the in-memory lobby cache |
59+ | ` HDX_API_KEY ` | — | HyperDX API key; omit to disable OpenTelemetry telemetry |
60+ | ` OTEL_EXPORTER_OTLP_ENDPOINT ` | — | OpenTelemetry Collector endpoint |
5461
5562## Development
5663
@@ -70,11 +77,11 @@ deno task dev
7077
7178Other useful tasks:
7279
73- | Task | Description |
74- | ------| -------------|
75- | ` deno task check ` | Type-check the codebase |
76- | ` deno task generate ` | Generate migrations from schema changes |
77- | ` deno task studio ` | Open Drizzle Studio for database inspection |
80+ | Task | Description |
81+ | -------------------- | ------------------------------------------- |
82+ | ` deno task check ` | Type-check the codebase |
83+ | ` deno task generate ` | Generate migrations from schema changes |
84+ | ` deno task studio ` | Open Drizzle Studio for database inspection |
7885
7986## Acknowledgements
8087
0 commit comments