AquaDX Documentation

repository·v1-dev·Indexed 20 days ago

https://github.com/mewolab/aquadx

A multipurpose server providing backend infrastructure for ALL.Net rhythm games, including CHUNITHM, maimai DX, and O.N.G.E.K.I. The project includes AquaNet, a web frontend, and supports features such as web interfaces, data importing, and AES encryption. Documentation covers self-hosting, environment configuration for AquaNet (Vite), SQL migration conventions, and API structures for Maimai user data and playlogs.

Tokens
23.5K
Snippets
63
Records
112
Agent score
66%

What's inside AquaDX

  1. Overview of AquaDX

    v1-dev

    AquaDX is a multipurpose game server designed for ALL.Net games. It provides backend services for various rhythm games, supporting features like web interfaces, data importing, and AES encryption.

    Key related projects include:

    • AquaMai: A maimai DX mod that adds features to the game.
    • AquaNet: The primary web frontend for AquaDX, hosted at aquadx.net.
  2. How Kaleidx Scope gate visibility works

    v1-dev

    Kaleidx Scope gate visibility is determined by the intersection of three server API responses. A gate is only visible and selectable in the game menu if it meets specific criteria across these endpoints:

    1. GetGameEventApi: Must return open event rows for the gate/course event IDs used by the game's static data.
    2. GetGameKaleidxScopeApi: Must return a gameKaleidxScopeList row for each gate the user can see. Known gate IDs include:
      • 1..6: Original gates
      • 7: Prism/Center Tower
      • 8: Post-Prism boss gate
      • 9: Hope Gate
      • 10: Final challenge
    3. GetUserKaleidxScopeApi: Must return a userKaleidxScopeList row for the same gateId.

    Visibility Requirements: The client hides a gate if the user row is missing, the event is closed, or the row has isGateFound = false. To be visible and selectable, a gate requires a JSON object state similar to this:

    {
      "gateId": 8,
      "isGateFound": true,
      "isKeyFound": true,
      "isClear": false
    }

    Progression Logic: For progression past Prism Tower, UpsertUserAllApi must persist upsertUserAll.userKaleidxScopeList by (userId, gateId). AquaDX automatically unlocks gate 7 after gate 6 is cleared. After gate 7 is cleared, the next GetUserKaleidxScopeApi response must include gate 7 as clear and a gate 8 row with both isGateFound and isKeyFound set to true.

  3. AquaDX License Information

    v1-dev

    AquaDX is licensed under the CC By-NC-SA (Creative Commons Attribution-NonCommercial-ShareAlike) license.

    Key restrictions:

    • Attribution: You must give appropriate credit and provide a link to the license.
    • NonCommercial: Commercial use of this software is strictly prohibited.
    • ShareAlike: If you remix or build upon the material, you must distribute your contributions under the same license.
  4. How Chunithm National Matching gameplay works

    v1-dev

    Matchmaking

    When entering matching mode, the game assigns you to a matching room (or creates a new one). Once 4 players are present or a timer expires, the game starts. If fewer than 4 players are present, the empty slots are filled with bots (which typically select songs under Lv10).

    Song Selection & Difficulty

    • Every player picks a song at the start.
    • Crucial: Other players will play the song on the SAME DIFFICULTY that you picked.
    • If an opponent picks a song you do not have, the game will repeat the previous song.
  5. Requirements for running games with AquaDX

    v1-dev

    To use games with the AquaDX server, keep the following in mind:

    • Patches Required: Most games cannot run unmodified. You must use patched versions of the games. Requirements for specific patches are listed in the game specific notes.
    • Game Versions: The server is designed for specific versions of supported games. While newer versions might work, compatibility is not guaranteed. If a newer version works, please report it in the issue tracker.
    • Files: AquaDX does not provide game files or update files.
  6. Import data to MariaDB and fix Flyway checksum

    v1-dev

    Once your aqua.sql file is prepared, import it into your MariaDB instance.

    After the import, you must run a specific SQL query to fix a Flyway checksum. Aqua uses Flyway for schema migrations, and one migration has a case-sensitivity difference between MySQL and MariaDB that will cause a checksum mismatch if not corrected.

    # 1. Login to MariaDB
    mysql --user={username} --password={password} --host={host} --port={port} {database}
    
    # 2. Import the data (inside the mysql prompt)
    source aqua.sql;
    
    # 3. Fix the Flyway checksum (inside the mysql prompt)
    UPDATE main.flyway_schema_history t
    SET t.checksum = 357127209
    WHERE t.installed_rank = 144;
  7. Update a self-hosted AquaDX instance

    v1-dev

    To update your self-hosted instance, follow these steps in the AquaDX folder to ensure data safety and version synchronization:

    1. Backup your database: Use mariadb-dump via Docker to create a backup.sql file.
    2. Pull the new repository: Use docker compose pull to fetch the latest images.
    3. Run the updated version: Use docker compose up to restart the services with the new images.
    # Backup your database
    docker run --rm -it mariadb:latest mariadb-dump -h host.docker.internal --port 3369 --user=cat --password=meow main > backup.sql
    
    # Pull the new repository
    docker compose pull
    
    # Run the updated version
    docker compose up
  8. Configure Chunithm (Chusan) for AquaDX

    v1-dev

    Chunithm (Chusan) support requires no specific patches. If you are using the public instance and do not have encryption keys set for your game version, no encryption or TLS is required.

    Key Behaviors:

    • Mode Activation: Class/Dan, National Matching, and LINKED VERSE modes become functional after playing the first game (this applies to both initial setup and after ROM/option updates).
    • National Matching: Supported out of the box via services provided by Yukiotoko.
    • Customization: Use the AquaNet website for user box and LINKED VERSE customization.
    • LINKED VERSE: All gates are available by default and can be played sequentially. Note that original condition flags are disregarded.
    • Freeplay Mode: Many game aspects may not function in freeplay mode; this is a limitation of the game client, not the server.
  9. Naming and organizing SQL migration files

    v1-dev

    When adding new SQL migrations to the database, follow a specific naming convention and folder structure to ensure they are processed correctly and remain easy to navigate.

    Naming Convention

    Files must follow the pattern: V1000_{version}__{description}.sql

    • {version}: A sequential ID. Always pick the next available number in the sequence.
    • {description}: A short, descriptive text of the change.

    Folder Organization

    To prevent long file lists, migrations are grouped into folders containing 40 changes each. Place your file in the folder corresponding to its version number:

    • db/40: Versions 1-40
    • db/80: Versions 41-80
    • (Continue incrementing by 40 for subsequent ranges)
    # Example naming and placement:
    # For version 42 with description 'add_users_table':
    # Path: db/80/V1000_42__add_users_table.sql
  10. Host AquaDX behind a reverse proxy

    v1-dev

    If you are hosting AquaDX behind a reverse proxy, follow these guidelines to ensure connectivity:

    1. Proxying Endpoints:
      • You can proxy ALL.Net and game endpoints.
      • You can proxy the Billing endpoint, but it requires extra steps: you must either enable deprecated TLS_RSA_* ciphers and use a self-signed ib.naominet.jp TLS certificate, or simply disable the billing endpoint.
      • You must not proxy the Aime endpoint (it is TCP, not HTTP).
    2. Configuration:
      • Set the allnet.server.host property in application.properties to your public IP or hostname.
    3. Port Mapping:
      • You may change the internal endpoint ports (between AquaDX and your proxy).
      • However, the external ports exposed to the internet (between the proxy and the game) must match the default AquaDX ports (80, 8443, 22345).
  11. Configure Firewall Rules for Chunithm

    v1-dev

    If you do not want to turn off your firewall entirely, you can add specific inbound and outbound rules for chusanApp.exe.

    Create a .bat file with the following content, ensuring you run it as an Administrator and provide the correct path to your game executable (e.g., C:\SegaGames\Chunithm\bin\chusanApp.exe).

    @echo off
    set /p gamedirectory = Make sure this is run as admin and enter game path (e.g. C:\SegaGames\Chunithm\bin\chusanApp.exe)
    netsh advfirewall firewall add rule name="Chunithm National Matching Inbound" dir=in action=allow profile=any program="%gamedirectory%" enable=yes
    netsh advfirewall firewall add rule name="Chunithm National Matching Outbound" dir=out action=allow profile=any program="%gamedirectory%" enable=yes