Compare commits

..

2 Commits
scripts ... snf

Author SHA1 Message Date
f81ce21bdc change textures path on my pc 2024-07-26 15:41:50 -07:00
c0fe3f71cc read snf map 2024-07-25 17:47:55 -07:00
21 changed files with 712 additions and 1224 deletions

1
.gitignore vendored
View File

@@ -1 +1,2 @@
/target /target
/textures

150
Cargo.lock generated
View File

@@ -262,9 +262,9 @@ dependencies = [
[[package]] [[package]]
name = "bytemuck" name = "bytemuck"
version = "1.16.3" version = "1.16.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "102087e286b4677862ea56cf8fc58bb2cdfa8725c40ffb80fe3a008eb7f2fc83" checksum = "b236fc92302c97ed75b38da1f4917b5cdda4984745740f153a5d3059e48d725e"
dependencies = [ dependencies = [
"bytemuck_derive", "bytemuck_derive",
] ]
@@ -294,9 +294,9 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b"
[[package]] [[package]]
name = "bytes" name = "bytes"
version = "1.7.1" version = "1.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8318a53db07bb3f8dca91a600466bdb3f2eaadeedfdbcf02e1accbad9271ba50" checksum = "a12916984aab3fa6e39d655a33e09c0071eb36d6ab3aea5c2d78551f1df6d952"
[[package]] [[package]]
name = "calloop" name = "calloop"
@@ -326,9 +326,9 @@ dependencies = [
[[package]] [[package]]
name = "cc" name = "cc"
version = "1.1.8" version = "1.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "504bdec147f2cc13c8b57ed9401fd8a147cc66b67ad5cb241394244f2c947549" checksum = "2aba8f4e9906c7ce3c73463f62a7f0c65183ada1a2d47e397cc8810827f9694f"
dependencies = [ dependencies = [
"jobserver", "jobserver",
"libc", "libc",
@@ -802,9 +802,9 @@ dependencies = [
[[package]] [[package]]
name = "indexmap" name = "indexmap"
version = "2.3.0" version = "2.2.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "de3fc2e30ba82dd1b3911c8de1ffc143c74a914a14e99514d7637e3099df5ea0" checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26"
dependencies = [ dependencies = [
"equivalent", "equivalent",
"hashbrown", "hashbrown",
@@ -843,9 +843,9 @@ checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130"
[[package]] [[package]]
name = "jobserver" name = "jobserver"
version = "0.1.32" version = "0.1.31"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "48d1dbcbbeb6a7fec7e059840aa538bd62aaccf972c7346c4d9d2059312853d0" checksum = "d2b099aaa34a9751c5bf0878add70444e1ed2dd73f347be99003d4577277de6e"
dependencies = [ dependencies = [
"libc", "libc",
] ]
@@ -878,9 +878,9 @@ checksum = "e2db585e1d738fc771bf08a151420d3ed193d9d895a36df7f6f8a9456b911ddc"
[[package]] [[package]]
name = "lazy-regex" name = "lazy-regex"
version = "3.2.0" version = "3.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "576c8060ecfdf2e56995cf3274b4f2d71fa5e4fa3607c1c0b63c10180ee58741" checksum = "5d12be4595afdf58bd19e4a9f4e24187da2a66700786ff660a418e9059937a4c"
dependencies = [ dependencies = [
"lazy-regex-proc_macros", "lazy-regex-proc_macros",
"once_cell", "once_cell",
@@ -889,9 +889,9 @@ dependencies = [
[[package]] [[package]]
name = "lazy-regex-proc_macros" name = "lazy-regex-proc_macros"
version = "3.2.0" version = "3.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9efb9e65d4503df81c615dc33ff07042a9408ac7f26b45abee25566f7fbfd12c" checksum = "44bcd58e6c97a7fcbaffcdc95728b393b8d98933bfadad49ed4097845b57ef0b"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@@ -1040,9 +1040,9 @@ dependencies = [
[[package]] [[package]]
name = "naga" name = "naga"
version = "22.1.0" version = "22.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8bd5a652b6faf21496f2cfd88fc49989c8db0825d1f6746b1a71a6ede24a63ad" checksum = "09eeccb9b50f4f7839b214aa3e08be467159506a986c18e0702170ccf720a453"
dependencies = [ dependencies = [
"arrayvec", "arrayvec",
"bit-set", "bit-set",
@@ -1109,18 +1109,18 @@ dependencies = [
[[package]] [[package]]
name = "num_enum" name = "num_enum"
version = "0.7.3" version = "0.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4e613fc340b2220f734a8595782c551f1250e969d87d3be1ae0579e8d4065179" checksum = "02339744ee7253741199f897151b38e72257d13802d4ee837285cc2990a90845"
dependencies = [ dependencies = [
"num_enum_derive", "num_enum_derive",
] ]
[[package]] [[package]]
name = "num_enum_derive" name = "num_enum_derive"
version = "0.7.3" version = "0.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "af1844ef2428cc3e1cb900be36181049ef3d3193c63e43026cfe202983b27a56" checksum = "681030a937600a36906c185595136d26abfebb4aa9c65701cefcaf8578bb982b"
dependencies = [ dependencies = [
"proc-macro-crate", "proc-macro-crate",
"proc-macro2", "proc-macro2",
@@ -1460,12 +1460,9 @@ checksum = "22686f4785f02a4fcc856d3b3bb19bf6c8160d103f7a99cc258bddd0251dc7f2"
[[package]] [[package]]
name = "ppv-lite86" name = "ppv-lite86"
version = "0.2.20" version = "0.2.17"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "77957b295656769bb8ad2b6a6b09d897d94f05c41b069aede1fcdaa675eaea04" checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de"
dependencies = [
"zerocopy",
]
[[package]] [[package]]
name = "presser" name = "presser"
@@ -1587,9 +1584,9 @@ dependencies = [
[[package]] [[package]]
name = "rbx_dom_weak" name = "rbx_dom_weak"
version = "2.9.0" version = "2.7.0"
source = "sparse+https://git.itzana.me/api/packages/strafesnet/cargo/" source = "sparse+https://git.itzana.me/api/packages/strafesnet/cargo/"
checksum = "2a6b916687c98aaea36f9c03e80906bfafab057bebee248628c8c04def807f43" checksum = "850d0a6c8d22592b125c9a82f8654857a7aba10f061b930cc2b86438e54157f1"
dependencies = [ dependencies = [
"rbx_types", "rbx_types",
"serde", "serde",
@@ -1607,9 +1604,9 @@ dependencies = [
[[package]] [[package]]
name = "rbx_reflection" name = "rbx_reflection"
version = "4.7.0" version = "4.5.0"
source = "sparse+https://git.itzana.me/api/packages/strafesnet/cargo/" source = "sparse+https://git.itzana.me/api/packages/strafesnet/cargo/"
checksum = "c1b43fe592a4ce6fe54eb215fb82735efbb516d2cc045a94e3dc0234ff293620" checksum = "80d31f6675c27c9f60b2322feb5565f4a4389ccbb75de4e737915e9208f0831f"
dependencies = [ dependencies = [
"rbx_types", "rbx_types",
"serde", "serde",
@@ -1618,9 +1615,9 @@ dependencies = [
[[package]] [[package]]
name = "rbx_reflection_database" name = "rbx_reflection_database"
version = "0.2.12+roblox-638" version = "0.2.10+roblox-607"
source = "sparse+https://git.itzana.me/api/packages/strafesnet/cargo/" source = "sparse+https://git.itzana.me/api/packages/strafesnet/cargo/"
checksum = "2e772bb9e1bc0ebe65d338f876d1bb1ea22e15a8f9a82e8245028010c2fea3c9" checksum = "f4da9f73ca317c158b922b757fe02317f7d3bc31d3f9fdb4a748d48b3951b8b8"
dependencies = [ dependencies = [
"lazy_static", "lazy_static",
"rbx_reflection", "rbx_reflection",
@@ -1630,9 +1627,9 @@ dependencies = [
[[package]] [[package]]
name = "rbx_types" name = "rbx_types"
version = "1.10.0" version = "1.8.0"
source = "sparse+https://git.itzana.me/api/packages/strafesnet/cargo/" source = "sparse+https://git.itzana.me/api/packages/strafesnet/cargo/"
checksum = "d7a390c44034fa448c53bd0983dfc2d70d8d6b2f65be4f164d4bec8b6a2a2d09" checksum = "6d0d394018a8df53fcd91e990301fe6e47b94e15067edfcb019e6238ae60e8bb"
dependencies = [ dependencies = [
"base64", "base64",
"bitflags 1.3.2", "bitflags 1.3.2",
@@ -1677,9 +1674,9 @@ dependencies = [
[[package]] [[package]]
name = "regex" name = "regex"
version = "1.10.6" version = "1.10.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4219d74c6b67a3654a9fbebc4b419e22126d13d2f3c4a07ee0cb61ff79a79619" checksum = "b91213439dad192326a0d7c6ee3955910425f441d7038e0d6933b0aec5c4517f"
dependencies = [ dependencies = [
"aho-corasick", "aho-corasick",
"memchr", "memchr",
@@ -1787,18 +1784,18 @@ dependencies = [
[[package]] [[package]]
name = "serde" name = "serde"
version = "1.0.205" version = "1.0.204"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e33aedb1a7135da52b7c21791455563facbbcc43d0f0f66165b42c21b3dfb150" checksum = "bc76f558e0cbb2a839d37354c575f1dc3fdc6546b5be373ba43d95f231bf7c12"
dependencies = [ dependencies = [
"serde_derive", "serde_derive",
] ]
[[package]] [[package]]
name = "serde_derive" name = "serde_derive"
version = "1.0.205" version = "1.0.204"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "692d6f5ac90220161d6774db30c662202721e64aed9058d2c394f451261420c1" checksum = "e0cd7e117be63d3c3678776753929474f3b04a43a080c744d6b0ae2a8c28e222"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@@ -1880,7 +1877,7 @@ checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
[[package]] [[package]]
name = "strafe-client" name = "strafe-client"
version = "0.10.3" version = "0.10.0"
dependencies = [ dependencies = [
"bytemuck", "bytemuck",
"configparser", "configparser",
@@ -1893,16 +1890,15 @@ dependencies = [
"strafesnet_common", "strafesnet_common",
"strafesnet_deferred_loader", "strafesnet_deferred_loader",
"strafesnet_rbx_loader", "strafesnet_rbx_loader",
"strafesnet_snf",
"wgpu", "wgpu",
"winit", "winit",
] ]
[[package]] [[package]]
name = "strafesnet_bsp_loader" name = "strafesnet_bsp_loader"
version = "0.1.5" version = "0.1.2"
source = "sparse+https://git.itzana.me/api/packages/strafesnet/cargo/" source = "sparse+https://git.itzana.me/api/packages/strafesnet/cargo/"
checksum = "35ee2c534efa039ad17ca41893ba1d75fafff014076353ac676c73fc808b9e44" checksum = "c3891b86fae658a904a38dc3e746987ae480898d355daca741e7ba6b10c50094"
dependencies = [ dependencies = [
"glam", "glam",
"strafesnet_common", "strafesnet_common",
@@ -1912,11 +1908,10 @@ dependencies = [
[[package]] [[package]]
name = "strafesnet_common" name = "strafesnet_common"
version = "0.4.1" version = "0.1.3"
source = "sparse+https://git.itzana.me/api/packages/strafesnet/cargo/" source = "sparse+https://git.itzana.me/api/packages/strafesnet/cargo/"
checksum = "9a2621612e675a8f804abbbbe3b60caeafe58a2422cccbe453268d6f457df4f3" checksum = "10a7e3b69506893bbdde90ce8a9d75cd56d280c0424d2dfdf98f8520179d0c1b"
dependencies = [ dependencies = [
"arrayvec",
"bitflags 2.6.0", "bitflags 2.6.0",
"glam", "glam",
"id", "id",
@@ -1924,9 +1919,9 @@ dependencies = [
[[package]] [[package]]
name = "strafesnet_deferred_loader" name = "strafesnet_deferred_loader"
version = "0.3.3" version = "0.3.0"
source = "sparse+https://git.itzana.me/api/packages/strafesnet/cargo/" source = "sparse+https://git.itzana.me/api/packages/strafesnet/cargo/"
checksum = "596aba6d2747818781336ad95a1ee496e37f70052fd625a299fc7a555a6938d4" checksum = "737954ffff299d244b0267b8101092034935d98fff7694628dbe438151579c3a"
dependencies = [ dependencies = [
"lazy-regex", "lazy-regex",
"strafesnet_common", "strafesnet_common",
@@ -1935,9 +1930,9 @@ dependencies = [
[[package]] [[package]]
name = "strafesnet_rbx_loader" name = "strafesnet_rbx_loader"
version = "0.3.4" version = "0.3.1"
source = "sparse+https://git.itzana.me/api/packages/strafesnet/cargo/" source = "sparse+https://git.itzana.me/api/packages/strafesnet/cargo/"
checksum = "6cd7fb0eca01ccd382067924e5fad15844f55a6bcc7c14c0e57a171298263a3e" checksum = "462e941b20f0d41b6ed138a8bd7d7e17a09c62b3817074a6c935798daa786697"
dependencies = [ dependencies = [
"bytemuck", "bytemuck",
"glam", "glam",
@@ -1950,17 +1945,6 @@ dependencies = [
"strafesnet_common", "strafesnet_common",
] ]
[[package]]
name = "strafesnet_snf"
version = "0.1.3"
source = "sparse+https://git.itzana.me/api/packages/strafesnet/cargo/"
checksum = "a9ae481152d0389be29967e1d5f0377498df8ff9638175d56cd8e2c2e6982bfa"
dependencies = [
"binrw 0.14.0",
"id",
"strafesnet_common",
]
[[package]] [[package]]
name = "strict-num" name = "strict-num"
version = "0.1.1" version = "0.1.1"
@@ -2056,9 +2040,9 @@ dependencies = [
[[package]] [[package]]
name = "toml_datetime" name = "toml_datetime"
version = "0.6.8" version = "0.6.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41" checksum = "4badfd56924ae69bcc9039335b2e017639ce3f9b001c393c1b2d1ef846ce2cbf"
[[package]] [[package]]
name = "toml_edit" name = "toml_edit"
@@ -2104,9 +2088,9 @@ dependencies = [
[[package]] [[package]]
name = "ttf-parser" name = "ttf-parser"
version = "0.24.1" version = "0.24.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5be21190ff5d38e8b4a2d3b6a3ae57f612cc39c96e83cedeaf7abc338a8bac4a" checksum = "8686b91785aff82828ed725225925b33b4fde44c4bb15876e5f7c832724c420a"
[[package]] [[package]]
name = "unicode-ident" name = "unicode-ident"
@@ -2167,9 +2151,9 @@ dependencies = [
[[package]] [[package]]
name = "version_check" name = "version_check"
version = "0.9.5" version = "0.9.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
[[package]] [[package]]
name = "vmdl" name = "vmdl"
@@ -2400,9 +2384,9 @@ dependencies = [
[[package]] [[package]]
name = "wgpu" name = "wgpu"
version = "22.1.0" version = "22.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e1d1c4ba43f80542cf63a0a6ed3134629ae73e8ab51e4b765a67f3aa062eb433" checksum = "c87e07e87a179614940ad845397e03201847453a37b43a31a3b54eee2e6e32ce"
dependencies = [ dependencies = [
"arrayvec", "arrayvec",
"cfg_aliases 0.1.1", "cfg_aliases 0.1.1",
@@ -2425,9 +2409,9 @@ dependencies = [
[[package]] [[package]]
name = "wgpu-core" name = "wgpu-core"
version = "22.1.0" version = "22.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0348c840d1051b8e86c3bcd31206080c5e71e5933dabd79be1ce732b0b2f089a" checksum = "e0f191908a21968991463fcf3b42cb6c9648c0fb7fa301b8fc733bc21a9ed9bd"
dependencies = [ dependencies = [
"arrayvec", "arrayvec",
"bit-vec", "bit-vec",
@@ -2528,11 +2512,11 @@ checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
[[package]] [[package]]
name = "winapi-util" name = "winapi-util"
version = "0.1.9" version = "0.1.8"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" checksum = "4d4cc384e1e73b93bafa6fb4f1df8c41695c8a91cf9c4c64358067d15a7b6c6b"
dependencies = [ dependencies = [
"windows-sys 0.59.0", "windows-sys 0.52.0",
] ]
[[package]] [[package]]
@@ -2578,15 +2562,6 @@ dependencies = [
"windows-targets 0.52.6", "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]] [[package]]
name = "windows-targets" name = "windows-targets"
version = "0.42.2" version = "0.42.2"
@@ -2767,9 +2742,9 @@ checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
[[package]] [[package]]
name = "winit" name = "winit"
version = "0.30.5" version = "0.30.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0be9e76a1f1077e04a411f0b989cbd3c93339e1771cb41e71ac4aee95bfd2c67" checksum = "4225ddd8ab67b8b59a2fee4b34889ebf13c0460c1c3fa297c58e21eb87801b33"
dependencies = [ dependencies = [
"ahash", "ahash",
"android-activity", "android-activity",
@@ -2885,9 +2860,9 @@ checksum = "b9cc00251562a284751c9973bace760d86c0276c471b4be569fe6b068ee97a56"
[[package]] [[package]]
name = "xml-rs" name = "xml-rs"
version = "0.8.21" version = "0.8.20"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "539a77ee7c0de333dcc6da69b177380a0b81e0dacfa4f7344c465a36871ee601" checksum = "791978798f0597cfc70478424c2b4fdc2b7a8024aaff78497ef00f24ef674193"
[[package]] [[package]]
name = "zerocopy" name = "zerocopy"
@@ -2895,7 +2870,6 @@ version = "0.7.35"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0"
dependencies = [ dependencies = [
"byteorder 1.5.0",
"zerocopy-derive", "zerocopy-derive",
] ]

View File

@@ -1,6 +1,6 @@
[package] [package]
name = "strafe-client" name = "strafe-client"
version = "0.10.3" version = "0.10.0"
edition = "2021" edition = "2021"
repository = "https://git.itzana.me/StrafesNET/strafe-client" repository = "https://git.itzana.me/StrafesNET/strafe-client"
license = "Custom" license = "Custom"
@@ -8,11 +8,6 @@ description = "StrafesNET game client for bhop and surf."
authors = ["Rhys Lloyd <krakow20@gmail.com>"] authors = ["Rhys Lloyd <krakow20@gmail.com>"]
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[features]
default = ["snf"]
snf = ["dep:strafesnet_snf"]
source = ["dep:strafesnet_deferred_loader", "dep:strafesnet_bsp_loader"]
roblox = ["dep:strafesnet_deferred_loader", "dep:strafesnet_rbx_loader"]
[dependencies] [dependencies]
bytemuck = { version = "1.13.1", features = ["derive"] } bytemuck = { version = "1.13.1", features = ["derive"] }
@@ -22,15 +17,14 @@ glam = "0.28.0"
id = { version = "0.1.0", registry = "strafesnet" } id = { version = "0.1.0", registry = "strafesnet" }
parking_lot = "0.12.1" parking_lot = "0.12.1"
pollster = "0.3.0" pollster = "0.3.0"
strafesnet_bsp_loader = { version = "0.1.3", registry = "strafesnet", optional = true } strafesnet_bsp_loader = { version = "0.1.2", registry = "strafesnet" }
strafesnet_common = { version = "0.4.0", registry = "strafesnet" } strafesnet_common = { version = "0.1.3", registry = "strafesnet" }
strafesnet_deferred_loader = { version = "0.3.1", features = ["legacy"], registry = "strafesnet", optional = true } strafesnet_deferred_loader = { version = "0.3.0", features = ["legacy"], registry = "strafesnet" }
strafesnet_rbx_loader = { version = "0.3.2", registry = "strafesnet", optional = true } strafesnet_rbx_loader = { version = "0.3.1", registry = "strafesnet" }
strafesnet_snf = { version = "0.1.2", registry = "strafesnet", optional = true }
wgpu = "22.0.0" wgpu = "22.0.0"
winit = "0.30.4" winit = "0.30.4"
[profile.release] #[profile.release]
#lto = true #lto = true
strip = true #strip = true
codegen-units = 1 #codegen-units = 1

View File

@@ -2,13 +2,9 @@ use std::io::Read;
#[derive(Debug)] #[derive(Debug)]
pub enum ReadError{ pub enum ReadError{
#[cfg(feature="roblox")]
Roblox(strafesnet_rbx_loader::ReadError), Roblox(strafesnet_rbx_loader::ReadError),
#[cfg(feature="source")]
Source(strafesnet_bsp_loader::ReadError), Source(strafesnet_bsp_loader::ReadError),
#[cfg(feature="snf")]
StrafesNET(strafesnet_snf::Error), StrafesNET(strafesnet_snf::Error),
#[cfg(feature="snf")]
StrafesNETMap(strafesnet_snf::map::Error), StrafesNETMap(strafesnet_snf::map::Error),
Io(std::io::Error), Io(std::io::Error),
UnknownFileFormat, UnknownFileFormat,
@@ -21,11 +17,8 @@ impl std::fmt::Display for ReadError{
impl std::error::Error for ReadError{} impl std::error::Error for ReadError{}
pub enum DataStructure{ pub enum DataStructure{
#[cfg(feature="roblox")]
Roblox(strafesnet_rbx_loader::Dom), Roblox(strafesnet_rbx_loader::Dom),
#[cfg(feature="source")]
Source(strafesnet_bsp_loader::Bsp), Source(strafesnet_bsp_loader::Bsp),
#[cfg(feature="snf")]
StrafesNET(strafesnet_common::map::CompleteMap), StrafesNET(strafesnet_common::map::CompleteMap),
} }
@@ -33,11 +26,8 @@ pub fn read<R:Read+std::io::Seek>(input:R)->Result<DataStructure,ReadError>{
let mut buf=std::io::BufReader::new(input); let mut buf=std::io::BufReader::new(input);
let peek=std::io::BufRead::fill_buf(&mut buf).map_err(ReadError::Io)?; let peek=std::io::BufRead::fill_buf(&mut buf).map_err(ReadError::Io)?;
match &peek[0..4]{ match &peek[0..4]{
#[cfg(feature="roblox")]
b"<rob"=>Ok(DataStructure::Roblox(strafesnet_rbx_loader::read(buf).map_err(ReadError::Roblox)?)), b"<rob"=>Ok(DataStructure::Roblox(strafesnet_rbx_loader::read(buf).map_err(ReadError::Roblox)?)),
#[cfg(feature="source")]
b"VBSP"=>Ok(DataStructure::Source(strafesnet_bsp_loader::read(buf).map_err(ReadError::Source)?)), b"VBSP"=>Ok(DataStructure::Source(strafesnet_bsp_loader::read(buf).map_err(ReadError::Source)?)),
#[cfg(feature="snf")]
b"SNFM"=>Ok(DataStructure::StrafesNET( b"SNFM"=>Ok(DataStructure::StrafesNET(
strafesnet_snf::read_map(buf).map_err(ReadError::StrafesNET)? strafesnet_snf::read_map(buf).map_err(ReadError::StrafesNET)?
.into_complete_map().map_err(ReadError::StrafesNETMap)? .into_complete_map().map_err(ReadError::StrafesNETMap)?
@@ -63,12 +53,8 @@ pub fn load<P:AsRef<std::path::Path>>(path:P)->Result<strafesnet_common::map::Co
//blocking because it's simpler... //blocking because it's simpler...
let file=std::fs::File::open(path).map_err(LoadError::File)?; let file=std::fs::File::open(path).map_err(LoadError::File)?;
match read(file).map_err(LoadError::ReadError)?{ match read(file).map_err(LoadError::ReadError)?{
#[cfg(feature="snf")]
DataStructure::StrafesNET(map)=>Ok(map), DataStructure::StrafesNET(map)=>Ok(map),
#[cfg(feature="roblox")] DataStructure::Roblox(dom)=>{
DataStructure::Roblox(mut dom)=>{
dom=dom.run_scripts();
let mut loader=strafesnet_deferred_loader::roblox_legacy(); let mut loader=strafesnet_deferred_loader::roblox_legacy();
let (texture_loader,mesh_loader)=loader.get_inner_mut(); let (texture_loader,mesh_loader)=loader.get_inner_mut();
@@ -100,7 +86,6 @@ pub fn load<P:AsRef<std::path::Path>>(path:P)->Result<strafesnet_common::map::Co
Ok(map) Ok(map)
}, },
#[cfg(feature="source")]
DataStructure::Source(bsp)=>{ DataStructure::Source(bsp)=>{
let mut loader=strafesnet_deferred_loader::source_legacy(); let mut loader=strafesnet_deferred_loader::source_legacy();

View File

@@ -6,6 +6,12 @@ use strafesnet_common::model::{self, ColorId, NormalId, PolygonIter, PositionId,
use wgpu::{util::DeviceExt,AstcBlock,AstcChannel}; use wgpu::{util::DeviceExt,AstcBlock,AstcChannel};
use crate::model_graphics::{self,IndexedGraphicsMeshOwnedRenderConfig,IndexedGraphicsMeshOwnedRenderConfigId,GraphicsMeshOwnedRenderConfig,GraphicsModelColor4,GraphicsModelOwned,GraphicsVertex}; use crate::model_graphics::{self,IndexedGraphicsMeshOwnedRenderConfig,IndexedGraphicsMeshOwnedRenderConfigId,GraphicsMeshOwnedRenderConfig,GraphicsModelColor4,GraphicsModelOwned,GraphicsVertex};
#[derive(Clone)]
pub struct GraphicsModelUpdate{
transform:Option<glam::Mat4>,
color:Option<glam::Vec4>,
}
struct Indices{ struct Indices{
count:u32, count:u32,
buf:wgpu::Buffer, buf:wgpu::Buffer,
@@ -26,6 +32,7 @@ impl Indices{
} }
struct GraphicsModel{ struct GraphicsModel{
indices:Indices, indices:Indices,
model_buf:wgpu::Buffer,
vertex_buf:wgpu::Buffer, vertex_buf:wgpu::Buffer,
bind_group:wgpu::BindGroup, bind_group:wgpu::BindGroup,
instance_count:u32, instance_count:u32,
@@ -58,12 +65,12 @@ struct GraphicsCamera{
#[inline] #[inline]
fn perspective_rh(fov_x_slope:f32,fov_y_slope:f32,z_near:f32,z_far:f32)->glam::Mat4{ fn perspective_rh(fov_x_slope:f32,fov_y_slope:f32,z_near:f32,z_far:f32)->glam::Mat4{
//glam_assert!(z_near > 0.0 && z_far > 0.0); //glam_assert!(z_near > 0.0 && z_far > 0.0);
let r=z_far/(z_near-z_far); let r=z_far / (z_near-z_far);
glam::Mat4::from_cols( glam::Mat4::from_cols(
glam::Vec4::new(1.0/fov_x_slope,0.0,0.0,0.0), glam::Vec4::new(1.0/fov_x_slope,0.0,0.0,0.0),
glam::Vec4::new(0.0,1.0/fov_y_slope,0.0,0.0), glam::Vec4::new(0.0,1.0/fov_y_slope,0.0,0.0),
glam::Vec4::new(0.0,0.0,r,-1.0), glam::Vec4::new(0.0,0.0,r,-1.0),
glam::Vec4::new(0.0,0.0,r*z_near,0.0), glam::Vec4::new(0.0,0.0,r * z_near,0.0),
) )
} }
impl GraphicsCamera{ impl GraphicsCamera{
@@ -72,10 +79,10 @@ impl GraphicsCamera{
} }
pub fn world(&self,pos:glam::Vec3,angles:glam::Vec2)->glam::Mat4{ pub fn world(&self,pos:glam::Vec3,angles:glam::Vec2)->glam::Mat4{
//f32 good enough for view matrix //f32 good enough for view matrix
glam::Mat4::from_translation(pos)*glam::Mat4::from_euler(glam::EulerRot::YXZ,angles.x,angles.y,0f32) glam::Mat4::from_translation(pos) * glam::Mat4::from_euler(glam::EulerRot::YXZ,angles.x,angles.y,0f32)
} }
pub fn to_uniform_data(&self,pos:glam::Vec3,angles:glam::Vec2)->[f32;16*4]{ pub fn to_uniform_data(&self,(pos,angles):(glam::Vec3,glam::Vec2))->[f32; 16 * 4]{
let proj=self.proj(); let proj=self.proj();
let proj_inv=proj.inverse(); let proj_inv=proj.inverse();
let view_inv=self.world(pos,angles); let view_inv=self.world(pos,angles);
@@ -98,12 +105,6 @@ impl std::default::Default for GraphicsCamera{
} }
} }
pub struct FrameState{
pub body:crate::physics::Body,
pub camera:crate::physics::PhysicsCamera,
pub time:integer::Time,
}
pub struct GraphicsState{ pub struct GraphicsState{
pipelines:GraphicsPipelines, pipelines:GraphicsPipelines,
bind_groups:GraphicsBindGroups, bind_groups:GraphicsBindGroups,
@@ -506,6 +507,7 @@ impl GraphicsState{
model_graphics::Indices::U16(indices)=>Indices::new(device,indices,wgpu::IndexFormat::Uint16), model_graphics::Indices::U16(indices)=>Indices::new(device,indices,wgpu::IndexFormat::Uint16),
}, },
bind_group, bind_group,
model_buf,
}); });
} }
} }
@@ -814,7 +816,7 @@ impl GraphicsState{
}); });
let camera=GraphicsCamera::default(); let camera=GraphicsCamera::default();
let camera_uniforms=camera.to_uniform_data(glam::Vec3::ZERO,glam::Vec2::ZERO); let camera_uniforms=camera.to_uniform_data(crate::physics::PhysicsOutputState::default().extrapolate(crate::physics::MouseState::default()));
let camera_buf=device.create_buffer_init(&wgpu::util::BufferInitDescriptor{ let camera_buf=device.create_buffer_init(&wgpu::util::BufferInitDescriptor{
label:Some("Camera"), label:Some("Camera"),
contents:bytemuck::cast_slice(&camera_uniforms), contents:bytemuck::cast_slice(&camera_uniforms),
@@ -882,17 +884,16 @@ impl GraphicsState{
view:&wgpu::TextureView, view:&wgpu::TextureView,
device:&wgpu::Device, device:&wgpu::Device,
queue:&wgpu::Queue, queue:&wgpu::Queue,
frame_state:FrameState, physics_output:crate::physics::PhysicsOutputState,
predicted_time:integer::Time,
mouse_pos:glam::IVec2,
){ ){
//TODO:use scheduled frame times to create beautiful smoothing simulation physics extrapolation assuming no input //TODO:use scheduled frame times to create beautiful smoothing simulation physics extrapolation assuming no input
let mut encoder=device.create_command_encoder(&wgpu::CommandEncoderDescriptor{label:None}); let mut encoder=device.create_command_encoder(&wgpu::CommandEncoderDescriptor{label:None});
// update rotation // update rotation
let camera_uniforms=self.camera.to_uniform_data( let camera_uniforms=self.camera.to_uniform_data(physics_output.extrapolate(crate::physics::MouseState{pos:mouse_pos,time:predicted_time}));
frame_state.body.extrapolated_position(frame_state.time).into(),
frame_state.camera.simulate_move_angles(glam::IVec2::ZERO)
);
self.staging_belt self.staging_belt
.write_buffer( .write_buffer(
&mut encoder, &mut encoder,

View File

@@ -1,8 +1,11 @@
use strafesnet_common::integer;
pub enum Instruction{ pub enum Instruction{
Render(crate::graphics::FrameState), Render(crate::physics::PhysicsOutputState,integer::Time,glam::IVec2),
//UpdateModel(crate::graphics::GraphicsModelUpdate), //UpdateModel(crate::graphics::GraphicsModelUpdate),
Resize(winit::dpi::PhysicalSize<u32>,crate::settings::UserSettings), Resize(winit::dpi::PhysicalSize<u32>,crate::settings::UserSettings),
ChangeMap(strafesnet_common::map::CompleteMap), GenerateModels(strafesnet_common::map::CompleteMap),
ClearModels,
} }
//Ideally the graphics thread worker description is: //Ideally the graphics thread worker description is:
@@ -15,32 +18,36 @@ WorkerDescription{
//up to three frames in flight, dropping new frame requests when all three are busy, and dropping output frames when one renders out of order //up to three frames in flight, dropping new frame requests when all three are busy, and dropping output frames when one renders out of order
pub fn new<'a>( pub fn new<'a>(
mut graphics:crate::graphics::GraphicsState, mut graphics:crate::graphics::GraphicsState,
mut config:wgpu::SurfaceConfiguration, mut config:wgpu::SurfaceConfiguration,
surface:wgpu::Surface<'a>, surface:wgpu::Surface<'a>,
device:wgpu::Device, device:wgpu::Device,
queue:wgpu::Queue, queue:wgpu::Queue,
)->crate::compat_worker::INWorker<'a,Instruction>{ )->crate::compat_worker::INWorker<'a,Instruction>{
let mut resize=None; let mut resize=None;
crate::compat_worker::INWorker::new(move |ins:Instruction|{ crate::compat_worker::INWorker::new(move |ins:Instruction|{
match ins{ match ins{
Instruction::ChangeMap(map)=>{ Instruction::GenerateModels(map)=>{
graphics.clear();
graphics.generate_models(&device,&queue,&map); graphics.generate_models(&device,&queue,&map);
}, },
Instruction::ClearModels=>{
graphics.clear();
},
Instruction::Resize(size,user_settings)=>{ Instruction::Resize(size,user_settings)=>{
resize=Some((size,user_settings)); resize=Some((size,user_settings));
} }
Instruction::Render(frame_state)=>{ Instruction::Render(physics_output,predicted_time,mouse_pos)=>{
if let Some((size,user_settings))=resize.take(){ if let Some((size,user_settings))=&resize{
println!("Resizing to {:?}",size); println!("Resizing to {:?}",size);
let t0=std::time::Instant::now(); let t0=std::time::Instant::now();
config.width=size.width.max(1); config.width=size.width.max(1);
config.height=size.height.max(1); config.height=size.height.max(1);
surface.configure(&device,&config); surface.configure(&device,&config);
graphics.resize(&device,&config,&user_settings); graphics.resize(&device,&config,user_settings);
println!("Resize took {:?}",t0.elapsed()); println!("Resize took {:?}",t0.elapsed());
} }
//clear every time w/e
resize=None;
//this has to go deeper somehow //this has to go deeper somehow
let frame=match surface.get_current_texture(){ let frame=match surface.get_current_texture(){
Ok(frame)=>frame, Ok(frame)=>frame,
@@ -56,10 +63,10 @@ pub fn new<'a>(
..wgpu::TextureViewDescriptor::default() ..wgpu::TextureViewDescriptor::default()
}); });
graphics.render(&view,&device,&queue,frame_state); graphics.render(&view,&device,&queue,physics_output,predicted_time,mouse_pos);
frame.present(); frame.present();
} }
} }
}) })
} }

View File

@@ -462,7 +462,7 @@ pub struct TransformedMesh<'a>{
transform:&'a PhysicsMeshTransform, transform:&'a PhysicsMeshTransform,
} }
impl TransformedMesh<'_>{ impl TransformedMesh<'_>{
pub const fn new<'a>( pub fn new<'a>(
view:PhysicsMeshView<'a>, view:PhysicsMeshView<'a>,
transform:&'a PhysicsMeshTransform, transform:&'a PhysicsMeshTransform,
)->TransformedMesh<'a>{ )->TransformedMesh<'a>{
@@ -751,23 +751,6 @@ impl MinkowskiMesh<'_>{
} }
best_edge.map(|e|(e.as_undirected(),best_time)) 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<'_>{ impl MeshQuery<MinkowskiFace,MinkowskiDirectedEdge,MinkowskiVert> for MinkowskiMesh<'_>{
fn face_nd(&self,face_id:MinkowskiFace)->(Planar64Vec3,Planar64){ fn face_nd(&self,face_id:MinkowskiFace)->(Planar64Vec3,Planar64){

File diff suppressed because it is too large Load Diff

View File

@@ -1,10 +1,6 @@
use strafesnet_common::mouse::MouseState; use crate::physics::{MouseState,PhysicsInputInstruction};
use strafesnet_common::physics::Instruction as PhysicsInputInstruction;
use strafesnet_common::integer::Time; use strafesnet_common::integer::Time;
use strafesnet_common::instruction::TimedInstruction; use strafesnet_common::instruction::{TimedInstruction,InstructionConsumer};
use strafesnet_common::timer::{Scaled,Timer,TimerState};
use mouse_interpolator::MouseInterpolator;
#[derive(Debug)] #[derive(Debug)]
pub enum InputInstruction{ pub enum InputInstruction{
MoveMouse(glam::IVec2), MoveMouse(glam::IVec2),
@@ -16,227 +12,120 @@ pub enum InputInstruction{
MoveForward(bool), MoveForward(bool),
Jump(bool), Jump(bool),
Zoom(bool), Zoom(bool),
ResetAndRestart, Reset,
ResetAndSpawn(strafesnet_common::gameplay_modes::ModeId,strafesnet_common::gameplay_modes::StageId),
PracticeFly, PracticeFly,
} }
pub enum Instruction{ pub enum Instruction{
Input(InputInstruction), Input(InputInstruction),
Render, Render,
Resize(winit::dpi::PhysicalSize<u32>), Resize(winit::dpi::PhysicalSize<u32>,crate::settings::UserSettings),
ChangeMap(strafesnet_common::map::CompleteMap), GenerateModels(strafesnet_common::map::CompleteMap),
//SetPaused is not an InputInstruction: the physics doesn't know that it's paused. ClearModels,
SetPaused(bool),
//Graphics(crate::graphics_worker::Instruction), //Graphics(crate::graphics_worker::Instruction),
} }
mod mouse_interpolator{
use super::*;
//TODO: move this or tab
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,
//"Simulation"
timer:Timer<Scaled>,
physics:crate::physics::PhysicsContext,
} pub fn new(mut physics:crate::physics::PhysicsContext,mut graphics_worker:crate::compat_worker::INWorker<crate::graphics_worker::Instruction>)->crate::compat_worker::QNWorker<TimedInstruction<Instruction>>{
impl MouseInterpolator{ let mut mouse_blocking=true;
pub fn new( let mut last_mouse_time=physics.get_next_mouse().time;
physics:crate::physics::PhysicsContext, let mut timeline=std::collections::VecDeque::new();
user_settings:crate::settings::UserSettings, crate::compat_worker::QNWorker::new(move |ins:TimedInstruction<Instruction>|{
)->MouseInterpolator{ if if let Some(phys_input)=match &ins.instruction{
MouseInterpolator{ Instruction::Input(input_instruction)=>match input_instruction{
mouse_blocking:true, &InputInstruction::MoveMouse(m)=>{
last_mouse_time:physics.get_next_mouse().time, if mouse_blocking{
timeline:std::collections::VecDeque::new(), //tell the game state which is living in the past about its future
timer:Timer::from_state(Scaled::identity(),false), timeline.push_front(TimedInstruction{
physics, time:last_mouse_time,
user_settings, instruction:PhysicsInputInstruction::SetNextMouse(MouseState{time:ins.time,pos:m}),
} });
} }else{
fn push_mouse_instruction(&mut self,ins:&TimedInstruction<Instruction>,m:glam::IVec2){ //mouse has just started moving again after being still for longer than 10ms.
if self.mouse_blocking{ //replace the entire mouse interpolation state to avoid an intermediate state with identical m0.t m1.t timestamps which will divide by zero
//tell the game state which is living in the past about its future timeline.push_front(TimedInstruction{
self.timeline.push_front(TimedInstruction{ time:last_mouse_time,
time:self.last_mouse_time, instruction:PhysicsInputInstruction::ReplaceMouse(
instruction:PhysicsInputInstruction::SetNextMouse(MouseState{time:self.timer.time(ins.time),pos:m}), MouseState{time:last_mouse_time,pos:physics.get_next_mouse().pos},
}); MouseState{time:ins.time,pos:m}
}else{ ),
//mouse has just started moving again after being still for longer than 10ms. });
//replace the entire mouse interpolation state to avoid an intermediate state with identical m0.t m1.t timestamps which will divide by zero //delay physics execution until we have an interpolation target
self.timeline.push_front(TimedInstruction{ mouse_blocking=true;
time:self.last_mouse_time, }
instruction:PhysicsInputInstruction::ReplaceMouse( last_mouse_time=ins.time;
MouseState{time:self.last_mouse_time,pos:self.physics.get_next_mouse().pos}, None
MouseState{time:self.timer.time(ins.time),pos:m} },
), &InputInstruction::MoveForward(s)=>Some(PhysicsInputInstruction::SetMoveForward(s)),
}); &InputInstruction::MoveLeft(s)=>Some(PhysicsInputInstruction::SetMoveLeft(s)),
//delay physics execution until we have an interpolation target &InputInstruction::MoveBack(s)=>Some(PhysicsInputInstruction::SetMoveBack(s)),
self.mouse_blocking=true; &InputInstruction::MoveRight(s)=>Some(PhysicsInputInstruction::SetMoveRight(s)),
} &InputInstruction::MoveUp(s)=>Some(PhysicsInputInstruction::SetMoveUp(s)),
self.last_mouse_time=self.timer.time(ins.time); &InputInstruction::MoveDown(s)=>Some(PhysicsInputInstruction::SetMoveDown(s)),
} &InputInstruction::Jump(s)=>Some(PhysicsInputInstruction::SetJump(s)),
fn push(&mut self,time:Time,phys_input:PhysicsInputInstruction){ &InputInstruction::Zoom(s)=>Some(PhysicsInputInstruction::SetZoom(s)),
//This is always a non-mouse event InputInstruction::Reset=>Some(PhysicsInputInstruction::Reset),
self.timeline.push_back(TimedInstruction{ InputInstruction::PracticeFly=>Some(PhysicsInputInstruction::PracticeFly),
time:self.timer.time(time), },
instruction:phys_input, Instruction::GenerateModels(_)=>Some(PhysicsInputInstruction::Idle),
}); Instruction::ClearModels=>Some(PhysicsInputInstruction::Idle),
} Instruction::Resize(_,_)=>Some(PhysicsInputInstruction::Idle),
/// returns should_empty_queue Instruction::Render=>Some(PhysicsInputInstruction::Idle),
/// may or may not mutate internal state XD! }{
fn map_instruction(&mut self,ins:&TimedInstruction<Instruction>)->bool{ //non-mouse event
let mut update_mouse_blocking=true; timeline.push_back(TimedInstruction{
match &ins.instruction{ time:ins.time,
Instruction::Input(input_instruction)=>match input_instruction{ instruction:phys_input,
&InputInstruction::MoveMouse(m)=>{ });
if !self.timer.is_paused(){
self.push_mouse_instruction(ins,m); if mouse_blocking{
//assume the mouse has stopped moving after 10ms.
//shitty mice are 125Hz which is 8ms so this should cover that.
//setting this to 100us still doesn't print even though it's 10x lower than the polling rate,
//so mouse events are probably not handled separately from drawing and fire right before it :(
if Time::from_millis(10)<ins.time-physics.get_next_mouse().time{
//push an event to extrapolate no movement from
timeline.push_front(TimedInstruction{
time:last_mouse_time,
instruction:PhysicsInputInstruction::SetNextMouse(MouseState{time:ins.time,pos:physics.get_next_mouse().pos}),
});
last_mouse_time=ins.time;
//stop blocking. the mouse is not moving so the physics does not need to live in the past and wait for interpolation targets.
mouse_blocking=false;
true
}else{
false
} }
update_mouse_blocking=false; }else{
}, //keep this up to date so that it can be used as a known-timestamp
&InputInstruction::MoveForward(s)=>self.push(ins.time,PhysicsInputInstruction::SetMoveForward(s)), //that the mouse was not moving when the mouse starts moving again
&InputInstruction::MoveLeft(s)=>self.push(ins.time,PhysicsInputInstruction::SetMoveLeft(s)), last_mouse_time=ins.time;
&InputInstruction::MoveBack(s)=>self.push(ins.time,PhysicsInputInstruction::SetMoveBack(s)), true
&InputInstruction::MoveRight(s)=>self.push(ins.time,PhysicsInputInstruction::SetMoveRight(s)),
&InputInstruction::MoveUp(s)=>self.push(ins.time,PhysicsInputInstruction::SetMoveUp(s)),
&InputInstruction::MoveDown(s)=>self.push(ins.time,PhysicsInputInstruction::SetMoveDown(s)),
&InputInstruction::Jump(s)=>self.push(ins.time,PhysicsInputInstruction::SetJump(s)),
&InputInstruction::Zoom(s)=>self.push(ins.time,PhysicsInputInstruction::SetZoom(s)),
&InputInstruction::ResetAndSpawn(mode_id,stage_id)=>{
self.push(ins.time,PhysicsInputInstruction::Reset);
self.push(ins.time,PhysicsInputInstruction::SetSensitivity(self.user_settings.calculate_sensitivity()));
self.push(ins.time,PhysicsInputInstruction::Spawn(mode_id,stage_id));
},
InputInstruction::ResetAndRestart=>{
self.push(ins.time,PhysicsInputInstruction::Reset);
self.push(ins.time,PhysicsInputInstruction::SetSensitivity(self.user_settings.calculate_sensitivity()));
self.push(ins.time,PhysicsInputInstruction::Restart);
},
InputInstruction::PracticeFly=>self.push(ins.time,PhysicsInputInstruction::PracticeFly),
},
//do these really need to idle the physics?
//sending None dumps the instruction queue
Instruction::ChangeMap(_)=>self.push(ins.time,PhysicsInputInstruction::Idle),
Instruction::Resize(_)=>self.push(ins.time,PhysicsInputInstruction::Idle),
Instruction::Render=>self.push(ins.time,PhysicsInputInstruction::Idle),
&Instruction::SetPaused(paused)=>{
if let Err(e)=self.timer.set_paused(ins.time,paused){
println!("Cannot pause: {e}");
} }
self.push(ins.time,PhysicsInputInstruction::Idle);
},
}
if update_mouse_blocking{
//this returns the bool for us
self.update_mouse_blocking(ins.time)
}else{
//do flush that queue
true
}
}
/// must check if self.mouse_blocking==true before calling!
fn unblock_mouse(&mut self,time:Time){
//push an event to extrapolate no movement from
self.timeline.push_front(TimedInstruction{
time:self.last_mouse_time,
instruction:PhysicsInputInstruction::SetNextMouse(MouseState{time:self.timer.time(time),pos:self.physics.get_next_mouse().pos}),
});
self.last_mouse_time=self.timer.time(time);
//stop blocking. the mouse is not moving so the physics does not need to live in the past and wait for interpolation targets.
self.mouse_blocking=false;
}
fn update_mouse_blocking(&mut self,time:Time)->bool{
if self.mouse_blocking{
//assume the mouse has stopped moving after 10ms.
//shitty mice are 125Hz which is 8ms so this should cover that.
//setting this to 100us still doesn't print even though it's 10x lower than the polling rate,
//so mouse events are probably not handled separately from drawing and fire right before it :(
if Time::from_millis(10)<self.timer.time(time)-self.physics.get_next_mouse().time{
self.unblock_mouse(time);
true
}else{ }else{
false //mouse event
true
}{
//empty queue
while let Some(instruction)=timeline.pop_front(){
physics.run_input_instruction(instruction);
}
} }
}else{ match ins.instruction{
//keep this up to date so that it can be used as a known-timestamp Instruction::Render=>{
//that the mouse was not moving when the mouse starts moving again graphics_worker.send(crate::graphics_worker::Instruction::Render(physics.output(),ins.time,physics.get_next_mouse().pos)).unwrap();
self.last_mouse_time=self.timer.time(time); },
true Instruction::Resize(size,user_settings)=>{
} graphics_worker.send(crate::graphics_worker::Instruction::Resize(size,user_settings)).unwrap();
} },
fn empty_queue(&mut self){ Instruction::GenerateModels(map)=>{
while let Some(instruction)=self.timeline.pop_front(){ physics.generate_models(&map);
self.physics.run_input_instruction(instruction); physics.spawn();
} graphics_worker.send(crate::graphics_worker::Instruction::GenerateModels(map)).unwrap();
} },
pub fn handle_instruction(&mut self,ins:&TimedInstruction<Instruction>){ Instruction::ClearModels=>{
let should_empty_queue=self.map_instruction(ins); physics.clear();
if should_empty_queue{ graphics_worker.send(crate::graphics_worker::Instruction::ClearModels).unwrap();
self.empty_queue(); },
} _=>(),
} }
pub fn get_frame_state(&self,time:Time)->crate::graphics::FrameState{ })
crate::graphics::FrameState{ }
body:self.physics.camera_body(),
camera:self.physics.camera(),
time:self.timer.time(time),
}
}
pub fn change_map(&mut self,time:Time,map:&strafesnet_common::map::CompleteMap){
//dump any pending interpolation state
if self.mouse_blocking{
self.unblock_mouse(time);
}
self.empty_queue();
//doing it like this to avoid doing PhysicsInstruction::ChangeMap(Rc<CompleteMap>)
self.physics.generate_models(&map);
//use the standard input interface so the instructions are written out to bots
self.handle_instruction(&TimedInstruction{
time:self.timer.time(time),
instruction:Instruction::Input(InputInstruction::ResetAndSpawn(
strafesnet_common::gameplay_modes::ModeId::MAIN,
strafesnet_common::gameplay_modes::StageId::FIRST,
)),
});
}
pub const fn user_settings(&self)->&crate::settings::UserSettings{
&self.user_settings
}
}
}
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
);
crate::compat_worker::QNWorker::new(move |ins:TimedInstruction<Instruction>|{
interpolator.handle_instruction(&ins);
match ins.instruction{
Instruction::Render=>{
let frame_state=interpolator.get_frame_state(ins.time);
graphics_worker.send(crate::graphics_worker::Instruction::Render(frame_state)).unwrap();
},
Instruction::Resize(size)=>{
graphics_worker.send(crate::graphics_worker::Instruction::Resize(size,interpolator.user_settings().clone())).unwrap();
},
Instruction::ChangeMap(map)=>{
interpolator.change_map(ins.time,&map);
graphics_worker.send(crate::graphics_worker::Instruction::ChangeMap(map)).unwrap();
},
Instruction::Input(_)=>(),
Instruction::SetPaused(_)=>(),
}
})
}

View File

@@ -213,14 +213,13 @@ pub fn setup_and_start(title:String){
//dedicated thread to ping request redraw back and resize the window doesn't seem logical //dedicated thread to ping request redraw back and resize the window doesn't seem logical
let window=crate::window::WindowContextSetup::new(&setup_context,&window);
//the thread that spawns the physics thread //the thread that spawns the physics thread
let mut window_thread=crate::window::worker( let mut window_thread=window.into_worker(setup_context);
&window,
setup_context,
);
if let Some(arg)=std::env::args().nth(1){ let args:Vec<String>=std::env::args().collect();
let path=std::path::PathBuf::from(arg); if args.len()==2{
let path=std::path::PathBuf::from(&args[1]);
window_thread.send(TimedInstruction{ window_thread.send(TimedInstruction{
time:integer::Time::ZERO, time:integer::Time::ZERO,
instruction:WindowInstruction::WindowEvent(winit::event::WindowEvent::DroppedFile(path)), instruction:WindowInstruction::WindowEvent(winit::event::WindowEvent::DroppedFile(path)),

View File

@@ -13,8 +13,9 @@ pub enum WindowInstruction{
//holds thread handles to dispatch to //holds thread handles to dispatch to
struct WindowContext<'a>{ struct WindowContext<'a>{
manual_mouse_lock:bool, manual_mouse_lock:bool,
mouse:strafesnet_common::mouse::MouseState,//std::sync::Arc<std::sync::Mutex<>> mouse:crate::physics::MouseState,//std::sync::Arc<std::sync::Mutex<>>
screen_size:glam::UVec2, screen_size:glam::UVec2,
user_settings:crate::settings::UserSettings,
window:&'a winit::window::Window, window:&'a winit::window::Window,
physics_thread:crate::compat_worker::QNWorker<'a, TimedInstruction<crate::physics_worker::Instruction>>, physics_thread:crate::compat_worker::QNWorker<'a, TimedInstruction<crate::physics_worker::Instruction>>,
} }
@@ -27,16 +28,15 @@ impl WindowContext<'_>{
match event { match event {
winit::event::WindowEvent::DroppedFile(path)=>{ winit::event::WindowEvent::DroppedFile(path)=>{
match crate::file::load(path.as_path()){ match crate::file::load(path.as_path()){
Ok(map)=>self.physics_thread.send(TimedInstruction{time,instruction:crate::physics_worker::Instruction::ChangeMap(map)}).unwrap(), Ok(map)=>{
self.physics_thread.send(TimedInstruction{time,instruction:crate::physics_worker::Instruction::ClearModels}).unwrap();
self.physics_thread.send(TimedInstruction{time,instruction:crate::physics_worker::Instruction::GenerateModels(map)}).unwrap();
},
Err(e)=>println!("Failed to load map: {e}"), Err(e)=>println!("Failed to load map: {e}"),
} }
}, },
winit::event::WindowEvent::Focused(state)=>{ winit::event::WindowEvent::Focused(_state)=>{
//pause unpause //pause unpause
self.physics_thread.send(TimedInstruction{
time,
instruction:crate::physics_worker::Instruction::SetPaused(!state),
}).unwrap();
//recalculate pressed keys on focus //recalculate pressed keys on focus
}, },
winit::event::WindowEvent::KeyboardInput{ winit::event::WindowEvent::KeyboardInput{
@@ -107,11 +107,7 @@ impl WindowContext<'_>{
"e"=>Some(InputInstruction::MoveUp(s)), "e"=>Some(InputInstruction::MoveUp(s)),
"q"=>Some(InputInstruction::MoveDown(s)), "q"=>Some(InputInstruction::MoveDown(s)),
"z"=>Some(InputInstruction::Zoom(s)), "z"=>Some(InputInstruction::Zoom(s)),
"r"=>if s{ "r"=>if s{Some(InputInstruction::Reset)}else{None},
//mouse needs to be reset since the position is absolute
self.mouse=strafesnet_common::mouse::MouseState::default();
Some(InputInstruction::ResetAndRestart)
}else{None},
"f"=>if s{Some(InputInstruction::PracticeFly)}else{None}, "f"=>if s{Some(InputInstruction::PracticeFly)}else{None},
_=>None, _=>None,
}, },
@@ -165,32 +161,48 @@ impl WindowContext<'_>{
} }
} }
} }
pub fn worker<'a>(
pub struct WindowContextSetup<'a>{
user_settings:crate::settings::UserSettings,
window:&'a winit::window::Window, window:&'a winit::window::Window,
setup_context:crate::setup::SetupContext<'a>, physics:crate::physics::PhysicsContext,
)->crate::compat_worker::QNWorker<'a,TimedInstruction<WindowInstruction>>{ graphics:crate::graphics::GraphicsState,
// WindowContextSetup::new }
impl<'a> WindowContextSetup<'a>{
pub fn new(context:&crate::setup::SetupContext,window:&'a winit::window::Window)->Self{
let user_settings=crate::settings::read_user_settings(); let user_settings=crate::settings::read_user_settings();
let mut graphics=crate::graphics::GraphicsState::new(&setup_context.device,&setup_context.queue,&setup_context.config); let mut physics=crate::physics::PhysicsContext::default();
physics.load_user_settings(&user_settings);
let mut graphics=crate::graphics::GraphicsState::new(&context.device,&context.queue,&context.config);
graphics.load_user_settings(&user_settings); graphics.load_user_settings(&user_settings);
//WindowContextSetup::into_context Self{
user_settings,
window,
graphics,
physics,
}
}
fn into_context(self,setup_context:crate::setup::SetupContext<'a>)->WindowContext<'a>{
let screen_size=glam::uvec2(setup_context.config.width,setup_context.config.height); 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); let graphics_thread=crate::graphics_worker::new(self.graphics,setup_context.config,setup_context.surface,setup_context.device,setup_context.queue);
let mut window_context=WindowContext{ WindowContext{
manual_mouse_lock:false, manual_mouse_lock:false,
mouse:strafesnet_common::mouse::MouseState::default(), mouse:crate::physics::MouseState::default(),
//make sure to update this!!!!! //make sure to update this!!!!!
screen_size, screen_size,
window, user_settings:self.user_settings,
physics_thread:crate::physics_worker::new( window:self.window,
graphics_thread, physics_thread:crate::physics_worker::new(self.physics,graphics_thread),
user_settings, }
), }
};
//WindowContextSetup::into_worker pub fn into_worker(self,setup_context:crate::setup::SetupContext<'a>)->crate::compat_worker::QNWorker<'a,TimedInstruction<WindowInstruction>>{
let mut window_context=self.into_context(setup_context);
crate::compat_worker::QNWorker::new(move |ins:TimedInstruction<WindowInstruction>|{ crate::compat_worker::QNWorker::new(move |ins:TimedInstruction<WindowInstruction>|{
match ins.instruction{ match ins.instruction{
WindowInstruction::RequestRedraw=>{ WindowInstruction::RequestRedraw=>{
@@ -206,7 +218,7 @@ pub fn worker<'a>(
window_context.physics_thread.send( window_context.physics_thread.send(
TimedInstruction{ TimedInstruction{
time:ins.time, time:ins.time,
instruction:crate::physics_worker::Instruction::Resize(size) instruction:crate::physics_worker::Instruction::Resize(size,window_context.user_settings.clone())
} }
).unwrap(); ).unwrap();
} }
@@ -220,4 +232,5 @@ pub fn worker<'a>(
} }
} }
}) })
} }
}

View File

@@ -190,7 +190,7 @@ mod test{
for _ in 0..5 { for _ in 0..5 {
let task = instruction::TimedInstruction{ let task = instruction::TimedInstruction{
time:integer::Time::ZERO, time:integer::Time::ZERO,
instruction:strafesnet_common::physics::Instruction::Idle, instruction:physics::PhysicsInstruction::StrafeTick,
}; };
worker.send(task).unwrap(); worker.send(task).unwrap();
} }
@@ -204,7 +204,7 @@ mod test{
// Send a new task // Send a new task
let task = instruction::TimedInstruction{ let task = instruction::TimedInstruction{
time:integer::Time::ZERO, time:integer::Time::ZERO,
instruction:strafesnet_common::physics::Instruction::Idle, instruction:physics::PhysicsInstruction::StrafeTick,
}; };
worker.send(task).unwrap(); worker.send(task).unwrap();

View File

@@ -1 +1 @@
mangohud ../target/release/strafe-client bhop_maps/5692113331.snfm mangohud ../target/release/strafe-client bhop_maps/5692113331.rbxm

View File

@@ -1 +1 @@
/run/media/quat/Files/Documents/map-files/verify-scripts/maps/bhop_snfm /run/media/quat/Files/Documents/map-files/verify-scripts/maps/bhop_all/

View File

@@ -1 +1 @@
cargo build --release --target x86_64-pc-windows-gnu --all-features cargo build --release --target x86_64-pc-windows-gnu

View File

@@ -1 +0,0 @@
mangohud ../target/release/strafe-client bhop_maps/5692124338.snfm

1
tools/meshes Symbolic link
View File

@@ -0,0 +1 @@
/run/media/quat/Files/Documents/map-files/verify-scripts/meshes/

View File

@@ -1 +1 @@
/run/media/quat/Files/Documents/map-files/verify-scripts/maps/surf_snfm /run/media/quat/Files/Documents/map-files/verify-scripts/maps/surf_all/

1
tools/textures Symbolic link
View File

@@ -0,0 +1 @@
/run/media/quat/Files/Documents/map-files/verify-scripts/textures

View File

@@ -1 +1 @@
mangohud ../target/release/strafe-client bhop_maps/5692152916.snfm mangohud ../target/release/strafe-client bhop_maps/5692152916.rbxm

View File

@@ -1 +1 @@
mangohud ../target/release/strafe-client surf_maps/5692145408.snfm mangohud ../target/release/strafe-client surf_maps/5692145408.rbxm