From 9ccf951473e21a8b90c25161156fa09a9b227a7b Mon Sep 17 00:00:00 2001 From: skylar Date: Wed, 11 Nov 2026 15:24:37 -0800 Subject: Orrery 0.1.0: the galaxy, flight, cities, inventory and saves Grows the derelict crawler into the whole game, and gets it ready to publish. - A galaxy of star systems joined by lanes, split between four peoples' territories, with a star map and a system map. Systems are modelled with Kepler orbits, moons inside their Hill spheres, belts past the frost line and stations at Lagrange points. - Flight around one place at a time: arcade flight with a throttle fallback where held keys can't be detected, mining rocks for ore, landing, docking at stations, and boarding wrecks that come and go by the calendar. - Your ship to walk about, and capital cities to land at: generated plans with walls, quarters and streets, building interiors, shops, taverns, scholars and armourers. - Fighting with a weapon and a gun ready, six damage types and how each monster takes them, and armour that guards, wears and can be mended. - Everything you own has a weight: a vim-keyed inventory, a pack and the ship's lockers, and trade in ore, salvage, arms and fuel. - Characters with a people and a ship of their own, saved as versioned JSON on every scene change and on quit, with a character sheet, a saves list and a pause menu wherever you are. - `orrery weapons`, `armour`, `galaxy`, `system` and `town` print the generators' output without the TUI. - Release: README install steps for macOS and Linux, a Makefile whose install also works with macOS's install, an MIT licence, and Cargo metadata with rust-version 1.88. Co-Authored-By: Claude Opus 5.5 --- src/names/artifact.rs | 17 +++++++++++++---- src/names/mod.rs | 13 +++++++++++-- 2 files changed, 24 insertions(+), 6 deletions(-) (limited to 'src/names') diff --git a/src/names/artifact.rs b/src/names/artifact.rs index af24b3d..336eef4 100644 --- a/src/names/artifact.rs +++ b/src/names/artifact.rs @@ -2,22 +2,31 @@ //! called once a scholar has told you what it is. use rand::RngExt; +use serde::{Deserialize, Serialize}; use super::{Culture, pick}; use crate::seed::Rng; -#[derive(Clone, Debug)] +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct Artifact { /// What you see when you find it: "a humming ochre lattice". pub unidentified: String, /// Its true name: "the Lacquered Orrery of Teshemond". pub true_name: String, + /// Whether a scholar has told you its true name. + pub identified: bool, +} + +impl Artifact { + /// What you call it: its true name once you know it. + pub fn name(&self) -> &str { + if self.identified { &self.true_name } else { &self.unidentified } + } } pub fn artifact(rng: &mut Rng) -> Artifact { let look = format!("{} {} {}", pick(QUALITIES, rng), pick(COLOURS, rng), pick(SHAPES, rng)); - let article = if look.starts_with(['a', 'e', 'i', 'o', 'u']) { "an" } else { "a" }; - let unidentified = format!("{article} {look}"); + let unidentified = super::a(&look); let object = pick(OBJECTS, rng); let culture = Culture::ALL[rng.random_range(..Culture::ALL.len())]; @@ -28,7 +37,7 @@ pub fn artifact(rng: &mut Rng) -> Artifact { 3 => format!("the {} {object}", pick(EPITHETS, rng)), _ => format!("the {object} {}", pick(CLAUSES, rng)), }; - Artifact { unidentified, true_name } + Artifact { unidentified, true_name, identified: false } } const QUALITIES: &[&str] = &[ diff --git a/src/names/mod.rs b/src/names/mod.rs index 719455f..9b5d9a6 100644 --- a/src/names/mod.rs +++ b/src/names/mod.rs @@ -21,10 +21,12 @@ use std::fmt::Write as _; use rand::RngExt; use rand::seq::IndexedRandom; +use serde::{Deserialize, Serialize}; use crate::seed::Rng; -#[derive(Clone, Copy, Debug, PartialEq, Eq)] +#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)] +#[serde(rename_all = "lowercase")] pub enum Culture { Qaari, Cant, @@ -198,7 +200,7 @@ impl Culture { self.expand(pick(self.phonology().places, rng), rng) } - fn expand(self, template: &str, rng: &mut Rng) -> String { + pub(crate) fn expand(self, template: &str, rng: &mut Rng) -> String { let mut out = String::new(); let mut rest = template; while let Some(open) = rest.find('{') { @@ -217,6 +219,13 @@ impl Culture { } } +/// The phrase with "a" or "an" in front, by its first letter: "an ice +/// world", "a desert world". +pub fn a(phrase: &str) -> String { + let article = if phrase.starts_with(['a', 'e', 'i', 'o', 'u']) { "an" } else { "a" }; + format!("{article} {phrase}") +} + pub(crate) fn pick(list: &'static [&'static str], rng: &mut Rng) -> &'static str { list.choose(rng).expect("name lists are never empty") } -- cgit v1.2.3