Compare commits
9 Commits
bot-worker
...
recalculat
| Author | SHA1 | Date | |
|---|---|---|---|
| da8492d559 | |||
| 46db92acd0 | |||
| 35076f5c17 | |||
| 63395d3928 | |||
| ce47f01375 | |||
| fb14e023df | |||
| d3f84c2dbd | |||
| 5e45753756 | |||
| cfee6f119f |
32
Cargo.lock
generated
32
Cargo.lock
generated
@@ -1787,18 +1787,18 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.204"
|
||||
version = "1.0.205"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bc76f558e0cbb2a839d37354c575f1dc3fdc6546b5be373ba43d95f231bf7c12"
|
||||
checksum = "e33aedb1a7135da52b7c21791455563facbbcc43d0f0f66165b42c21b3dfb150"
|
||||
dependencies = [
|
||||
"serde_derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_derive"
|
||||
version = "1.0.204"
|
||||
version = "1.0.205"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e0cd7e117be63d3c3678776753929474f3b04a43a080c744d6b0ae2a8c28e222"
|
||||
checksum = "692d6f5ac90220161d6774db30c662202721e64aed9058d2c394f451261420c1"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@@ -1900,9 +1900,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "strafesnet_bsp_loader"
|
||||
version = "0.1.4"
|
||||
version = "0.1.5"
|
||||
source = "sparse+https://git.itzana.me/api/packages/strafesnet/cargo/"
|
||||
checksum = "b6b3e1324034abfd648e339580989f8f2c30ac2009296229349d88b8fcb4eedd"
|
||||
checksum = "35ee2c534efa039ad17ca41893ba1d75fafff014076353ac676c73fc808b9e44"
|
||||
dependencies = [
|
||||
"glam",
|
||||
"strafesnet_common",
|
||||
@@ -1912,9 +1912,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "strafesnet_common"
|
||||
version = "0.3.0"
|
||||
version = "0.4.0"
|
||||
source = "sparse+https://git.itzana.me/api/packages/strafesnet/cargo/"
|
||||
checksum = "1077d45a0b064964906a57de765a5a2bfe47b41f2f807d13b18c70765e76d3dd"
|
||||
checksum = "ea4126f6fbf9aecf89c9e319290f0221d177dcaa8659b4b9e3d82acc37829f12"
|
||||
dependencies = [
|
||||
"arrayvec",
|
||||
"bitflags 2.6.0",
|
||||
@@ -1924,9 +1924,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "strafesnet_deferred_loader"
|
||||
version = "0.3.2"
|
||||
version = "0.3.3"
|
||||
source = "sparse+https://git.itzana.me/api/packages/strafesnet/cargo/"
|
||||
checksum = "9d5ad437524fb201fd5be68f76c53dd831e81ccad4655e19e3d1ca201863b566"
|
||||
checksum = "596aba6d2747818781336ad95a1ee496e37f70052fd625a299fc7a555a6938d4"
|
||||
dependencies = [
|
||||
"lazy-regex",
|
||||
"strafesnet_common",
|
||||
@@ -1935,9 +1935,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "strafesnet_rbx_loader"
|
||||
version = "0.3.3"
|
||||
version = "0.3.4"
|
||||
source = "sparse+https://git.itzana.me/api/packages/strafesnet/cargo/"
|
||||
checksum = "3a910867e1f5ab2d9cc9c178973aee7fa029547e27465e47fea2eb99b860bb81"
|
||||
checksum = "6cd7fb0eca01ccd382067924e5fad15844f55a6bcc7c14c0e57a171298263a3e"
|
||||
dependencies = [
|
||||
"bytemuck",
|
||||
"glam",
|
||||
@@ -1952,9 +1952,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "strafesnet_snf"
|
||||
version = "0.1.3-bot"
|
||||
version = "0.1.3"
|
||||
source = "sparse+https://git.itzana.me/api/packages/strafesnet/cargo/"
|
||||
checksum = "69448a3ed6ab5e9886cf83a3b2358c1f05d652cde4839963cd867978b924b52b"
|
||||
checksum = "a9ae481152d0389be29967e1d5f0377498df8ff9638175d56cd8e2c2e6982bfa"
|
||||
dependencies = [
|
||||
"binrw 0.14.0",
|
||||
"id",
|
||||
@@ -2767,9 +2767,9 @@ checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
|
||||
|
||||
[[package]]
|
||||
name = "winit"
|
||||
version = "0.30.4"
|
||||
version = "0.30.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4225ddd8ab67b8b59a2fee4b34889ebf13c0460c1c3fa297c58e21eb87801b33"
|
||||
checksum = "0be9e76a1f1077e04a411f0b989cbd3c93339e1771cb41e71ac4aee95bfd2c67"
|
||||
dependencies = [
|
||||
"ahash",
|
||||
"android-activity",
|
||||
|
||||
@@ -23,10 +23,10 @@ id = { version = "0.1.0", registry = "strafesnet" }
|
||||
parking_lot = "0.12.1"
|
||||
pollster = "0.3.0"
|
||||
strafesnet_bsp_loader = { version = "0.1.3", registry = "strafesnet", optional = true }
|
||||
strafesnet_common = { version = "0.3.0", registry = "strafesnet" }
|
||||
strafesnet_common = { version = "0.4.0", registry = "strafesnet" }
|
||||
strafesnet_deferred_loader = { version = "0.3.1", features = ["legacy"], registry = "strafesnet", optional = true }
|
||||
strafesnet_rbx_loader = { version = "0.3.2", registry = "strafesnet", optional = true }
|
||||
strafesnet_snf = { version = "0.1.3-bot", registry = "strafesnet", optional = true }
|
||||
strafesnet_snf = { version = "0.1.2", registry = "strafesnet", optional = true }
|
||||
wgpu = "22.0.0"
|
||||
winit = "0.30.4"
|
||||
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
use strafesnet_snf::bot::BotDebug;
|
||||
|
||||
pub enum Instruction{
|
||||
//TODO: pass map id
|
||||
Create,
|
||||
//Delete,
|
||||
Push{
|
||||
ins:strafesnet_common::instruction::TimedInstruction<strafesnet_common::physics::Instruction>,
|
||||
},
|
||||
}
|
||||
|
||||
//a new worker is spawned on a thread
|
||||
//create opens a new file
|
||||
//push pushes an instruction to the file
|
||||
|
||||
pub struct Worker{
|
||||
file:BotDebug,
|
||||
}
|
||||
|
||||
fn date()->String{
|
||||
format!("/run/media/quat/Files/Documents/Strafe Client/debug_bots_v2/{}",std::time::SystemTime::UNIX_EPOCH.elapsed().unwrap().as_nanos())
|
||||
}
|
||||
|
||||
pub fn new<'a>(scope:&'a std::thread::Scope<'a,'_>)->crate::worker::QNWorker<'a,Instruction>{
|
||||
let mut worker=Worker{
|
||||
file:BotDebug::new(date()).unwrap(),
|
||||
};
|
||||
crate::worker::QNWorker::new(scope,move|instruction|{
|
||||
match instruction{
|
||||
Instruction::Create=>worker.file=BotDebug::new(date()).unwrap(),
|
||||
//Instruction::Delete=>worker.file.delete().unwrap(),
|
||||
Instruction::Push{ins}=>worker.file.push(ins).unwrap(),
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -5,7 +5,6 @@ mod worker;
|
||||
mod physics;
|
||||
mod graphics;
|
||||
mod settings;
|
||||
mod bot_worker;
|
||||
mod face_crawler;
|
||||
mod compat_worker;
|
||||
mod model_physics;
|
||||
|
||||
@@ -751,6 +751,23 @@ impl MinkowskiMesh<'_>{
|
||||
}
|
||||
best_edge.map(|e|(e.as_undirected(),best_time))
|
||||
}
|
||||
fn infinity_in(&self,infinity_body:crate::physics::Body)->Option<(MinkowskiFace,integer::Time)>{
|
||||
let infinity_fev=self.infinity_fev(-infinity_body.velocity,infinity_body.position);
|
||||
match crate::face_crawler::crawl_fev(infinity_fev,self,&infinity_body,integer::Time::MIN,infinity_body.time){
|
||||
crate::face_crawler::CrawlResult::Miss(_)=>None,
|
||||
crate::face_crawler::CrawlResult::Hit(face,time)=>Some((face,time)),
|
||||
}
|
||||
}
|
||||
pub fn is_point_in_mesh(&self,point:Planar64Vec3)->bool{
|
||||
let infinity_body=crate::physics::Body::new(point,Planar64Vec3::Y,Planar64Vec3::ZERO,integer::Time::ZERO);
|
||||
//movement must escape the mesh forwards and backwards in time,
|
||||
//otherwise the point is not inside the mesh
|
||||
self.infinity_in(infinity_body)
|
||||
.is_some_and(|_|
|
||||
self.infinity_in(-infinity_body)
|
||||
.is_some()
|
||||
)
|
||||
}
|
||||
}
|
||||
impl MeshQuery<MinkowskiFace,MinkowskiDirectedEdge,MinkowskiVert> for MinkowskiMesh<'_>{
|
||||
fn face_nd(&self,face_id:MinkowskiFace)->(Planar64Vec3,Planar64){
|
||||
|
||||
948
src/physics.rs
948
src/physics.rs
File diff suppressed because it is too large
Load Diff
@@ -32,33 +32,29 @@ pub enum Instruction{
|
||||
mod mouse_interpolator{
|
||||
use super::*;
|
||||
//TODO: move this or tab
|
||||
pub struct MouseInterpolator<'a>{
|
||||
pub struct MouseInterpolator{
|
||||
//"PlayerController"
|
||||
user_settings:crate::settings::UserSettings,
|
||||
//"MouseInterpolator"
|
||||
timeline:std::collections::VecDeque<TimedInstruction<PhysicsInputInstruction>>,
|
||||
last_mouse_time:Time,//this value is pre-transformed to simulation time
|
||||
mouse_blocking:bool,
|
||||
//????
|
||||
bot_worker:crate::worker::QNWorker<'a,crate::bot_worker::Instruction>,
|
||||
//"Simulation"
|
||||
timer:Timer<Scaled>,
|
||||
physics:crate::physics::PhysicsContext,
|
||||
|
||||
}
|
||||
impl MouseInterpolator<'_>{
|
||||
pub fn new<'a>(
|
||||
impl MouseInterpolator{
|
||||
pub fn new(
|
||||
physics:crate::physics::PhysicsContext,
|
||||
bot_worker:crate::worker::QNWorker<'a,crate::bot_worker::Instruction>,
|
||||
user_settings:crate::settings::UserSettings,
|
||||
)->MouseInterpolator<'a>{
|
||||
)->MouseInterpolator{
|
||||
MouseInterpolator{
|
||||
mouse_blocking:true,
|
||||
last_mouse_time:physics.get_next_mouse().time,
|
||||
timeline:std::collections::VecDeque::new(),
|
||||
timer:Timer::from_state(Scaled::identity(),false),
|
||||
physics,
|
||||
bot_worker,
|
||||
user_settings,
|
||||
}
|
||||
}
|
||||
@@ -175,13 +171,6 @@ impl MouseInterpolator<'_>{
|
||||
}
|
||||
fn empty_queue(&mut self){
|
||||
while let Some(instruction)=self.timeline.pop_front(){
|
||||
//makeshift clone because requiring all TimedInstructions to be Clone is troublesome
|
||||
self.bot_worker.send(crate::bot_worker::Instruction::Push{
|
||||
ins:TimedInstruction{
|
||||
time:instruction.time,
|
||||
instruction:instruction.instruction.clone(),
|
||||
}
|
||||
}).unwrap();
|
||||
self.physics.run_input_instruction(instruction);
|
||||
}
|
||||
}
|
||||
@@ -222,12 +211,10 @@ impl MouseInterpolator<'_>{
|
||||
pub fn new<'a>(
|
||||
mut graphics_worker:crate::compat_worker::INWorker<'a,crate::graphics_worker::Instruction>,
|
||||
user_settings:crate::settings::UserSettings,
|
||||
bot_worker:crate::worker::QNWorker<'a,crate::bot_worker::Instruction>,
|
||||
)->crate::compat_worker::QNWorker<'a,TimedInstruction<Instruction>>{
|
||||
let physics=crate::physics::PhysicsContext::default();
|
||||
let mut interpolator=MouseInterpolator::new(
|
||||
physics,
|
||||
bot_worker,
|
||||
user_settings
|
||||
);
|
||||
crate::compat_worker::QNWorker::new(move |ins:TimedInstruction<Instruction>|{
|
||||
|
||||
@@ -213,13 +213,10 @@ pub fn setup_and_start(title:String){
|
||||
|
||||
//dedicated thread to ping request redraw back and resize the window doesn't seem logical
|
||||
|
||||
std::thread::scope(|scope|{
|
||||
//TODO: TAB
|
||||
//the thread that spawns the physics thread
|
||||
let mut window_thread=crate::window::worker(
|
||||
&window,
|
||||
setup_context,
|
||||
scope
|
||||
);
|
||||
|
||||
if let Some(arg)=std::env::args().nth(1){
|
||||
@@ -233,7 +230,6 @@ pub fn setup_and_start(title:String){
|
||||
println!("Entering event loop...");
|
||||
let root_time=std::time::Instant::now();
|
||||
run_event_loop(event_loop,window_thread,root_time).unwrap();
|
||||
});
|
||||
}
|
||||
|
||||
fn run_event_loop(
|
||||
|
||||
@@ -168,7 +168,6 @@ impl WindowContext<'_>{
|
||||
pub fn worker<'a>(
|
||||
window:&'a winit::window::Window,
|
||||
setup_context:crate::setup::SetupContext<'a>,
|
||||
scope:&'a std::thread::Scope<'a,'_>,
|
||||
)->crate::compat_worker::QNWorker<'a,TimedInstruction<WindowInstruction>>{
|
||||
// WindowContextSetup::new
|
||||
let user_settings=crate::settings::read_user_settings();
|
||||
@@ -179,8 +178,6 @@ pub fn worker<'a>(
|
||||
//WindowContextSetup::into_context
|
||||
let screen_size=glam::uvec2(setup_context.config.width,setup_context.config.height);
|
||||
let graphics_thread=crate::graphics_worker::new(graphics,setup_context.config,setup_context.surface,setup_context.device,setup_context.queue);
|
||||
//this obviously doesn't belong here, do something about it pls
|
||||
let bot_thread=crate::bot_worker::new(scope);
|
||||
let mut window_context=WindowContext{
|
||||
manual_mouse_lock:false,
|
||||
mouse:strafesnet_common::mouse::MouseState::default(),
|
||||
@@ -190,7 +187,6 @@ pub fn worker<'a>(
|
||||
physics_thread:crate::physics_worker::new(
|
||||
graphics_thread,
|
||||
user_settings,
|
||||
bot_thread,
|
||||
),
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user