TradeWars / gamemode

A work in progress aggressive economy gamemode...
5 stars 1 forks source link

High Level Architecture Design #18

Open Southclaws opened 6 years ago

Southclaws commented 6 years ago

This thread documents and discusses the high-level design of the overall architecture of services that surround the gamemode.

In development, we will make best efforts to make it easy to spin up the game server alone without needing to connect to anything else unless you are specifically working on features that require these external services.

For example, building the codebase with the NO_AUTH constant will disable authentication and thus, won't require running SSC in the background to perform login and registration.


Services

Below is a concrete list of all proposed services and their purposes.

SSC - "ScavengeSurviveCore" - or "StorageServiCe" (🤔)

A JSON-based storage server backed by MongoDB built for storing player accounts and administrative data such as staff roles, reports and bans.

This was originally built for Scavenge and Survive - hence the name - but was repurposed to be a generic account storage service.

It provides an API via HTTP which provides RPC endpoints for CRUD operations on:

Timerunner

This is an event store for receiving events from other services and storing them to a Timescale database (a time-series PostgreSQL database).

Events will play a key role in both administrative, statistics and possibly even data operations. An event will be any player action on the server (and maybe some non-player actions). This can involve:

Not only will this be extremely useful for anti-cheat (based on years of experience dealing with the creative cheaters in Scavenge and Survive) it will also serve as a complete history of everything that happened on the server in chronological order, easy to query.

More neat applications of this data include:

Econ (economy? vendors? not sure yet)

This will serve as the "brain" for vendors (#3) to control the simulated economy. Vendors will buy items from players but vendors also have their own finite amount of money because they are individuals. So some omnipotent deity (nicknamed "Gaĩa") with infinite money needs to exist to purchase these items from vendors at market price.

Because this stuff is complex, it was decided that it would make sense to pull this entire piece of functionality out to a separate service. This also means the vendor's data can be queried by other services, like maybe a web frontend that lists vendor item prices.

This thing should be kinda simple, there won't be a whole lot of "artificial intelligence" on the trade-making side of things since actual trades will be done by players.

There also won't be an order book or ledger (the event store will serve as a ledger) - trades are not negotiated, whether that's between players and vendors or vendors and Gaĩa. There is one set market price. Though this could change, a full scale player-to-player trading platform would be very interesting to build.

Diagram

Here's a rough diagram that I drew at 11pm one night that outlines the communication channels between these services.

image