Data Model¶
The data in Stellar Magnate is divided into two categories: static data that defines base information and dynamic data that changes over the course of the game.
Static data is shipped in yaml files with the program. When a new Stellar Magnate game is started, the yaml files are loaded into a database to initialize the program.
The dynamic data is generated by the game as it moves along. It is persisted into separate tables in the database as the game progresses.
Static data and dynamic data reside in different tables in the database but the dynamic data can reference the static tables.
Static Data¶
Shipped format¶
Game Dependent¶
These are various records that only the game ships because there needs to be new game logic whenever something is added to them.
location_type: | enumeration of known location types. :surface: On the surface of a celestial body :orbital: Orbiting a celestial body in the system :dome: Exists under a dome because the ecosystem is otherwise non-habitable |
---|---|
planetoid_type: | enumeration of planetoid types - oceanic - gas giant - rocky - oxygen - methane |
moon_type: | enumeration of planetoid types |
commodity_type: | enumeration of known commodities. - food - metal - fuel - low bulk chemical - low bulk machine - high bulk chemical - high bulk machine |
finance_type: | enumeration of known bank types. - mafia - system - capital - planetary |
order_status_type: | |
The status of a transaction - presale - submitter - rejected - finalized |
|
ship_type: |
|
equipment: | |
ship: |
|
property: |
|
ship parts: |
|
Extendable by Server Owners¶
system: | list of stellar systems
|
---|
Someday locations will have other characteristics like:
- Orbit velocity
- Initial position
- Orbit radius
- type jump will have locations that can be jumped to
- population. Population affects the amount of commodities that a location needs or produces
- population_origin: list of stellar systems that the population originates in. Affects
- commodities for sale
- commodity consumption and production information
- Production should be of a specific commodity
- Consumption can be of a commodity or commodity_type
- These numbers should be weightings. Production weighting affects how likely (or how much) a place is to sell an item
- Consumption affects how much of an item a place is likely to take
commodity: | list of commodities that can be bought and sold :name: name of the commodity :type: Type of the commodity :mean_price: average price of the commodity :standard_deviation: How much money is there in one std deviation :depreciation_rate: How quickly the value of a product degrades :space: Volume the commodity consumes |
---|---|
financial_institution: | |
list of financial institutions in these stellar systems :name: name of the institution :type: type of institution |
Someday commodity should grow a weight attribute. Weight will affect a fee for transporting the commodity to the ship. (Perhaps. Perhaps there needs to be a way for this to be offset. Rockets are inefficient weight. Space elevators are volume constrained. Counter grav can land a whole ship but only high tech worlds and weightless environments (orbital facilities) have it?) To implement this, locations would need to grow a surface_to_orbit type
event: | list of events that can change the price of goods :msg: Description of the event. Like headline and subheading of a news article :affects: list of commodities affected by the event
|
||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
ship: | A user’s ship :type: Type of ship :mean_price: Average price of the ship :standard_deviation: How much the ship’s price fluctuates :depreciation_rate: How quickly the resale value of the ship drops :holdspace: How much space the ship has for cargo :weaponmount: How many weapons the ship can have ready to fire |
Database Schema¶
This closely mirrors the Shipped format. The static data should live in separate db tables from dynamic data and be associated via foreign keys. This allows for easier changes to the static data if an update occurs.
Tables for static data should all have _data as a suffix
Linter¶
There should be a static_data linter that does the following:
- Verifies the schema
- Checks everything for spelling
- Assembles a list of commodity types (in commodity and in event) and asks for confirmation if any of the commodity_types are unknown
- All location names must be unique within a stellar_system
- All stellar_system names must be unique within the game
- All commodity names must be unique within their system
- All types (for locations, commodities, etc) must be known to the game
Dynamic Data¶
These pieces of data are per game instance. They change as the game progresses
Database Schema¶
All records have a system created id
players: | Table of players :username: Player’s handle :display_name: If set, an alternate name the player can go by :password: hashed password that the player can use to verify themselves :cash: Amount of cash on hand |
||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
epoch: | Number of “ticks” since the game was created. Eventually a number of calculations will include the epoch |
||||||||||||||||||
bank_accounts: | Table of bank accounts that players have :bank_id: foreign key to bank :loan amount: amount on loan :loan_rate: interest rate |
||||||||||||||||||
commodity: |
|
||||||||||||||||||
order: |
|
||||||||||||||||||
manifest: |
|
||||||||||||||||||
ship: |
|
||||||||||||||||||
ship_parts: |
|