mirror of
https://github.com/mat-1/azalea.git
synced 2025-08-02 14:26:04 +00:00
tweak pathfinder costs a bit
This commit is contained in:
parent
bffa28e706
commit
a060ffff93
2 changed files with 8 additions and 6 deletions
|
@ -3,9 +3,9 @@ use std::sync::LazyLock;
|
||||||
use num_traits::Float;
|
use num_traits::Float;
|
||||||
|
|
||||||
// based on https://github.com/cabaletta/baritone/blob/1.20.1/src/api/java/baritone/api/pathing/movement/ActionCosts.java
|
// based on https://github.com/cabaletta/baritone/blob/1.20.1/src/api/java/baritone/api/pathing/movement/ActionCosts.java
|
||||||
pub const WALK_ONE_BLOCK_COST: f32 = 20. / 4.317;
|
pub const WALK_ONE_BLOCK_COST: f32 = 20. / 4.317; // 4.633
|
||||||
pub const SPRINT_ONE_BLOCK_COST: f32 = 20. / 5.612;
|
pub const SPRINT_ONE_BLOCK_COST: f32 = 20. / 5.612; // 3.564
|
||||||
pub const FALL_ONE_BLOCK_COST: f32 = 0.5;
|
pub const FALL_ONE_BLOCK_COST: f32 = 1.;
|
||||||
pub const WALK_OFF_BLOCK_COST: f32 = WALK_ONE_BLOCK_COST * 0.8;
|
pub const WALK_OFF_BLOCK_COST: f32 = WALK_ONE_BLOCK_COST * 0.8;
|
||||||
pub const SPRINT_MULTIPLIER: f32 = SPRINT_ONE_BLOCK_COST / WALK_ONE_BLOCK_COST;
|
pub const SPRINT_MULTIPLIER: f32 = SPRINT_ONE_BLOCK_COST / WALK_ONE_BLOCK_COST;
|
||||||
pub const JUMP_PENALTY: f32 = 2.;
|
pub const JUMP_PENALTY: f32 = 2.;
|
||||||
|
@ -13,7 +13,7 @@ pub const JUMP_PENALTY: f32 = 2.;
|
||||||
pub static FALL_1_25_BLOCKS_COST: LazyLock<f32> = LazyLock::new(|| distance_to_ticks(1.25));
|
pub static FALL_1_25_BLOCKS_COST: LazyLock<f32> = LazyLock::new(|| distance_to_ticks(1.25));
|
||||||
pub static FALL_0_25_BLOCKS_COST: LazyLock<f32> = LazyLock::new(|| distance_to_ticks(0.25));
|
pub static FALL_0_25_BLOCKS_COST: LazyLock<f32> = LazyLock::new(|| distance_to_ticks(0.25));
|
||||||
pub static JUMP_ONE_BLOCK_COST: LazyLock<f32> =
|
pub static JUMP_ONE_BLOCK_COST: LazyLock<f32> =
|
||||||
LazyLock::new(|| *FALL_1_25_BLOCKS_COST - *FALL_0_25_BLOCKS_COST);
|
LazyLock::new(|| *FALL_1_25_BLOCKS_COST - *FALL_0_25_BLOCKS_COST); // 3.163
|
||||||
|
|
||||||
fn velocity(ticks: usize) -> f32 {
|
fn velocity(ticks: usize) -> f32 {
|
||||||
(0.98.powi(ticks.try_into().unwrap()) - 1.) * -3.92
|
(0.98.powi(ticks.try_into().unwrap()) - 1.) * -3.92
|
||||||
|
@ -21,7 +21,7 @@ fn velocity(ticks: usize) -> f32 {
|
||||||
|
|
||||||
fn distance_to_ticks(distance: f32) -> f32 {
|
fn distance_to_ticks(distance: f32) -> f32 {
|
||||||
if distance == 0. {
|
if distance == 0. {
|
||||||
// // Avoid 0/0 NaN
|
// Avoid 0/0 NaN
|
||||||
return 0.;
|
return 0.;
|
||||||
}
|
}
|
||||||
let mut temp_distance = distance;
|
let mut temp_distance = distance;
|
||||||
|
|
|
@ -172,7 +172,9 @@ fn descend_move(ctx: &PathfinderCtx, pos: BlockPos) -> Vec<Edge> {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
let cost = SPRINT_ONE_BLOCK_COST + FALL_ONE_BLOCK_COST * fall_distance as f32;
|
let cost = SPRINT_ONE_BLOCK_COST
|
||||||
|
+ WALK_OFF_BLOCK_COST
|
||||||
|
+ FALL_ONE_BLOCK_COST * fall_distance as f32;
|
||||||
|
|
||||||
edges.push(Edge {
|
edges.push(Edge {
|
||||||
movement: astar::Movement {
|
movement: astar::Movement {
|
||||||
|
|
Loading…
Add table
Reference in a new issue