@@ -262,6 +262,9 @@ fn play(path: &Path, report: &mut Report) -> Result<(), String> {
|
||||
format!("{}: {text}", if error { "error" } else { "feedback" })
|
||||
}
|
||||
Output::Command { line } => format!("command: /{line}"),
|
||||
Output::QuietCommands { lines, .. } => {
|
||||
format!("{} quiet command(s)", lines.len())
|
||||
}
|
||||
Output::Stopped { reason, .. } => return Err(format!("it stopped: {reason}")),
|
||||
Output::OpenScreen { .. } => "opened a screen".to_string(),
|
||||
Output::CloseScreen { .. } => "closed its screen".to_string(),
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
use horizon_client::{
|
||||
Result,
|
||||
item_data::StackData,
|
||||
items::{ItemStack, Items},
|
||||
};
|
||||
use horizon_world::nbt::Tag;
|
||||
use serde_json::Value;
|
||||
use std::{
|
||||
fs::File,
|
||||
io::{BufRead, BufReader, BufWriter, Write},
|
||||
path::Path,
|
||||
};
|
||||
|
||||
pub fn main() -> Result<()> {
|
||||
let args: Vec<_> = crate::args().collect();
|
||||
let root = Path::new(env!("CARGO_MANIFEST_DIR")).join("../../.local/horizon-client/26.3");
|
||||
let items = Items::catalog(&root)?;
|
||||
let mut out = BufWriter::new(File::create(&args[2])?);
|
||||
for line in BufReader::new(File::open(&args[1])?).lines() {
|
||||
let row: Value = serde_json::from_str(&line?)?;
|
||||
let mut stack = ItemStack::new(
|
||||
row["item"].as_str().unwrap(),
|
||||
row["count"].as_u64().unwrap() as u32,
|
||||
);
|
||||
match row["tool"].as_str().unwrap() {
|
||||
"default" => {}
|
||||
mode => {
|
||||
let mut data = StackData::default();
|
||||
let tool = if mode == "implicit" {
|
||||
Tag::compound([] as [(&str, Tag); 0])
|
||||
} else {
|
||||
Tag::compound([(
|
||||
"can_destroy_blocks_in_creative",
|
||||
Tag::Byte(i8::from(mode == "allow")),
|
||||
)])
|
||||
};
|
||||
data.set_other("minecraft:tool", Some(tool));
|
||||
stack.extra = Some(Box::new(data));
|
||||
}
|
||||
}
|
||||
writeln!(
|
||||
out,
|
||||
"{}",
|
||||
items.can_destroy_block(Some(&stack), row["creative"].as_bool().unwrap())
|
||||
)?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
@@ -27,6 +27,7 @@ mod chat_screen_fixture;
|
||||
mod cloud_fixture;
|
||||
mod command_parse_fixture;
|
||||
mod container_screen_probe;
|
||||
mod creative_mining_probe;
|
||||
mod creative_search_fixture;
|
||||
mod cushion_placement_probe;
|
||||
mod emitter_particles_probe;
|
||||
@@ -108,6 +109,7 @@ probes! {
|
||||
block_transform_fixture,
|
||||
breaking_fixture,
|
||||
camera_probe,
|
||||
creative_mining_probe,
|
||||
cushion_placement_probe,
|
||||
cauldron_fixture,
|
||||
chat_screen_fixture,
|
||||
|
||||
@@ -58,7 +58,10 @@ enum Animate {
|
||||
BubbleColumn {
|
||||
drag: bool,
|
||||
},
|
||||
Fire,
|
||||
/// `BaseFireBlock` (`SoulFireBlock.canBurn` is always true).
|
||||
Fire {
|
||||
soul: bool,
|
||||
},
|
||||
/// An active sculk sensor.
|
||||
SculkSensor,
|
||||
/// Potent sulfur that is not dry.
|
||||
@@ -140,7 +143,8 @@ fn classify(name: &str, prop: &dyn Fn(&str) -> Option<String>) -> Animate {
|
||||
"bubble_column" => Animate::BubbleColumn {
|
||||
drag: prop("drag").as_deref() == Some("true"),
|
||||
},
|
||||
"fire" | "soul_fire" => Animate::Fire,
|
||||
"fire" => Animate::Fire { soul: false },
|
||||
"soul_fire" => Animate::Fire { soul: true },
|
||||
"dried_ghast" => Animate::DriedGhast {
|
||||
waterlogged: prop("waterlogged").as_deref() == Some("true"),
|
||||
},
|
||||
@@ -190,6 +194,8 @@ pub struct AnimateTables {
|
||||
power_transmitter: Vec<bool>,
|
||||
/// `#triggers_ambient_dried_ghast_block_sounds` (soul sand, soul soil).
|
||||
dried_ghast_sounds: Vec<bool>,
|
||||
/// `FireBlock.canBurn`: states with ignite odds above zero (none waterlogged).
|
||||
burnable: Vec<bool>,
|
||||
/// Biome id -> ambient particles and probabilities (`minecraft:visual/ambient_particles`).
|
||||
ambient: Vec<Vec<(T, f32)>>,
|
||||
}
|
||||
@@ -220,6 +226,21 @@ impl AnimateTables {
|
||||
})
|
||||
.collect()
|
||||
};
|
||||
let behaviour: serde_json::Value =
|
||||
serde_json::from_slice(&std::fs::read(root.join("block-behaviours.json"))?)?;
|
||||
let ignite_odds = behaviour["fire"]["igniteOdds"].as_object();
|
||||
let burnable = (0..registry.len() as u32)
|
||||
.map(|id| {
|
||||
// FireBlock.getIgniteOdds: a waterlogged state never burns.
|
||||
registry.state(BlockStateId(id)).is_some_and(|s| {
|
||||
s.properties.get("waterlogged").map(String::as_str) != Some("true")
|
||||
&& ignite_odds
|
||||
.and_then(|m| m.get(s.name.as_str()))
|
||||
.and_then(serde_json::Value::as_i64)
|
||||
.is_some_and(|odds| odds > 0)
|
||||
})
|
||||
})
|
||||
.collect();
|
||||
let mut ambient = vec![Vec::new(); biomes.list.len()];
|
||||
for (name, &id) in &biomes.index {
|
||||
let path = root.join(format!(
|
||||
@@ -248,6 +269,7 @@ impl AnimateTables {
|
||||
power_provider: by_state("minecraft:enchantment_power_provider"),
|
||||
power_transmitter: by_state("minecraft:enchantment_power_transmitter"),
|
||||
dried_ghast_sounds: by_state("minecraft:triggers_ambient_dried_ghast_block_sounds"),
|
||||
burnable,
|
||||
ambient,
|
||||
})
|
||||
}
|
||||
@@ -1103,7 +1125,7 @@ fn block_animate_tick(
|
||||
}
|
||||
}
|
||||
}
|
||||
Animate::Fire => {
|
||||
Animate::Fire { soul } => {
|
||||
let r = engine.random();
|
||||
if next_int(r, 24) == 0 {
|
||||
let (volume, pitch) = (1.0 + r.next_float(), r.next_float() * 0.7 + 0.3);
|
||||
@@ -1115,6 +1137,55 @@ fn block_animate_tick(
|
||||
pitch,
|
||||
);
|
||||
}
|
||||
// BaseFireBlock.animateTick: three large smoke above the fire, or
|
||||
// two at each burnable neighbour's face when nothing burnable or
|
||||
// sturdy supports it (SoulFireBlock.canBurn is always true).
|
||||
let can_burn = |p: [i32; 3]| {
|
||||
soul || tables
|
||||
.burnable
|
||||
.get(ctx.state(p).0 as usize)
|
||||
.copied()
|
||||
.unwrap_or(false)
|
||||
};
|
||||
let below = [pos[0], pos[1] - 1, pos[2]];
|
||||
let sturdy = ctx.facts.get(ctx.state(below)).sturdy_full & (1 << 1) != 0;
|
||||
if !can_burn(below) && !sturdy {
|
||||
// (neighbour, coordinate axis, face at the axis' high end): the
|
||||
// west, east, north, south and above faces, in vanilla order.
|
||||
for (at, axis, high) in [
|
||||
([pos[0] - 1, pos[1], pos[2]], 0usize, false),
|
||||
([pos[0] + 1, pos[1], pos[2]], 0, true),
|
||||
([pos[0], pos[1], pos[2] - 1], 2, false),
|
||||
([pos[0], pos[1], pos[2] + 1], 2, true),
|
||||
([pos[0], pos[1] + 1, pos[2]], 1, true),
|
||||
] {
|
||||
if !can_burn(at) {
|
||||
continue;
|
||||
}
|
||||
for _ in 0..2 {
|
||||
let r = engine.random();
|
||||
let d = [r.next_double(), r.next_double(), r.next_double()];
|
||||
let mut p = [fx + d[0], fy + d[1], fz + d[2]];
|
||||
// The face coordinate hugs the edge: `* 0.1F` (float).
|
||||
p[axis] = if high {
|
||||
f64::from(pos[axis]) + 1.0 - d[axis] * f64::from(0.1f32)
|
||||
} else {
|
||||
f64::from(pos[axis]) + d[axis] * f64::from(0.1f32)
|
||||
};
|
||||
add(engine, T::LargeSmoke, p, [0.0; 3]);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for _ in 0..3 {
|
||||
let r = engine.random();
|
||||
let p = [
|
||||
fx + r.next_double(),
|
||||
fy + r.next_double() * 0.5 + 0.5,
|
||||
fz + r.next_double(),
|
||||
];
|
||||
add(engine, T::LargeSmoke, p, [0.0; 3]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -161,6 +161,9 @@ pub struct Chunk {
|
||||
/// Structure starts reaching into this chunk (`structures.References`):
|
||||
/// structure id and the start's chunk.
|
||||
pub structure_refs: Vec<(Arc<str>, (i32, i32))>,
|
||||
/// The starts generation made in this chunk (`structures.starts`), saved
|
||||
/// with the state their placement has reached by then.
|
||||
pub structure_starts: Vec<Arc<horizon_world::worldgen::structure::start::StructureStart>>,
|
||||
}
|
||||
impl Chunk {
|
||||
pub fn empty(x: i32, z: i32) -> Self {
|
||||
@@ -178,6 +181,7 @@ impl Chunk {
|
||||
block_entities: Vec::new(),
|
||||
block_names: Vec::new(),
|
||||
structure_refs: Vec::new(),
|
||||
structure_starts: Vec::new(),
|
||||
postprocess: Vec::new(),
|
||||
saved: None,
|
||||
entities: Vec::new(),
|
||||
|
||||
@@ -3346,6 +3346,13 @@ impl Game<'_> {
|
||||
self.with_player_actor(|game| game.break_block_as_player(pos))
|
||||
}
|
||||
fn break_block_as_player(&mut self, pos: [i32; 3]) -> Result<()> {
|
||||
if !self
|
||||
.res
|
||||
.items()
|
||||
.can_destroy_block(self.held(), self.creative)
|
||||
{
|
||||
return Ok(());
|
||||
}
|
||||
self.pad_rumble(horizon_client::gamepad::Rumble::BlockBroken);
|
||||
// ServerPlayerGameMode.destroyBlock.
|
||||
let state = self.world.block(pos[0], pos[1], pos[2]);
|
||||
@@ -3971,7 +3978,12 @@ impl Game<'_> {
|
||||
return Ok(());
|
||||
};
|
||||
// GameType.isBlockPlacingRestricted: adventure and spectator.
|
||||
if !self.may_build() {
|
||||
if !self.may_build()
|
||||
|| !self
|
||||
.res
|
||||
.items()
|
||||
.can_destroy_block(self.held(), self.creative)
|
||||
{
|
||||
self.mining = None;
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
@@ -1066,7 +1066,10 @@ impl Game<'_> {
|
||||
}
|
||||
MobEvent::BreakBlock { pos, drop } => {
|
||||
let old = self.world.block(pos[0], pos[1], pos[2]);
|
||||
self.destroy_particles(pos, old);
|
||||
// Block.spawnDestroyParticles: fire breaks leave nothing.
|
||||
if !self.res.facts().get(old).has_class("BaseFireBlock") {
|
||||
self.destroy_particles(pos, old);
|
||||
}
|
||||
if drop {
|
||||
let drops = self.res.items().block_drops_in(
|
||||
self.pack.assets.registry,
|
||||
|
||||
@@ -1560,6 +1560,7 @@ impl Game<'_> {
|
||||
y -= 1.0;
|
||||
}
|
||||
self.breath_clouds.push(Breath {
|
||||
id: 0,
|
||||
at: [x, y.floor() + 1.0, z],
|
||||
radius: 5.0,
|
||||
age: 0,
|
||||
@@ -2022,6 +2023,7 @@ impl Game<'_> {
|
||||
// assignDirectionalMovement: the direction times the acceleration power 0.1.
|
||||
let velocity = Vec3::new(v.x * 0.1, v.y * 0.1, v.z * 0.1);
|
||||
self.dragon_fireballs.push(DragonFireball {
|
||||
id: 0,
|
||||
position: at,
|
||||
previous: at,
|
||||
velocity,
|
||||
@@ -2068,6 +2070,7 @@ impl Game<'_> {
|
||||
});
|
||||
if hit_block || hit_player || b.age > 600 {
|
||||
self.breath_clouds.push(Breath {
|
||||
id: 0,
|
||||
at: [next.x, next.y, next.z],
|
||||
radius: 3.0,
|
||||
age: 0,
|
||||
@@ -2197,15 +2200,58 @@ impl Game<'_> {
|
||||
}
|
||||
}
|
||||
pub(super) struct DragonFireball {
|
||||
position: Vec3,
|
||||
previous: Vec3,
|
||||
velocity: Vec3,
|
||||
/// Its entity id once a server's players track it (0 until then).
|
||||
pub(super) id: u32,
|
||||
pub(super) position: Vec3,
|
||||
pub(super) previous: Vec3,
|
||||
pub(super) velocity: Vec3,
|
||||
age: i32,
|
||||
}
|
||||
impl DragonFireball {
|
||||
/// One a server sent (`handleAddEntity`).
|
||||
pub(super) fn remote(id: u32, at: Vec3, velocity: Vec3) -> Self {
|
||||
Self {
|
||||
id,
|
||||
position: at,
|
||||
previous: at,
|
||||
velocity,
|
||||
age: 0,
|
||||
}
|
||||
}
|
||||
/// `AbstractHurtingProjectile.tick` on a server's client: `applyInertia`
|
||||
/// first (power 0.1, inertia 0.95 or 0.8 in water), then the move; only
|
||||
/// the server decides what it hits.
|
||||
pub(super) fn remote_step(&mut self, water: bool) {
|
||||
self.previous = self.position;
|
||||
self.age += 1;
|
||||
let v = self.velocity;
|
||||
// Vec3.normalize: a vector shorter than 1e-5 stays zero.
|
||||
let l = (v.x * v.x + v.y * v.y + v.z * v.z).sqrt();
|
||||
let n = if l < 1.0e-5 {
|
||||
Vec3::new(0.0, 0.0, 0.0)
|
||||
} else {
|
||||
Vec3::new(v.x / l, v.y / l, v.z / l)
|
||||
};
|
||||
let inertia = f64::from(if water { 0.8f32 } else { 0.95f32 });
|
||||
let v = Vec3::new(
|
||||
(v.x + n.x * 0.1) * inertia,
|
||||
(v.y + n.y * 0.1) * inertia,
|
||||
(v.z + n.z * 0.1) * inertia,
|
||||
);
|
||||
self.velocity = v;
|
||||
self.position = Vec3::new(
|
||||
self.position.x + v.x,
|
||||
self.position.y + v.y,
|
||||
self.position.z + v.z,
|
||||
);
|
||||
}
|
||||
}
|
||||
pub(super) struct Breath {
|
||||
at: [f64; 3],
|
||||
radius: f32,
|
||||
age: i32,
|
||||
/// Its entity id once a server's players track it (0 until then).
|
||||
pub(super) id: u32,
|
||||
pub(super) at: [f64; 3],
|
||||
pub(super) radius: f32,
|
||||
pub(super) age: i32,
|
||||
duration: i32,
|
||||
from_dragon: bool,
|
||||
}
|
||||
|
||||
@@ -289,6 +289,10 @@ impl Game<'_> {
|
||||
self.bolts.iter_mut().for_each(|b| give(&mut b.id));
|
||||
self.potions.thrown_ids().for_each(&mut give);
|
||||
self.end.eye_ids().for_each(&mut give);
|
||||
self.breath_clouds.iter_mut().for_each(|b| give(&mut b.id));
|
||||
self.dragon_fireballs
|
||||
.iter_mut()
|
||||
.for_each(|b| give(&mut b.id));
|
||||
}
|
||||
|
||||
/// Primed TNT, falling blocks, projectiles, tridents, firework rockets and
|
||||
@@ -445,6 +449,35 @@ impl Game<'_> {
|
||||
}
|
||||
out.push(e);
|
||||
}
|
||||
// The dragon's breath clouds (AreaEffectCloud's DATA_RADIUS,
|
||||
// DATA_WAITING for its 20-tick wait, and DATA_PARTICLE): the
|
||||
// client draws them from these (`tick_remote_clouds`).
|
||||
let breath = self.network_particle(
|
||||
&horizon_client::particles::ParticleOptions::simple(
|
||||
horizon_client::particles::ParticleType::DragonBreath,
|
||||
),
|
||||
None,
|
||||
);
|
||||
for b in self.dragon_fireballs.iter().filter(|b| b.id != 0) {
|
||||
let p = b.position;
|
||||
let mut e = state(b.id, "minecraft:dragon_fireball", at(p), 0.0, false);
|
||||
e.velocity = [b.velocity.x, b.velocity.y, b.velocity.z];
|
||||
out.push(e);
|
||||
}
|
||||
for b in self.breath_clouds.iter().filter(|b| b.id != 0) {
|
||||
let mut e = state(b.id, "minecraft:area_effect_cloud", b.at, 0.0, false);
|
||||
e.meta.push((8, serializer::FLOAT, Value::Float(b.radius)));
|
||||
if b.age < 20 {
|
||||
e.meta.push((9, serializer::BOOLEAN, Value::Bool(true)));
|
||||
}
|
||||
if let Some(p) = &breath {
|
||||
e.meta
|
||||
.push((10, serializer::PARTICLE, Value::Particle(p.clone())));
|
||||
}
|
||||
e.defaults
|
||||
.push((9, serializer::BOOLEAN, Value::Bool(false)));
|
||||
out.push(e);
|
||||
}
|
||||
out.extend(self.lan_dragon_state());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,7 +95,11 @@ impl Game<'_> {
|
||||
|
||||
/// The options a server's particle stands for (None for a type or data
|
||||
/// this client doesn't draw).
|
||||
fn received_particle(&mut self, p: &Particle, at: [f64; 3]) -> Option<ParticleOptions> {
|
||||
pub(super) fn received_particle(
|
||||
&mut self,
|
||||
p: &Particle,
|
||||
at: [f64; 3],
|
||||
) -> Option<ParticleOptions> {
|
||||
let name = self
|
||||
.remote
|
||||
.as_ref()?
|
||||
|
||||
@@ -68,6 +68,10 @@ pub(super) struct ModsState {
|
||||
/// is still being shown, and a mod answering its own lines would recurse.
|
||||
#[cfg(feature = "mods")]
|
||||
commands: Vec<String>,
|
||||
/// `command.run-quiet` batches for this window's own world, by mod id,
|
||||
/// run on the next tick as `commands` are.
|
||||
#[cfg(feature = "mods")]
|
||||
quiet: Vec<(String, Vec<String>)>,
|
||||
/// The server's command tree with the running mods' commands added.
|
||||
#[cfg(feature = "mods")]
|
||||
remote_tree: Option<Dispatcher>,
|
||||
@@ -505,6 +509,51 @@ impl Game<'_> {
|
||||
}
|
||||
None
|
||||
}
|
||||
/// A mod's `command.run-quiet` lines (vanilla's commands only, as
|
||||
/// `command.run`): to a server that runs them quietly as one payload
|
||||
/// (`horizon_protocol::quiet`), to any other as chat commands, or for this
|
||||
/// window's own world next tick.
|
||||
fn mod_quiet_commands(&mut self, mod_id: String, lines: Vec<String>) {
|
||||
let lines: Vec<String> = lines
|
||||
.into_iter()
|
||||
.filter(|l| vanilla_command(l.split(' ').next().unwrap_or_default()))
|
||||
.collect();
|
||||
match self.remote.as_ref().map(|r| r.quiet_commands) {
|
||||
Some(true) => {
|
||||
for data in horizon_protocol::quiet::encode(&mod_id, &lines) {
|
||||
self.send(horizon_protocol::packets::play::Serverbound::CustomPayload(
|
||||
horizon_protocol::packets::configuration::CustomPayload {
|
||||
channel: horizon_protocol::quiet::CHANNEL.into(),
|
||||
data,
|
||||
},
|
||||
));
|
||||
}
|
||||
}
|
||||
// The server checks the player's permissions; its feedback shows.
|
||||
Some(false) => {
|
||||
for line in lines {
|
||||
self.send_chat(&format!("/{line}"));
|
||||
}
|
||||
}
|
||||
None => self.mods.quiet.push((mod_id, lines)),
|
||||
}
|
||||
}
|
||||
/// A quiet batch in this window's own world, as a server runs one
|
||||
/// (game/lan_quiet.rs): each line as the player typing it, no chat, a
|
||||
/// chat message refused; one line in the log.
|
||||
fn run_quiet_batch(&mut self, mod_id: &str, lines: &[String]) {
|
||||
let permission = self.ui.registries.permission;
|
||||
let mut failed = 0;
|
||||
for line in lines {
|
||||
let ok = self.signable_arguments(permission, line).is_empty()
|
||||
&& self.run_command_quietly(line);
|
||||
failed += usize::from(!ok);
|
||||
}
|
||||
log::info!(
|
||||
"[mod {mod_id}] ran {} quiet command(s): {failed} failed",
|
||||
lines.len()
|
||||
);
|
||||
}
|
||||
/// A game tick.
|
||||
pub(super) fn tick_mods(&mut self) {
|
||||
// Here, at the player's level: shown inside a console call (a control
|
||||
@@ -512,6 +561,9 @@ impl Game<'_> {
|
||||
for line in std::mem::take(&mut self.mods.commands) {
|
||||
self.run_command(&line);
|
||||
}
|
||||
for (mod_id, lines) in std::mem::take(&mut self.mods.quiet) {
|
||||
self.run_quiet_batch(&mod_id, &lines);
|
||||
}
|
||||
if !self.mods.mods.is_running() {
|
||||
return;
|
||||
}
|
||||
@@ -606,6 +658,10 @@ impl Game<'_> {
|
||||
}
|
||||
continue;
|
||||
}
|
||||
Output::QuietCommands { mod_id, lines } => {
|
||||
self.mod_quiet_commands(mod_id, lines);
|
||||
continue;
|
||||
}
|
||||
Output::Stopped { name, reason } => {
|
||||
// Its screen goes with it: the entry's run is gone, so
|
||||
// `mod_ui_view` finds no widgets and the screen closes.
|
||||
|
||||
@@ -71,6 +71,8 @@ pub(super) struct BodyPotions {
|
||||
pub(super) struct PotionState {
|
||||
pub(super) effects: PlayerEffects,
|
||||
thrown: Vec<ThrownPotion>,
|
||||
/// The area effect clouds a server tracks (game/remote_projectiles.rs).
|
||||
pub(super) clouds: Vec<super::remote_projectiles::RemoteCloud>,
|
||||
applied: Vec<(&'static str, &'static str, f64, &'static str)>,
|
||||
/// Armor the protection table was computed for.
|
||||
protection_for: Option<Vec<Option<ItemStack>>>,
|
||||
|
||||
@@ -109,6 +109,8 @@ enum Received {
|
||||
pub(super) struct Remote {
|
||||
pub session: Session,
|
||||
pub brand: String,
|
||||
/// The server announced it runs mods' quiet commands.
|
||||
pub quiet_commands: bool,
|
||||
pub(super) builtin: Arc<Builtin>,
|
||||
lang: Arc<Language>,
|
||||
pub(super) registries: Arc<Dynamic>,
|
||||
@@ -419,6 +421,7 @@ impl Game<'_> {
|
||||
self.remote = Some(Remote {
|
||||
session,
|
||||
brand: "unknown".into(),
|
||||
quiet_commands: false,
|
||||
builtin: Arc::new(builtin),
|
||||
lang,
|
||||
registries: Arc::new(Dynamic::default()),
|
||||
@@ -839,6 +842,11 @@ impl Game<'_> {
|
||||
remote.brand = brand;
|
||||
}
|
||||
}
|
||||
Event::QuietCommands => {
|
||||
if let Some(remote) = &mut self.remote {
|
||||
remote.quiet_commands = true;
|
||||
}
|
||||
}
|
||||
Event::Reconfigured(registries) => {
|
||||
self.boss_overlay.reset();
|
||||
self.set_registries(registries);
|
||||
@@ -1398,6 +1406,14 @@ impl Game<'_> {
|
||||
{
|
||||
return;
|
||||
}
|
||||
// A dragon fireball keeps Entity's NO_OP InterpolationHandler too:
|
||||
// the server's position replaces its own at once.
|
||||
if let Some(b) = self.dragon_fireballs.iter_mut().find(|b| b.id == id as u32) {
|
||||
if path.is_some() {
|
||||
b.position = Vec3::new(position[0], position[1], position[2]);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if let Some(p) = r.pending_items.get_mut(&id) {
|
||||
p.0 = position;
|
||||
}
|
||||
@@ -2979,6 +2995,8 @@ impl Game<'_> {
|
||||
.find(|p| p.id == id as u32)
|
||||
{
|
||||
p.velocity = v;
|
||||
} else if let Some(b) = self.dragon_fireballs.iter_mut().find(|b| b.id == id as u32) {
|
||||
b.velocity = v;
|
||||
} else if let Some(p) = self
|
||||
.remote
|
||||
.as_mut()
|
||||
@@ -3741,6 +3759,15 @@ impl Game<'_> {
|
||||
|
||||
/// MultiPlayerGameMode.startDestroyBlock / continueDestroyBlock.
|
||||
fn remote_mining(&mut self, start: bool) {
|
||||
if !self
|
||||
.res
|
||||
.items()
|
||||
.can_destroy_block(self.held(), self.creative)
|
||||
{
|
||||
self.stop_remote_mining();
|
||||
self.mining = None;
|
||||
return;
|
||||
}
|
||||
let Some(r) = self.remote.as_mut() else {
|
||||
return;
|
||||
};
|
||||
|
||||
@@ -3,11 +3,26 @@
|
||||
//! and `handleSetEntityData`): the server simulates them, the client draws
|
||||
//! them where it says and interpolates their moves.
|
||||
use super::{FallStep, FallingBlock, Game, fireworks::fireworks_of, view_vector};
|
||||
use horizon_client::particles::{ParticleOptions, ParticleType};
|
||||
use horizon_client::projectiles::{Hit, Projectile, ProjectileKind, ProjectileWorld};
|
||||
use horizon_core::{geometry::Vec3, position::BlockPos};
|
||||
use horizon_core::{geometry::Vec3, position::BlockPos, random::RandomSource};
|
||||
use horizon_protocol::entity_data::Value;
|
||||
use horizon_world::registry::BlockStateId;
|
||||
|
||||
/// An `AreaEffectCloud` a server tracks: what its client tick reads.
|
||||
pub(super) struct RemoteCloud {
|
||||
id: u32,
|
||||
at: [f64; 3],
|
||||
radius: f32,
|
||||
waiting: bool,
|
||||
particle: ParticleOptions,
|
||||
}
|
||||
|
||||
/// `AreaEffectCloud.DEFAULT_PARTICLE`: a white entity effect.
|
||||
fn default_cloud_particle() -> ParticleOptions {
|
||||
ParticleOptions::colored(ParticleType::EntityEffect, [1.0; 4])
|
||||
}
|
||||
|
||||
/// The projectile a type id names, as Horizon models it.
|
||||
fn projectile_kind(kind: &str) -> Option<ProjectileKind> {
|
||||
Some(match kind {
|
||||
@@ -118,6 +133,16 @@ impl Game<'_> {
|
||||
| "minecraft:experience_bottle" => {
|
||||
self.potions.add_remote_thrown(id, kind, at, velocity);
|
||||
}
|
||||
"minecraft:dragon_fireball" => self
|
||||
.dragon_fireballs
|
||||
.push(super::dragon::DragonFireball::remote(id, at, velocity)),
|
||||
"minecraft:area_effect_cloud" => self.potions.clouds.push(RemoteCloud {
|
||||
id,
|
||||
at: position,
|
||||
radius: 3.0,
|
||||
waiting: false,
|
||||
particle: default_cloud_particle(),
|
||||
}),
|
||||
"minecraft:eye_of_ender" => {
|
||||
self.end
|
||||
.add_remote_eye(id, position, [velocity.x, velocity.y, velocity.z])
|
||||
@@ -151,6 +176,31 @@ impl Game<'_> {
|
||||
pub(super) fn remote_projectile_data(&mut self, id: i32, values: &[(u8, i32, Value)]) {
|
||||
let id = id as u32;
|
||||
self.remote_hook_data(id, values);
|
||||
if let Some(at) = self
|
||||
.potions
|
||||
.clouds
|
||||
.iter()
|
||||
.find(|c| c.id == id)
|
||||
.map(|c| c.at)
|
||||
{
|
||||
// AreaEffectCloud.DATA_RADIUS, DATA_WAITING and DATA_PARTICLE.
|
||||
for (index, _, value) in values {
|
||||
let particle = match (index, value) {
|
||||
(10, Value::Particle(p)) => self.received_particle(p, at),
|
||||
_ => None,
|
||||
};
|
||||
let Some(c) = self.potions.clouds.iter_mut().find(|c| c.id == id) else {
|
||||
return;
|
||||
};
|
||||
match (index, value) {
|
||||
(8, Value::Float(r)) => c.radius = *r,
|
||||
(9, Value::Bool(w)) => c.waiting = *w,
|
||||
(10, _) => c.particle = particle.unwrap_or_else(default_cloud_particle),
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
if self.rockets.iter().any(|r| r.id == id) {
|
||||
for (index, _, value) in values {
|
||||
match (index, value) {
|
||||
@@ -336,6 +386,75 @@ impl Game<'_> {
|
||||
self.step_remote_thrown();
|
||||
self.step_remote_hooks(&mut step);
|
||||
self.end.step_remote_eyes();
|
||||
self.tick_remote_clouds();
|
||||
// The dragon's fireballs fly on between the tracker's updates, with
|
||||
// their dragon_breath trail (`AbstractHurtingProjectile.getTrailParticle`).
|
||||
let trail = ParticleOptions::simple(ParticleType::DragonBreath);
|
||||
for b in &mut self.dragon_fireballs {
|
||||
let at = b.position;
|
||||
let water = self
|
||||
.res
|
||||
.facts()
|
||||
.get(self.world.block(
|
||||
at.x.floor() as i32,
|
||||
at.y.floor() as i32,
|
||||
at.z.floor() as i32,
|
||||
))
|
||||
.fluid
|
||||
== horizon_client::blocks::Fluid::Water;
|
||||
b.remote_step(water);
|
||||
let p = b.position;
|
||||
self.particles.add(&trail, [p.x, p.y + 0.5, p.z], [0.0; 3]);
|
||||
}
|
||||
}
|
||||
|
||||
/// `AreaEffectCloud.clientTick`: while waiting, now and then two
|
||||
/// particles near the middle; then about one per square block of the
|
||||
/// disc, drifting (an entity effect stays still).
|
||||
fn tick_remote_clouds(&mut self) {
|
||||
for c in &self.potions.clouds {
|
||||
let r = self.particles.random();
|
||||
if c.waiting && r.next_boolean() {
|
||||
continue;
|
||||
}
|
||||
let (count, spread) = if c.waiting {
|
||||
(2, 0.2)
|
||||
} else {
|
||||
(
|
||||
(std::f32::consts::PI * c.radius * c.radius).ceil() as i32,
|
||||
c.radius,
|
||||
)
|
||||
};
|
||||
for _ in 0..count {
|
||||
let r = self.particles.random();
|
||||
let angle = r.next_float() * std::f32::consts::TAU;
|
||||
let distance = r.next_float().sqrt() * spread;
|
||||
let at = [
|
||||
c.at[0] + f64::from(angle.cos() * distance),
|
||||
c.at[1],
|
||||
c.at[2] + f64::from(angle.sin() * distance),
|
||||
];
|
||||
let (options, velocity) = if c.particle.ty == ParticleType::EntityEffect {
|
||||
let default = c.waiting && r.next_boolean();
|
||||
let options = if default {
|
||||
default_cloud_particle()
|
||||
} else {
|
||||
c.particle.clone()
|
||||
};
|
||||
(options, [0.0; 3])
|
||||
} else if c.waiting {
|
||||
(c.particle.clone(), [0.0; 3])
|
||||
} else {
|
||||
let v = [
|
||||
(0.5 - r.next_double()) * 0.15,
|
||||
f64::from(0.01f32),
|
||||
(0.5 - r.next_double()) * 0.15,
|
||||
];
|
||||
(c.particle.clone(), v)
|
||||
};
|
||||
self.particles.add(&options, at, velocity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) fn remove_remote_projectile(&mut self, id: u32) {
|
||||
@@ -346,6 +465,8 @@ impl Game<'_> {
|
||||
self.rockets.retain(|r| r.id != id);
|
||||
self.crystals.retain(|c| c.id != id);
|
||||
self.potions.remove_remote_thrown(id);
|
||||
self.potions.clouds.retain(|c| c.id != id);
|
||||
self.dragon_fireballs.retain(|b| b.id != id);
|
||||
self.end.remove_remote_eye(id);
|
||||
self.remove_remote_hook(id);
|
||||
}
|
||||
@@ -361,6 +482,8 @@ impl Game<'_> {
|
||||
// The dragon a server sent goes with its crystals.
|
||||
self.dragon = None;
|
||||
self.potions.clear_thrown();
|
||||
self.potions.clouds.clear();
|
||||
self.dragon_fireballs.clear();
|
||||
self.end.clear_remote_eyes();
|
||||
self.clear_remote_hooks();
|
||||
}
|
||||
|
||||
@@ -71,6 +71,8 @@ pub struct ItemInfo {
|
||||
/// The `tool` component's `damage_per_block`, when the item has the
|
||||
/// component (a mace or trident has one without rules).
|
||||
pub tool_damage_per_block: Option<u32>,
|
||||
/// `tool.can_destroy_blocks_in_creative` (defaults to true).
|
||||
pub can_destroy_blocks_in_creative: bool,
|
||||
pub food: Option<(u32, f32)>,
|
||||
pub can_always_eat: bool,
|
||||
/// `consumable`: its timing, sound, particles and `on_consume_effects`.
|
||||
@@ -558,6 +560,10 @@ impl Items {
|
||||
tool_damage_per_block: c
|
||||
.get("minecraft:tool")
|
||||
.map(|t| t["damage_per_block"].as_u64().unwrap_or(1) as u32),
|
||||
can_destroy_blocks_in_creative:
|
||||
c["minecraft:tool"]["can_destroy_blocks_in_creative"]
|
||||
.as_bool()
|
||||
.unwrap_or(true),
|
||||
food,
|
||||
can_always_eat,
|
||||
// Consumable.CODEC's defaults.
|
||||
@@ -758,6 +764,26 @@ impl Items {
|
||||
None => spec == block,
|
||||
}
|
||||
}
|
||||
/// `Item.canDestroyBlock`: a tool may forbid block destruction with instabuild.
|
||||
pub fn can_destroy_block(&self, held: Option<&ItemStack>, creative: bool) -> bool {
|
||||
if !creative {
|
||||
return true;
|
||||
}
|
||||
let Some(held) = held.filter(|s| s.count > 0 && &*s.item != "minecraft:air") else {
|
||||
return true;
|
||||
};
|
||||
if let Some(tool) = held.data().and_then(|d| d.other("minecraft:tool")) {
|
||||
return tool
|
||||
.get("can_destroy_blocks_in_creative")
|
||||
.and_then(|v| match v {
|
||||
horizon_world::nbt::Tag::Byte(v) => Some(*v),
|
||||
_ => None,
|
||||
})
|
||||
.is_none_or(|v| v != 0);
|
||||
}
|
||||
self.get(&held.item)
|
||||
.is_none_or(|info| info.can_destroy_blocks_in_creative)
|
||||
}
|
||||
/// `Tool.getMiningSpeed` for the held item (1.0 without a tool component).
|
||||
pub fn mining_speed(&self, held: Option<&ItemStack>, block: &str) -> f32 {
|
||||
let Some(info) = held.and_then(|s| self.get(&s.item)) else {
|
||||
|
||||
@@ -40,6 +40,8 @@ pub enum Event {
|
||||
Status(String),
|
||||
/// The server's `minecraft:brand` custom payload.
|
||||
Brand(String),
|
||||
/// The server runs mods' quiet commands (`horizon_protocol::quiet`).
|
||||
QuietCommands,
|
||||
/// Configuration finished: the play state begins with these registries.
|
||||
Joined {
|
||||
registries: Arc<Dynamic>,
|
||||
@@ -668,6 +670,8 @@ fn receive_brand(payload: &cfg::CustomPayload, send: &Sender<Event>) {
|
||||
&& let Ok(brand) = horizon_protocol::buf::Reader::new(&payload.data).string(32767)
|
||||
{
|
||||
let _ = send.send(Event::Brand(brand));
|
||||
} else if payload.channel == horizon_protocol::quiet::CHANNEL {
|
||||
let _ = send.send(Event::QuietCommands);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1165,6 +1165,25 @@ pub fn encode_with(
|
||||
.collect();
|
||||
s.insert("References".into(), Tag::Compound(refs));
|
||||
}
|
||||
let starts: Compound = chunk
|
||||
.structure_starts
|
||||
.iter()
|
||||
.filter_map(|start| match start.save() {
|
||||
Some(tag) => Some((start.name.as_str().into(), tag)),
|
||||
None => {
|
||||
log::warn!(
|
||||
"Horizon: structure start {} not saved: one of its pieces cannot be",
|
||||
start.name
|
||||
);
|
||||
None
|
||||
}
|
||||
})
|
||||
.collect();
|
||||
if !starts.is_empty()
|
||||
&& let Some(Tag::Compound(s)) = map.get_mut(&"structures".into())
|
||||
{
|
||||
s.insert("starts".into(), Tag::Compound(starts));
|
||||
}
|
||||
map.entry("PostProcessing".into())
|
||||
.or_insert_with(|| Tag::List(vec![Tag::List(Vec::new()); shape.section_count()]));
|
||||
}
|
||||
|
||||
@@ -158,6 +158,12 @@ impl VanillaTerrain {
|
||||
chunk.terrain.min_y().max(MIN_Y),
|
||||
(chunk.terrain.min_y() + chunk.terrain.height()).min(MIN_Y + HEIGHT),
|
||||
);
|
||||
out.structure_refs = chunk
|
||||
.structures()
|
||||
.into_iter()
|
||||
.map(|(id, start, _, _)| (Arc::from(id), (start.x, start.z)))
|
||||
.collect();
|
||||
out.structure_starts = chunk.own_starts();
|
||||
let mut values = Box::new([0u32; 4096]);
|
||||
for si in 0..SECTIONS as i32 {
|
||||
let base = MIN_Y + si * 16;
|
||||
@@ -577,11 +583,6 @@ impl ChunkGenerator for VanillaTerrain {
|
||||
extras.rolled_loot = rolled_loot;
|
||||
out.saved = Some(Arc::new(extras));
|
||||
}
|
||||
out.structure_refs = chunk
|
||||
.structures()
|
||||
.into_iter()
|
||||
.map(|(id, start, _, _)| (Arc::from(id), (start.x, start.z)))
|
||||
.collect();
|
||||
let entities = std::mem::take(&mut chunk.entities);
|
||||
// Chest minecarts keep their loot table; the game rolls it on load.
|
||||
out.entities = entities
|
||||
|
||||
@@ -111,6 +111,14 @@ interface storage {
|
||||
interface command {
|
||||
/// `line` without its slash; its feedback goes to the chat as if typed.
|
||||
run: func(line: string);
|
||||
/// `lines` (each without its slash, at most 256 a call) as `run` does,
|
||||
/// but with nothing in the chat: no feedback and no failure. In single
|
||||
/// player and on Horizon's servers, each runs exactly as the player
|
||||
/// typing it would (the same rights), in order, 64 a tick, and the
|
||||
/// server logs one line a batch; one that carries a chat message (`say`,
|
||||
/// `msg`) is refused. On any other server they go as chat commands, and
|
||||
/// there their feedback shows: a mod running many should say so.
|
||||
run-quiet: func(lines: list<string>);
|
||||
}
|
||||
|
||||
/// Capability `ui`: widgets the game draws with its own menus' widgets, for
|
||||
|
||||
@@ -7,13 +7,13 @@
|
||||
//! version's level so the launcher can tell before it installs.
|
||||
|
||||
/// The newest level this Horizon serves.
|
||||
pub const LEVEL: u32 = 2;
|
||||
pub const LEVEL: u32 = 3;
|
||||
|
||||
/// Every function the game offers mods, as `interface.function`, with its
|
||||
/// level. Level 0 is the contract of Horizon 0.2.67 to 0.2.69. A new
|
||||
/// function takes the next level and raises [`LEVEL`] (the `api_reference`
|
||||
/// test fails until it is listed here).
|
||||
pub const FUNCTIONS: [(&str, u32); 33] = [
|
||||
pub const FUNCTIONS: [(&str, u32); 34] = [
|
||||
("log.write", 0),
|
||||
("game.get-player", 0),
|
||||
("game.get-clock", 0),
|
||||
@@ -47,6 +47,7 @@ pub const FUNCTIONS: [(&str, u32); 33] = [
|
||||
("players.tell", 1),
|
||||
("players.broadcast", 1),
|
||||
("game.raycast", 2),
|
||||
("command.run-quiet", 3),
|
||||
];
|
||||
|
||||
/// What the game's program carries so the launcher can read its level
|
||||
|
||||
@@ -89,6 +89,9 @@ const FUEL_FRAME: u64 = 10_000_000;
|
||||
const FUEL_EVENT: u64 = 100_000_000;
|
||||
/// Chat lines a mod may show per call, HUD lines and their length.
|
||||
const CHAT_PER_CALL: usize = 8;
|
||||
/// `command.run-quiet` lines one call of a mod may queue (a quiet payload's
|
||||
/// cap, `horizon_protocol::quiet::MAX_LINES`).
|
||||
const QUIET_PER_CALL: usize = 256;
|
||||
/// How far `game.raycast` sees, in blocks.
|
||||
pub const RAYCAST_MAX: f32 = 1024.0;
|
||||
const HUD_LINES: usize = 16;
|
||||
@@ -160,6 +163,9 @@ pub enum Output {
|
||||
/// `command.run`: a vanilla command line, without its slash, to run as
|
||||
/// the player.
|
||||
Command { line: String },
|
||||
/// `command.run-quiet`: vanilla command lines to run as the player with
|
||||
/// nothing in the chat (`horizon_protocol::quiet` on a server).
|
||||
QuietCommands { mod_id: String, lines: Vec<String> },
|
||||
/// The mod was turned off: it trapped, overran or failed to start.
|
||||
Stopped { name: String, reason: String },
|
||||
/// `players.tell`: a line after the mod's name, to the player with this id.
|
||||
@@ -1408,6 +1414,23 @@ impl command::Host for State {
|
||||
self.out.push(Output::Command { line: clip(line) });
|
||||
}
|
||||
}
|
||||
fn run_quiet(&mut self, lines: Vec<String>) {
|
||||
let queued: usize = self
|
||||
.out
|
||||
.iter()
|
||||
.map(|o| match o {
|
||||
Output::QuietCommands { lines, .. } => lines.len(),
|
||||
_ => 0,
|
||||
})
|
||||
.sum();
|
||||
let room = QUIET_PER_CALL.saturating_sub(queued);
|
||||
if room > 0 && !lines.is_empty() {
|
||||
self.out.push(Output::QuietCommands {
|
||||
mod_id: self.id.clone(),
|
||||
lines: lines.into_iter().take(room).map(clip).collect(),
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
impl hud::Host for State {
|
||||
fn set_panel(&mut self, corner: Corner, lines: Vec<Line>) {
|
||||
|
||||
@@ -26,7 +26,7 @@ id = "test_ui_guest"
|
||||
name = "Test UI Guest"
|
||||
version = "0.1.0"
|
||||
api = "0.1"
|
||||
capabilities = ["game-read", "chat", "ui", "render", "input"]
|
||||
capabilities = ["game-read", "chat", "command", "ui", "render", "input"]
|
||||
experimental = ["ui", "render", "input"]
|
||||
"#;
|
||||
|
||||
@@ -763,6 +763,32 @@ fn game_raycast_sees_the_view_hit_within_its_distance() {
|
||||
assert_eq!(said(&mut mods, "1e9"), [hit]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn quiet_commands_come_out_as_one_batch_capped() {
|
||||
let mut mods = load("horizon_mods_test_ui_guest.hmod");
|
||||
let quiet = |mods: &mut Mods, command: &str| -> Vec<(String, Vec<String>)> {
|
||||
assert!(mods.command(command));
|
||||
mods.drain()
|
||||
.into_iter()
|
||||
.filter_map(|o| match o {
|
||||
Output::QuietCommands { mod_id, lines } => Some((mod_id, lines)),
|
||||
_ => None,
|
||||
})
|
||||
.collect()
|
||||
};
|
||||
assert_eq!(
|
||||
quiet(&mut mods, "quiet setblock 0 0 0 stone;say hi"),
|
||||
[(
|
||||
"test_ui_guest".to_string(),
|
||||
vec!["setblock 0 0 0 stone".to_string(), "say hi".to_string()]
|
||||
)]
|
||||
);
|
||||
let batches = quiet(&mut mods, "quiet_many 300");
|
||||
assert_eq!(batches.len(), 1);
|
||||
assert_eq!(batches[0].1.len(), 256);
|
||||
assert_eq!(batches[0].1[255], "setblock 255 300 0 stone");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn corner_panels_text_width_and_readings() {
|
||||
let mut mods = load("horizon_mods_test_ui_guest.hmod");
|
||||
|
||||
@@ -5,9 +5,10 @@
|
||||
//! `/input_claim`, `/input_poll`, `/input_held` and `/input_wheel` test
|
||||
//! `input`; `/zoom FACTOR SMOOTH TURN` tests `render.set-zoom`;
|
||||
//! `/corner` and `/readings` the calls the official extras mods use;
|
||||
//! `/raycast DISTANCE` says what `game.raycast` sees.
|
||||
//! `/raycast DISTANCE` says what `game.raycast` sees; `/quiet A;B` runs
|
||||
//! lines with `command.run-quiet` (`/quiet_many N`: N of them).
|
||||
use horizon_mod_sdk::{
|
||||
Mod, Registration, chat, game,
|
||||
Mod, Registration, chat, command, game,
|
||||
input::{self, Event},
|
||||
render::{self, FillShape, ItemShape, Point, QuadShape, Rect, Shape, SpriteShape, TextShape},
|
||||
ui::{self, ItemWidget, ListWidget, Screen, TextWidget, Widget},
|
||||
@@ -99,6 +100,8 @@ impl Mod for Guest {
|
||||
"zoom",
|
||||
"minimap",
|
||||
"raycast",
|
||||
"quiet",
|
||||
"quiet_many",
|
||||
"corner",
|
||||
"readings",
|
||||
]
|
||||
@@ -219,6 +222,15 @@ impl Mod for Guest {
|
||||
});
|
||||
render::set_minimap(map);
|
||||
}
|
||||
"quiet" => command::run_quiet(&args.split(';').map(str::to_owned).collect::<Vec<_>>()),
|
||||
"quiet_many" => {
|
||||
let n: usize = args.parse().unwrap_or(0);
|
||||
command::run_quiet(
|
||||
&(0..n)
|
||||
.map(|i| format!("setblock {i} 300 0 stone"))
|
||||
.collect::<Vec<_>>(),
|
||||
);
|
||||
}
|
||||
"raycast" => {
|
||||
let distance = args.parse().unwrap_or(f32::NAN);
|
||||
chat::show(&match game::raycast(distance) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* The Horizon server panel. Colours and spacing are horizon-theme's tokens (website/src/tokens.css). */
|
||||
/* The Horizon server panel. Colours and spacing are horizon-theme's tokens (crates/horizon-theme/tokens.css). */
|
||||
:root {
|
||||
--page: #fafafc;
|
||||
--plate-soft: #f3f3f8;
|
||||
|
||||
@@ -30,7 +30,7 @@ The totals are grouped per version, OS, GPU vendor and render distance. Each gro
|
||||
|
||||
## Benchmarks summary
|
||||
|
||||
`src/summary.rs` makes it with the same rules as `website/scripts/benchmarks.mjs`, which bakes the page's fallback copy; both are tested against the same fixtures (`website/scripts/fixtures/benchmarks/`).
|
||||
`src/summary.rs` makes it with the same rules as the website's `scripts/benchmarks.mjs` (ludovic111/horizon-site), which bakes the page's fallback copy; both are tested against the same fixtures (`tests/fixtures/benchmarks/` here, copied in the site's repository).
|
||||
|
||||
- Only reports that compare: a version 1 `horizon-benchmark-report` of the standard flight over the four scenes, VSync off, no frame cap, on screen, from Horizon or plain vanilla, naming its GPU and CPU.
|
||||
- A group (GPU, CPU, render distance, game) is published only with **at least 3 different installs**. Each install counts once: the median of its runs, then the median across installs.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
//! The hardware classes the public output breaks results down by. Coarse on purpose: a class
|
||||
//! holds many machines, and a published cell still needs `MIN_INSTALLS` different installs.
|
||||
//! `website/scripts/benchmarks.mjs` has the same functions, tested on the same fixtures.
|
||||
//! The website's `scripts/benchmarks.mjs` (ludovic111/horizon-site) has the same functions, tested on the same fixtures.
|
||||
//!
|
||||
//! The raw values (the exact memory, the driver, the screen) stay in the database for the
|
||||
//! retention period and are never published.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//! `GET /v1/benchmarks/summary`: players' benchmark uploads, grouped for the website's Benchmarks page.
|
||||
//!
|
||||
//! The same rules as `website/scripts/benchmarks.mjs` (which builds the page's baked copy), checked against the
|
||||
//! same fixtures (`website/scripts/fixtures/benchmarks/`):
|
||||
//! The same rules as the website's `scripts/benchmarks.mjs` (ludovic111/horizon-site; it builds the page's baked
|
||||
//! copy), checked against the same fixtures (`tests/fixtures/benchmarks/`, which the site's test keeps a copy of):
|
||||
//!
|
||||
//! - Only reports that compare: `horizon-benchmark-report` version 1, kind `game`, Horizon or plain vanilla, the
|
||||
//! standard flight over the four scenes, VSync off, no frame cap, drawn on a screen, with a GPU and CPU name.
|
||||
@@ -198,7 +198,7 @@ struct Group {
|
||||
versions: BTreeSet<String>,
|
||||
}
|
||||
|
||||
/// Players' groups of at least `min_installs` installs, as `website/scripts/benchmarks.mjs` makes them.
|
||||
/// Players' groups of at least `min_installs` installs, as the website's `scripts/benchmarks.mjs` makes them.
|
||||
pub fn groups(uploads: &[Upload], min_installs: usize) -> Vec<Value> {
|
||||
let mut by: BTreeMap<(String, String, i64, &str), Group> = BTreeMap::new();
|
||||
for u in uploads {
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
# Benchmark summary fixtures
|
||||
|
||||
Used by the telemetry server's `GET /v1/benchmarks/summary` test (`tests/summary.rs`) and, as a copy, by the
|
||||
website's aggregator test (`scripts/benchmarks.test.mjs` in ludovic111/horizon-site, which checks its copy against
|
||||
this one on main): the same `benchmark` items in, the same groups out. Change both together.
|
||||
|
||||
- `items.jsonl`: one stored item per line (`install_id`, `day`, `version`, `data`: a benchmark report). Group
|
||||
RTX 4080 + i7-13700KF at render distance 12 has three installs (one with two runs); the same install at 32,
|
||||
and the RTX 3060 group, have fewer than three and are left out. The other runs are rejected: VSync on,
|
||||
offscreen, a frame cap, a missing scene, a one-scene scenario, a report of another version, no install ID.
|
||||
- Breakdowns: the RTX 4080 group's three installs share a VRAM class (16 GB), the OS and a discrete GPU, so
|
||||
those cells are published; a3 has 16 GB of RAM and an SSD where a1 and a2 have 32 GB and NVMe, so neither the
|
||||
RAM nor the drive cells reach three installs and those dimensions are left out.
|
||||
- `expected.json`: `min_installs` and `groups` of the summary (`generated` varies).
|
||||
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"min_installs": 3,
|
||||
"groups": [
|
||||
{
|
||||
"gpu": "NVIDIA GeForce RTX 4080",
|
||||
"cpu": "13th Gen Intel Core i7-13700KF",
|
||||
"render_distance": 12,
|
||||
"game": "horizon",
|
||||
"source": "players",
|
||||
"installs": 3,
|
||||
"reports": 4,
|
||||
"versions": ["v0.2.1", "v0.2.0"],
|
||||
"medians": { "avg_fps": 515, "low_1pct_fps": 120, "p95_ms": 3.5, "world_ms": 4500, "chunk_load_ms": 1400, "rss_peak_mb": 1450, "rss_steady_mb": 1250 },
|
||||
"breakdowns": {
|
||||
"vram": [{ "class": "16 GB", "installs": 3 }],
|
||||
"os": [{ "class": "linux", "installs": 3 }],
|
||||
"gpu_kind": [{ "class": "discrete", "installs": 3 }]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
{"install_id":"a1","day":20394,"version":"v0.2.0","source":"game","kind":"benchmark","data":{"format":"horizon-benchmark-report","version":1,"kind":"game","created":"2026-11-02","app":{"name":"horizon-client","version":"0.2.0"},"hardware":{"os":"linux","os_version":"secret-os-version","arch":"x86_64","cpu":"13th Gen Intel(R) Core(TM) i7-13700KF","cpu_threads":24,"ram_mb":32768,"gpu":{"name":"NVIDIA GeForce RTX 4080","vendor":"nvidia","driver":"secret-driver","backend":"vulkan","kind":"discrete","vram_mb":16376},"display":{"width":2560,"height":1440,"scale":1,"refresh_hz":165},"storage":"nvme"},"conditions":{"scenario":"standard","seed":"1234","render_distance":12,"simulation_distance":12,"window":[1280,720],"vsync":false,"repeats":1,"warmup_s":2},"metrics":{"startup.title_ms":{"n":1,"mean":900,"stdev":null,"min":900,"max":900,"ci95":null},"startup.world_ms":{"n":1,"mean":5000,"stdev":null,"min":5000,"max":5000,"ci95":null},"memory.rss_peak_mb":{"n":1,"mean":1400},"memory.rss_steady_mb":{"n":1,"mean":1200},"chunks.village.load_ms":{"n":1,"mean":1500},"chunks.forest.load_ms":{"n":1,"mean":1500},"chunks.ocean.load_ms":{"n":1,"mean":1500},"chunks.mountain.load_ms":{"n":1,"mean":1500}},"frames":[{"phase":"village","repeat":0,"frames":1000,"seconds":12,"avg_fps":400,"low_1pct_fps":100,"low_01pct_fps":50,"p50_ms":2,"p95_ms":4,"p99_ms":8,"p999_ms":12,"max_ms":50,"histogram":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]},{"phase":"forest","repeat":0,"frames":1000,"seconds":12,"avg_fps":410,"low_1pct_fps":100,"low_01pct_fps":50,"p50_ms":2,"p95_ms":4,"p99_ms":8,"p999_ms":12,"max_ms":50,"histogram":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]},{"phase":"ocean","repeat":0,"frames":1000,"seconds":12,"avg_fps":420,"low_1pct_fps":100,"low_01pct_fps":50,"p50_ms":2,"p95_ms":4,"p99_ms":8,"p999_ms":12,"max_ms":50,"histogram":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]},{"phase":"mountain","repeat":0,"frames":1000,"seconds":12,"avg_fps":430,"low_1pct_fps":100,"low_01pct_fps":50,"p50_ms":2,"p95_ms":4,"p99_ms":8,"p999_ms":12,"max_ms":50,"histogram":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}]}}
|
||||
{"install_id":"a1","day":20395,"version":"v0.2.1","source":"game","kind":"benchmark","data":{"format":"horizon-benchmark-report","version":1,"kind":"game","created":"2026-11-02","app":{"name":"horizon-client","version":"0.2.0"},"hardware":{"os":"linux","os_version":"secret-os-version","arch":"x86_64","cpu":"13th Gen Intel(R) Core(TM) i7-13700KF","cpu_threads":24,"ram_mb":32768,"gpu":{"name":"NVIDIA GeForce RTX 4080","vendor":"nvidia","driver":"secret-driver","backend":"vulkan","kind":"discrete","vram_mb":16376},"display":{"width":2560,"height":1440,"scale":1,"refresh_hz":165},"storage":"nvme"},"conditions":{"scenario":"standard","seed":"1234","render_distance":12,"simulation_distance":12,"window":[1280,720],"vsync":false,"repeats":1,"warmup_s":2},"metrics":{"startup.title_ms":{"n":1,"mean":900,"stdev":null,"min":900,"max":900,"ci95":null},"startup.world_ms":{"n":1,"mean":4000,"stdev":null,"min":4000,"max":4000,"ci95":null},"memory.rss_peak_mb":{"n":1,"mean":1500},"memory.rss_steady_mb":{"n":1,"mean":1300},"chunks.village.load_ms":{"n":1,"mean":1300},"chunks.forest.load_ms":{"n":1,"mean":1300},"chunks.ocean.load_ms":{"n":1,"mean":1300},"chunks.mountain.load_ms":{"n":1,"mean":1300}},"frames":[{"phase":"village","repeat":0,"frames":1000,"seconds":12,"avg_fps":600,"low_1pct_fps":140,"low_01pct_fps":70,"p50_ms":2,"p95_ms":3,"p99_ms":6,"p999_ms":9,"max_ms":50,"histogram":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]},{"phase":"forest","repeat":0,"frames":1000,"seconds":12,"avg_fps":610,"low_1pct_fps":140,"low_01pct_fps":70,"p50_ms":2,"p95_ms":3,"p99_ms":6,"p999_ms":9,"max_ms":50,"histogram":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]},{"phase":"ocean","repeat":0,"frames":1000,"seconds":12,"avg_fps":620,"low_1pct_fps":140,"low_01pct_fps":70,"p50_ms":2,"p95_ms":3,"p99_ms":6,"p999_ms":9,"max_ms":50,"histogram":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]},{"phase":"mountain","repeat":0,"frames":1000,"seconds":12,"avg_fps":630,"low_1pct_fps":140,"low_01pct_fps":70,"p50_ms":2,"p95_ms":3,"p99_ms":6,"p999_ms":9,"max_ms":50,"histogram":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}]}}
|
||||
{"install_id":"a2","day":20395,"version":"v0.2.1","source":"game","kind":"benchmark","data":{"format":"horizon-benchmark-report","version":1,"kind":"game","created":"2026-11-02","app":{"name":"horizon-client","version":"0.2.0"},"hardware":{"os":"linux","os_version":"secret-os-version","arch":"x86_64","cpu":"13th Gen Intel(R) Core(TM) i7-13700KF","cpu_threads":24,"ram_mb":32768,"gpu":{"name":"NVIDIA GeForce RTX 4080","vendor":"nvidia","driver":"secret-driver","backend":"vulkan","kind":"discrete","vram_mb":16376},"display":{"width":2560,"height":1440,"scale":1,"refresh_hz":165},"storage":"nvme"},"conditions":{"scenario":"standard","seed":"1234","render_distance":12,"simulation_distance":12,"window":[1280,720],"vsync":false,"repeats":1,"warmup_s":2},"metrics":{"startup.title_ms":{"n":1,"mean":900,"stdev":null,"min":900,"max":900,"ci95":null},"startup.world_ms":{"n":1,"mean":6000,"stdev":null,"min":6000,"max":6000,"ci95":null},"memory.rss_peak_mb":{"n":1,"mean":1300},"memory.rss_steady_mb":{"n":1,"mean":1100},"chunks.village.load_ms":{"n":1,"mean":1700},"chunks.forest.load_ms":{"n":1,"mean":1700},"chunks.ocean.load_ms":{"n":1,"mean":1700},"chunks.mountain.load_ms":{"n":1,"mean":1700}},"frames":[{"phase":"village","repeat":0,"frames":1000,"seconds":12,"avg_fps":300,"low_1pct_fps":80,"low_01pct_fps":40,"p50_ms":2,"p95_ms":5,"p99_ms":10,"p999_ms":15,"max_ms":50,"histogram":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]},{"phase":"forest","repeat":0,"frames":1000,"seconds":12,"avg_fps":310,"low_1pct_fps":80,"low_01pct_fps":40,"p50_ms":2,"p95_ms":5,"p99_ms":10,"p999_ms":15,"max_ms":50,"histogram":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]},{"phase":"ocean","repeat":0,"frames":1000,"seconds":12,"avg_fps":320,"low_1pct_fps":80,"low_01pct_fps":40,"p50_ms":2,"p95_ms":5,"p99_ms":10,"p999_ms":15,"max_ms":50,"histogram":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]},{"phase":"mountain","repeat":0,"frames":1000,"seconds":12,"avg_fps":330,"low_1pct_fps":80,"low_01pct_fps":40,"p50_ms":2,"p95_ms":5,"p99_ms":10,"p999_ms":15,"max_ms":50,"histogram":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}]}}
|
||||
{"install_id":"a3","day":20396,"version":"v0.2.1","source":"game","kind":"benchmark","data":{"format":"horizon-benchmark-report","version":1,"kind":"game","created":"2026-11-02","app":{"name":"horizon-client","version":"0.2.0"},"hardware":{"os":"linux","os_version":"secret-os-version","arch":"x86_64","cpu":"13th Gen Intel(R) Core(TM) i7-13700KF","cpu_threads":24,"ram_mb":16384,"gpu":{"name":"NVIDIA GeForce RTX 4080","vendor":"nvidia","driver":"secret-driver","backend":"vulkan","kind":"discrete","vram_mb":16376},"display":{"width":2560,"height":1440,"scale":1,"refresh_hz":165},"storage":"ssd"},"conditions":{"scenario":"standard","seed":"1234","render_distance":12,"simulation_distance":12,"window":[1280,720],"vsync":false,"repeats":1,"warmup_s":2},"metrics":{"startup.title_ms":{"n":1,"mean":900,"stdev":null,"min":900,"max":900,"ci95":null},"startup.world_ms":{"n":1,"mean":3000,"stdev":null,"min":3000,"max":3000,"ci95":null},"memory.rss_peak_mb":{"n":1,"mean":1600},"memory.rss_steady_mb":{"n":1,"mean":1400},"chunks.village.load_ms":{"n":1,"mean":1100},"chunks.forest.load_ms":{"n":1,"mean":1100},"chunks.ocean.load_ms":{"n":1,"mean":1100},"chunks.mountain.load_ms":{"n":1,"mean":1100}},"frames":[{"phase":"village","repeat":0,"frames":1000,"seconds":12,"avg_fps":700,"low_1pct_fps":160,"low_01pct_fps":80,"p50_ms":2,"p95_ms":2.5,"p99_ms":5,"p999_ms":7.5,"max_ms":50,"histogram":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]},{"phase":"forest","repeat":0,"frames":1000,"seconds":12,"avg_fps":710,"low_1pct_fps":160,"low_01pct_fps":80,"p50_ms":2,"p95_ms":2.5,"p99_ms":5,"p999_ms":7.5,"max_ms":50,"histogram":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]},{"phase":"ocean","repeat":0,"frames":1000,"seconds":12,"avg_fps":720,"low_1pct_fps":160,"low_01pct_fps":80,"p50_ms":2,"p95_ms":2.5,"p99_ms":5,"p999_ms":7.5,"max_ms":50,"histogram":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]},{"phase":"mountain","repeat":0,"frames":1000,"seconds":12,"avg_fps":730,"low_1pct_fps":160,"low_01pct_fps":80,"p50_ms":2,"p95_ms":2.5,"p99_ms":5,"p999_ms":7.5,"max_ms":50,"histogram":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}]}}
|
||||
{"install_id":"a4","day":20396,"version":"v0.2.1","source":"game","kind":"benchmark","data":{"format":"horizon-benchmark-report","version":1,"kind":"game","created":"2026-11-02","app":{"name":"horizon-client","version":"0.2.0"},"hardware":{"os":"linux","os_version":"secret-os-version","arch":"x86_64","cpu":"13th Gen Intel(R) Core(TM) i7-13700KF","cpu_threads":24,"ram_mb":32768,"gpu":{"name":"NVIDIA GeForce RTX 4080","vendor":"nvidia","driver":"secret-driver","backend":"vulkan","kind":"discrete","vram_mb":16376},"display":{"width":2560,"height":1440,"scale":1,"refresh_hz":165},"storage":"nvme"},"conditions":{"scenario":"standard","seed":"1234","render_distance":12,"simulation_distance":12,"window":[1280,720],"vsync":true,"repeats":1,"warmup_s":2},"metrics":{"startup.title_ms":{"n":1,"mean":900,"stdev":null,"min":900,"max":900,"ci95":null},"startup.world_ms":{"n":1,"mean":2000,"stdev":null,"min":2000,"max":2000,"ci95":null},"memory.rss_peak_mb":{"n":1,"mean":1700},"memory.rss_steady_mb":{"n":1,"mean":1500},"chunks.village.load_ms":{"n":1,"mean":900},"chunks.forest.load_ms":{"n":1,"mean":900},"chunks.ocean.load_ms":{"n":1,"mean":900},"chunks.mountain.load_ms":{"n":1,"mean":900}},"frames":[{"phase":"village","repeat":0,"frames":1000,"seconds":12,"avg_fps":900,"low_1pct_fps":200,"low_01pct_fps":100,"p50_ms":2,"p95_ms":2,"p99_ms":4,"p999_ms":6,"max_ms":50,"histogram":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]},{"phase":"forest","repeat":0,"frames":1000,"seconds":12,"avg_fps":910,"low_1pct_fps":200,"low_01pct_fps":100,"p50_ms":2,"p95_ms":2,"p99_ms":4,"p999_ms":6,"max_ms":50,"histogram":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]},{"phase":"ocean","repeat":0,"frames":1000,"seconds":12,"avg_fps":920,"low_1pct_fps":200,"low_01pct_fps":100,"p50_ms":2,"p95_ms":2,"p99_ms":4,"p999_ms":6,"max_ms":50,"histogram":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]},{"phase":"mountain","repeat":0,"frames":1000,"seconds":12,"avg_fps":930,"low_1pct_fps":200,"low_01pct_fps":100,"p50_ms":2,"p95_ms":2,"p99_ms":4,"p999_ms":6,"max_ms":50,"histogram":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}]}}
|
||||
{"install_id":"a5","day":20396,"version":"v0.2.1","source":"game","kind":"benchmark","data":{"format":"horizon-benchmark-report","version":1,"kind":"game","created":"2026-11-02","app":{"name":"horizon-client","version":"0.2.0"},"hardware":{"os":"linux","os_version":"secret-os-version","arch":"x86_64","cpu":"13th Gen Intel(R) Core(TM) i7-13700KF","cpu_threads":24,"ram_mb":32768,"gpu":{"name":"NVIDIA GeForce RTX 4080","vendor":"nvidia","driver":"secret-driver","backend":"vulkan","kind":"discrete","vram_mb":16376},"display":{"width":2560,"height":1440,"scale":1,"refresh_hz":165},"storage":"nvme"},"conditions":{"scenario":"standard","seed":"1234","render_distance":12,"simulation_distance":12,"window":[1280,720],"vsync":false,"offscreen":true,"repeats":1,"warmup_s":2},"metrics":{"startup.title_ms":{"n":1,"mean":900,"stdev":null,"min":900,"max":900,"ci95":null},"startup.world_ms":{"n":1,"mean":2000,"stdev":null,"min":2000,"max":2000,"ci95":null},"memory.rss_peak_mb":{"n":1,"mean":1700},"memory.rss_steady_mb":{"n":1,"mean":1500},"chunks.village.load_ms":{"n":1,"mean":900},"chunks.forest.load_ms":{"n":1,"mean":900},"chunks.ocean.load_ms":{"n":1,"mean":900},"chunks.mountain.load_ms":{"n":1,"mean":900}},"frames":[{"phase":"village","repeat":0,"frames":1000,"seconds":12,"avg_fps":900,"low_1pct_fps":200,"low_01pct_fps":100,"p50_ms":2,"p95_ms":2,"p99_ms":4,"p999_ms":6,"max_ms":50,"histogram":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]},{"phase":"forest","repeat":0,"frames":1000,"seconds":12,"avg_fps":910,"low_1pct_fps":200,"low_01pct_fps":100,"p50_ms":2,"p95_ms":2,"p99_ms":4,"p999_ms":6,"max_ms":50,"histogram":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]},{"phase":"ocean","repeat":0,"frames":1000,"seconds":12,"avg_fps":920,"low_1pct_fps":200,"low_01pct_fps":100,"p50_ms":2,"p95_ms":2,"p99_ms":4,"p999_ms":6,"max_ms":50,"histogram":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]},{"phase":"mountain","repeat":0,"frames":1000,"seconds":12,"avg_fps":930,"low_1pct_fps":200,"low_01pct_fps":100,"p50_ms":2,"p95_ms":2,"p99_ms":4,"p999_ms":6,"max_ms":50,"histogram":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}]}}
|
||||
{"install_id":"a6","day":20396,"version":"v0.2.1","source":"game","kind":"benchmark","data":{"format":"horizon-benchmark-report","version":1,"kind":"game","created":"2026-11-02","app":{"name":"horizon-client","version":"0.2.0"},"hardware":{"os":"linux","os_version":"secret-os-version","arch":"x86_64","cpu":"13th Gen Intel(R) Core(TM) i7-13700KF","cpu_threads":24,"ram_mb":32768,"gpu":{"name":"NVIDIA GeForce RTX 4080","vendor":"nvidia","driver":"secret-driver","backend":"vulkan","kind":"discrete","vram_mb":16376},"display":{"width":2560,"height":1440,"scale":1,"refresh_hz":165},"storage":"nvme"},"conditions":{"scenario":"standard","seed":"1234","render_distance":12,"simulation_distance":12,"window":[1280,720],"vsync":false,"fps_cap":60,"repeats":1,"warmup_s":2},"metrics":{"startup.title_ms":{"n":1,"mean":900,"stdev":null,"min":900,"max":900,"ci95":null},"startup.world_ms":{"n":1,"mean":2000,"stdev":null,"min":2000,"max":2000,"ci95":null},"memory.rss_peak_mb":{"n":1,"mean":1700},"memory.rss_steady_mb":{"n":1,"mean":1500},"chunks.village.load_ms":{"n":1,"mean":900},"chunks.forest.load_ms":{"n":1,"mean":900},"chunks.ocean.load_ms":{"n":1,"mean":900},"chunks.mountain.load_ms":{"n":1,"mean":900}},"frames":[{"phase":"village","repeat":0,"frames":1000,"seconds":12,"avg_fps":900,"low_1pct_fps":200,"low_01pct_fps":100,"p50_ms":2,"p95_ms":2,"p99_ms":4,"p999_ms":6,"max_ms":50,"histogram":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]},{"phase":"forest","repeat":0,"frames":1000,"seconds":12,"avg_fps":910,"low_1pct_fps":200,"low_01pct_fps":100,"p50_ms":2,"p95_ms":2,"p99_ms":4,"p999_ms":6,"max_ms":50,"histogram":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]},{"phase":"ocean","repeat":0,"frames":1000,"seconds":12,"avg_fps":920,"low_1pct_fps":200,"low_01pct_fps":100,"p50_ms":2,"p95_ms":2,"p99_ms":4,"p999_ms":6,"max_ms":50,"histogram":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]},{"phase":"mountain","repeat":0,"frames":1000,"seconds":12,"avg_fps":930,"low_1pct_fps":200,"low_01pct_fps":100,"p50_ms":2,"p95_ms":2,"p99_ms":4,"p999_ms":6,"max_ms":50,"histogram":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}]}}
|
||||
{"install_id":"a7","day":20396,"version":"v0.2.1","source":"game","kind":"benchmark","data":{"format":"horizon-benchmark-report","version":1,"kind":"game","created":"2026-11-02","app":{"name":"horizon-client","version":"0.2.0"},"hardware":{"os":"linux","os_version":"secret-os-version","arch":"x86_64","cpu":"13th Gen Intel(R) Core(TM) i7-13700KF","cpu_threads":24,"ram_mb":32768,"gpu":{"name":"NVIDIA GeForce RTX 4080","vendor":"nvidia","driver":"secret-driver","backend":"vulkan","kind":"discrete","vram_mb":16376},"display":{"width":2560,"height":1440,"scale":1,"refresh_hz":165},"storage":"nvme"},"conditions":{"scenario":"standard","seed":"1234","render_distance":12,"simulation_distance":12,"window":[1280,720],"vsync":false,"repeats":1,"warmup_s":2},"metrics":{"startup.title_ms":{"n":1,"mean":900,"stdev":null,"min":900,"max":900,"ci95":null},"startup.world_ms":{"n":1,"mean":2000,"stdev":null,"min":2000,"max":2000,"ci95":null},"memory.rss_peak_mb":{"n":1,"mean":1700},"memory.rss_steady_mb":{"n":1,"mean":1500},"chunks.village.load_ms":{"n":1,"mean":900},"chunks.forest.load_ms":{"n":1,"mean":900},"chunks.mountain.load_ms":{"n":1,"mean":900}},"frames":[{"phase":"village","repeat":0,"frames":1000,"seconds":12,"avg_fps":900,"low_1pct_fps":200,"low_01pct_fps":100,"p50_ms":2,"p95_ms":2,"p99_ms":4,"p999_ms":6,"max_ms":50,"histogram":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]},{"phase":"forest","repeat":0,"frames":1000,"seconds":12,"avg_fps":910,"low_1pct_fps":200,"low_01pct_fps":100,"p50_ms":2,"p95_ms":2,"p99_ms":4,"p999_ms":6,"max_ms":50,"histogram":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]},{"phase":"mountain","repeat":0,"frames":1000,"seconds":12,"avg_fps":920,"low_1pct_fps":200,"low_01pct_fps":100,"p50_ms":2,"p95_ms":2,"p99_ms":4,"p999_ms":6,"max_ms":50,"histogram":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}]}}
|
||||
{"install_id":"a8","day":20396,"version":"v0.2.1","source":"game","kind":"benchmark","data":{"format":"horizon-benchmark-report","version":1,"kind":"game","created":"2026-11-02","app":{"name":"horizon-client","version":"0.2.0"},"hardware":{"os":"linux","os_version":"secret-os-version","arch":"x86_64","cpu":"13th Gen Intel(R) Core(TM) i7-13700KF","cpu_threads":24,"ram_mb":32768,"gpu":{"name":"NVIDIA GeForce RTX 4080","vendor":"nvidia","driver":"secret-driver","backend":"vulkan","kind":"discrete","vram_mb":16376},"display":{"width":2560,"height":1440,"scale":1,"refresh_hz":165},"storage":"nvme"},"conditions":{"scenario":"village","seed":"1234","render_distance":12,"simulation_distance":12,"window":[1280,720],"vsync":false,"repeats":1,"warmup_s":2},"metrics":{"startup.title_ms":{"n":1,"mean":900,"stdev":null,"min":900,"max":900,"ci95":null},"startup.world_ms":{"n":1,"mean":2000,"stdev":null,"min":2000,"max":2000,"ci95":null},"memory.rss_peak_mb":{"n":1,"mean":1700},"memory.rss_steady_mb":{"n":1,"mean":1500},"chunks.village.load_ms":{"n":1,"mean":900},"chunks.forest.load_ms":{"n":1,"mean":900},"chunks.ocean.load_ms":{"n":1,"mean":900},"chunks.mountain.load_ms":{"n":1,"mean":900}},"frames":[{"phase":"village","repeat":0,"frames":1000,"seconds":12,"avg_fps":900,"low_1pct_fps":200,"low_01pct_fps":100,"p50_ms":2,"p95_ms":2,"p99_ms":4,"p999_ms":6,"max_ms":50,"histogram":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]},{"phase":"forest","repeat":0,"frames":1000,"seconds":12,"avg_fps":910,"low_1pct_fps":200,"low_01pct_fps":100,"p50_ms":2,"p95_ms":2,"p99_ms":4,"p999_ms":6,"max_ms":50,"histogram":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]},{"phase":"ocean","repeat":0,"frames":1000,"seconds":12,"avg_fps":920,"low_1pct_fps":200,"low_01pct_fps":100,"p50_ms":2,"p95_ms":2,"p99_ms":4,"p999_ms":6,"max_ms":50,"histogram":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]},{"phase":"mountain","repeat":0,"frames":1000,"seconds":12,"avg_fps":930,"low_1pct_fps":200,"low_01pct_fps":100,"p50_ms":2,"p95_ms":2,"p99_ms":4,"p999_ms":6,"max_ms":50,"histogram":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}]}}
|
||||
{"install_id":"a1","day":20396,"version":"v0.2.1","source":"game","kind":"benchmark","data":{"format":"horizon-benchmark-report","version":1,"kind":"game","created":"2026-11-02","app":{"name":"horizon-client","version":"0.2.0"},"hardware":{"os":"linux","os_version":"secret-os-version","arch":"x86_64","cpu":"13th Gen Intel(R) Core(TM) i7-13700KF","cpu_threads":24,"ram_mb":32768,"gpu":{"name":"NVIDIA GeForce RTX 4080","vendor":"nvidia","driver":"secret-driver","backend":"vulkan","kind":"discrete","vram_mb":16376},"display":{"width":2560,"height":1440,"scale":1,"refresh_hz":165},"storage":"nvme"},"conditions":{"scenario":"standard","seed":"1234","render_distance":32,"simulation_distance":12,"window":[1280,720],"vsync":false,"repeats":1,"warmup_s":2},"metrics":{"startup.title_ms":{"n":1,"mean":900,"stdev":null,"min":900,"max":900,"ci95":null},"startup.world_ms":{"n":1,"mean":9000,"stdev":null,"min":9000,"max":9000,"ci95":null},"memory.rss_peak_mb":{"n":1,"mean":2600},"memory.rss_steady_mb":{"n":1,"mean":2300},"chunks.village.load_ms":{"n":1,"mean":6000},"chunks.forest.load_ms":{"n":1,"mean":6000},"chunks.ocean.load_ms":{"n":1,"mean":6000},"chunks.mountain.load_ms":{"n":1,"mean":6000}},"frames":[{"phase":"village","repeat":0,"frames":1000,"seconds":12,"avg_fps":120,"low_1pct_fps":30,"low_01pct_fps":15,"p50_ms":2,"p95_ms":12,"p99_ms":24,"p999_ms":36,"max_ms":50,"histogram":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]},{"phase":"forest","repeat":0,"frames":1000,"seconds":12,"avg_fps":130,"low_1pct_fps":30,"low_01pct_fps":15,"p50_ms":2,"p95_ms":12,"p99_ms":24,"p999_ms":36,"max_ms":50,"histogram":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]},{"phase":"ocean","repeat":0,"frames":1000,"seconds":12,"avg_fps":140,"low_1pct_fps":30,"low_01pct_fps":15,"p50_ms":2,"p95_ms":12,"p99_ms":24,"p999_ms":36,"max_ms":50,"histogram":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]},{"phase":"mountain","repeat":0,"frames":1000,"seconds":12,"avg_fps":150,"low_1pct_fps":30,"low_01pct_fps":15,"p50_ms":2,"p95_ms":12,"p99_ms":24,"p999_ms":36,"max_ms":50,"histogram":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}]}}
|
||||
{"install_id":"b1","day":20396,"version":"v0.2.1","source":"game","kind":"benchmark","data":{"format":"horizon-benchmark-report","version":1,"kind":"game","created":"2026-11-02","app":{"name":"horizon-client","version":"0.2.0"},"hardware":{"os":"linux","os_version":"secret-os-version","arch":"x86_64","cpu":"AMD Ryzen 5 5600X 6-Core Processor","cpu_threads":24,"ram_mb":32768,"gpu":{"name":"NVIDIA GeForce RTX 3060","vendor":"nvidia","driver":"secret-driver","backend":"vulkan","kind":"discrete","vram_mb":12288},"display":{"width":2560,"height":1440,"scale":1,"refresh_hz":165},"storage":"nvme"},"conditions":{"scenario":"standard","seed":"1234","render_distance":12,"simulation_distance":12,"window":[1280,720],"vsync":false,"repeats":1,"warmup_s":2},"metrics":{"startup.title_ms":{"n":1,"mean":900,"stdev":null,"min":900,"max":900,"ci95":null},"startup.world_ms":{"n":1,"mean":7000,"stdev":null,"min":7000,"max":7000,"ci95":null},"memory.rss_peak_mb":{"n":1,"mean":1300},"memory.rss_steady_mb":{"n":1,"mean":1100},"chunks.village.load_ms":{"n":1,"mean":2500},"chunks.forest.load_ms":{"n":1,"mean":2500},"chunks.ocean.load_ms":{"n":1,"mean":2500},"chunks.mountain.load_ms":{"n":1,"mean":2500}},"frames":[{"phase":"village","repeat":0,"frames":1000,"seconds":12,"avg_fps":250,"low_1pct_fps":60,"low_01pct_fps":30,"p50_ms":2,"p95_ms":6,"p99_ms":12,"p999_ms":18,"max_ms":50,"histogram":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]},{"phase":"forest","repeat":0,"frames":1000,"seconds":12,"avg_fps":260,"low_1pct_fps":60,"low_01pct_fps":30,"p50_ms":2,"p95_ms":6,"p99_ms":12,"p999_ms":18,"max_ms":50,"histogram":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]},{"phase":"ocean","repeat":0,"frames":1000,"seconds":12,"avg_fps":270,"low_1pct_fps":60,"low_01pct_fps":30,"p50_ms":2,"p95_ms":6,"p99_ms":12,"p999_ms":18,"max_ms":50,"histogram":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]},{"phase":"mountain","repeat":0,"frames":1000,"seconds":12,"avg_fps":280,"low_1pct_fps":60,"low_01pct_fps":30,"p50_ms":2,"p95_ms":6,"p99_ms":12,"p999_ms":18,"max_ms":50,"histogram":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}]}}
|
||||
{"install_id":"b2","day":20396,"version":"v0.2.1","source":"game","kind":"benchmark","data":{"format":"horizon-benchmark-report","version":1,"kind":"game","created":"2026-11-02","app":{"name":"horizon-client","version":"0.2.0"},"hardware":{"os":"linux","os_version":"secret-os-version","arch":"x86_64","cpu":"AMD Ryzen 5 5600X 6-Core Processor","cpu_threads":24,"ram_mb":32768,"gpu":{"name":"NVIDIA GeForce RTX 3060","vendor":"nvidia","driver":"secret-driver","backend":"vulkan","kind":"discrete","vram_mb":12288},"display":{"width":2560,"height":1440,"scale":1,"refresh_hz":165},"storage":"nvme"},"conditions":{"scenario":"standard","seed":"1234","render_distance":12,"simulation_distance":12,"window":[1280,720],"vsync":false,"repeats":1,"warmup_s":2},"metrics":{"startup.title_ms":{"n":1,"mean":900,"stdev":null,"min":900,"max":900,"ci95":null},"startup.world_ms":{"n":1,"mean":7100,"stdev":null,"min":7100,"max":7100,"ci95":null},"memory.rss_peak_mb":{"n":1,"mean":1300},"memory.rss_steady_mb":{"n":1,"mean":1100},"chunks.village.load_ms":{"n":1,"mean":2400},"chunks.forest.load_ms":{"n":1,"mean":2400},"chunks.ocean.load_ms":{"n":1,"mean":2400},"chunks.mountain.load_ms":{"n":1,"mean":2400}},"frames":[{"phase":"village","repeat":0,"frames":1000,"seconds":12,"avg_fps":260,"low_1pct_fps":70,"low_01pct_fps":35,"p50_ms":2,"p95_ms":6,"p99_ms":12,"p999_ms":18,"max_ms":50,"histogram":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]},{"phase":"forest","repeat":0,"frames":1000,"seconds":12,"avg_fps":270,"low_1pct_fps":70,"low_01pct_fps":35,"p50_ms":2,"p95_ms":6,"p99_ms":12,"p999_ms":18,"max_ms":50,"histogram":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]},{"phase":"ocean","repeat":0,"frames":1000,"seconds":12,"avg_fps":280,"low_1pct_fps":70,"low_01pct_fps":35,"p50_ms":2,"p95_ms":6,"p99_ms":12,"p999_ms":18,"max_ms":50,"histogram":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]},{"phase":"mountain","repeat":0,"frames":1000,"seconds":12,"avg_fps":290,"low_1pct_fps":70,"low_01pct_fps":35,"p50_ms":2,"p95_ms":6,"p99_ms":12,"p999_ms":18,"max_ms":50,"histogram":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}]}}
|
||||
{"install_id":"b3","day":20396,"version":"v0.2.1","source":"game","kind":"benchmark","data":{"format":"horizon-benchmark-report","version":2,"kind":"game","created":"2026-11-02","app":{"name":"horizon-client","version":"0.2.0"},"hardware":{"os":"linux","os_version":"secret-os-version","arch":"x86_64","cpu":"AMD Ryzen 5 5600X 6-Core Processor","cpu_threads":24,"ram_mb":32768,"gpu":{"name":"NVIDIA GeForce RTX 3060","vendor":"nvidia","driver":"secret-driver","backend":"vulkan","kind":"discrete","vram_mb":12288},"display":{"width":2560,"height":1440,"scale":1,"refresh_hz":165},"storage":"nvme"},"conditions":{"scenario":"standard","seed":"1234","render_distance":12,"simulation_distance":12,"window":[1280,720],"vsync":false,"repeats":1,"warmup_s":2},"metrics":{"startup.title_ms":{"n":1,"mean":900,"stdev":null,"min":900,"max":900,"ci95":null},"startup.world_ms":{"n":1,"mean":7100,"stdev":null,"min":7100,"max":7100,"ci95":null},"memory.rss_peak_mb":{"n":1,"mean":1300},"memory.rss_steady_mb":{"n":1,"mean":1100},"chunks.village.load_ms":{"n":1,"mean":2400},"chunks.forest.load_ms":{"n":1,"mean":2400},"chunks.ocean.load_ms":{"n":1,"mean":2400},"chunks.mountain.load_ms":{"n":1,"mean":2400}},"frames":[{"phase":"village","repeat":0,"frames":1000,"seconds":12,"avg_fps":260,"low_1pct_fps":70,"low_01pct_fps":35,"p50_ms":2,"p95_ms":6,"p99_ms":12,"p999_ms":18,"max_ms":50,"histogram":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]},{"phase":"forest","repeat":0,"frames":1000,"seconds":12,"avg_fps":270,"low_1pct_fps":70,"low_01pct_fps":35,"p50_ms":2,"p95_ms":6,"p99_ms":12,"p999_ms":18,"max_ms":50,"histogram":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]},{"phase":"ocean","repeat":0,"frames":1000,"seconds":12,"avg_fps":280,"low_1pct_fps":70,"low_01pct_fps":35,"p50_ms":2,"p95_ms":6,"p99_ms":12,"p999_ms":18,"max_ms":50,"histogram":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]},{"phase":"mountain","repeat":0,"frames":1000,"seconds":12,"avg_fps":290,"low_1pct_fps":70,"low_01pct_fps":35,"p50_ms":2,"p95_ms":6,"p99_ms":12,"p999_ms":18,"max_ms":50,"histogram":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}]}}
|
||||
{"day":20396,"version":"v0.2.1","kind":"benchmark","data":{"format":"horizon-benchmark-report","version":1,"kind":"game","created":"2026-11-02","app":{"name":"horizon-client","version":"0.2.0"},"hardware":{"os":"linux","os_version":"secret-os-version","arch":"x86_64","cpu":"AMD Ryzen 5 5600X 6-Core Processor","cpu_threads":24,"ram_mb":32768,"gpu":{"name":"NVIDIA GeForce RTX 3060","vendor":"nvidia","driver":"secret-driver","backend":"vulkan","kind":"discrete","vram_mb":12288},"display":{"width":2560,"height":1440,"scale":1,"refresh_hz":165},"storage":"nvme"},"conditions":{"scenario":"standard","seed":"1234","render_distance":12,"simulation_distance":12,"window":[1280,720],"vsync":false,"repeats":1,"warmup_s":2},"metrics":{"startup.title_ms":{"n":1,"mean":900,"stdev":null,"min":900,"max":900,"ci95":null},"startup.world_ms":{"n":1,"mean":1,"stdev":null,"min":1,"max":1,"ci95":null},"memory.rss_peak_mb":{"n":1,"mean":1},"memory.rss_steady_mb":{"n":1,"mean":1},"chunks.village.load_ms":{"n":1,"mean":1},"chunks.forest.load_ms":{"n":1,"mean":1},"chunks.ocean.load_ms":{"n":1,"mean":1},"chunks.mountain.load_ms":{"n":1,"mean":1}},"frames":[{"phase":"village","repeat":0,"frames":1000,"seconds":12,"avg_fps":1,"low_1pct_fps":1,"low_01pct_fps":0.5,"p50_ms":2,"p95_ms":1,"p99_ms":2,"p999_ms":3,"max_ms":50,"histogram":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]},{"phase":"forest","repeat":0,"frames":1000,"seconds":12,"avg_fps":11,"low_1pct_fps":1,"low_01pct_fps":0.5,"p50_ms":2,"p95_ms":1,"p99_ms":2,"p999_ms":3,"max_ms":50,"histogram":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]},{"phase":"ocean","repeat":0,"frames":1000,"seconds":12,"avg_fps":21,"low_1pct_fps":1,"low_01pct_fps":0.5,"p50_ms":2,"p95_ms":1,"p99_ms":2,"p999_ms":3,"max_ms":50,"histogram":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]},{"phase":"mountain","repeat":0,"frames":1000,"seconds":12,"avg_fps":31,"low_1pct_fps":1,"low_01pct_fps":0.5,"p50_ms":2,"p95_ms":1,"p99_ms":2,"p999_ms":3,"max_ms":50,"histogram":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}]}}
|
||||
@@ -1,5 +1,5 @@
|
||||
//! `GET /v1/benchmarks/summary` against the website's fixtures (website/scripts/fixtures/benchmarks/): the same
|
||||
//! uploads must give the groups `website/scripts/benchmarks.mjs` gives.
|
||||
//! `GET /v1/benchmarks/summary` against the shared fixtures (tests/fixtures/benchmarks/): the same uploads must
|
||||
//! give the groups the website's `scripts/benchmarks.mjs` (ludovic111/horizon-site) gives on its copy of them.
|
||||
use std::sync::Arc;
|
||||
use std::sync::atomic::AtomicU32;
|
||||
|
||||
@@ -15,10 +15,7 @@ use http_body_util::BodyExt;
|
||||
use serde_json::Value;
|
||||
use tower::ServiceExt;
|
||||
|
||||
const FIXTURES: &str = concat!(
|
||||
env!("CARGO_MANIFEST_DIR"),
|
||||
"/../../website/scripts/fixtures/benchmarks"
|
||||
);
|
||||
const FIXTURES: &str = concat!(env!("CARGO_MANIFEST_DIR"), "/tests/fixtures/benchmarks");
|
||||
|
||||
fn items() -> Vec<Value> {
|
||||
std::fs::read_to_string(format!("{FIXTURES}/items.jsonl"))
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
//! Horizon's design tokens, the one source of truth for the launcher (`launcher/src/theme.rs`),
|
||||
//! the game's on-screen keyboard (`horizon-client`'s `ui_theme`) and the website (`website/src/tokens.css`,
|
||||
//! generated from [`css`] by `cargo run -p xtask -- tokens`). Change a value here and all three
|
||||
//! the game's on-screen keyboard (`horizon-client`'s `ui_theme`) and the website (`tokens.css` in this crate,
|
||||
//! generated from [`css`] by `cargo run -p xtask -- tokens`, which the site's build reads from main). Change a value here and all three
|
||||
//! follow. The system is described in `docs/design-system.md`.
|
||||
//!
|
||||
//! Cool neutrals in two appearances and one violet accent; Geist and Geist Mono only, bundled
|
||||
@@ -528,7 +528,7 @@ pub fn contrast(a: u32, b: u32) -> f32 {
|
||||
(x.max(y) + 0.05) / (x.min(y) + 0.05)
|
||||
}
|
||||
|
||||
/// `website/src/tokens.css`: every token as a CSS custom property, the light palette by
|
||||
/// `tokens.css`: every token as a CSS custom property, the light palette by
|
||||
/// default, the dark one when the system asks for it or the page sets `data-theme="dark"`.
|
||||
pub fn css() -> String {
|
||||
let mut s = String::new();
|
||||
@@ -771,15 +771,15 @@ mod tests {
|
||||
assert!((bezier([0., 0., 1., 1.], 0.3) - 0.3).abs() < 1e-3);
|
||||
}
|
||||
|
||||
/// `website/src/tokens.css` is what [`css`] writes; regenerate it with
|
||||
/// `cargo run -p xtask -- tokens`.
|
||||
/// `tokens.css` (beside Cargo.toml, read by the website's build) is what [`css`] writes;
|
||||
/// regenerate it with `cargo run -p xtask -- tokens`.
|
||||
#[test]
|
||||
fn website_tokens_are_up_to_date() {
|
||||
let path = concat!(env!("CARGO_MANIFEST_DIR"), "/../../website/src/tokens.css");
|
||||
fn tokens_css_is_up_to_date() {
|
||||
let path = concat!(env!("CARGO_MANIFEST_DIR"), "/tokens.css");
|
||||
let written = std::fs::read_to_string(path).unwrap_or_default();
|
||||
assert!(
|
||||
written == css(),
|
||||
"website/src/tokens.css is out of date: run `cargo run -p xtask -- tokens`"
|
||||
"crates/horizon-theme/tokens.css is out of date: run `cargo run -p xtask -- tokens`"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,167 @@
|
||||
/* Generated from crates/horizon-theme by `cargo run -p xtask -- tokens`; do not edit.
|
||||
docs/design-system.md describes the tokens. */
|
||||
|
||||
:root {
|
||||
--page: #ece7f7;
|
||||
--plate-soft: #e9e3f8;
|
||||
--plate: #ddd4f3;
|
||||
--surface: #f8f6fd;
|
||||
--rule: #e4ddf4;
|
||||
--ink: #1b1530;
|
||||
--ink-soft: #3b3354;
|
||||
--muted: #585071;
|
||||
--accent: #5333c9;
|
||||
--on-accent: #ffffff;
|
||||
--danger: #a3301d;
|
||||
--success: #136336;
|
||||
--warn: #7a4f00;
|
||||
--side: #e2dbf2;
|
||||
--panel: #f8f6fd;
|
||||
--raised: #e9e3f8;
|
||||
--button: #ddd4f3;
|
||||
--button-bevel: #f4f0fe;
|
||||
--well: #f3f0fb;
|
||||
--bevel: #ffffff;
|
||||
--lip: #c3b8e2;
|
||||
--outline: #2b2244;
|
||||
--face: #5b3fd6;
|
||||
--face-bevel: #8069ef;
|
||||
--face-lip: #3a2694;
|
||||
--on-face: #ffffff;
|
||||
color-scheme: light;
|
||||
--font: "Geist", ui-sans-serif, system-ui, sans-serif;
|
||||
--mono: "Geist Mono", ui-monospace, monospace;
|
||||
--pixel: "Pixelify Sans", "Geist", ui-sans-serif, sans-serif;
|
||||
--block-outline: 2px;
|
||||
--block-bevel: 2px;
|
||||
--block-lip: 4px;
|
||||
--text-micro: 11px;
|
||||
--text-micro-line: 1.5;
|
||||
--text-micro-tracking: 0.04em;
|
||||
--text-micro-weight: 400;
|
||||
--text-caption: 12px;
|
||||
--text-caption-line: 1.5;
|
||||
--text-caption-tracking: 0em;
|
||||
--text-caption-weight: 400;
|
||||
--text-label: 13px;
|
||||
--text-label-line: 1.5;
|
||||
--text-label-tracking: 0em;
|
||||
--text-label-weight: 400;
|
||||
--text-ui: 14px;
|
||||
--text-ui-line: 1.5;
|
||||
--text-ui-tracking: 0em;
|
||||
--text-ui-weight: 400;
|
||||
--text-body: clamp(15px, calc(15px + 2 * (100vw - 375px) / 1065), 17px);
|
||||
--text-body-line: 1.6;
|
||||
--text-body-tracking: 0em;
|
||||
--text-body-weight: 400;
|
||||
--text-heading: clamp(20px, calc(20px + 4 * (100vw - 375px) / 1065), 24px);
|
||||
--text-heading-line: 1.3;
|
||||
--text-heading-tracking: -0.01em;
|
||||
--text-heading-weight: 500;
|
||||
--text-title: clamp(32px, calc(32px + 16 * (100vw - 375px) / 1065), 48px);
|
||||
--text-title-line: 1.05;
|
||||
--text-title-tracking: -0.02em;
|
||||
--text-title-weight: 500;
|
||||
--text-display: clamp(34px, calc(34px + 30 * (100vw - 375px) / 1065), 64px);
|
||||
--text-display-line: 1.05;
|
||||
--text-display-tracking: -0.025em;
|
||||
--text-display-weight: 500;
|
||||
--text-wordmark: 18vw;
|
||||
--text-wordmark-line: 0.8;
|
||||
--text-wordmark-tracking: -0.04em;
|
||||
--text-wordmark-weight: 500;
|
||||
--space-1: 4px;
|
||||
--space-2: 8px;
|
||||
--space-3: 12px;
|
||||
--space-4: 16px;
|
||||
--space-5: 24px;
|
||||
--space-6: 32px;
|
||||
--space-7: 48px;
|
||||
--space-8: 64px;
|
||||
--space-9: 96px;
|
||||
--gutter: 64px;
|
||||
--gutter-narrow: 16px;
|
||||
--radius: 8px;
|
||||
--radius-plate: 12px;
|
||||
--radius-pill: 999px;
|
||||
--rule-width: 1px;
|
||||
--control: 32px;
|
||||
--control-large: 40px;
|
||||
--segment: 28px;
|
||||
--field: 36px;
|
||||
--row: 86px;
|
||||
--index: 40px;
|
||||
--plate-bleed: 16px;
|
||||
--rise: 8px;
|
||||
--measure: 56ch;
|
||||
--quick: 150ms;
|
||||
--ease-quick: cubic-bezier(0.4, 0, 0.2, 1);
|
||||
--move: 240ms;
|
||||
--ease-move: cubic-bezier(0.23, 1, 0.32, 1);
|
||||
--enter: 600ms;
|
||||
--ease-enter: cubic-bezier(0.23, 1, 0.32, 1);
|
||||
--stagger: 40ms;
|
||||
}
|
||||
|
||||
@media (prefers-color-scheme: dark) {
|
||||
:root:not([data-theme="light"]) {
|
||||
--page: #0f0d17;
|
||||
--plate-soft: #221e34;
|
||||
--plate: #2b2641;
|
||||
--surface: #1a1727;
|
||||
--rule: #120f1c;
|
||||
--ink: #ecedf3;
|
||||
--ink-soft: #c5c7d1;
|
||||
--muted: #a29cb8;
|
||||
--accent: #9a86ff;
|
||||
--on-accent: #ffffff;
|
||||
--danger: #f07a68;
|
||||
--success: #45c27a;
|
||||
--warn: #f0b84f;
|
||||
--side: #0b0a11;
|
||||
--panel: #1a1727;
|
||||
--raised: #221e34;
|
||||
--button: #2b2641;
|
||||
--button-bevel: #3d3560;
|
||||
--well: #0c0b12;
|
||||
--bevel: #342d52;
|
||||
--lip: #07060b;
|
||||
--outline: #05040a;
|
||||
--face: #5b3fd6;
|
||||
--face-bevel: #8a74ff;
|
||||
--face-lip: #3a2694;
|
||||
--on-face: #ffffff;
|
||||
color-scheme: dark;
|
||||
}
|
||||
}
|
||||
|
||||
:root[data-theme="dark"] {
|
||||
--page: #0f0d17;
|
||||
--plate-soft: #221e34;
|
||||
--plate: #2b2641;
|
||||
--surface: #1a1727;
|
||||
--rule: #120f1c;
|
||||
--ink: #ecedf3;
|
||||
--ink-soft: #c5c7d1;
|
||||
--muted: #a29cb8;
|
||||
--accent: #9a86ff;
|
||||
--on-accent: #ffffff;
|
||||
--danger: #f07a68;
|
||||
--success: #45c27a;
|
||||
--warn: #f0b84f;
|
||||
--side: #0b0a11;
|
||||
--panel: #1a1727;
|
||||
--raised: #221e34;
|
||||
--button: #2b2641;
|
||||
--button-bevel: #3d3560;
|
||||
--well: #0c0b12;
|
||||
--bevel: #342d52;
|
||||
--lip: #07060b;
|
||||
--outline: #05040a;
|
||||
--face: #5b3fd6;
|
||||
--face-bevel: #8a74ff;
|
||||
--face-lip: #3a2694;
|
||||
--on-face: #ffffff;
|
||||
color-scheme: dark;
|
||||
}
|
||||
@@ -618,6 +618,15 @@ impl ProtoChunk {
|
||||
pub fn is_decorated(&self) -> bool {
|
||||
self.decorated
|
||||
}
|
||||
/// The structure starts this chunk holds itself (`structures.starts`).
|
||||
pub fn own_starts(&self) -> Vec<Arc<super::structure::start::StructureStart>> {
|
||||
let pos = self.position();
|
||||
self.structure_starts
|
||||
.iter()
|
||||
.filter(|s| s.chunk == pos)
|
||||
.cloned()
|
||||
.collect()
|
||||
}
|
||||
/// Also restores a saved proto chunk that was decorated before it was saved.
|
||||
pub fn set_decorated(&mut self) {
|
||||
self.decorated = true;
|
||||
|
||||
Reference in New Issue
Block a user