Compare commits

..

17 Commits

Author SHA1 Message Date
96eb23d66b test resimulation 2024-08-05 18:43:27 -07:00
6e206f4207 fix sensitivity 2024-08-05 18:43:11 -07:00
c485c02b05 this doesn't need to be option 2024-08-05 17:25:11 -07:00
af478bce28 the mistake 2024-08-05 17:13:12 -07:00
a3ac815e45 leave tabs alone to make diffs legible 2024-08-05 17:08:43 -07:00
78cf5e155e yeah 2024-08-05 16:53:21 -07:00
26b286af31 wip 2024-08-05 16:23:11 -07:00
ad78fd22be move mouse state 2024-08-05 16:23:02 -07:00
3d0643e7cf level up 2024-08-05 16:15:25 -07:00
78d7af70a3 wip 2024-08-05 14:52:17 -07:00
b27ad3473e wip 2024-08-05 13:35:59 -07:00
0985661e45 move mouse and physics types to common 2024-08-05 13:35:54 -07:00
eb99ea3707 the api 2024-08-05 13:35:27 -07:00
8d4db7e654 move physics types to common 2024-08-02 13:47:02 -07:00
4eccd27237 this is how 2024-08-02 12:57:39 -07:00
a54836a9cb testing test 2024-08-02 12:14:26 -07:00
d3bede8b1c wip bot worker 2024-08-02 11:15:07 -07:00
8 changed files with 173 additions and 159 deletions

82
Cargo.lock generated

@ -28,7 +28,7 @@ dependencies = [
"getrandom",
"once_cell",
"version_check",
"zerocopy",
"zerocopy 0.7.35",
]
[[package]]
@ -326,9 +326,9 @@ dependencies = [
[[package]]
name = "cc"
version = "1.1.8"
version = "1.1.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "504bdec147f2cc13c8b57ed9401fd8a147cc66b67ad5cb241394244f2c947549"
checksum = "26a5c3fd7bfa1ce3897a3a3501d362b2d87b7f2583ebcb4a949ec25911025cbc"
dependencies = [
"jobserver",
"libc",
@ -1460,11 +1460,11 @@ checksum = "22686f4785f02a4fcc856d3b3bb19bf6c8160d103f7a99cc258bddd0251dc7f2"
[[package]]
name = "ppv-lite86"
version = "0.2.20"
version = "0.2.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "77957b295656769bb8ad2b6a6b09d897d94f05c41b069aede1fcdaa675eaea04"
checksum = "dee4364d9f3b902ef14fab8a1ddffb783a1cb6b4bba3bfc1fa3922732c7de97f"
dependencies = [
"zerocopy",
"zerocopy 0.6.6",
]
[[package]]
@ -1880,7 +1880,7 @@ checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
[[package]]
name = "strafe-client"
version = "0.10.3"
version = "0.10.2"
dependencies = [
"bytemuck",
"configparser",
@ -1900,9 +1900,9 @@ dependencies = [
[[package]]
name = "strafesnet_bsp_loader"
version = "0.1.4"
version = "0.1.3"
source = "sparse+https://git.itzana.me/api/packages/strafesnet/cargo/"
checksum = "b6b3e1324034abfd648e339580989f8f2c30ac2009296229349d88b8fcb4eedd"
checksum = "6d4af68c422b5f57febbaa218f44ba02d413fd25e84afff9e45e557a8caee2ce"
dependencies = [
"glam",
"strafesnet_common",
@ -1912,11 +1912,10 @@ dependencies = [
[[package]]
name = "strafesnet_common"
version = "0.3.0"
version = "0.2.2"
source = "sparse+https://git.itzana.me/api/packages/strafesnet/cargo/"
checksum = "1077d45a0b064964906a57de765a5a2bfe47b41f2f807d13b18c70765e76d3dd"
checksum = "8d5459f1862aa23c514a6331e8b65cdee1d18b340d003ae03ebbfaa34c82e614"
dependencies = [
"arrayvec",
"bitflags 2.6.0",
"glam",
"id",
@ -1924,9 +1923,9 @@ dependencies = [
[[package]]
name = "strafesnet_deferred_loader"
version = "0.3.2"
version = "0.3.1"
source = "sparse+https://git.itzana.me/api/packages/strafesnet/cargo/"
checksum = "9d5ad437524fb201fd5be68f76c53dd831e81ccad4655e19e3d1ca201863b566"
checksum = "c3891dcbdbc20b03cf561786b810e839ae7c11dd8810fd005f2474805ee9cccc"
dependencies = [
"lazy-regex",
"strafesnet_common",
@ -1935,9 +1934,9 @@ dependencies = [
[[package]]
name = "strafesnet_rbx_loader"
version = "0.3.3"
version = "0.3.2"
source = "sparse+https://git.itzana.me/api/packages/strafesnet/cargo/"
checksum = "3a910867e1f5ab2d9cc9c178973aee7fa029547e27465e47fea2eb99b860bb81"
checksum = "21ea93b0170063dd2a063a138c41e6f7a6c14a82c6553fa4ba32df65a26efc6e"
dependencies = [
"bytemuck",
"glam",
@ -1952,9 +1951,9 @@ dependencies = [
[[package]]
name = "strafesnet_snf"
version = "0.1.3-bot"
version = "0.1.1"
source = "sparse+https://git.itzana.me/api/packages/strafesnet/cargo/"
checksum = "69448a3ed6ab5e9886cf83a3b2358c1f05d652cde4839963cd867978b924b52b"
checksum = "78479f73437a3f10230efd2304be0f3ef30dff98c54d93613ed1621bfd6a7da6"
dependencies = [
"binrw 0.14.0",
"id",
@ -2104,9 +2103,9 @@ dependencies = [
[[package]]
name = "ttf-parser"
version = "0.24.1"
version = "0.24.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5be21190ff5d38e8b4a2d3b6a3ae57f612cc39c96e83cedeaf7abc338a8bac4a"
checksum = "8686b91785aff82828ed725225925b33b4fde44c4bb15876e5f7c832724c420a"
[[package]]
name = "unicode-ident"
@ -2528,11 +2527,11 @@ checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
[[package]]
name = "winapi-util"
version = "0.1.9"
version = "0.1.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb"
checksum = "4d4cc384e1e73b93bafa6fb4f1df8c41695c8a91cf9c4c64358067d15a7b6c6b"
dependencies = [
"windows-sys 0.59.0",
"windows-sys 0.52.0",
]
[[package]]
@ -2578,15 +2577,6 @@ dependencies = [
"windows-targets 0.52.6",
]
[[package]]
name = "windows-sys"
version = "0.59.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b"
dependencies = [
"windows-targets 0.52.6",
]
[[package]]
name = "windows-targets"
version = "0.42.2"
@ -2885,9 +2875,19 @@ checksum = "b9cc00251562a284751c9973bace760d86c0276c471b4be569fe6b068ee97a56"
[[package]]
name = "xml-rs"
version = "0.8.21"
version = "0.8.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "539a77ee7c0de333dcc6da69b177380a0b81e0dacfa4f7344c465a36871ee601"
checksum = "791978798f0597cfc70478424c2b4fdc2b7a8024aaff78497ef00f24ef674193"
[[package]]
name = "zerocopy"
version = "0.6.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "854e949ac82d619ee9a14c66a1b674ac730422372ccb759ce0c39cabcf2bf8e6"
dependencies = [
"byteorder 1.5.0",
"zerocopy-derive 0.6.6",
]
[[package]]
name = "zerocopy"
@ -2895,8 +2895,18 @@ version = "0.7.35"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0"
dependencies = [
"byteorder 1.5.0",
"zerocopy-derive",
"zerocopy-derive 0.7.35",
]
[[package]]
name = "zerocopy-derive"
version = "0.6.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "125139de3f6b9d625c39e2efdd73d41bdac468ccd556556440e322be0e1bbd91"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.72",
]
[[package]]

@ -1,6 +1,6 @@
[package]
name = "strafe-client"
version = "0.10.3"
version = "0.10.2"
edition = "2021"
repository = "https://git.itzana.me/StrafesNET/strafe-client"
license = "Custom"
@ -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.2.1", 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.0", registry = "strafesnet", optional = true }
wgpu = "22.0.0"
winit = "0.30.4"

31
src/bot_worker.rs Normal file

@ -0,0 +1,31 @@
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,
}
pub fn new<'a>(scope:&'a std::thread::Scope<'a,'_>)->crate::worker::QNWorker<'a,Instruction>{
let mut worker=Worker{
file:BotDebug::new().unwrap(),
};
crate::worker::QNWorker::new(scope,move|instruction|{
match instruction{
Instruction::Create=>worker.file=BotDebug::new().unwrap(),
//Instruction::Delete=>worker.file.delete().unwrap(),
Instruction::Push{ins}=>worker.file.push(ins).unwrap(),
}
})
}

@ -5,6 +5,7 @@ mod worker;
mod physics;
mod graphics;
mod settings;
mod bot_worker;
mod face_crawler;
mod compat_worker;
mod model_physics;

@ -1124,16 +1124,15 @@ impl PhysicsContext{
let mut aabb=aabb::Aabb::default();
state.body.grow_aabb(&mut aabb,state.time,collector.time());
aabb.inflate(data.hitbox_mesh.halfsize);
//relative to moving platforms
//let relative_body=&VirtualBody::relative(&Body::default(),&state.body).body(state.time);
let relative_body=&state.body;
//common body
let relative_body=VirtualBody::relative(&Body::default(),&state.body).body(state.time);
data.bvh.the_tester(&aabb,&mut |&convex_mesh_id|{
//no checks are needed because of the time limits.
let model_mesh=data.models.mesh(convex_mesh_id);
let minkowski=model_physics::MinkowskiMesh::minkowski_sum(model_mesh,data.hitbox_mesh.transformed_mesh());
collector.collect(minkowski.predict_collision_in(relative_body,collector.time())
collector.collect(minkowski.predict_collision_in(&relative_body,collector.time())
//temp (?) code to avoid collision loops
.map_or(None,|(face,time)|if time<=state.time{None}else{Some((face,time))})
.map_or(None,|(face,time)|if time==state.time{None}else{Some((face,time))})
.map(|(face,time)|{
TimedInstruction{time,instruction:PhysicsInternalInstruction::CollisionStart(match data.models.attr(convex_mesh_id.model_id){
PhysicsCollisionAttributes::Contact{contacting:_,general:_}=>Collision::Contact(ContactCollision{convex_mesh_id,face_id:face}),
@ -1272,7 +1271,6 @@ fn run_teleport_behaviour(wormhole:&Option<gameplay_attributes::Wormhole>,models
}
fn atomic_internal_instruction(state:&mut PhysicsState,data:&PhysicsData,ins:TimedInstruction<PhysicsInternalInstruction>){
state.time=ins.time;
let should_advance_body=match ins.instruction{
PhysicsInternalInstruction::CollisionStart(_)
|PhysicsInternalInstruction::CollisionEnd(_)
@ -1326,10 +1324,25 @@ fn atomic_internal_instruction(state:&mut PhysicsState,data:&PhysicsData,ins:Tim
if let Some(mode)=data.modes.get_mode(state.mode_state.get_mode_id()){
run_teleport_behaviour(&general.wormhole,&data.models,mode,&state.style,&data.hitbox_mesh,&mut state.mode_state,&mut state.touching,&mut state.body,convex_mesh_id);
}
match &general.booster{
Some(booster)=>{
//DELETE THIS when boosters get converted to height machines
match booster{
//&gameplay_attributes::Booster::Affine(transform)=>v=transform.transform_point3(v),
&gameplay_attributes::Booster::Velocity(velocity)=>{
let boosted_velocity=state.body.velocity+velocity;
//fall through boosters
state.cull_velocity(data,boosted_velocity);
},
&gameplay_attributes::Booster::Energy{direction: _,energy: _}=>todo!(),
}
},
None=>(),
}
if state.style.get_control(Controls::Jump,state.input_state.controls){
if let (Some(jump_settings),Some(walk_state))=(&state.style.jump,state.move_state.get_walk_state()){
let jump_dir=walk_state.jump_direction.direction(&data.models,&data.hitbox_mesh,&walk_state.contact);
let jumped_velocity=jump_settings.jumped_velocity(&state.style,jump_dir,state.body.velocity,general.booster.as_ref());
let jumped_velocity=jump_settings.jumped_velocity(&state.style,jump_dir,state.body.velocity);
state.cull_velocity(data,jumped_velocity);
}
}
@ -1355,10 +1368,6 @@ fn atomic_internal_instruction(state:&mut PhysicsState,data:&PhysicsData,ins:Tim
(PhysicsCollisionAttributes::Intersect{intersecting:_,general},Collision::Intersect(_intersect))=>{
//I think that setting the velocity to 0 was preventing surface contacts from entering an infinite loop
state.touching.insert(collision);
//insta booster!
if let Some(booster)=&general.booster{
state.cull_velocity(data,booster.boost(state.body.velocity));
}
if let Some(mode)=data.modes.get_mode(state.mode_state.get_mode_id()){
let zone=mode.get_zone(convex_mesh_id.model_id.into());
match zone{
@ -1460,7 +1469,6 @@ fn atomic_internal_instruction(state:&mut PhysicsState,data:&PhysicsData,ins:Tim
}
fn atomic_input_instruction(state:&mut PhysicsState,data:&PhysicsData,ins:TimedInstruction<PhysicsInputInstruction>){
state.time=ins.time;
let should_advance_body=match ins.instruction{
//the body may as well be a quantum wave function
//as far as these instruction are concerned (they don't care where it is)
@ -1517,11 +1525,7 @@ fn atomic_input_instruction(state:&mut PhysicsState,data:&PhysicsData,ins:TimedI
if let Some(walk_state)=state.move_state.get_walk_state(){
if let Some(jump_settings)=&state.style.jump{
let jump_dir=walk_state.jump_direction.direction(&data.models,&data.hitbox_mesh,&walk_state.contact);
let booster_option=match data.models.attr(walk_state.contact.convex_mesh_id.model_id){
PhysicsCollisionAttributes::Contact{contacting:_,general}=>general.booster.as_ref(),
PhysicsCollisionAttributes::Intersect{..}=>None,
};
let jumped_velocity=jump_settings.jumped_velocity(&state.style,jump_dir,state.body.velocity,booster_option);
let jumped_velocity=jump_settings.jumped_velocity(&state.style,jump_dir,state.body.velocity);
state.cull_velocity(&data,jumped_velocity);
}
}
@ -1589,9 +1593,8 @@ fn atomic_input_instruction(state:&mut PhysicsState,data:&PhysicsData,ins:TimedI
if ins.time<state.time{
println!("@@@@ Time travel warning! {:?}",ins);
}
//idle is special, it is specifically a no-op to get Internal events to catch up to real time
state.time=ins.time;
match ins.instruction{
PhysicsInstruction::Input(PhysicsInputInstruction::Idle)=>(),
PhysicsInstruction::Internal(instruction)=>atomic_internal_instruction(state,data,TimedInstruction{time:ins.time,instruction}),
PhysicsInstruction::Input(instruction)=>atomic_input_instruction(state,data,TimedInstruction{time:ins.time,instruction}),
}
@ -1811,4 +1814,38 @@ mod test{
Time::ZERO
),None);
}
fn simulate(map:&str,bot:&str){
//create physics
let mut physics=PhysicsContext::default();
//load map
let map_file=std::fs::File::open(format!("/run/media/quat/Files/Documents/map-files/verify-scripts/maps/bhop_snfm/{map}.snfm")).unwrap();
let map=strafesnet_snf::read_map(map_file).unwrap().into_complete_map().unwrap();
physics.generate_models(&map);
//load bot
let bot_file=std::fs::File::open(format!("/home/quat/strafesnet/strafe-client/tools/debug_bots/{bot}")).unwrap();
let instructions=strafesnet_snf::bot::read_bot_debug(bot_file).unwrap();
//run bot on physics
for ins in instructions{
physics.run_input_instruction(ins);
}
}
#[test]
fn simulate_bot_1(){
simulate("5692113331","ff4940efb50f724e48eb54ce3593d88f")
}
#[test]
fn simulate_bot_2(){
simulate("5692113331","17cf70412eba16d172a67385cab5727e")
}
#[test]
fn simulate_bot_3(){
simulate("5692176057","f0fe0dc2fda5f8b59a658e82d26fc69")
}
#[test]
fn simulate_bot_4(){
simulate("5692176057","c0631c6f524eebddbf75237cac48e78e")
}
}

@ -32,29 +32,32 @@ pub enum Instruction{
mod mouse_interpolator{
use super::*;
//TODO: move this or tab
pub struct MouseInterpolator{
pub struct MouseInterpolator<'a>{
//"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>,
user_settings:crate::settings::UserSettings,
//"Simulation"
timer:Timer<Scaled>,
physics:crate::physics::PhysicsContext,
}
impl MouseInterpolator{
pub fn new(
impl MouseInterpolator<'_>{
pub fn new<'a>(
physics:crate::physics::PhysicsContext,
bot_worker:crate::worker::QNWorker<'a,crate::bot_worker::Instruction>,
user_settings:crate::settings::UserSettings,
)->MouseInterpolator{
)->MouseInterpolator<'a>{
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,
}
}
@ -171,6 +174,13 @@ 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);
}
}
@ -208,83 +218,13 @@ impl MouseInterpolator{
}
}
struct PlayBacker{
//Instructions
timeline:std::collections::VecDeque<TimedInstruction<PhysicsInputInstruction>>,
//"Simulation"
timer:Timer<Scaled>,
physics:crate::physics::PhysicsContext,
}
impl PlayBacker{
pub fn new(
physics:crate::physics::PhysicsContext,
timeline:std::collections::VecDeque<TimedInstruction<PhysicsInputInstruction>>,
)->Self{
Self{
timeline,
timer:Timer::from_state(Scaled::identity(),false),
physics,
}
}
fn run(&mut self,time:Time){
//all this does is advance the simulation to the instruction's timestamp
let simulation_time=self.timer.time(time);
while let Some(ins)=self.timeline.get(0){
if ins.time<simulation_time{
//run that sucker
let ins=self.timeline.pop_front().unwrap();
self.physics.run_input_instruction(ins);
}else{
break;
}
}
}
pub fn handle_instruction(&mut self,TimedInstruction{time,instruction}:&TimedInstruction<Instruction>){
//match the instruction so the playback is pausable :D
match instruction{
&Instruction::SetPaused(paused)=>{
let _=self.timer.set_paused(*time,paused);
},
_=>(),
}
self.run(*time);
//idle the physics to allow any internal events to run (collisions mostly)
self.physics.run_input_instruction(TimedInstruction{
time:self.timer.time(*time),
instruction:PhysicsInputInstruction::Idle,
});
}
pub fn get_render_stuff(&self,time:Time)->(crate::physics::PhysicsOutputState,Time,glam::IVec2){
(self.physics.output(),self.timer.time(time),self.physics.get_next_mouse().pos)
}
pub fn user_settings(&self)->crate::settings::UserSettings{
//oof, settings ignored
crate::settings::UserSettings::default()
}
pub fn change_map(&mut self,time:Time,map:&strafesnet_common::map::CompleteMap){
self.run(time);
self.physics.generate_models(&map);
}
}
pub fn new<'a>(
mut graphics_worker:crate::compat_worker::INWorker<'a,crate::graphics_worker::Instruction>,
bot_worker:crate::worker::QNWorker<'a,crate::bot_worker::Instruction>,
user_settings:crate::settings::UserSettings,
)->crate::compat_worker::QNWorker<'a,TimedInstruction<Instruction>>{
let physics=crate::physics::PhysicsContext::default();
/*
let mut interpolator=MouseInterpolator::new(
physics,
user_settings
);
*/
//load bot
let bot_file=std::fs::File::open(format!("/run/media/quat/Files/Documents/Strafe Client/debug_bots_v2/1723150291506606436")).unwrap();
let instructions=strafesnet_snf::bot::read_bot_debug(bot_file).unwrap();
let mut interpolator=PlayBacker::new(
physics,
instructions.into(),
);
let mut interpolator=MouseInterpolator::new(physics,bot_worker,user_settings);
crate::compat_worker::QNWorker::new(move |ins:TimedInstruction<Instruction>|{
interpolator.handle_instruction(&ins);
match ins.instruction{

@ -213,23 +213,22 @@ pub fn setup_and_start(title:String){
//dedicated thread to ping request redraw back and resize the window doesn't seem logical
//the thread that spawns the physics thread
let mut window_thread=crate::window::worker(
&window,
setup_context,
);
std::thread::scope(|scope|{
//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){
let path=std::path::PathBuf::from(arg);
window_thread.send(TimedInstruction{
time:integer::Time::ZERO,
instruction:WindowInstruction::WindowEvent(winit::event::WindowEvent::DroppedFile(path)),
}).unwrap();
};
if let Some(arg)=std::env::args().nth(1){
let path=std::path::PathBuf::from(arg);
window_thread.send(TimedInstruction{
time:integer::Time::ZERO,
instruction:WindowInstruction::WindowEvent(winit::event::WindowEvent::DroppedFile(path)),
}).unwrap();
};
println!("Entering event loop...");
let root_time=std::time::Instant::now();
run_event_loop(event_loop,window_thread,root_time).unwrap();
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(

@ -165,10 +165,7 @@ impl WindowContext<'_>{
}
}
}
pub fn worker<'a>(
window:&'a winit::window::Window,
setup_context:crate::setup::SetupContext<'a>,
)->crate::compat_worker::QNWorker<'a,TimedInstruction<WindowInstruction>>{
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();
@ -178,16 +175,15 @@ 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(),
//make sure to update this!!!!!
screen_size,
window,
physics_thread:crate::physics_worker::new(
graphics_thread,
user_settings,
),
physics_thread:crate::physics_worker::new(graphics_thread,bot_thread,user_settings),
};
//WindowContextSetup::into_worker