diff --git a/Cargo.lock b/Cargo.lock index fb9dc22..a8e57fe 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2432,6 +2432,7 @@ name = "dorf" version = "0.1.0" dependencies = [ "ahash", + "arrayvec", "bevy", "bevy_platform", "bevy_rand", diff --git a/Cargo.toml b/Cargo.toml index 1f33281..19ee719 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,6 +17,7 @@ rustc-hash = "2.1.1" ahash = "0.8.12" nohash-hasher = "0.2.0" futures-lite = "2.6.1" +arrayvec = "0.7.6" [build-dependencies] image = "0.25.10" diff --git a/assets/tileset.png b/assets/tileset.png index 6130ddc..36274f6 100644 Binary files a/assets/tileset.png and b/assets/tileset.png differ diff --git a/config.toml b/config.toml index 419b4cd..0acfd90 100644 --- a/config.toml +++ b/config.toml @@ -1,4 +1,4 @@ -initial_chunk_radius = 15 +initial_chunk_radius = 8 [display] vsync = "mailbox" diff --git a/entity_dump_9.52.csv b/entity_dump_9.52.csv new file mode 100644 index 0000000..a028003 --- /dev/null +++ b/entity_dump_9.52.csv @@ -0,0 +1,61 @@ +timestamp,entity_id,x,y,z,has_path,path_index,path_len,target_x,target_y,target_z +9.523,14600,-16.0,32.0,0.0,true,0,56,816.0,-816.0,33.0 +9.523,14601,-0.0,32.0,0.0,true,0,60,640.0,-848.0,33.0 +9.523,14602,-16.0,0.0,0.0,true,0,38,-608.0,-144.0,17.0 +9.523,14603,0.0,-0.0,0.0,true,0,61,960.0,256.0,-15.0 +9.523,14604,16.0,-32.0,16.0,true,0,10,752.0,48.0,17.0 +9.523,14599,16.0,-16.0,16.0,true,0,46,-496.0,704.0,-15.0 +9.523,14598,-32.0,16.0,0.0,true,0,62,-832.0,800.0,-31.0 +9.523,14547,0.0,0.0,0.0,true,0,53,832.0,336.0,1.0 +9.523,14548,0.0,-0.0,0.0,true,0,55,848.0,-752.0,33.0 +9.523,14549,0.0,0.0,0.0,true,0,30,-96.0,464.0,-15.0 +9.523,14550,0.0,-0.0,0.0,true,0,52,816.0,512.0,17.0 +9.523,14551,0.0,-0.0,0.0,true,0,46,720.0,464.0,17.0 +9.523,14552,-0.0,0.0,0.0,true,0,49,768.0,-128.0,33.0 +9.523,14553,0.0,0.0,0.0,true,0,42,656.0,-400.0,49.0 +9.523,14554,-0.0,0.0,0.0,true,0,34,-512.0,-416.0,49.0 +9.523,14555,-0.0,-0.0,0.0,true,0,49,144.0,768.0,17.0 +9.523,14597,16.0,16.0,0.0,true,0,58,-256.0,928.0,-15.0 +9.523,14557,0.0,0.0,0.0,true,0,40,624.0,160.0,1.0 +9.523,14558,-0.0,0.0,0.0,true,0,44,96.0,688.0,17.0 +9.523,14559,0.0,-0.0,0.0,true,0,61,352.0,960.0,33.0 +9.523,14560,0.0,0.0,0.0,true,0,46,-704.0,-352.0,33.0 +9.523,14561,-0.0,-0.0,0.0,true,0,31,480.0,80.0,1.0 +9.523,14562,0.0,0.0,0.0,true,0,46,-272.0,-720.0,65.0 +9.523,14563,-0.0,-0.0,0.0,true,0,41,640.0,64.0,1.0 +9.523,14564,-0.0,0.0,0.0,true,0,43,672.0,176.0,1.0 +9.523,14565,0.0,0.0,0.0,true,0,54,-64.0,-848.0,49.0 +9.523,14566,-0.0,-0.0,0.0,true,0,51,-640.0,-768.0,49.0 +9.523,14596,-16.0,0.0,0.0,true,0,41,-512.0,-592.0,49.0 +9.523,14568,0.0,0.0,0.0,true,0,32,224.0,-464.0,33.0 +9.523,14569,0.0,-0.0,0.0,true,0,52,-656.0,784.0,-15.0 +9.523,14570,-0.0,-0.0,0.0,true,0,33,-512.0,256.0,-31.0 +9.523,14571,-0.0,0.0,0.0,true,0,49,176.0,-768.0,33.0 +9.523,14572,-0.0,-0.0,0.0,true,0,40,-272.0,-624.0,49.0 +9.523,14573,-0.0,0.0,0.0,true,0,61,960.0,336.0,1.0 +9.523,14595,-16.0,32.0,0.0,true,0,54,288.0,-816.0,17.0 +9.523,14575,0.0,-0.0,0.0,true,0,31,336.0,464.0,17.0 +9.523,14576,0.0,0.0,0.0,true,0,63,992.0,-64.0,1.0 +9.523,14577,-0.0,-0.0,0.0,true,0,47,-736.0,-112.0,17.0 +9.523,14578,-0.0,-0.0,0.0,true,0,58,368.0,896.0,33.0 +9.523,14579,0.0,0.0,0.0,true,0,40,-464.0,512.0,-15.0 +9.523,14580,-0.0,-0.0,0.0,true,0,42,-288.0,-656.0,65.0 +9.523,14581,0.0,-0.0,0.0,true,0,47,128.0,736.0,17.0 +9.523,14582,0.0,0.0,0.0,true,0,47,736.0,-400.0,49.0 +9.523,14583,-0.0,0.0,0.0,true,0,45,-368.0,-704.0,65.0 +9.523,14594,0.0,0.0,0.0,true,0,40,-464.0,512.0,-15.0 +9.523,14585,0.0,0.0,0.0,true,0,56,-880.0,336.0,-15.0 +9.523,14586,0.0,-0.0,0.0,true,0,64,784.0,992.0,17.0 +9.523,14587,0.0,0.0,0.0,true,0,64,896.0,-512.0,49.0 +9.523,14588,0.0,-0.0,0.0,true,0,30,-464.0,288.0,-31.0 +9.523,14592,0.0,0.0,0.0,true,0,50,48.0,-784.0,33.0 +9.523,14590,0.0,0.0,0.0,true,0,44,688.0,-224.0,49.0 +9.523,14591,-0.0,-0.0,0.0,true,0,46,-720.0,448.0,-31.0 +9.523,14545,0.0,-0.0,0.0,true,0,20,80.0,-304.0,33.0 +9.523,14546,0.0,0.0,0.0,true,0,5,368.0,576.0,17.0 +9.523,14556,0.0,0.0,0.0,true,0,9,640.0,576.0,17.0 +9.523,14567,0.0,-0.0,0.0,true,0,13,-528.0,-96.0,17.0 +9.523,14574,0.0,0.0,0.0,true,0,13,-640.0,64.0,1.0 +9.523,14584,0.0,0.0,0.0,true,0,13,-864.0,0.0,1.0 +9.523,14589,-0.0,-0.0,0.0,true,0,19,-112.0,-288.0,33.0 +9.523,14593,-0.0,-0.0,0.0,true,0,10,528.0,-32.0,17.0 diff --git a/full.patch b/full.patch new file mode 100644 index 0000000..ef294dd --- /dev/null +++ b/full.patch @@ -0,0 +1,1423 @@ +diff --git a/Cargo.lock b/Cargo.lock +index fb9dc22..a8e57fe 100644 +--- a/Cargo.lock ++++ b/Cargo.lock +@@ -2432,6 +2432,7 @@ name = "dorf" + version = "0.1.0" + dependencies = [ + "ahash", ++ "arrayvec", + "bevy", + "bevy_platform", + "bevy_rand", +diff --git a/Cargo.toml b/Cargo.toml +index 1f33281..19ee719 100644 +--- a/Cargo.toml ++++ b/Cargo.toml +@@ -17,6 +17,7 @@ rustc-hash = "2.1.1" + ahash = "0.8.12" + nohash-hasher = "0.2.0" + futures-lite = "2.6.1" ++arrayvec = "0.7.6" + + [build-dependencies] + image = "0.25.10" +diff --git a/assets/tileset.png b/assets/tileset.png +index 6130ddc..36274f6 100644 +Binary files a/assets/tileset.png and b/assets/tileset.png differ +diff --git a/config.toml b/config.toml +index 419b4cd..da69d4f 100644 +--- a/config.toml ++++ b/config.toml +@@ -1,9 +1,9 @@ +-initial_chunk_radius = 15 ++initial_chunk_radius = 8 + + [display] + vsync = "mailbox" + + [spawn_counts] +-dorfs = 5 ++dorfs = 50 + pigs = 5 + rabbits = 5 +\ No newline at end of file +diff --git a/full.patch b/full.patch +new file mode 100644 +index 0000000..e69de29 +diff --git a/src/constants.rs b/src/constants.rs +index 5025d11..83a29b1 100644 +--- a/src/constants.rs ++++ b/src/constants.rs +@@ -5,16 +5,11 @@ pub const ITILE_SIZE: i32 = TILE_SIZE as i32; + pub const SEED: u32 = 420; + + pub const PATHFINDER_SHORT_PATH_MAX_TILES: i32 = 64; +-pub const PATHFINDER_MAX_NODES: usize = 5000; +-pub const PATHFINDER_WAYPOINT_THRESHOLD_TILES: i32 = 100; +-pub const PATHFINDER_PROVISIONAL_NODE_LIMIT: usize = 64; ++pub const PATHFINDER_MAX_NODES: usize = 15000; ++pub const PATHFINDER_PROVISIONAL_NODE_LIMIT: usize = 256; + + // Hierarchical pathfinding thresholds + // Tier 1: Same/adjacent chunk -> sync A* (fast, ~87µs) + // Tier 2: 2-4 chunks away -> Provisional + full path via queue + // Tier 3: >4 chunks away -> Hierarchical chunk-path + async segmented A* + pub const PATHFINDER_HIERARCHICAL_THRESHOLD_CHUNKS: i32 = 4; +-pub const PATHFINDER_ASYNC_NODE_BUDGET_PER_FRAME: usize = 2000; +- +-// Snapshot bounds for async pathfinding (in chunks) +-pub const PATHFINDER_SNAPSHOT_CHUNK_RADIUS: i32 = 2; +diff --git a/src/debug/entity_dump.rs b/src/debug/entity_dump.rs +new file mode 100644 +index 0000000..b79403a +--- /dev/null ++++ b/src/debug/entity_dump.rs +@@ -0,0 +1,74 @@ ++use bevy::prelude::*; ++use std::fs::OpenOptions; ++use std::io::Write; ++ ++use crate::entities::shared_components::Ambulatory; ++ ++pub fn dump_entity_positions( ++ keys: Res>, ++ time: Res