Skip to content

Instantly share code, notes, and snippets.

@zesterer
Created January 25, 2022 17:04
Show Gist options
  • Save zesterer/7875763733d8b3fa87b0d1be28c83ee2 to your computer and use it in GitHub Desktop.
Save zesterer/7875763733d8b3fa87b0d1be28c83ee2 to your computer and use it in GitHub Desktop.
Veloren rtsim2 data model ideas
// Top-level rtsim state. The contents of this struct are entirely sufficient to describe the state of the world.
struct RtState {
temporal: &mut Temporal,
agents: &mut Agents,
}
// Contains tick-by-tick information such as decision tree state, short-term planning, aggro, current activity, etc.
// Agents can be both single characters and groups of characters (see `Groups`).
struct Agents { ... }
// Contains short-term information about world state. We probably won't be persisting this data for now (because it's
// liable to rapidly change), but it is desirable to persist it eventually.
struct Temporal {
civ_state: &mut World,
quests: &mut Quests,
characters: &mut Characters,
groups: &mut Groups,
}
// Contains questing information: quest givers, receivers, goals, etc.
struct Quests { ... }
// Contains character position, identity, faction membership, goals, opinions of other characters, etc.
struct Characters { ... }
// Contains information about character groups (armies, bandits, merchants, etc.)
// Groups are more short-term than factions and may appear and disband relatively quickly as the goals of the
// characters in them change. Group membership is broadly governed by each agent, but being a member of a group implies
// submitting to the will of the group (i.e: it is its own centralised AI system)
struct Groups { ... }
// Contains long-term world state, simulated using large ticks (~1 month, perhaps?)
// This data can only be updated during server startup, we progress it forwards according to IRL time passed (maybe
// configurable?)
struct World {
// Never mutated after being created! If we want to modify the world, it needs to be done in `Nature`.
terrain: &Terrain,
nature: &mut Nature,
economy: &mut Economy,
sites: &mut Sites,
factions: &mut Factions,
diplomacy: &mut Diplomacy,
}
// Contains currently persisted erosion map
struct Terrain { ... }
// Contains river/ocean state, caves, temperature, humidity, tree cover, etc.
struct Nature { ... }
// Contains site stockpiles, workforce allocation, trade data, site knowledge of prices, etc.
// TODO: Maybe combine this with `Sites`?
struct Economy { ... }
// Contains site demographics, plot/tile/building information, site planning state, etc.
struct Sites { ... }
// Contains faction information (ideology, goals, etc.), membership across sites, control of sites, AI state, etc.
struct Factions { ... }
// Contains diplomatic state between factions, etc.
struct Diplomacy { ... }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment