Skip to main content

Architecture

The pieces​

  • Velocity proxy (graycore-velocity). Players connect here. It knows the game servers only through server-service: there are no static servers in velocity.toml. It picks the server a player joins, moves players when a server goes down, applies the permissions on the proxy and fills the TAB tab list.
  • Paper game servers (graycore-paper). Each one has a SERVER_ID (unique) and a SERVER_TYPE (for example gens): servers of the same type are interchangeable. A game server loads the profiles of its players, saves them, runs the commands and the modules.
  • server-service. A small Spring Boot service, the registry of live game servers. Each game server sends it a heartbeat every 500 ms; a server silent for 3 seconds is considered dead. Proxies subscribe to a stream of changes.
  • PostgreSQL. Player profiles, permission groups and the vault (numeric counters such as currencies). The schema is created and migrated by Liquibase, see Database.
  • Redis. Network-wide presence: who is online, on which server, used by private messages and player counts.

Rules that hold everywhere​

  • A profile has one owner. A player's row is locked by the server that loaded it, with a lease that the owner keeps alive. Another server waits for the lock to be released, so two servers never write the same profile. A crashed server's lease expires and the profile can be taken over. See Player profiles.
  • Nothing slow on the game thread. Database and network work runs off the main thread; profiles are serialized on the main thread and written by workers.
  • The proxy decides where players go, from the list server-service streams to it. While that stream is down, the last known list is still used for a while, then players are refused rather than sent to servers that may be gone. See Servers and routing.
  • Features are modules. The core provides players, permissions and servers; everything else (kits, warps, the RPG) is a module with its own folder and its own switch. See Modules.