Merge remote-tracking branch 'origin/main' into perf/parity-manifest-aware
This commit is contained in:
@@ -25,8 +25,8 @@ jobs:
|
||||
parity-main:
|
||||
# A Mac mini runner of its own (ludovics-mac-mini-2 holds only this label since 2026-10-26): behind PR parity jobs
|
||||
# this run waited 2 h while every merge replaced the pending one, and on the release runner a release then waited
|
||||
# behind the next run. PR parity jobs have ludovics-mac-mini and the desktop. Not the desktop: a job slowed down
|
||||
# because the maintainer came back could time out, and a failure here bisects and comments on merges.
|
||||
# behind the next run. PR parity jobs have ludovics-mac-mini and playhorizon. Not playhorizon: its 4 CPUs
|
||||
# make a core-crate run several times longer, and a failure here bisects and comments on merges.
|
||||
runs-on: [self-hosted, macOS, horizon-parity-main]
|
||||
timeout-minutes: 240 # a core-crate batch reruns ~300 harnesses (~60-90 min), a bisect a few rounds of the failures
|
||||
steps:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
name: parity
|
||||
# The vanilla harnesses a pull request's changes can affect, on the Mac mini's runner, which holds the maintainer's
|
||||
# own Minecraft files (Horizon never downloads the game). Called by ci.yml for pull requests from this repository
|
||||
# The vanilla harnesses a pull request's changes can affect, on the Mac mini's runner or playhorizon's, which hold the
|
||||
# maintainer's own Minecraft files (Horizon never downloads the game). Called by ci.yml for pull requests from this repository
|
||||
# and by run-parity.yml when a maintainer labels a fork's pull request run-parity. See docs/release-flow.md.
|
||||
on:
|
||||
workflow_call:
|
||||
@@ -16,8 +16,8 @@ on:
|
||||
full:
|
||||
description: >-
|
||||
The pull request carries the full-parity label (a change every harness reaches, such as a crate split): it
|
||||
runs on the desktop's runner only, so the Mac mini's runners stay free for the others. While the desktop is
|
||||
in use the job waits for it.
|
||||
runs on playhorizon's runner only, so the Mac mini's runners stay free for the others. While that runner is
|
||||
busy the job waits for it.
|
||||
type: boolean
|
||||
default: false
|
||||
permissions:
|
||||
@@ -28,10 +28,10 @@ env:
|
||||
|
||||
jobs:
|
||||
parity:
|
||||
runs-on: ${{ inputs.full && fromJSON('["self-hosted", "horizon-game", "ludodesktop"]') || fromJSON('["self-hosted", "horizon-game"]') }}
|
||||
# A change to core crates reruns ~350 harnesses: ~60-90 min on the Mac mini, ~35 min on the desktop, longer if
|
||||
# someone comes back to the desktop meanwhile (the job then goes on with 2 threads).
|
||||
timeout-minutes: ${{ inputs.full && 300 || 120 }}
|
||||
runs-on: ${{ inputs.full && fromJSON('["self-hosted", "horizon-game", "playhorizon"]') || fromJSON('["self-hosted", "horizon-game"]') }}
|
||||
# A change to core crates reruns ~350 harnesses: ~60-90 min on the Mac mini; on playhorizon (4 of its 8 vCPUs, 4
|
||||
# harnesses at a time) up to a few hours, and any pull request's job may land there.
|
||||
timeout-minutes: ${{ inputs.full && 360 || 180 }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//! Biome colours from the pinned biome definitions and colormaps
|
||||
//! (`Biome.getGrassColor`/`getFoliageColor`/..., `BlockTintSources`).
|
||||
use crate::Result;
|
||||
use horizon_core::{noise::SimplexNoise, random::LegacyRandom};
|
||||
use horizon_core::{noise::SimplexNoise, position::BlockPos, random::LegacyRandom};
|
||||
use serde_json::Value;
|
||||
use std::{collections::HashMap, fs, path::Path};
|
||||
|
||||
@@ -33,6 +33,8 @@ pub struct BiomeInfo {
|
||||
pub increased_fire_burnout: bool,
|
||||
pub name: String,
|
||||
pub temperature: f32,
|
||||
/// `temperature_modifier: frozen` (the frozen oceans).
|
||||
pub frozen: bool,
|
||||
pub downfall: f32,
|
||||
pub precipitation: bool,
|
||||
pub grass: u32,
|
||||
@@ -45,6 +47,26 @@ pub struct BiomeInfo {
|
||||
pub fog: Option<u32>,
|
||||
pub water_fog: u32,
|
||||
}
|
||||
impl BiomeInfo {
|
||||
/// `Biome.getHeightAdjustedTemperature`: the frozen modifier, then cooler
|
||||
/// with height above `sea_level + 17`.
|
||||
pub fn temperature_at(&self, pos: BlockPos, sea_level: i32) -> f32 {
|
||||
use horizon_world::worldgen::biome_temperature::{
|
||||
BiomeTemperatureSettings, TemperatureModifier,
|
||||
};
|
||||
BiomeTemperatureSettings {
|
||||
base_temperature: self.temperature,
|
||||
modifier: if self.frozen {
|
||||
TemperatureModifier::Frozen
|
||||
} else {
|
||||
TemperatureModifier::None
|
||||
},
|
||||
has_precipitation: self.precipitation,
|
||||
downfall: self.downfall,
|
||||
}
|
||||
.height_adjusted(pos, sea_level)
|
||||
}
|
||||
}
|
||||
pub struct Biomes {
|
||||
pub list: Vec<BiomeInfo>,
|
||||
pub index: HashMap<String, u16>,
|
||||
@@ -135,6 +157,7 @@ impl Biomes {
|
||||
.as_bool()
|
||||
.unwrap_or(false),
|
||||
temperature,
|
||||
frozen: v["temperature_modifier"].as_str() == Some("frozen"),
|
||||
downfall,
|
||||
precipitation: v["has_precipitation"].as_bool().unwrap_or(true),
|
||||
grass: color(&effects["grass_color"])
|
||||
|
||||
@@ -115,6 +115,7 @@ impl Game<'_> {
|
||||
"in_fire" | "campfire" | "hot_floor" => DamageKind::InFire,
|
||||
"lava" => DamageKind::Lava,
|
||||
"drown" => DamageKind::Drown,
|
||||
"dry_out" => DamageKind::DryOut,
|
||||
"magic" | "indirect_magic" | "dragon_breath" => DamageKind::Magic,
|
||||
"sting" => DamageKind::Sting,
|
||||
"cactus" | "sweet_berry_bush" => DamageKind::Cactus,
|
||||
|
||||
@@ -3524,6 +3524,7 @@ pub(super) fn damage_type(kind: horizon_client::mobs::DamageKind, player: bool)
|
||||
K::InFire => "minecraft:in_fire",
|
||||
K::Lava => "minecraft:lava",
|
||||
K::Drown => "minecraft:drown",
|
||||
K::DryOut => "minecraft:dry_out",
|
||||
K::Magic => "minecraft:magic",
|
||||
K::Sting => "minecraft:sting",
|
||||
K::Cactus => "minecraft:cactus",
|
||||
|
||||
@@ -517,6 +517,8 @@ pub enum DamageKind {
|
||||
InFire,
|
||||
Lava,
|
||||
Drown,
|
||||
/// `dry_out`: an axolotl out of water for too long.
|
||||
DryOut,
|
||||
Magic,
|
||||
Sting,
|
||||
Cactus,
|
||||
@@ -575,7 +577,11 @@ impl Damage {
|
||||
pub fn causes_panic(&self) -> bool {
|
||||
!matches!(
|
||||
self.kind,
|
||||
DamageKind::Fall | DamageKind::Drown | DamageKind::Generic | DamageKind::InWall
|
||||
DamageKind::Fall
|
||||
| DamageKind::Drown
|
||||
| DamageKind::DryOut
|
||||
| DamageKind::Generic
|
||||
| DamageKind::InWall
|
||||
)
|
||||
}
|
||||
/// DamageTypeTags.BYPASSES_ARMOR
|
||||
@@ -608,6 +614,7 @@ impl Damage {
|
||||
| DamageKind::InFire
|
||||
| DamageKind::Lava
|
||||
| DamageKind::Drown
|
||||
| DamageKind::DryOut
|
||||
| DamageKind::Magic
|
||||
| DamageKind::Cactus
|
||||
| DamageKind::Generic
|
||||
@@ -1880,6 +1887,12 @@ impl Mob {
|
||||
}
|
||||
}
|
||||
}
|
||||
// Squid.hurtServer: a squid hurt after a living entity hit it squirts ink.
|
||||
if matches!(self.species(), Species::Squid | Species::GlowSquid)
|
||||
&& self.ai.last_hurt_by.is_some()
|
||||
{
|
||||
aquatic::spawn_ink(self);
|
||||
}
|
||||
true
|
||||
}
|
||||
/// LivingEntity.knockback(power, xd, zd) towards the negative direction.
|
||||
|
||||
@@ -444,6 +444,34 @@ pub fn tick_swing(m: &mut Mob) {
|
||||
}
|
||||
m.anim.attack_anim = m.ai.swing_time as f32 / 6.0;
|
||||
}
|
||||
/// `LivingEntity.baseTick` refills a breather's air by 4, then
|
||||
/// `Axolotl.handleAirSupply` (unless the mob has no AI): water or rain fills
|
||||
/// it, anywhere else it runs down from the pre-tick value, and at -20 the
|
||||
/// axolotl dries out.
|
||||
fn axolotl_air_supply(m: &mut Mob, w: &MobWorld) {
|
||||
let before = m.air;
|
||||
m.air = (m.air + 4).min(super::axolotl::MAX_AIR);
|
||||
if m.no_ai {
|
||||
return;
|
||||
}
|
||||
// Entity.isInRain: rain at the block, or at the top of the box.
|
||||
let (x, y, z) = (
|
||||
m.position.x.floor() as i32,
|
||||
m.position.y.floor() as i32,
|
||||
m.position.z.floor() as i32,
|
||||
);
|
||||
let top = (m.position.y + f64::from(m.height())).floor() as i32;
|
||||
let in_rain = w.raining_at(x, y, z) || w.raining_at(x, top, z);
|
||||
if m.fluids.in_water || in_rain {
|
||||
m.air = super::axolotl::MAX_AIR;
|
||||
} else {
|
||||
m.air = before - 1;
|
||||
if m.air <= -20 {
|
||||
m.air = 0;
|
||||
m.damage(2.0, Damage::of(DamageKind::DryOut));
|
||||
}
|
||||
}
|
||||
}
|
||||
/// Entity.baseTick + LivingEntity.baseTick + Mob.baseTick.
|
||||
fn base_tick(m: &mut Mob, w: &MobWorld, events: &mut Vec<MobEvent>) {
|
||||
m.was_eye_in_water = m.fluids.eye_in_water;
|
||||
@@ -503,7 +531,9 @@ fn base_tick(m: &mut Mob, w: &MobWorld, events: &mut Vec<MobEvent>) {
|
||||
m.damage(1.0, Damage::of(DamageKind::InWall));
|
||||
}
|
||||
// Air supply and drowning (WaterAnimal.handleAirSupply for aquatic mobs).
|
||||
if m.kind.flags.needs_water {
|
||||
if m.species() == Species::Axolotl {
|
||||
axolotl_air_supply(m, w);
|
||||
} else if m.kind.flags.needs_water {
|
||||
if !m.fluids.in_water {
|
||||
m.air -= 1;
|
||||
if m.air == -20 {
|
||||
|
||||
@@ -24,6 +24,58 @@ const Z_BODY_ROT: usize = 3;
|
||||
const TENTACLE_SPEED: usize = 4;
|
||||
const ROTATE_SPEED: usize = 5;
|
||||
|
||||
/// `Squid.spawnInk`: the squirt sound and 30 ink particles shot from under
|
||||
/// the squid, turned by its body rotation.
|
||||
pub fn spawn_ink(m: &mut Mob) {
|
||||
let sound = if m.species() == Species::GlowSquid {
|
||||
"entity.glow_squid.squirt"
|
||||
} else {
|
||||
"entity.squid.squirt"
|
||||
};
|
||||
let kind = if m.species() == Species::GlowSquid {
|
||||
"glow_squid_ink"
|
||||
} else {
|
||||
"squid_ink"
|
||||
};
|
||||
// makeSound draws the voice pitch even for a silent squid.
|
||||
let pitch = m.voice_pitch();
|
||||
if !m.silent {
|
||||
let at = [m.position.x, m.position.y, m.position.z];
|
||||
m.outbox.push(MobEvent::Sound(
|
||||
sound,
|
||||
at,
|
||||
super::ai::sound_volume(m),
|
||||
pitch,
|
||||
));
|
||||
}
|
||||
// rotateVector: xRot(xBodyRotO), then yRot(-yBodyRotO).
|
||||
let to_radians = (std::f64::consts::PI / 180.0) as f32;
|
||||
let (x_rot, y_rot) = (
|
||||
m.anim.vo[X_BODY_ROT] * to_radians,
|
||||
-m.previous_body_yaw * to_radians,
|
||||
);
|
||||
let rotate = |v: Vec3| v.rotate_x(x_rot).rotate_y(y_rot);
|
||||
let pos = rotate(Vec3::new(0.0, -1.0, 0.0)).add_vector(m.position);
|
||||
let offset_scale: f32 = if m.is_baby() { 0.1 } else { 0.3 };
|
||||
for _ in 0..30 {
|
||||
let x = f64::from(m.random.next_float()) * 0.6 - 0.3;
|
||||
let z = f64::from(m.random.next_float()) * 0.6 - 0.3;
|
||||
let dir = rotate(Vec3::new(x, -1.0, z));
|
||||
let d = dir.scale(f64::from(offset_scale + m.random.next_float() * 2.0));
|
||||
// ServerLevel.sendParticles with a count of 0 and speed 0.1: one
|
||||
// particle moving at the float offset times the float speed.
|
||||
let speed = f64::from(0.1f32);
|
||||
m.outbox.push(MobEvent::ParticleAt {
|
||||
kind,
|
||||
at: [pos.x, pos.y + 0.5, pos.z],
|
||||
velocity: [
|
||||
speed * f64::from(d.x as f32),
|
||||
speed * f64::from(d.y as f32),
|
||||
speed * f64::from(d.z as f32),
|
||||
],
|
||||
});
|
||||
}
|
||||
}
|
||||
pub fn register(m: &mut Mob) {
|
||||
use Species as S;
|
||||
match m.species() {
|
||||
@@ -36,6 +88,7 @@ pub fn register(m: &mut Mob) {
|
||||
m.anim.v[TENTACLE_SPEED] = speed;
|
||||
}
|
||||
S::Axolotl => {
|
||||
m.air = super::axolotl::MAX_AIR;
|
||||
// Native controller scaling is essential: the base speed attribute is 1.0.
|
||||
m.ai.mov.kind = MoveKind::SmoothSwimming {
|
||||
max_turn_x: 85.0,
|
||||
|
||||
@@ -3,6 +3,8 @@ use super::{Mob, MobEvent, MobWorld, Species, Who, animal_brain, keyframes::Anim
|
||||
use horizon_core::random::RandomSource;
|
||||
pub const PLAY_DEAD_TICKS: i32 = 200;
|
||||
pub const HUNTING_COOLDOWN: i64 = 2400;
|
||||
/// `Axolotl.getMaxAirSupply`.
|
||||
pub const MAX_AIR: i32 = 6000;
|
||||
|
||||
/// AxolotlAttackablesSensor: always-hostile targets bypass the hunting cooldown.
|
||||
pub fn prey_eligible(
|
||||
|
||||
@@ -206,6 +206,19 @@ impl MobWorld<'_> {
|
||||
}
|
||||
self.world.light(x, y, z) >> 4 == 15
|
||||
}
|
||||
/// Level.isRainingAt: raining, open to the sky, nothing motion blocking
|
||||
/// above, and the biome's precipitation at the position is rain, not snow
|
||||
/// or none.
|
||||
pub fn raining_at(&self, x: i32, y: i32, z: i32) -> bool {
|
||||
if !self.raining || !self.can_see_sky(x, y, z) || self.motion_blocking_height(x, z) > y {
|
||||
return false;
|
||||
}
|
||||
let Some(chunk) = self.world.chunks.get(&(x >> 4, z >> 4)) else {
|
||||
return false;
|
||||
};
|
||||
let biome = self.biomes.get(chunk.biome(x, y, z));
|
||||
biome.precipitation && biome.temperature_at(BlockPos::new(x, y, z), self.sea_level) >= 0.15
|
||||
}
|
||||
/// Level.getLightLevelDependentMagicValue: the dimension's brightness curve
|
||||
/// at the raw (sky darkened) light level.
|
||||
pub fn brightness(&self, x: i32, y: i32, z: i32) -> f32 {
|
||||
|
||||
+15
-10
@@ -13,7 +13,7 @@ reopened; labels never start it):
|
||||
| Job | Runs on | What | Time |
|
||||
| --- | --- | --- | --- |
|
||||
| `verify` | GitHub `ubuntu-latest` | Public-tree check, Python tests, rustfmt, clippy with warnings denied, Rust tests. Dependencies and the workspace build come from a cache saved by main's runs | ~4 min cold, less warm |
|
||||
| `parity / parity` | A runner with the label `horizon-game`: the Mac mini's two, and the desktop's while nobody uses it (below) | Only for a change to a harness, an oracle, a probe or the runner (or the `run-parity` label): the vanilla harnesses the change can affect (`tools/parity.py --changed <base>`). Other pull requests skip it: [parity-main](#parity-on-main) checks them on main | seconds when nothing is affected; minutes per affected harness |
|
||||
| `parity / parity` | A runner with the label `horizon-game`: the Mac mini's and playhorizon's (below) | Only for a change to a harness, an oracle, a probe or the runner (or the `run-parity` label): the vanilla harnesses the change can affect (`tools/parity.py --changed <base>`). Other pull requests skip it: [parity-main](#parity-on-main) checks them on main | seconds when nothing is affected; minutes per affected harness |
|
||||
|
||||
Pushes to main run `verify` only; the nightly audit covers main's harnesses.
|
||||
|
||||
@@ -29,12 +29,12 @@ repository, `run-parity.yml` for a fork's pull request a maintainer labels `run-
|
||||
|
||||
A pull request every harness reaches (a crate split moves files every probe links: #2160 ran all 352 harnesses, 71
|
||||
minutes on a Mac mini runner, while five other pull requests' jobs queued behind it) carries the `full-parity` label:
|
||||
its job runs on the desktop's runner only (8 harnesses at a time), and waits for it while the desktop is in use
|
||||
instead of taking a Mac mini runner. Labels don't start `checks`: add it when opening the pull request
|
||||
its job runs on playhorizon's runner only (4 harnesses at a time), and waits for it while that runner is busy
|
||||
instead of taking the Mac mini's. Labels don't start `checks`: add it when opening the pull request
|
||||
(`gh pr create --label full-parity`), or before the next push.
|
||||
|
||||
Horizon never downloads the game, so harnesses that compare with vanilla run only where the maintainer's own
|
||||
copy is: the Mac mini, his Linux desktop and playhorizon (below). Their runners run as the maintainer's account and keep their checkout
|
||||
copy is: the Mac mini and playhorizon (below). Their runners run as the maintainer's account and keep their checkout
|
||||
between runs (`clean: false`), so the probes build incrementally into `.local/parity-target` and earlier passes
|
||||
stand.
|
||||
|
||||
@@ -83,8 +83,9 @@ release's macOS build back. Each keeps its own checkout, `target/` and Rust inst
|
||||
`_work/horizon/shared-local` links to the first's, so they share the vanilla data, the preparations (one at a
|
||||
time, under a lock) and the parity passes and slots.
|
||||
|
||||
**The desktop's runner.** `ludodesktop-horizon` (labels `self-hosted`, `Linux`, `X64`, `ludodesktop`, and
|
||||
`horizon-game` once a full trial has passed there) runs on the maintainer's Linux desktop while nobody uses it: its
|
||||
**The desktop's runner (retired).** On 2026-10-26 the maintainer asked that CI stop using his desktop: its services are
|
||||
stopped and `ludodesktop-horizon` has no label a job asks for (only `self-hosted`, `Linux`, `X64`), so nothing waits for
|
||||
it. What follows describes it as it ran. It ran on the maintainer's Linux desktop while nobody used it: its
|
||||
screen locked, or untouched for 15 minutes (his rule, 2026-10-26). `tools/ci/linux-runner.sh install`, run there as
|
||||
him, registers it and installs two systemd user services: `horizon-runner` (the runner, in
|
||||
`~/.actions-runners/horizon`, nice 19, in `horizon-ci.slice` with CPU and I/O weight 20, half the threads (on all of
|
||||
@@ -105,12 +106,16 @@ and its failures bisect and comment on merges.
|
||||
|
||||
**playhorizon's runner.** `playhorizon-horizon` runs on a server a hosting partner lends the project (Ubuntu, 8
|
||||
AMD EPYC threads, 30 GB, in Detroit; reachable only through the maintainer's tailnet). Nobody sits at it, so the
|
||||
watcher never pauses it except by hand, and it gets the machine: `RUNNER_CPUS=7 RUNNER_MEMORY=24 RUNNER_JOBS=6`.
|
||||
watcher never pauses it except by hand. It gets half the machine: `RUNNER_MEMORY=24`, `CARGO_BUILD_JOBS` and the
|
||||
harness slots at 4, and a drop-in (`~/.config/systemd/user/horizon-runner.service.d/cpus.conf`) that starts it under
|
||||
`taskset -c 4-7`, so CPUs 0-3 stay free for benchmarks pinned there (the user slice can't set `AllowedCPUs`: systemd
|
||||
doesn't delegate the cpuset controller to it).
|
||||
Without Nix, `linux-runner.sh` takes the build libraries, the JDK, sccache, Xvfb and Mesa's software Vulkan
|
||||
(lavapipe; there is no GPU) from apt, and Python 3.13 from uv. The partner can reach the machine, so gh is not
|
||||
logged in there: the registration token comes from another machine (`RUNNER_TOKEN`), and no job with secrets may
|
||||
run there (parity has none). It is also a parity host (`playhorizon` in `tools/parity_hosts.json`, 6 jobs). Like
|
||||
the desktop's, it gets the `horizon-game` label only once a full trial has passed there.
|
||||
run there (parity has none). It is also a parity host (`playhorizon` in `tools/parity_hosts.json`, 6 jobs). Since
|
||||
2026-10-26 it has the `horizon-game` label: pull requests' parity jobs run there or on the Mac mini, and `full-parity`
|
||||
ones only there.
|
||||
|
||||
## Merging
|
||||
|
||||
@@ -218,7 +223,7 @@ How releases are numbered, and how installs from before 0.2 reach it: [versionin
|
||||
| `release-now` | Releases as soon as main's checks pass, without waiting for merges to settle |
|
||||
| `skip-release` | Doesn't trigger a release and isn't listed in the notes |
|
||||
| `run-parity` | Runs the parity job once on a fork's pull request |
|
||||
| `full-parity` | Runs the pull request's parity job on the desktop's runner only (a change every harness reaches) |
|
||||
| `full-parity` | Runs the pull request's parity job on playhorizon's runner only (a change every harness reaches) |
|
||||
| `parity-regression` | Opened by the nightly audit for a harness that fails on main |
|
||||
| `release-blocker` | On an issue: no game release is published while it is open ([One channel](#one-channel)) |
|
||||
|
||||
|
||||
@@ -44,7 +44,6 @@
|
||||
"lan_integration": "the whole lan_e2e suite: ~40 min a run on a loaded runner, and single checks flake under load; run it by name, or tools/lan_e2e.py"
|
||||
},
|
||||
"known_flaky": {
|
||||
"remote_fireball": "samples the fireball on the wall clock, so a slow host sees it in too few samples (desktop runner, 3 times on 10-26)",
|
||||
"world_reopen": "counted 4 minecarts instead of 3 once on a loaded Mac mini runner, then passed at the same head (10-26)"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user