Compare commits
9 Commits
bot-playba
...
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"
|
||||
|
||||
|
||||
@@ -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
@@ -208,83 +208,15 @@ 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>,
|
||||
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(),
|
||||
);
|
||||
crate::compat_worker::QNWorker::new(move |ins:TimedInstruction<Instruction>|{
|
||||
interpolator.handle_instruction(&ins);
|
||||
match ins.instruction{
|
||||
|
||||
Reference in New Issue
Block a user