forked from StrafesNET/roblox-bot-player
Compare commits
55 Commits
playback-i
...
advanced-a
| Author | SHA1 | Date | |
|---|---|---|---|
|
42fc93f68d
|
|||
|
030adf2a87
|
|||
|
495092f79f
|
|||
|
e0a8175355
|
|||
|
006a70a18b
|
|||
|
7ce2ca8b0a
|
|||
|
6ef6c67703
|
|||
|
8dfb5f5094
|
|||
|
9e0e9a62e7
|
|||
|
6fbeba94ae
|
|||
|
01916e0682
|
|||
|
2af2134f72
|
|||
|
a3e7b5ff99
|
|||
|
58f9a70e16
|
|||
|
3b218856c9
|
|||
|
00393490a0
|
|||
|
f96891dcbc
|
|||
|
35a90f28ae
|
|||
|
c3676349b0
|
|||
|
299a2b8051
|
|||
|
a4c4f20bad
|
|||
|
3644dd7f15
|
|||
|
197f840246
|
|||
|
c3cca22839
|
|||
|
81a158d08f
|
|||
|
7a421d1eab
|
|||
|
e821fb6982
|
|||
|
cb71fa7257
|
|||
|
51fdc72e0e
|
|||
|
29e49587ff
|
|||
|
d03f84c893
|
|||
|
48a7b06b71
|
|||
|
43cc9b6416
|
|||
|
e4433cf06c
|
|||
|
54beb3e9df
|
|||
|
aa0a333431
|
|||
|
cb7474522f
|
|||
|
87fa1220c6
|
|||
|
4fb2e6c800
|
|||
|
b1ebd01463
|
|||
|
de8ef7fae2
|
|||
|
dd55987403
|
|||
|
e4f6f8490d
|
|||
|
db634247ac
|
|||
|
c5cd25c27a
|
|||
|
57c545efa6
|
|||
|
8ecb79a0b4
|
|||
|
98f56d0608
|
|||
|
cf59852468
|
|||
|
2f584744c7
|
|||
|
c33daaf0c6
|
|||
|
3dea810a50
|
|||
|
a238793cdc
|
|||
|
d9610901cb
|
|||
|
dd9cf502f1
|
2
.cargo/config.toml
Normal file
2
.cargo/config.toml
Normal file
@@ -0,0 +1,2 @@
|
||||
[registries.strafesnet]
|
||||
index = "sparse+https://git.itzana.me/api/packages/strafesnet/cargo/"
|
||||
317
Cargo.lock
generated
317
Cargo.lock
generated
@@ -44,7 +44,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ef6978589202a00cd7e118380c448a08b6ed394c3a8df3a430d0898e3a42d046"
|
||||
dependencies = [
|
||||
"android-properties",
|
||||
"bitflags 2.10.0",
|
||||
"bitflags 2.11.0",
|
||||
"cc",
|
||||
"cesu8",
|
||||
"jni",
|
||||
@@ -120,9 +120,9 @@ checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8"
|
||||
|
||||
[[package]]
|
||||
name = "binrw"
|
||||
version = "0.15.0"
|
||||
version = "0.15.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "81419ff39e6ed10a92a7f125290859776ced35d9a08a665ae40b23e7ca702f30"
|
||||
checksum = "d53195f985e88ab94d1cc87e80049dd2929fd39e4a772c5ae96a7e5c4aad3642"
|
||||
dependencies = [
|
||||
"array-init",
|
||||
"binrw_derive",
|
||||
@@ -131,15 +131,15 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "binrw_derive"
|
||||
version = "0.15.0"
|
||||
version = "0.15.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "376404e55ec40d0d6f8b4b7df3f87b87954bd987f0cf9a7207ea3b6ea5c9add4"
|
||||
checksum = "5910da05ee556b789032c8ff5a61fb99239580aa3fd0bfaa8f4d094b2aee00ad"
|
||||
dependencies = [
|
||||
"either",
|
||||
"owo-colors",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.114",
|
||||
"syn 2.0.117",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -165,9 +165,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
|
||||
|
||||
[[package]]
|
||||
name = "bitflags"
|
||||
version = "2.10.0"
|
||||
version = "2.11.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "812e12b5285cc515a9c72a5c1d3b6d46a19dac5acfef5265968c166106e31dd3"
|
||||
checksum = "843867be96c8daad0d758b57df9392b6d8d271134fce549de6ce169ff98a92af"
|
||||
|
||||
[[package]]
|
||||
name = "block"
|
||||
@@ -192,9 +192,9 @@ checksum = "119771309b95163ec7aaf79810da82f7cd0599c19722d48b9c03894dca833966"
|
||||
|
||||
[[package]]
|
||||
name = "bumpalo"
|
||||
version = "3.19.1"
|
||||
version = "3.20.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5dd9dc738b7a8311c7ade152424974d8115f2cdad61e8dab8dac9f2362298510"
|
||||
checksum = "5d20789868f4b01b2f2caec9f5c4e0213b41e3e5702a50157d699ae31ced2fcb"
|
||||
|
||||
[[package]]
|
||||
name = "bytemuck"
|
||||
@@ -213,7 +213,7 @@ checksum = "f9abbd1bc6865053c427f7198e6af43bfdedc55ab791faed4fbd361d789575ff"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.114",
|
||||
"syn 2.0.117",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -234,7 +234,7 @@ version = "0.13.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b99da2f8558ca23c71f4fd15dc57c906239752dd27ff3c00a1d56b685b7cbfec"
|
||||
dependencies = [
|
||||
"bitflags 2.10.0",
|
||||
"bitflags 2.11.0",
|
||||
"log",
|
||||
"polling",
|
||||
"rustix 0.38.44",
|
||||
@@ -256,9 +256,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "cc"
|
||||
version = "1.2.55"
|
||||
version = "1.2.56"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "47b26a0954ae34af09b50f0de26458fa95369a0d478d8236d3f93082b219bd29"
|
||||
checksum = "aebf35691d1bfb0ac386a69bac2fde4dd276fb618cf8bf4f5318fe285e821bb2"
|
||||
dependencies = [
|
||||
"find-msvc-tools",
|
||||
"jobserver",
|
||||
@@ -370,7 +370,7 @@ version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3d44a101f213f6c4cdc1853d4b78aef6db6bdfa3468798cc1d9912f4735013eb"
|
||||
dependencies = [
|
||||
"bitflags 2.10.0",
|
||||
"bitflags 2.11.0",
|
||||
"core-foundation 0.10.1",
|
||||
"libc",
|
||||
]
|
||||
@@ -399,7 +399,7 @@ version = "0.5.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "479dfe1e6737aa9e96c6ac7b69689dc4c32da8383f2c12744739d76afa8b66c4"
|
||||
dependencies = [
|
||||
"bitflags 2.10.0",
|
||||
"bitflags 2.11.0",
|
||||
"byteorder",
|
||||
"enum-primitive-derive",
|
||||
"num-traits",
|
||||
@@ -413,9 +413,9 @@ checksum = "bd0c93bb4b0c6d9b77f4435b0ae98c24d17f1c45b2ff844c6151a07256ca923b"
|
||||
|
||||
[[package]]
|
||||
name = "dlib"
|
||||
version = "0.5.2"
|
||||
version = "0.5.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "330c60081dcc4c72131f8eb70510f1ac07223e5d4163db481a04a0befcffa412"
|
||||
checksum = "ab8ecd87370524b461f8557c119c405552c396ed91fc0a8eec68679eab26f94a"
|
||||
dependencies = [
|
||||
"libloading",
|
||||
]
|
||||
@@ -522,7 +522,7 @@ checksum = "1a5c6c585bc94aaf2c7b51dd4c2ba22680844aba4c687be581871a6f518c5742"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.114",
|
||||
"syn 2.0.117",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -533,26 +533,25 @@ checksum = "aa9a19cbb55df58761df49b23516a86d432839add4af60fc256da840f66ed35b"
|
||||
|
||||
[[package]]
|
||||
name = "futures-core"
|
||||
version = "0.3.31"
|
||||
version = "0.3.32"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e"
|
||||
checksum = "7e3450815272ef58cec6d564423f6e755e25379b217b0bc688e295ba24df6b1d"
|
||||
|
||||
[[package]]
|
||||
name = "futures-task"
|
||||
version = "0.3.31"
|
||||
version = "0.3.32"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988"
|
||||
checksum = "037711b3d59c33004d3856fbdc83b99d4ff37a24768fa1be9ce3538a1cde4393"
|
||||
|
||||
[[package]]
|
||||
name = "futures-util"
|
||||
version = "0.3.31"
|
||||
version = "0.3.32"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81"
|
||||
checksum = "389ca41296e6190b48053de0321d02a77f32f8a5d2461dd38762c0593805c6d6"
|
||||
dependencies = [
|
||||
"futures-core",
|
||||
"futures-task",
|
||||
"pin-project-lite",
|
||||
"pin-utils",
|
||||
"slab",
|
||||
]
|
||||
|
||||
@@ -562,7 +561,7 @@ version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1bd49230192a3797a9a4d6abe9b3eed6f7fa4c8a8a4947977c6f80025f92cbd8"
|
||||
dependencies = [
|
||||
"rustix 1.1.3",
|
||||
"rustix 1.1.4",
|
||||
"windows-link",
|
||||
]
|
||||
|
||||
@@ -591,9 +590,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "glam"
|
||||
version = "0.31.0"
|
||||
version = "0.32.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "74a4d85559e2637d3d839438b5b3d75c31e655276f9544d72475c36b92fabbed"
|
||||
checksum = "34627c5158214743a374170fed714833fdf4e4b0cbcc1ea98417866a4c5d4441"
|
||||
|
||||
[[package]]
|
||||
name = "glow"
|
||||
@@ -636,7 +635,7 @@ version = "0.3.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b89c83349105e3732062a895becfc71a8f921bb71ecbbdd8ff99263e3b53a0ca"
|
||||
dependencies = [
|
||||
"bitflags 2.10.0",
|
||||
"bitflags 2.11.0",
|
||||
"gpu-descriptor-types",
|
||||
"hashbrown 0.15.5",
|
||||
]
|
||||
@@ -647,7 +646,7 @@ version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fdf242682df893b86f33a73828fb09ca4b2d3bb6cc95249707fc684d27484b91"
|
||||
dependencies = [
|
||||
"bitflags 2.10.0",
|
||||
"bitflags 2.11.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -702,7 +701,7 @@ checksum = "2337e7a6c273082b672e377e159d7a168fb51438461b7c4033c79a515dd7a25a"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.114",
|
||||
"syn 2.0.117",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -758,9 +757,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "js-sys"
|
||||
version = "0.3.85"
|
||||
version = "0.3.91"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8c942ebf8e95485ca0d52d97da7c5a2c387d0e7f0ba4c35e93bfcaee045955b3"
|
||||
checksum = "b49715b7073f385ba4bc528e5747d02e66cb39c6146efb66b781f131f0fb399c"
|
||||
dependencies = [
|
||||
"once_cell",
|
||||
"wasm-bindgen",
|
||||
@@ -785,9 +784,9 @@ checksum = "e2db585e1d738fc771bf08a151420d3ed193d9d895a36df7f6f8a9456b911ddc"
|
||||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.181"
|
||||
version = "0.2.182"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "459427e2af2b9c839b132acb702a1c654d95e10f8c326bfc2ad11310e458b1c5"
|
||||
checksum = "6800badb6cb2082ffd7b6a67e6125bb39f18782f793520caee8cb8846be06112"
|
||||
|
||||
[[package]]
|
||||
name = "libloading"
|
||||
@@ -807,13 +806,14 @@ checksum = "b6d2cec3eae94f9f509c767b45932f1ada8350c4bdb85af2fcab4a3c14807981"
|
||||
|
||||
[[package]]
|
||||
name = "libredox"
|
||||
version = "0.1.12"
|
||||
version = "0.1.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3d0b95e02c851351f877147b7deea7b1afb1df71b63aa5f8270716e0c5720616"
|
||||
checksum = "1744e39d1d6a9948f4f388969627434e31128196de472883b39f148769bfe30a"
|
||||
dependencies = [
|
||||
"bitflags 2.10.0",
|
||||
"bitflags 2.11.0",
|
||||
"libc",
|
||||
"redox_syscall 0.7.0",
|
||||
"plain",
|
||||
"redox_syscall 0.7.3",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -835,9 +835,9 @@ checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab"
|
||||
|
||||
[[package]]
|
||||
name = "linux-raw-sys"
|
||||
version = "0.11.0"
|
||||
version = "0.12.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "df1d3c3b53da64cf5760482273a98e575c651a67eec7f77df96b5b642de8f039"
|
||||
checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53"
|
||||
|
||||
[[package]]
|
||||
name = "litrs"
|
||||
@@ -877,9 +877,9 @@ checksum = "f8ca58f447f06ed17d5fc4043ce1b10dd205e060fb3ce5b979b8ed8e59ff3f79"
|
||||
|
||||
[[package]]
|
||||
name = "memmap2"
|
||||
version = "0.9.9"
|
||||
version = "0.9.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "744133e4a0e0a658e1374cf3bf8e415c4052a15a111acd372764c55b4177d490"
|
||||
checksum = "714098028fe011992e1c3962653c96b2d578c4b4bce9036e15ff220319b1e0e3"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
@@ -890,7 +890,7 @@ version = "0.33.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c7047791b5bc903b8cd963014b355f71dc9864a9a0b727057676c1dcae5cbc15"
|
||||
dependencies = [
|
||||
"bitflags 2.10.0",
|
||||
"bitflags 2.11.0",
|
||||
"block",
|
||||
"core-graphics-types 0.2.0",
|
||||
"foreign-types",
|
||||
@@ -907,7 +907,7 @@ checksum = "618f667225063219ddfc61251087db8a9aec3c3f0950c916b614e403486f1135"
|
||||
dependencies = [
|
||||
"arrayvec",
|
||||
"bit-set",
|
||||
"bitflags 2.10.0",
|
||||
"bitflags 2.11.0",
|
||||
"cfg-if",
|
||||
"cfg_aliases",
|
||||
"codespan-reporting",
|
||||
@@ -931,7 +931,7 @@ version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c3f42e7bbe13d351b6bead8286a43aac9534b82bd3cc43e47037f012ebfd62d4"
|
||||
dependencies = [
|
||||
"bitflags 2.10.0",
|
||||
"bitflags 2.11.0",
|
||||
"jni-sys",
|
||||
"log",
|
||||
"ndk-sys",
|
||||
@@ -984,7 +984,7 @@ dependencies = [
|
||||
"proc-macro-crate",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.114",
|
||||
"syn 2.0.117",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1018,7 +1018,7 @@ version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e4e89ad9e3d7d297152b17d39ed92cd50ca8063a89a9fa569046d41568891eff"
|
||||
dependencies = [
|
||||
"bitflags 2.10.0",
|
||||
"bitflags 2.11.0",
|
||||
"block2",
|
||||
"libc",
|
||||
"objc2",
|
||||
@@ -1034,7 +1034,7 @@ version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "74dd3b56391c7a0596a295029734d3c1c5e7e510a4cb30245f8221ccea96b009"
|
||||
dependencies = [
|
||||
"bitflags 2.10.0",
|
||||
"bitflags 2.11.0",
|
||||
"block2",
|
||||
"objc2",
|
||||
"objc2-core-location",
|
||||
@@ -1058,7 +1058,7 @@ version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "617fbf49e071c178c0b24c080767db52958f716d9eabdf0890523aeae54773ef"
|
||||
dependencies = [
|
||||
"bitflags 2.10.0",
|
||||
"bitflags 2.11.0",
|
||||
"block2",
|
||||
"objc2",
|
||||
"objc2-foundation",
|
||||
@@ -1100,7 +1100,7 @@ version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0ee638a5da3799329310ad4cfa62fbf045d5f56e3ef5ba4149e7452dcf89d5a8"
|
||||
dependencies = [
|
||||
"bitflags 2.10.0",
|
||||
"bitflags 2.11.0",
|
||||
"block2",
|
||||
"dispatch",
|
||||
"libc",
|
||||
@@ -1125,7 +1125,7 @@ version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dd0cba1276f6023976a406a14ffa85e1fdd19df6b0f737b063b95f6c8c7aadd6"
|
||||
dependencies = [
|
||||
"bitflags 2.10.0",
|
||||
"bitflags 2.11.0",
|
||||
"block2",
|
||||
"objc2",
|
||||
"objc2-foundation",
|
||||
@@ -1137,7 +1137,7 @@ version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e42bee7bff906b14b167da2bac5efe6b6a07e6f7c0a21a7308d40c960242dc7a"
|
||||
dependencies = [
|
||||
"bitflags 2.10.0",
|
||||
"bitflags 2.11.0",
|
||||
"block2",
|
||||
"objc2",
|
||||
"objc2-foundation",
|
||||
@@ -1160,7 +1160,7 @@ version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b8bb46798b20cd6b91cbd113524c490f1686f4c4e8f49502431415f3512e2b6f"
|
||||
dependencies = [
|
||||
"bitflags 2.10.0",
|
||||
"bitflags 2.11.0",
|
||||
"block2",
|
||||
"objc2",
|
||||
"objc2-cloud-kit",
|
||||
@@ -1192,7 +1192,7 @@ version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "76cfcbf642358e8689af64cee815d139339f3ed8ad05103ed5eaf73db8d84cb3"
|
||||
dependencies = [
|
||||
"bitflags 2.10.0",
|
||||
"bitflags 2.11.0",
|
||||
"block2",
|
||||
"objc2",
|
||||
"objc2-core-location",
|
||||
@@ -1235,9 +1235,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "owo-colors"
|
||||
version = "4.2.3"
|
||||
version = "4.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9c6901729fa79e91a0913333229e9ca5dc725089d1c363b2f4b4760709dc4a52"
|
||||
checksum = "d211803b9b6b570f68772237e415a029d5a50c65d382910b879fb19d3271f94d"
|
||||
|
||||
[[package]]
|
||||
name = "parking_lot"
|
||||
@@ -1276,35 +1276,29 @@ checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220"
|
||||
|
||||
[[package]]
|
||||
name = "pin-project"
|
||||
version = "1.1.10"
|
||||
version = "1.1.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "677f1add503faace112b9f1373e43e9e054bfdd22ff1a63c1bc485eaec6a6a8a"
|
||||
checksum = "f1749c7ed4bcaf4c3d0a3efc28538844fb29bcdd7d2b67b2be7e20ba861ff517"
|
||||
dependencies = [
|
||||
"pin-project-internal",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pin-project-internal"
|
||||
version = "1.1.10"
|
||||
version = "1.1.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6e918e4ff8c4549eb882f14b3a4bc8c8bc93de829416eacf579f1207a8fbf861"
|
||||
checksum = "d9b20ed30f105399776b9c883e68e536ef602a16ae6f596d2c473591d6ad64c6"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.114",
|
||||
"syn 2.0.117",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pin-project-lite"
|
||||
version = "0.2.16"
|
||||
version = "0.2.17"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b"
|
||||
|
||||
[[package]]
|
||||
name = "pin-utils"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
|
||||
checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd"
|
||||
|
||||
[[package]]
|
||||
name = "pkg-config"
|
||||
@@ -1312,6 +1306,12 @@ version = "0.3.32"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c"
|
||||
|
||||
[[package]]
|
||||
name = "plain"
|
||||
version = "0.2.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b4596b6d070b27117e987119b4dac604f3c58cfb0b191112e24771b2faeac1a6"
|
||||
|
||||
[[package]]
|
||||
name = "polling"
|
||||
version = "3.11.0"
|
||||
@@ -1322,7 +1322,7 @@ dependencies = [
|
||||
"concurrent-queue",
|
||||
"hermit-abi",
|
||||
"pin-project-lite",
|
||||
"rustix 1.1.3",
|
||||
"rustix 1.1.4",
|
||||
"windows-sys 0.61.2",
|
||||
]
|
||||
|
||||
@@ -1355,9 +1355,9 @@ checksum = "e8cf8e6a8aa66ce33f63993ffc4ea4271eb5b0530a9002db8455ea6050c77bfa"
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro-crate"
|
||||
version = "3.4.0"
|
||||
version = "3.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "219cb19e96be00ab2e37d6e299658a0cfa83e52429179969b0f0121b4ac46983"
|
||||
checksum = "e67ba7e9b2b56446f1d419b1d807906278ffa1a658a8a5d8a39dcb1f5a78614f"
|
||||
dependencies = [
|
||||
"toml_edit",
|
||||
]
|
||||
@@ -1388,9 +1388,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "1.0.44"
|
||||
version = "1.0.45"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "21b2ebcf727b7760c461f091f9f0f539b77b8e87f2fd88131e7f1b433b3cece4"
|
||||
checksum = "41f2619966050689382d2b44f664f4bc593e129785a36d6ee376ddf37259b924"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
]
|
||||
@@ -1403,9 +1403,9 @@ checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f"
|
||||
|
||||
[[package]]
|
||||
name = "range-alloc"
|
||||
version = "0.1.4"
|
||||
version = "0.1.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c3d6831663a5098ea164f89cff59c6284e95f4e3c76ce9848d4529f5ccca9bde"
|
||||
checksum = "ca45419789ae5a7899559e9512e58ca889e41f04f1f2445e9f4b290ceccd1d08"
|
||||
|
||||
[[package]]
|
||||
name = "ratio_ops"
|
||||
@@ -1434,16 +1434,16 @@ version = "0.5.18"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d"
|
||||
dependencies = [
|
||||
"bitflags 2.10.0",
|
||||
"bitflags 2.11.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "redox_syscall"
|
||||
version = "0.7.0"
|
||||
version = "0.7.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "49f3fe0889e69e2ae9e41f4d6c4c0181701d00e4697b356fb1f74173a5e0ee27"
|
||||
checksum = "6ce70a74e890531977d37e532c34d45e9055d2409ed08ddba14529471ed0be16"
|
||||
dependencies = [
|
||||
"bitflags 2.10.0",
|
||||
"bitflags 2.11.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1464,7 +1464,7 @@ version = "0.38.44"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154"
|
||||
dependencies = [
|
||||
"bitflags 2.10.0",
|
||||
"bitflags 2.11.0",
|
||||
"errno",
|
||||
"libc",
|
||||
"linux-raw-sys 0.4.15",
|
||||
@@ -1473,14 +1473,14 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rustix"
|
||||
version = "1.1.3"
|
||||
version = "1.1.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "146c9e247ccc180c1f61615433868c99f3de3ae256a30a43b49f67c2d9171f34"
|
||||
checksum = "b6fe4565b9518b83ef4f91bb47ce29620ca828bd32cb7e408f0062e9930ba190"
|
||||
dependencies = [
|
||||
"bitflags 2.10.0",
|
||||
"bitflags 2.11.0",
|
||||
"errno",
|
||||
"libc",
|
||||
"linux-raw-sys 0.11.0",
|
||||
"linux-raw-sys 0.12.1",
|
||||
"windows-sys 0.61.2",
|
||||
]
|
||||
|
||||
@@ -1551,7 +1551,7 @@ checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.114",
|
||||
"syn 2.0.117",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1587,7 +1587,7 @@ version = "0.19.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3457dea1f0eb631b4034d61d4d8c32074caa6cd1ab2d59f2327bd8461e2c0016"
|
||||
dependencies = [
|
||||
"bitflags 2.10.0",
|
||||
"bitflags 2.11.0",
|
||||
"calloop",
|
||||
"calloop-wayland-source",
|
||||
"cursor-icon",
|
||||
@@ -1621,7 +1621,7 @@ version = "0.3.0+sdk-1.3.268.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "eda41003dc44290527a59b13432d4a0379379fa074b70174882adfbdfd917844"
|
||||
dependencies = [
|
||||
"bitflags 2.10.0",
|
||||
"bitflags 2.11.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1632,12 +1632,12 @@ checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
|
||||
|
||||
[[package]]
|
||||
name = "strafesnet_common"
|
||||
version = "0.8.0"
|
||||
version = "0.8.6"
|
||||
source = "sparse+https://git.itzana.me/api/packages/strafesnet/cargo/"
|
||||
checksum = "171f2b754a8c59b335578824d5465d9637fb41ec4906c6a8c1fd39206891b09c"
|
||||
checksum = "fb31424f16d189979d9f5781067ff29169a258c11da6ff46a4196bffd96d61dc"
|
||||
dependencies = [
|
||||
"arrayvec",
|
||||
"bitflags 2.10.0",
|
||||
"bitflags 2.11.0",
|
||||
"fixed_wide",
|
||||
"glam",
|
||||
"id",
|
||||
@@ -1647,9 +1647,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "strafesnet_graphics"
|
||||
version = "0.0.2"
|
||||
version = "0.0.5"
|
||||
source = "sparse+https://git.itzana.me/api/packages/strafesnet/cargo/"
|
||||
checksum = "a0f063bd3579397908d411cef8ee3a755760f567ff354247c21d503c2a406669"
|
||||
checksum = "786feeee41d2a65707eea824ad928f1dad5be3fc82e80d541bb36e45fda1c9d6"
|
||||
dependencies = [
|
||||
"bytemuck",
|
||||
"ddsfile",
|
||||
@@ -1661,24 +1661,23 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "strafesnet_roblox_bot_file"
|
||||
version = "0.8.1"
|
||||
version = "0.9.3"
|
||||
source = "sparse+https://git.itzana.me/api/packages/strafesnet/cargo/"
|
||||
checksum = "33d0fa524476d8b6cf23269b0c9cff6334b70585546b807cb8ec193858defecd"
|
||||
checksum = "423d931e4f4f97406a86519a22172d1fc0d5b9d8c3b2d4553ae89b641bbd555c"
|
||||
dependencies = [
|
||||
"binrw",
|
||||
"bitflags 2.10.0",
|
||||
"bitflags 2.11.0",
|
||||
"itertools",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "strafesnet_roblox_bot_player"
|
||||
version = "0.1.0"
|
||||
version = "0.1.1"
|
||||
dependencies = [
|
||||
"glam",
|
||||
"strafesnet_common",
|
||||
"strafesnet_graphics",
|
||||
"strafesnet_roblox_bot_file",
|
||||
"strafesnet_snf",
|
||||
"wgpu",
|
||||
]
|
||||
|
||||
@@ -1701,10 +1700,12 @@ dependencies = [
|
||||
name = "strafesnet_roblox_bot_player_wasm_module"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"glam",
|
||||
"strafesnet_common",
|
||||
"strafesnet_graphics",
|
||||
"strafesnet_roblox_bot_file",
|
||||
"strafesnet_roblox_bot_player",
|
||||
"strafesnet_snf",
|
||||
"wasm-bindgen",
|
||||
"wasm-bindgen-futures",
|
||||
"web-sys",
|
||||
@@ -1741,9 +1742,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "2.0.114"
|
||||
version = "2.0.117"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d4d107df263a3013ef9b1879b0df87d706ff80f65a86ea879bd9c31f9b307c2a"
|
||||
checksum = "e665b8803e7b1d2a727f4023456bbbbe74da67099c585258af0ad9c5013b9b99"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@@ -1785,7 +1786,7 @@ checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.114",
|
||||
"syn 2.0.117",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1796,7 +1797,7 @@ checksum = "ebc4ee7f67670e9b64d05fa4253e753e016c6c95ff35b89b7941d6b856dec1d5"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.114",
|
||||
"syn 2.0.117",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1826,18 +1827,18 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "toml_datetime"
|
||||
version = "0.7.5+spec-1.1.0"
|
||||
version = "1.0.0+spec-1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "92e1cfed4a3038bc5a127e35a2d360f145e1f4b971b551a2ba5fd7aedf7e1347"
|
||||
checksum = "32c2555c699578a4f59f0cc68e5116c8d7cabbd45e1409b989d4be085b53f13e"
|
||||
dependencies = [
|
||||
"serde_core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "toml_edit"
|
||||
version = "0.23.10+spec-1.0.0"
|
||||
version = "0.25.3+spec-1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "84c8b9f757e028cee9fa244aea147aab2a9ec09d5325a9b01e0a49730c2b5269"
|
||||
checksum = "a0a07913e63758bc95142d9863a5a45173b71515e68b690cad70cf99c3255ce1"
|
||||
dependencies = [
|
||||
"indexmap",
|
||||
"toml_datetime",
|
||||
@@ -1847,9 +1848,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "toml_parser"
|
||||
version = "1.0.7+spec-1.1.0"
|
||||
version = "1.0.9+spec-1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "247eaa3197818b831697600aadf81514e577e0cba5eab10f7e064e78ae154df1"
|
||||
checksum = "702d4415e08923e7e1ef96cd5727c0dfed80b4d2fa25db9647fe5eb6f7c5a4c4"
|
||||
dependencies = [
|
||||
"winnow",
|
||||
]
|
||||
@@ -1878,9 +1879,9 @@ checksum = "d2df906b07856748fa3f6e0ad0cbaa047052d4a7dd609e231c4f72cee8c36f31"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-ident"
|
||||
version = "1.0.23"
|
||||
version = "1.0.24"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "537dd038a89878be9b64dd4bd1b260315c1bb94f4d784956b81e27a088d9a09e"
|
||||
checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-segmentation"
|
||||
@@ -1921,9 +1922,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen"
|
||||
version = "0.2.108"
|
||||
version = "0.2.114"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "64024a30ec1e37399cf85a7ffefebdb72205ca1c972291c51512360d90bd8566"
|
||||
checksum = "6532f9a5c1ece3798cb1c2cfdba640b9b3ba884f5db45973a6f442510a87d38e"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"once_cell",
|
||||
@@ -1934,9 +1935,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-futures"
|
||||
version = "0.4.58"
|
||||
version = "0.4.64"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "70a6e77fd0ae8029c9ea0063f87c46fde723e7d887703d74ad2616d792e51e6f"
|
||||
checksum = "e9c5522b3a28661442748e09d40924dfb9ca614b21c00d3fd135720e48b67db8"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"futures-util",
|
||||
@@ -1948,9 +1949,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-macro"
|
||||
version = "0.2.108"
|
||||
version = "0.2.114"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "008b239d9c740232e71bd39e8ef6429d27097518b6b30bdf9086833bd5b6d608"
|
||||
checksum = "18a2d50fcf105fb33bb15f00e7a77b772945a2ee45dcf454961fd843e74c18e6"
|
||||
dependencies = [
|
||||
"quote",
|
||||
"wasm-bindgen-macro-support",
|
||||
@@ -1958,22 +1959,22 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-macro-support"
|
||||
version = "0.2.108"
|
||||
version = "0.2.114"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5256bae2d58f54820e6490f9839c49780dff84c65aeab9e772f15d5f0e913a55"
|
||||
checksum = "03ce4caeaac547cdf713d280eda22a730824dd11e6b8c3ca9e42247b25c631e3"
|
||||
dependencies = [
|
||||
"bumpalo",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.114",
|
||||
"syn 2.0.117",
|
||||
"wasm-bindgen-shared",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-shared"
|
||||
version = "0.2.108"
|
||||
version = "0.2.114"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1f01b580c9ac74c8d8f0c0e4afb04eeef2acf145458e52c03845ee9cd23e3d12"
|
||||
checksum = "75a326b8c223ee17883a4251907455a2431acc2791c98c26279376490c378c16"
|
||||
dependencies = [
|
||||
"unicode-ident",
|
||||
]
|
||||
@@ -1986,7 +1987,7 @@ checksum = "fee64194ccd96bf648f42a65a7e589547096dfa702f7cadef84347b66ad164f9"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"downcast-rs",
|
||||
"rustix 1.1.3",
|
||||
"rustix 1.1.4",
|
||||
"scoped-tls",
|
||||
"smallvec",
|
||||
"wayland-sys",
|
||||
@@ -1998,8 +1999,8 @@ version = "0.31.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b8e6faa537fbb6c186cb9f1d41f2f811a4120d1b57ec61f50da451a0c5122bec"
|
||||
dependencies = [
|
||||
"bitflags 2.10.0",
|
||||
"rustix 1.1.3",
|
||||
"bitflags 2.11.0",
|
||||
"rustix 1.1.4",
|
||||
"wayland-backend",
|
||||
"wayland-scanner",
|
||||
]
|
||||
@@ -2010,7 +2011,7 @@ version = "0.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "625c5029dbd43d25e6aa9615e88b829a5cad13b2819c4ae129fdbb7c31ab4c7e"
|
||||
dependencies = [
|
||||
"bitflags 2.10.0",
|
||||
"bitflags 2.11.0",
|
||||
"cursor-icon",
|
||||
"wayland-backend",
|
||||
]
|
||||
@@ -2021,7 +2022,7 @@ version = "0.31.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5864c4b5b6064b06b1e8b74ead4a98a6c45a285fe7a0e784d24735f011fdb078"
|
||||
dependencies = [
|
||||
"rustix 1.1.3",
|
||||
"rustix 1.1.4",
|
||||
"wayland-client",
|
||||
"xcursor",
|
||||
]
|
||||
@@ -2032,7 +2033,7 @@ version = "0.32.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "baeda9ffbcfc8cd6ddaade385eaf2393bd2115a69523c735f12242353c3df4f3"
|
||||
dependencies = [
|
||||
"bitflags 2.10.0",
|
||||
"bitflags 2.11.0",
|
||||
"wayland-backend",
|
||||
"wayland-client",
|
||||
"wayland-scanner",
|
||||
@@ -2044,7 +2045,7 @@ version = "0.3.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "aa98634619300a535a9a97f338aed9a5ff1e01a461943e8346ff4ae26007306b"
|
||||
dependencies = [
|
||||
"bitflags 2.10.0",
|
||||
"bitflags 2.11.0",
|
||||
"wayland-backend",
|
||||
"wayland-client",
|
||||
"wayland-protocols",
|
||||
@@ -2057,7 +2058,7 @@ version = "0.3.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e9597cdf02cf0c34cd5823786dce6b5ae8598f05c2daf5621b6e178d4f7345f3"
|
||||
dependencies = [
|
||||
"bitflags 2.10.0",
|
||||
"bitflags 2.11.0",
|
||||
"wayland-backend",
|
||||
"wayland-client",
|
||||
"wayland-protocols",
|
||||
@@ -2089,9 +2090,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "web-sys"
|
||||
version = "0.3.85"
|
||||
version = "0.3.91"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "312e32e551d92129218ea9a2452120f4aabc03529ef03e4d0d82fb2780608598"
|
||||
checksum = "854ba17bb104abfb26ba36da9729addc7ce7f06f5c0f90f3c391f8461cca21f9"
|
||||
dependencies = [
|
||||
"js-sys",
|
||||
"wasm-bindgen",
|
||||
@@ -2114,7 +2115,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f9cb534d5ffd109c7d1135f34cdae29e60eab94855a625dcfe1705f8bc7ad79f"
|
||||
dependencies = [
|
||||
"arrayvec",
|
||||
"bitflags 2.10.0",
|
||||
"bitflags 2.11.0",
|
||||
"bytemuck",
|
||||
"cfg-if",
|
||||
"cfg_aliases",
|
||||
@@ -2139,14 +2140,14 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wgpu-core"
|
||||
version = "28.0.0"
|
||||
version = "28.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8bb4c8b5db5f00e56f1f08869d870a0dff7c8bc7ebc01091fec140b0cf0211a9"
|
||||
checksum = "d23f4642f53f666adcfd2d3218ab174d1e6681101aef18696b90cbe64d1c10f9"
|
||||
dependencies = [
|
||||
"arrayvec",
|
||||
"bit-set",
|
||||
"bit-vec",
|
||||
"bitflags 2.10.0",
|
||||
"bitflags 2.11.0",
|
||||
"bytemuck",
|
||||
"cfg_aliases",
|
||||
"document-features",
|
||||
@@ -2164,6 +2165,7 @@ dependencies = [
|
||||
"thiserror 2.0.18",
|
||||
"wgpu-core-deps-apple",
|
||||
"wgpu-core-deps-emscripten",
|
||||
"wgpu-core-deps-wasm",
|
||||
"wgpu-core-deps-windows-linux-android",
|
||||
"wgpu-hal",
|
||||
"wgpu-types",
|
||||
@@ -2187,6 +2189,15 @@ dependencies = [
|
||||
"wgpu-hal",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wgpu-core-deps-wasm"
|
||||
version = "28.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "12a2cf578ce8d7d50d0e63ddc2345c7dcb599f6eb90b888813406ea78b9b7010"
|
||||
dependencies = [
|
||||
"wgpu-hal",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wgpu-core-deps-windows-linux-android"
|
||||
version = "28.0.0"
|
||||
@@ -2198,15 +2209,15 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wgpu-hal"
|
||||
version = "28.0.0"
|
||||
version = "28.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "293080d77fdd14d6b08a67c5487dfddbf874534bb7921526db56a7b75d7e3bef"
|
||||
checksum = "44d6cb474beb218824dcc9e1ce679d973f719262789bfb27407da560cac20eeb"
|
||||
dependencies = [
|
||||
"android_system_properties",
|
||||
"arrayvec",
|
||||
"ash",
|
||||
"bit-set",
|
||||
"bitflags 2.10.0",
|
||||
"bitflags 2.11.0",
|
||||
"block",
|
||||
"bytemuck",
|
||||
"cfg-if",
|
||||
@@ -2250,7 +2261,7 @@ version = "28.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e18308757e594ed2cd27dddbb16a139c42a683819d32a2e0b1b0167552f5840c"
|
||||
dependencies = [
|
||||
"bitflags 2.10.0",
|
||||
"bitflags 2.11.0",
|
||||
"bytemuck",
|
||||
"js-sys",
|
||||
"log",
|
||||
@@ -2319,7 +2330,7 @@ checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.114",
|
||||
"syn 2.0.117",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -2330,7 +2341,7 @@ checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.114",
|
||||
"syn 2.0.117",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -2535,14 +2546,14 @@ checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
|
||||
|
||||
[[package]]
|
||||
name = "winit"
|
||||
version = "0.30.12"
|
||||
version = "0.30.13"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c66d4b9ed69c4009f6321f762d6e61ad8a2389cd431b97cb1e146812e9e6c732"
|
||||
checksum = "a6755fa58a9f8350bd1e472d4c3fcc25f824ec358933bba33306d0b63df5978d"
|
||||
dependencies = [
|
||||
"ahash",
|
||||
"android-activity",
|
||||
"atomic-waker",
|
||||
"bitflags 2.10.0",
|
||||
"bitflags 2.11.0",
|
||||
"block2",
|
||||
"bytemuck",
|
||||
"calloop",
|
||||
@@ -2622,7 +2633,7 @@ dependencies = [
|
||||
"libc",
|
||||
"libloading",
|
||||
"once_cell",
|
||||
"rustix 1.1.3",
|
||||
"rustix 1.1.4",
|
||||
"x11rb-protocol",
|
||||
]
|
||||
|
||||
@@ -2644,7 +2655,7 @@ version = "0.4.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d039de8032a9a8856a6be89cea3e5d12fdd82306ab7c94d74e6deab2460651c5"
|
||||
dependencies = [
|
||||
"bitflags 2.10.0",
|
||||
"bitflags 2.11.0",
|
||||
"dlib",
|
||||
"log",
|
||||
"once_cell",
|
||||
@@ -2665,20 +2676,20 @@ checksum = "3ae8337f8a065cfc972643663ea4279e04e7256de865aa66fe25cec5fb912d3f"
|
||||
|
||||
[[package]]
|
||||
name = "zerocopy"
|
||||
version = "0.8.39"
|
||||
version = "0.8.40"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "db6d35d663eadb6c932438e763b262fe1a70987f9ae936e60158176d710cae4a"
|
||||
checksum = "a789c6e490b576db9f7e6b6d661bcc9799f7c0ac8352f56ea20193b2681532e5"
|
||||
dependencies = [
|
||||
"zerocopy-derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zerocopy-derive"
|
||||
version = "0.8.39"
|
||||
version = "0.8.40"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4122cd3169e94605190e77839c9a40d40ed048d305bfdc146e7df40ab0f3e517"
|
||||
checksum = "f65c489a7071a749c849713807783f70672b28094011623e200cb86dcb835953"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.114",
|
||||
"syn 2.0.117",
|
||||
]
|
||||
|
||||
@@ -12,7 +12,9 @@ strip = true
|
||||
codegen-units = 1
|
||||
|
||||
[workspace.dependencies]
|
||||
strafesnet_common = { version = "0.8.0", registry = "strafesnet" }
|
||||
strafesnet_graphics = { version = "0.0.2", registry = "strafesnet" }
|
||||
strafesnet_roblox_bot_file = { version = "0.8.1", registry = "strafesnet" }
|
||||
glam = "0.32.0"
|
||||
|
||||
strafesnet_common = { version = "0.8.6", registry = "strafesnet" }
|
||||
strafesnet_graphics = { version = "0.0.5", registry = "strafesnet" }
|
||||
strafesnet_roblox_bot_file = { version = "0.9.3", registry = "strafesnet" }
|
||||
strafesnet_snf = { version = "0.3.2", registry = "strafesnet" }
|
||||
|
||||
176
LICENSE-APACHE
Normal file
176
LICENSE-APACHE
Normal file
@@ -0,0 +1,176 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
23
LICENSE-MIT
Normal file
23
LICENSE-MIT
Normal file
@@ -0,0 +1,23 @@
|
||||
Permission is hereby granted, free of charge, to any
|
||||
person obtaining a copy of this software and associated
|
||||
documentation files (the "Software"), to deal in the
|
||||
Software without restriction, including without
|
||||
limitation the rights to use, copy, modify, merge,
|
||||
publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software
|
||||
is furnished to do so, subject to the following
|
||||
conditions:
|
||||
|
||||
The above copyright notice and this permission notice
|
||||
shall be included in all copies or substantial portions
|
||||
of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
|
||||
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
|
||||
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
||||
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
|
||||
SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
|
||||
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
41
README.md
41
README.md
@@ -1,17 +1,50 @@
|
||||
How to build the wasm module:
|
||||
### How to clone this repository:
|
||||
- Install git
|
||||
- Install git lfs (for test files)
|
||||
```
|
||||
git clone https://git.itzana.me/StrafesNET/roblox-bot-player
|
||||
cd roblox-bot-player
|
||||
git lfs pull
|
||||
```
|
||||
|
||||
### How to build the wasm module:
|
||||
- Install rust
|
||||
- Install wasm-pack
|
||||
```
|
||||
cd wasm-module
|
||||
wasm-pack build --target web --out-dir ../web-demo/pkg
|
||||
```
|
||||
|
||||
How to serve the web demo (requires wasm module):
|
||||
### How to serve the web demo (requires wasm module):
|
||||
- Install python3 or use your favourite http server
|
||||
```
|
||||
cd web-demo
|
||||
python3 -m http.server
|
||||
```
|
||||
|
||||
How to run the native player:
|
||||
### How to run the native player:
|
||||
- Install rust
|
||||
```
|
||||
cd native-player
|
||||
cargo run --release
|
||||
cargo run --release -- ../web-demo/bhop_marble_5692093612.snfm ../web-demo/bhop_marble_7cf33a64-7120-4514-b9fa-4fe29d9523d.qbot
|
||||
```
|
||||
You can drag and drop map files and bot files to load them.
|
||||
|
||||
#### License
|
||||
|
||||
This code depends on a proprietary module, [strafesnet_graphics](https://git.itzana.me/StrafesNET/strafe-project/src/branch/master/engine/graphics). The resulting binary is
|
||||
not redistributable without the express permission of Rhys Lloyd. The code in this repository
|
||||
is MIT & Apache 2.0 dual licensed, and is free to use.
|
||||
|
||||
<sup>
|
||||
Licensed under either of <a href="LICENSE-APACHE">Apache License, Version
|
||||
2.0</a> or <a href="LICENSE-MIT">MIT license</a> at your option.
|
||||
</sup>
|
||||
|
||||
<br>
|
||||
|
||||
<sub>
|
||||
Unless you explicitly state otherwise, any contribution intentionally submitted
|
||||
for inclusion in this crate by you, as defined in the Apache-2.0 license, shall
|
||||
be dual licensed as above, without any additional terms or conditions.
|
||||
</sub>
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
[package]
|
||||
name = "strafesnet_roblox_bot_player"
|
||||
version = "0.1.0"
|
||||
version = "0.1.1"
|
||||
edition = "2024"
|
||||
|
||||
[dependencies]
|
||||
glam = "0.31.0"
|
||||
glam.workspace = true
|
||||
strafesnet_common.workspace = true
|
||||
strafesnet_graphics.workspace = true
|
||||
strafesnet_roblox_bot_file.workspace = true
|
||||
strafesnet_snf.workspace = true
|
||||
wgpu = "28.0.0"
|
||||
|
||||
@@ -1,31 +1,60 @@
|
||||
use strafesnet_common::timer::{TimerFixed,Realtime,Unpaused};
|
||||
use strafesnet_common::run::{Time as RunTime};
|
||||
use strafesnet_common::physics::{Time as PhysicsTime,TimeInner as PhysicsTimeInner};
|
||||
use strafesnet_roblox_bot_file::v0;
|
||||
|
||||
use crate::head::{Time as PlaybackTime,TimeInner as PlaybackTimeInner};
|
||||
|
||||
/// A loaded bot file.
|
||||
pub struct CompleteBot{
|
||||
//Instructions
|
||||
timelines:strafesnet_roblox_bot_file::v0::Block,
|
||||
offset:f64,
|
||||
duration:f64,
|
||||
timelines:v0::Block,
|
||||
timer:TimerFixed<Realtime<PlaybackTimeInner,PhysicsTimeInner>,Unpaused>,
|
||||
duration:PhysicsTime,
|
||||
world_offset:glam::Vec3,
|
||||
}
|
||||
impl CompleteBot{
|
||||
pub(crate) const CAMERA_OFFSET:glam::Vec3=glam::vec3(0.0,2.0,0.0);
|
||||
pub fn new(
|
||||
data:&[u8],
|
||||
)->Result<Self,strafesnet_roblox_bot_file::v0::Error>{
|
||||
let timelines=strafesnet_roblox_bot_file::v0::read_all_to_block(std::io::Cursor::new(data))?;
|
||||
let first=timelines.output_events.first().unwrap();
|
||||
let last=timelines.output_events.last().unwrap();
|
||||
Ok(Self{
|
||||
offset:first.time,
|
||||
duration:last.time-first.time,
|
||||
timelines:v0::Block,
|
||||
)->Self{
|
||||
let start=crate::time::from_float(timelines.output_events.first().unwrap().time).unwrap();
|
||||
let end=crate::time::from_float(timelines.output_events.last().unwrap().time).unwrap();
|
||||
let world_position=timelines.world_events.iter().find_map(|event|match &event.event{
|
||||
v0::WorldEvent::Reset(world_reset_event)=>Some(world_reset_event.position),
|
||||
_=>None,
|
||||
}).expect("Map must contain a WorldReset event");
|
||||
Self{
|
||||
timer:TimerFixed::new(PlaybackTime::ZERO,start),
|
||||
duration:end-start,
|
||||
timelines,
|
||||
})
|
||||
world_offset:glam::vec3(world_position.x,world_position.y,world_position.z),
|
||||
}
|
||||
}
|
||||
pub const fn offset(&self)->f64{
|
||||
self.offset
|
||||
pub fn time(&self,time:PlaybackTime)->PhysicsTime{
|
||||
self.timer.time(time)
|
||||
}
|
||||
pub const fn duration(&self)->f64{
|
||||
pub const fn duration(&self)->PhysicsTime{
|
||||
self.duration
|
||||
}
|
||||
pub const fn timelines(&self)->&strafesnet_roblox_bot_file::v0::Block{
|
||||
pub const fn world_offset(&self)->glam::Vec3{
|
||||
self.world_offset
|
||||
}
|
||||
pub const fn timelines(&self)->&v0::Block{
|
||||
&self.timelines
|
||||
}
|
||||
pub fn run_duration(&self,mode_id:v0::ModeID)->Option<RunTime>{
|
||||
let mut it=self.timelines.run_events.iter().rev();
|
||||
let end=it.find_map(|event|match &event.event{
|
||||
v0::RunEvent::Finish(run_start_event) if run_start_event.mode==mode_id=>Some(event.time),
|
||||
_=>None,
|
||||
})?;
|
||||
let start=it.find_map(|event|match &event.event{
|
||||
v0::RunEvent::Start(run_start_event) if run_start_event.mode==mode_id=>Some(event.time),
|
||||
_=>None,
|
||||
})?;
|
||||
let start=crate::time::from_float(start).unwrap();
|
||||
let end=crate::time::from_float(end).unwrap();
|
||||
Some(end-start)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,27 +6,32 @@ pub struct Graphics{
|
||||
config:wgpu::SurfaceConfiguration,
|
||||
device:wgpu::Device,
|
||||
queue:wgpu::Queue,
|
||||
start_offset:glam::Vec3,
|
||||
}
|
||||
impl Graphics{
|
||||
pub fn new(device:wgpu::Device,queue:wgpu::Queue,config:wgpu::SurfaceConfiguration)->Self{
|
||||
let mut graphics=strafesnet_graphics::graphics::GraphicsState::new(&device,&queue,&config);
|
||||
graphics.resize(&device,&config,glam::Vec2::ONE);
|
||||
let graphics=strafesnet_graphics::graphics::GraphicsState::new(&device,&queue,&config);
|
||||
Self{
|
||||
graphics,
|
||||
device,
|
||||
queue,
|
||||
config,
|
||||
start_offset:glam::Vec3::ZERO,
|
||||
}
|
||||
}
|
||||
pub fn change_map(&mut self,map:&crate::map::CompleteMap){
|
||||
pub fn change_map(&mut self,map:&strafesnet_common::map::CompleteMap){
|
||||
self.graphics.clear();
|
||||
self.graphics.generate_models(&self.device,&self.queue,map.map());
|
||||
self.graphics.generate_models(&self.device,&self.queue,map);
|
||||
let modes=map.modes.clone().denormalize();
|
||||
let mode=modes.get_mode(strafesnet_common::gameplay_modes::ModeId::MAIN).expect("Map does not have a main mode");
|
||||
let start_zone=map.models.get(mode.get_start().get() as usize).expect("Map does not have a start zone");
|
||||
self.start_offset=glam::Vec3::from_array(start_zone.transform.translation.map(|f|f.into()).to_array());
|
||||
}
|
||||
pub fn resize(&mut self,surface:&wgpu::Surface<'_>,size:glam::UVec2){
|
||||
pub fn resize(&mut self,surface:&wgpu::Surface<'_>,size:glam::UVec2,fov:glam::Vec2){
|
||||
self.config.width=size.x.max(1);
|
||||
self.config.height=size.y.max(1);
|
||||
surface.configure(&self.device,&self.config);
|
||||
self.graphics.resize(&self.device,&self.config,glam::Vec2::ONE);
|
||||
self.graphics.resize(&self.device,&self.config,fov);
|
||||
}
|
||||
pub fn render(&mut self,surface:&wgpu::Surface<'_>,pos:glam::Vec3,angles:glam::Vec2){
|
||||
//this has to go deeper somehow
|
||||
@@ -44,7 +49,7 @@ impl Graphics{
|
||||
..wgpu::TextureViewDescriptor::default()
|
||||
});
|
||||
|
||||
self.graphics.render(&view,&self.device,&self.queue,strafesnet_graphics::graphics::view_inv(pos,angles));
|
||||
self.graphics.render(&view,&self.device,&self.queue,strafesnet_graphics::graphics::view_inv(pos+self.start_offset,angles));
|
||||
|
||||
frame.present();
|
||||
}
|
||||
|
||||
167
lib/src/head.rs
167
lib/src/head.rs
@@ -1,81 +1,156 @@
|
||||
use glam::Vec3Swizzles;
|
||||
use strafesnet_common::timer::{Timer,Scaled};
|
||||
use strafesnet_common::timer::{Scaled,Timer,TimerState};
|
||||
use strafesnet_common::session::{Time as SessionTime,TimeInner as SessionTimeInner};
|
||||
use strafesnet_common::physics::{Time as PhysicsTime,TimeInner as PhysicsTimeInner};
|
||||
use strafesnet_roblox_bot_file::v0::{EventType,Head,Timed};
|
||||
|
||||
pub enum PlaybackInstructionInternal{
|
||||
Sound
|
||||
}
|
||||
pub enum PlaybackInstructionExternal{
|
||||
SetPaused(bool),
|
||||
Idle,
|
||||
}
|
||||
use crate::bot::CompleteBot;
|
||||
use crate::state::PlaybackState;
|
||||
|
||||
fn vector3_to_glam(v:&strafesnet_roblox_bot_file::v0::Vector3)->glam::Vec3{
|
||||
glam::vec3(v.x,v.y,v.z)
|
||||
}
|
||||
|
||||
#[derive(Clone,Copy,Hash,Eq,PartialEq,Ord,PartialOrd,Debug)]
|
||||
pub enum TimeInner{}
|
||||
pub type Time=strafesnet_common::integer::Time<TimeInner>;
|
||||
|
||||
/// A playback context. Advance time and then generate a camera position to pass to the renderer.
|
||||
pub struct PlaybackHead{
|
||||
//"Simulation"
|
||||
event_id:usize,
|
||||
offset:f64,
|
||||
timer:Timer<Scaled<SessionTimeInner,PhysicsTimeInner>>,
|
||||
head:Head,
|
||||
timer:Timer<Scaled<SessionTimeInner,TimeInner>>,
|
||||
state:PlaybackState,
|
||||
}
|
||||
impl PlaybackHead{
|
||||
pub fn new(time:SessionTime)->Self{
|
||||
let timer=Timer::unpaused(time,PhysicsTime::ZERO);
|
||||
pub fn new(bot:&CompleteBot,time:SessionTime)->Self{
|
||||
let timer=Timer::unpaused(time,Time::ZERO);
|
||||
let head=Head::after_time(bot.timelines(),bot.time(Time::ZERO).into());
|
||||
let mut state=PlaybackState::new();
|
||||
state.process_head(bot.timelines(),&head);
|
||||
Self{
|
||||
event_id:0,
|
||||
offset:0.0,
|
||||
head,
|
||||
timer,
|
||||
state,
|
||||
}
|
||||
}
|
||||
pub fn advance_time(&mut self,bot:&crate::bot::CompleteBot,time:SessionTime){
|
||||
let simulation_time=self.timer.time(time);
|
||||
let mut time_float=simulation_time.get() as f64/PhysicsTime::ONE_SECOND.get() as f64+self.offset+bot.offset();
|
||||
pub const fn state(&self)->&PlaybackState{
|
||||
&self.state
|
||||
}
|
||||
pub fn time(&self,time:SessionTime)->Time{
|
||||
self.timer.time(time)
|
||||
}
|
||||
pub fn timer(&self)->&Timer<Scaled<SessionTimeInner,TimeInner>>{
|
||||
&self.timer
|
||||
}
|
||||
pub fn set_paused(&mut self,time:SessionTime,paused:bool){
|
||||
_=self.timer.set_paused(time,paused);
|
||||
}
|
||||
pub fn set_time(&mut self,bot:&CompleteBot,time:SessionTime,new_time:Time){
|
||||
let new_time=new_time.rem_euclid(bot.duration().coerce());
|
||||
self.timer.set_time(time,new_time);
|
||||
// reset head
|
||||
self.head=Head::after_time(bot.timelines(),bot.time(new_time).into());
|
||||
|
||||
self.state=PlaybackState::new();
|
||||
self.state.process_head(bot.timelines(),&self.head);
|
||||
}
|
||||
pub fn get_scale(&self)->strafesnet_common::integer::Ratio64{
|
||||
self.timer.get_scale()
|
||||
}
|
||||
pub fn set_scale(&mut self,time:SessionTime,new_scale:strafesnet_common::integer::Ratio64){
|
||||
self.timer.set_scale(time,new_scale);
|
||||
}
|
||||
pub fn next_event(&self,bot:&CompleteBot)->Option<Timed<EventType>>{
|
||||
self.head.next_event(bot.timelines())
|
||||
}
|
||||
pub fn process_event(&mut self,bot:&CompleteBot,event_type:EventType){
|
||||
self.state.process_event(bot.timelines(),event_type,self.head.get_event_index(event_type));
|
||||
self.head.push(event_type);
|
||||
}
|
||||
pub fn get_event_index(&self,event_type:EventType)->usize{
|
||||
self.head.get_event_index(event_type)
|
||||
}
|
||||
pub fn advance_time(&mut self,bot:&CompleteBot,time:SessionTime){
|
||||
let mut simulation_time=bot.time(self.time(time));
|
||||
let mut time_float=simulation_time.into();
|
||||
loop{
|
||||
match bot.timelines().output_events.get(self.event_id+1){
|
||||
match self.next_event(bot){
|
||||
Some(next_event)=>{
|
||||
if next_event.time<time_float{
|
||||
self.event_id+=1;
|
||||
self.process_event(bot,next_event.event);
|
||||
}else{
|
||||
break;
|
||||
}
|
||||
},
|
||||
None=>{
|
||||
//reset playback
|
||||
self.event_id=0;
|
||||
self.offset-=bot.duration();
|
||||
time_float-=bot.duration();
|
||||
self.head=Head::after_time(bot.timelines(),bot.time(Time::ZERO).into());
|
||||
self.state=PlaybackState::new();
|
||||
self.state.process_head(bot.timelines(),&self.head);
|
||||
|
||||
// hack to wind back timer offset without precise session timestamp
|
||||
let (mut state,paused)=self.timer.clone().into_state();
|
||||
let offset=state.get_offset()-bot.duration().coerce();
|
||||
state.set_offset(offset);
|
||||
self.timer=Timer::from_state(state,paused);
|
||||
|
||||
// update loop variables
|
||||
simulation_time-=bot.duration();
|
||||
time_float=simulation_time.into();
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
pub fn get_position_angles(&self,bot:&crate::bot::CompleteBot,time:SessionTime)->(glam::Vec3,glam::Vec2){
|
||||
let time=self.timer.time(time);
|
||||
let event0=&bot.timelines().output_events[self.event_id];
|
||||
let event1=&bot.timelines().output_events[self.event_id+1];
|
||||
let p0=vector3_to_glam(&event0.event.position);
|
||||
let p1=vector3_to_glam(&event1.event.position);
|
||||
// let v0=vector3_to_glam(&event0.event.velocity);
|
||||
// let v1=vector3_to_glam(&event1.event.velocity);
|
||||
// let a0=vector3_to_glam(&event0.event.acceleration);
|
||||
// let a1=vector3_to_glam(&event1.event.acceleration);
|
||||
fn interpolate_output<'a>(&self,bot:&'a CompleteBot,time:SessionTime)->InterpolateOutput<'a>{
|
||||
let time=bot.time(self.time(time));
|
||||
let event0=&bot.timelines().output_events[self.head.get_event_index(EventType::Output)-1];
|
||||
let event1=&bot.timelines().output_events[self.head.get_event_index(EventType::Output)];
|
||||
let t0=event0.time;
|
||||
let t1=event1.time;
|
||||
let time_float=time.get() as f64/PhysicsTime::ONE_SECOND.get() as f64;
|
||||
let t=((time_float+self.offset+bot.offset()-t0)/(t1-t0)) as f32;
|
||||
let p=p0.lerp(p1,t);
|
||||
// let v=v0.lerp(v1,t);
|
||||
// let a=a0.lerp(a1,t);
|
||||
let time_float:f64=time.into();
|
||||
let t=((time_float-t0)/(t1-t0)) as f32;
|
||||
InterpolateOutput{
|
||||
event0:&event0.event,
|
||||
event1:&event1.event,
|
||||
t:t,
|
||||
}
|
||||
}
|
||||
pub fn get_position_angles(&self,bot:&CompleteBot,time:SessionTime)->(glam::Vec3,glam::Vec2){
|
||||
let interp=self.interpolate_output(bot,time);
|
||||
|
||||
//println!("position={:?}",p);
|
||||
let p=interp.position();
|
||||
let a=interp.angles();
|
||||
|
||||
let angles0=vector3_to_glam(&event0.event.angles);
|
||||
let angles1=vector3_to_glam(&event1.event.angles);
|
||||
let angles=angles0.lerp(angles1,t);
|
||||
|
||||
(p+crate::bot::CompleteBot::CAMERA_OFFSET,angles.yx())
|
||||
(p-bot.world_offset()+CompleteBot::CAMERA_OFFSET,a.yx())
|
||||
}
|
||||
pub fn get_velocity(&self,bot:&CompleteBot,time:SessionTime)->glam::Vec3{
|
||||
let interp=self.interpolate_output(bot,time);
|
||||
interp.velocity()
|
||||
}
|
||||
pub fn get_angles(&self,bot:&CompleteBot,time:SessionTime)->glam::Vec3{
|
||||
let interp=self.interpolate_output(bot,time);
|
||||
interp.angles()
|
||||
}
|
||||
}
|
||||
|
||||
struct InterpolateOutput<'a>{
|
||||
event0:&'a strafesnet_roblox_bot_file::v0::OutputEvent,
|
||||
event1:&'a strafesnet_roblox_bot_file::v0::OutputEvent,
|
||||
t:f32,
|
||||
}
|
||||
impl InterpolateOutput<'_>{
|
||||
fn position(&self)->glam::Vec3{
|
||||
let p0=vector3_to_glam(&self.event0.position);
|
||||
let p1=vector3_to_glam(&self.event1.position);
|
||||
p0.lerp(p1,self.t)
|
||||
}
|
||||
fn velocity(&self)->glam::Vec3{
|
||||
let v0=vector3_to_glam(&self.event0.velocity);
|
||||
let v1=vector3_to_glam(&self.event1.velocity);
|
||||
v0.lerp(v1,self.t)
|
||||
}
|
||||
fn angles(&self)->glam::Vec3{
|
||||
let a0=vector3_to_glam(&self.event0.angles);
|
||||
let a1=vector3_to_glam(&self.event1.angles);
|
||||
a0.lerp(a1,self.t)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
pub mod bot;
|
||||
pub mod map;
|
||||
pub mod head;
|
||||
pub mod time;
|
||||
pub mod state;
|
||||
// pub mod surface;
|
||||
pub mod graphics;
|
||||
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
#[derive(Debug)]
|
||||
pub enum Error{
|
||||
File(strafesnet_snf::Error),
|
||||
Map(strafesnet_snf::map::Error),
|
||||
}
|
||||
impl std::fmt::Display for Error{
|
||||
fn fmt(&self,f:&mut std::fmt::Formatter<'_>)->std::fmt::Result{
|
||||
write!(f,"{self:?}")
|
||||
}
|
||||
}
|
||||
impl std::error::Error for Error{}
|
||||
|
||||
pub struct CompleteMap{
|
||||
complete_map:strafesnet_common::map::CompleteMap,
|
||||
}
|
||||
impl CompleteMap{
|
||||
pub fn new(
|
||||
data:&[u8],
|
||||
)->Result<Self,Error>{
|
||||
let complete_map=strafesnet_snf::read_map(std::io::Cursor::new(data))
|
||||
.map_err(Error::File)?
|
||||
.into_complete_map()
|
||||
.map_err(Error::Map)?;
|
||||
Ok(Self{complete_map})
|
||||
}
|
||||
pub const fn map(&self)->&strafesnet_common::map::CompleteMap{
|
||||
&self.complete_map
|
||||
}
|
||||
}
|
||||
258
lib/src/state.rs
Normal file
258
lib/src/state.rs
Normal file
@@ -0,0 +1,258 @@
|
||||
use std::collections::HashMap;
|
||||
|
||||
use strafesnet_common::run;
|
||||
use strafesnet_common::physics::Time as PhysicsTime;
|
||||
use strafesnet_roblox_bot_file::v0;
|
||||
|
||||
pub struct Run{
|
||||
run:run::RunState,
|
||||
flag_reason:Option<v0::FlagReason>,
|
||||
}
|
||||
impl Run{
|
||||
fn new()->Self{
|
||||
Self{
|
||||
run:run::RunState::Created,
|
||||
flag_reason:None,
|
||||
}
|
||||
}
|
||||
fn flag(&mut self,flag_reason:v0::FlagReason){
|
||||
if self.flag_reason.is_none(){
|
||||
self.flag_reason=Some(flag_reason);
|
||||
}
|
||||
}
|
||||
pub fn time(&self,time:PhysicsTime)->run::Time{
|
||||
self.run.time(time)
|
||||
}
|
||||
pub fn is_invalid(&self)->bool{
|
||||
self.flag_reason.is_some()
|
||||
}
|
||||
pub fn is_in_progress(&self)->bool{
|
||||
matches!(&self.run,run::RunState::Started{..})
|
||||
}
|
||||
pub fn is_finished(&self)->bool{
|
||||
matches!(&self.run,run::RunState::Finished{..})
|
||||
}
|
||||
pub fn get_flag_reason_text(&self)->Option<&'static str>{
|
||||
Some(match self.flag_reason{
|
||||
Some(v0::FlagReason::Anticheat)=>"Passed through anticheat zone.",
|
||||
Some(v0::FlagReason::StyleChange)=>"Changed style.",
|
||||
Some(v0::FlagReason::Clock)=>"Incorrect clock. (This can be caused by internet hiccups)",
|
||||
Some(v0::FlagReason::Pause)=>"Pausing is not allowed in this style.",
|
||||
Some(v0::FlagReason::Flying)=>"Flying is not allowed in this style.",
|
||||
Some(v0::FlagReason::Gravity)=>"Gravity modification is not allowed in this style.",
|
||||
Some(v0::FlagReason::Timescale)=>"Timescale is not allowed in this style.",
|
||||
Some(v0::FlagReason::Timetravel)=>"Time travel is not allowed in this style.",
|
||||
Some(v0::FlagReason::Teleport)=>"Illegal teleport.",
|
||||
Some(v0::FlagReason::Practice)=>"Practice mode triggers invalidation.",
|
||||
None=>return None,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
pub struct PlaybackState{
|
||||
// EventType::Input
|
||||
game_controls:v0::GameControls,
|
||||
mouse_pos:v0::Vector2,
|
||||
// EventType::Output
|
||||
jump_count:u32,
|
||||
// EventType::Sound
|
||||
// EventType::World
|
||||
// EventType::Gravity
|
||||
gravity:v0::Vector3,
|
||||
// EventType::Run
|
||||
runs:HashMap<v0::ModeID,Run>,
|
||||
style:v0::Style,
|
||||
// EventType::Camera
|
||||
// TODO: camera punch
|
||||
// EventType::Setting
|
||||
absolute_sensitivity_enabled:bool,
|
||||
fov_y:f64,
|
||||
sens_x:f64,
|
||||
vertical_sensitivity_multipler:f64,
|
||||
turn_speed:f64,
|
||||
}
|
||||
impl PlaybackState{
|
||||
pub fn new()->Self{
|
||||
Self{
|
||||
game_controls:v0::GameControls::empty(),
|
||||
mouse_pos:v0::Vector2{x:0.0,y:0.0},
|
||||
jump_count:0,
|
||||
gravity:v0::Vector3{x:0.0,y:0.0,z:0.0},
|
||||
runs:HashMap::new(),
|
||||
style:v0::Style::Autohop,
|
||||
absolute_sensitivity_enabled:false,
|
||||
fov_y:1.0,
|
||||
sens_x:0.3,
|
||||
vertical_sensitivity_multipler:1.0,
|
||||
turn_speed:core::f64::consts::TAU/0.715588,
|
||||
}
|
||||
}
|
||||
pub fn get_run(&self,mode:v0::ModeID)->Option<&Run>{
|
||||
self.runs.get(&mode)
|
||||
}
|
||||
fn push_output(&mut self,event:&v0::OutputEvent){
|
||||
if event.tick_info.contains(v0::TickInfo::Jump){
|
||||
self.jump_count+=1;
|
||||
}
|
||||
}
|
||||
fn push_input(&mut self,event:&v0::InputEvent){
|
||||
self.game_controls=event.game_controls;
|
||||
self.mouse_pos=event.mouse_pos;
|
||||
}
|
||||
fn push_gravity(&mut self,event:&v0::GravityEvent){
|
||||
self.gravity=event.gravity;
|
||||
}
|
||||
fn push_run(&mut self,event:&v0::Timed<v0::RunEvent>){
|
||||
match &event.event{
|
||||
v0::RunEvent::Prepare(run_event_prepare)=>{
|
||||
self.runs.insert(run_event_prepare.mode,Run::new());
|
||||
self.style=run_event_prepare.style;
|
||||
},
|
||||
v0::RunEvent::Start(run_event_zone)=>{
|
||||
let time=crate::time::from_float(event.time).unwrap();
|
||||
if let Some(run)=self.runs.get_mut(&run_event_zone.mode){
|
||||
_=run.run.start(time);
|
||||
}
|
||||
},
|
||||
v0::RunEvent::Finish(run_event_zone)=>{
|
||||
let time=crate::time::from_float(event.time).unwrap();
|
||||
if let Some(run)=self.runs.get_mut(&run_event_zone.mode){
|
||||
_=run.run.finish(time);
|
||||
}
|
||||
},
|
||||
v0::RunEvent::Clear(run_event_clear)=>{
|
||||
match run_event_clear.mode{
|
||||
v0::ModeSpec::Exactly(mode_id)=>{
|
||||
self.runs.remove(&mode_id);
|
||||
},
|
||||
v0::ModeSpec::All=>{
|
||||
self.runs.clear();
|
||||
},
|
||||
v0::ModeSpec::Invalid=>{
|
||||
self.runs.retain(|_,run|!run.is_invalid());
|
||||
},
|
||||
v0::ModeSpec::InProgress=>{
|
||||
self.runs.retain(|_,run|!run.is_in_progress());
|
||||
},
|
||||
}
|
||||
},
|
||||
v0::RunEvent::Flag(run_event_flag)=>{
|
||||
match run_event_flag.mode{
|
||||
v0::ModeSpec::Exactly(mode_id)=>{
|
||||
if let Some(run)=self.runs.get_mut(&mode_id){
|
||||
run.flag(run_event_flag.flag_reason);
|
||||
}
|
||||
},
|
||||
v0::ModeSpec::All=>{
|
||||
for run in self.runs.values_mut(){
|
||||
run.flag(run_event_flag.flag_reason);
|
||||
}
|
||||
},
|
||||
v0::ModeSpec::Invalid=>{
|
||||
for run in self.runs.values_mut(){
|
||||
if run.is_invalid(){
|
||||
run.flag(run_event_flag.flag_reason);
|
||||
}
|
||||
}
|
||||
},
|
||||
v0::ModeSpec::InProgress=>{
|
||||
for run in self.runs.values_mut(){
|
||||
if run.is_in_progress(){
|
||||
run.flag(run_event_flag.flag_reason);
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
},
|
||||
// these should never appear in a uploaded bot file,
|
||||
// they are just part of the network protocol for spectating
|
||||
// someone in practice mode.
|
||||
//
|
||||
// Yes, this is a design mistake.
|
||||
// I didn't understand Session vs Simulation when I rewrote bhop in 2022
|
||||
v0::RunEvent::LoadState(_run_event_practice)=>{},
|
||||
v0::RunEvent::SaveState(_run_event_practice)=>{},
|
||||
}
|
||||
}
|
||||
fn push_setting(&mut self,event:&v0::SettingEvent){
|
||||
match event{
|
||||
v0::SettingEvent::FieldOfView(setting_event_field_of_view)=>{
|
||||
self.fov_y=(setting_event_field_of_view.fov*0.5).to_radians().tan();
|
||||
},
|
||||
v0::SettingEvent::Sensitivity(setting_event_sensitivity)=>{
|
||||
self.sens_x=setting_event_sensitivity.sensitivity;
|
||||
},
|
||||
v0::SettingEvent::VerticalSensitivityMultiplier(setting_event_vertical_sensitivity_multiplier)=>{
|
||||
self.vertical_sensitivity_multipler=setting_event_vertical_sensitivity_multiplier.multiplier;
|
||||
},
|
||||
v0::SettingEvent::AbsoluteSensitivity(setting_event_absolute_sensitivity)=>{
|
||||
self.absolute_sensitivity_enabled=setting_event_absolute_sensitivity.enabled;
|
||||
},
|
||||
v0::SettingEvent::TurnSpeed(setting_event_turn_speed)=>{
|
||||
self.turn_speed=setting_event_turn_speed.turn_speed;
|
||||
},
|
||||
}
|
||||
}
|
||||
pub(crate) fn process_head(&mut self,block:&v0::Block,head:&v0::Head){
|
||||
// The whole point of this is to avoid running the realtime events!
|
||||
/*
|
||||
for event in &block.input_events[0..head.get_event_index(v0::EventType::Input)]{
|
||||
self.push_input(&event.event);
|
||||
}
|
||||
for event in &block.output_events[0..head.get_event_index(v0::EventType::Output)]{
|
||||
self.push_output(&event.event);
|
||||
}
|
||||
for event in &bot.sound_events[0..head.get_event_index(v0::EventType::Sound)]{
|
||||
self.push_sound(&event.event);
|
||||
}
|
||||
*/
|
||||
// for event in &bot.world_events[0..head.get_event_index(v0::EventType::World)]{
|
||||
// self.push_world(&event.event);
|
||||
// }
|
||||
for event in &block.gravity_events[0..head.get_event_index(v0::EventType::Gravity)]{
|
||||
self.push_gravity(&event.event);
|
||||
}
|
||||
for event in &block.run_events[0..head.get_event_index(v0::EventType::Run)]{
|
||||
self.push_run(event);
|
||||
}
|
||||
// for event in &bot.camera_events[0..head.get_event_index(v0::EventType::Camera)]{
|
||||
// self.push_camera(&event.event);
|
||||
// }
|
||||
for event in &block.setting_events[0..head.get_event_index(v0::EventType::Setting)]{
|
||||
self.push_setting(&event.event);
|
||||
}
|
||||
}
|
||||
pub(crate) fn process_event(&mut self,block:&v0::Block,event_type:v0::EventType,event_index:usize){
|
||||
match event_type{
|
||||
v0::EventType::Input=>self.push_input(&block.input_events[event_index].event),
|
||||
v0::EventType::Output=>self.push_output(&block.output_events[event_index].event),
|
||||
v0::EventType::Sound=>{},
|
||||
v0::EventType::World=>{},
|
||||
v0::EventType::Gravity=>self.push_gravity(&block.gravity_events[event_index].event),
|
||||
v0::EventType::Run=>self.push_run(&block.run_events[event_index]),
|
||||
v0::EventType::Camera=>{},
|
||||
v0::EventType::Setting=>self.push_setting(&block.setting_events[event_index].event),
|
||||
}
|
||||
}
|
||||
pub const fn get_fov_y(&self)->f64{
|
||||
let zoom_enabled=self.game_controls.contains(v0::GameControls::Zoom);
|
||||
if zoom_enabled{self.fov_y*0.2}else{self.fov_y}
|
||||
}
|
||||
pub const fn get_sensitivity(&self)->glam::DVec2{
|
||||
if self.absolute_sensitivity_enabled{
|
||||
glam::dvec2(self.sens_x,self.sens_x*self.vertical_sensitivity_multipler)
|
||||
}else{
|
||||
let sens_x=self.sens_x*self.get_fov_y()/128.0;
|
||||
glam::dvec2(sens_x,sens_x*self.vertical_sensitivity_multipler)
|
||||
}
|
||||
}
|
||||
pub const fn get_controls(&self)->v0::GameControls{
|
||||
self.game_controls
|
||||
}
|
||||
pub const fn get_jump_count(&self)->u32{
|
||||
self.jump_count
|
||||
}
|
||||
pub const fn get_gravity(&self)->v0::Vector3{
|
||||
self.gravity
|
||||
}
|
||||
}
|
||||
32
lib/src/time.rs
Normal file
32
lib/src/time.rs
Normal file
@@ -0,0 +1,32 @@
|
||||
use strafesnet_common::integer::Time;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum Error{
|
||||
Underflow,
|
||||
Overflow,
|
||||
Nan,
|
||||
}
|
||||
impl std::fmt::Display for Error{
|
||||
fn fmt(&self,f:&mut std::fmt::Formatter<'_>)->std::fmt::Result{
|
||||
write!(f,"{self:?}")
|
||||
}
|
||||
}
|
||||
impl std::error::Error for Error{}
|
||||
|
||||
pub fn from_float<T>(time:f64)->Result<Time<T>,Error>{
|
||||
match time.classify(){
|
||||
core::num::FpCategory::Nan=>Err(Error::Nan),
|
||||
core::num::FpCategory::Zero=>Ok(Time::ZERO),
|
||||
core::num::FpCategory::Infinite
|
||||
|core::num::FpCategory::Subnormal
|
||||
|core::num::FpCategory::Normal=>{
|
||||
if time<Time::<T>::MIN.get() as f64{
|
||||
return Err(Error::Underflow);
|
||||
}
|
||||
if (Time::<T>::MAX.get() as f64)<time{
|
||||
return Err(Error::Overflow);
|
||||
}
|
||||
Ok(Time::raw((time*Time::<T>::ONE_SECOND.get() as f64) as i64))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,12 +4,12 @@ version = "0.1.0"
|
||||
edition = "2024"
|
||||
|
||||
[dependencies]
|
||||
glam.workspace = true
|
||||
pollster = "0.4.0"
|
||||
strafesnet_roblox_bot_player = { version = "0.1.0", path = "../lib" }
|
||||
wgpu = "28.0.0"
|
||||
winit = "0.30.12"
|
||||
strafesnet_roblox_bot_player = { version = "0.1.0", path = "../lib" }
|
||||
strafesnet_common.workspace = true
|
||||
strafesnet_graphics.workspace = true
|
||||
strafesnet_roblox_bot_file.workspace = true
|
||||
strafesnet_snf.workspace = true
|
||||
glam = "0.31.0"
|
||||
|
||||
@@ -1,21 +1,11 @@
|
||||
use std::io::Read;
|
||||
|
||||
#[cfg(any(feature="roblox",feature="source"))]
|
||||
use strafesnet_deferred_loader::deferred_loader::LoadFailureMode;
|
||||
|
||||
#[expect(dead_code)]
|
||||
#[derive(Debug)]
|
||||
pub enum ReadError{
|
||||
#[cfg(feature="roblox")]
|
||||
Roblox(strafesnet_rbx_loader::ReadError),
|
||||
#[cfg(feature="source")]
|
||||
Source(strafesnet_bsp_loader::ReadError),
|
||||
#[cfg(feature="snf")]
|
||||
StrafesNET(strafesnet_snf::Error),
|
||||
#[cfg(feature="snf")]
|
||||
StrafesNETMap(strafesnet_snf::map::Error),
|
||||
#[cfg(feature="snf")]
|
||||
StrafesNETBot(strafesnet_snf::bot::Error),
|
||||
RobloxBot(strafesnet_roblox_bot_file::v0::Error),
|
||||
Io(std::io::Error),
|
||||
UnknownFileFormat,
|
||||
}
|
||||
@@ -27,14 +17,8 @@ impl std::fmt::Display for ReadError{
|
||||
impl std::error::Error for ReadError{}
|
||||
|
||||
pub enum ReadFormat{
|
||||
#[cfg(feature="roblox")]
|
||||
Roblox(strafesnet_rbx_loader::Model),
|
||||
#[cfg(feature="source")]
|
||||
Source(strafesnet_bsp_loader::Bsp),
|
||||
#[cfg(feature="snf")]
|
||||
SNFM(strafesnet_common::map::CompleteMap),
|
||||
#[cfg(feature="snf")]
|
||||
SNFB(strafesnet_snf::bot::Segment),
|
||||
QBOT(strafesnet_roblox_bot_file::v0::Block),
|
||||
}
|
||||
|
||||
pub fn read<R:Read+std::io::Seek>(input:R)->Result<ReadFormat,ReadError>{
|
||||
@@ -45,19 +29,12 @@ pub fn read<R:Read+std::io::Seek>(input:R)->Result<ReadFormat,ReadError>{
|
||||
buf.read_to_end(&mut entire_file).map_err(ReadError::Io)?;
|
||||
let cursor=std::io::Cursor::new(entire_file);
|
||||
match peek.as_slice(){
|
||||
#[cfg(feature="roblox")]
|
||||
b"<rob"=>Ok(ReadFormat::Roblox(strafesnet_rbx_loader::read(cursor).map_err(ReadError::Roblox)?)),
|
||||
#[cfg(feature="source")]
|
||||
b"VBSP"=>Ok(ReadFormat::Source(strafesnet_bsp_loader::read(cursor).map_err(ReadError::Source)?)),
|
||||
#[cfg(feature="snf")]
|
||||
b"SNFM"=>Ok(ReadFormat::SNFM(
|
||||
strafesnet_snf::read_map(cursor).map_err(ReadError::StrafesNET)?
|
||||
.into_complete_map().map_err(ReadError::StrafesNETMap)?
|
||||
)),
|
||||
#[cfg(feature="snf")]
|
||||
b"SNFB"=>Ok(ReadFormat::SNFB(
|
||||
strafesnet_snf::read_bot(cursor).map_err(ReadError::StrafesNET)?
|
||||
.read_all().map_err(ReadError::StrafesNETBot)?
|
||||
b"qbot"=>Ok(ReadFormat::QBOT(
|
||||
strafesnet_roblox_bot_file::v0::read_all_to_block(cursor).map_err(ReadError::RobloxBot)?
|
||||
)),
|
||||
_=>Err(ReadError::UnknownFileFormat),
|
||||
}
|
||||
@@ -68,10 +45,6 @@ pub fn read<R:Read+std::io::Seek>(input:R)->Result<ReadFormat,ReadError>{
|
||||
pub enum LoadError{
|
||||
ReadError(ReadError),
|
||||
File(std::io::Error),
|
||||
#[cfg(feature="roblox")]
|
||||
LoadRoblox(strafesnet_rbx_loader::LoadError),
|
||||
#[cfg(feature="source")]
|
||||
LoadSource(strafesnet_bsp_loader::LoadError),
|
||||
}
|
||||
impl std::fmt::Display for LoadError{
|
||||
fn fmt(&self,f:&mut std::fmt::Formatter<'_>)->std::fmt::Result{
|
||||
@@ -81,36 +54,15 @@ impl std::fmt::Display for LoadError{
|
||||
impl std::error::Error for LoadError{}
|
||||
|
||||
pub enum LoadFormat{
|
||||
#[cfg(any(feature="snf",feature="roblox",feature="source"))]
|
||||
Map(strafesnet_common::map::CompleteMap),
|
||||
#[cfg(feature="snf")]
|
||||
Bot(strafesnet_snf::bot::Segment),
|
||||
Bot(strafesnet_roblox_bot_file::v0::Block),
|
||||
}
|
||||
|
||||
pub fn load<P:AsRef<std::path::Path>>(path:P)->Result<LoadFormat,LoadError>{
|
||||
//blocking because it's simpler...
|
||||
let file=std::fs::File::open(path).map_err(LoadError::File)?;
|
||||
match read(file).map_err(LoadError::ReadError)?{
|
||||
#[cfg(feature="snf")]
|
||||
ReadFormat::SNFB(bot)=>Ok(LoadFormat::Bot(bot)),
|
||||
#[cfg(feature="snf")]
|
||||
ReadFormat::QBOT(bot)=>Ok(LoadFormat::Bot(bot)),
|
||||
ReadFormat::SNFM(map)=>Ok(LoadFormat::Map(map)),
|
||||
#[cfg(feature="roblox")]
|
||||
ReadFormat::Roblox(model)=>{
|
||||
let mut place=strafesnet_rbx_loader::Place::from(model);
|
||||
let script_errors=place.run_scripts().unwrap();
|
||||
for error in script_errors{
|
||||
println!("Script error: {error}");
|
||||
}
|
||||
let (map,errors)=place.to_snf(LoadFailureMode::DefaultToNone).map_err(LoadError::LoadRoblox)?;
|
||||
if errors.count()!=0{
|
||||
print!("Errors encountered while loading the map:\n{}",errors);
|
||||
}
|
||||
Ok(LoadFormat::Map(map))
|
||||
},
|
||||
#[cfg(feature="source")]
|
||||
ReadFormat::Source(bsp)=>Ok(LoadFormat::Map(
|
||||
bsp.to_snf(LoadFailureMode::DefaultToNone,&[]).map_err(LoadError::LoadSource)?
|
||||
)),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
use strafesnet_common::instruction::TimedInstruction;
|
||||
use strafesnet_common::session::Time as SessionTime;
|
||||
use strafesnet_roblox_bot_player::{bot::CompleteBot,graphics::Graphics,head::PlaybackHead};
|
||||
use strafesnet_common::timer::TimerState;
|
||||
use strafesnet_roblox_bot_player::{bot::CompleteBot,graphics::Graphics,head::{PlaybackHead,Time as PlaybackTime}};
|
||||
|
||||
pub enum SessionControlInstruction{
|
||||
SetPaused(bool),
|
||||
}
|
||||
pub enum SessionPlaybackInstruction{
|
||||
Restart,
|
||||
SkipForward,
|
||||
SkipBack,
|
||||
DecreaseTimescale,
|
||||
@@ -14,42 +14,87 @@ pub enum SessionPlaybackInstruction{
|
||||
|
||||
pub enum Instruction{
|
||||
SessionControl(SessionControlInstruction),
|
||||
SessionPlayback(SessionPlaybackInstruction),
|
||||
Render,
|
||||
Resize(winit::dpi::PhysicalSize<u32>),
|
||||
ChangeMap(strafesnet_common::map::CompleteMap),
|
||||
LoadReplay(strafesnet_roblox_bot_file::v0::Block),
|
||||
}
|
||||
|
||||
fn speed_ratio(speed:i8)->strafesnet_common::integer::Ratio64{
|
||||
if speed.is_negative(){
|
||||
strafesnet_common::integer::Ratio64::new(4i64.pow(-speed as u32),5u64.pow(-speed as u32)).unwrap()
|
||||
}else{
|
||||
strafesnet_common::integer::Ratio64::new(5i64.pow(speed as u32),4u64.pow(speed as u32)).unwrap()
|
||||
}
|
||||
}
|
||||
|
||||
struct Playback{
|
||||
bot:CompleteBot,
|
||||
playback_head:PlaybackHead,
|
||||
playback_speed:i8,
|
||||
}
|
||||
|
||||
pub struct PlayerWorker<'a>{
|
||||
surface:wgpu::Surface<'a>,
|
||||
graphics_thread:Graphics,
|
||||
bot:CompleteBot,
|
||||
playback_head:PlaybackHead,
|
||||
playback:Option<Playback>,
|
||||
}
|
||||
impl<'a> PlayerWorker<'a>{
|
||||
pub fn new(
|
||||
surface:wgpu::Surface<'a>,
|
||||
bot:CompleteBot,
|
||||
graphics_thread:Graphics,
|
||||
)->Self{
|
||||
let playback_head=PlaybackHead::new(SessionTime::ZERO);
|
||||
Self{
|
||||
surface,
|
||||
graphics_thread,
|
||||
bot,
|
||||
playback_head,
|
||||
playback:None,
|
||||
}
|
||||
}
|
||||
pub fn send(&mut self,ins:TimedInstruction<Instruction,SessionTime>){
|
||||
match ins.instruction{
|
||||
Instruction::SessionControl(session_control_instruction)=>{},
|
||||
Instruction::SessionPlayback(session_playback_instruction)=>{},
|
||||
Instruction::Render=>{
|
||||
self.playback_head.advance_time(&self.bot,ins.time);
|
||||
let (pos,angles)=self.playback_head.get_position_angles(&self.bot,ins.time);
|
||||
Instruction::SessionControl(SessionControlInstruction::SetPaused(paused))=>if let Some(playback)=&mut self.playback{
|
||||
playback.playback_head.set_paused(ins.time,paused);
|
||||
},
|
||||
Instruction::SessionControl(SessionControlInstruction::Restart)=>if let Some(playback)=&mut self.playback{
|
||||
playback.playback_head.set_time(&playback.bot,ins.time,PlaybackTime::ZERO);
|
||||
},
|
||||
Instruction::SessionControl(SessionControlInstruction::SkipForward)=>if let Some(playback)=&mut self.playback{
|
||||
let head_time=playback.playback_head.timer().clone().into_state().0.get_time(ins.time+SessionTime::from_secs(2));
|
||||
playback.playback_head.set_time(&playback.bot,ins.time,head_time);
|
||||
},
|
||||
Instruction::SessionControl(SessionControlInstruction::SkipBack)=>if let Some(playback)=&mut self.playback{
|
||||
let head_time=playback.playback_head.timer().clone().into_state().0.get_time(ins.time-SessionTime::from_secs(2));
|
||||
playback.playback_head.set_time(&playback.bot,ins.time,head_time);
|
||||
},
|
||||
Instruction::SessionControl(SessionControlInstruction::DecreaseTimescale)=>if let Some(playback)=&mut self.playback{
|
||||
playback.playback_speed=playback.playback_speed.saturating_sub(1).max(-27);
|
||||
playback.playback_head.set_scale(ins.time,speed_ratio(playback.playback_speed));
|
||||
},
|
||||
Instruction::SessionControl(SessionControlInstruction::IncreaseTimescale)=>if let Some(playback)=&mut self.playback{
|
||||
playback.playback_speed=playback.playback_speed.saturating_add(1).min(27);
|
||||
playback.playback_head.set_scale(ins.time,speed_ratio(playback.playback_speed));
|
||||
},
|
||||
Instruction::Render=>if let Some(playback)=&mut self.playback{
|
||||
playback.playback_head.advance_time(&playback.bot,ins.time);
|
||||
let (pos,angles)=playback.playback_head.get_position_angles(&playback.bot,ins.time);
|
||||
self.graphics_thread.render(&self.surface,pos,angles);
|
||||
},
|
||||
Instruction::Resize(physical_size)=>{
|
||||
self.graphics_thread.resize(&self.surface,glam::uvec2(physical_size.width,physical_size.height));
|
||||
Instruction::Resize(physical_size)=>if let Some(playback)=&self.playback{
|
||||
let fov_y=playback.playback_head.state().get_fov_y();
|
||||
let fov_x=fov_y*physical_size.width as f64/physical_size.height as f64;
|
||||
self.graphics_thread.resize(&self.surface,glam::uvec2(physical_size.width,physical_size.height),glam::vec2(fov_x as f32,fov_y as f32));
|
||||
},
|
||||
Instruction::ChangeMap(complete_map)=>{
|
||||
self.graphics_thread.change_map(&complete_map);
|
||||
},
|
||||
Instruction::LoadReplay(bot)=>{
|
||||
let bot=CompleteBot::new(bot);
|
||||
let playback_head=PlaybackHead::new(&bot,SessionTime::ZERO);
|
||||
self.playback=Some(Playback{
|
||||
bot,
|
||||
playback_head,
|
||||
playback_speed:0,
|
||||
});
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,10 +19,10 @@ pub async fn setup_and_start(title:&str){
|
||||
|
||||
let adapter=setup::step3::pick_adapter(&instance,&surface).await.expect("No suitable GPU adapters found on the system!");
|
||||
|
||||
let (device,queue)=setup::step4::request_device(&adapter).await;
|
||||
let (device,queue)=setup::step4::request_device(&adapter).await.unwrap();
|
||||
|
||||
let size=window.inner_size();
|
||||
let config=setup::step5::configure_surface(&adapter,&device,&surface,(size.width,size.height));
|
||||
let config=setup::step5::configure_surface(&adapter,&device,&surface,(size.width,size.height)).unwrap();
|
||||
|
||||
//dedicated thread to ping request redraw back and resize the window doesn't seem logical
|
||||
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
use strafesnet_common::instruction::TimedInstruction;
|
||||
use strafesnet_common::session::Time as SessionTime;
|
||||
use strafesnet_common::physics::{MiscInstruction,SetControlInstruction};
|
||||
use crate::file::LoadFormat;
|
||||
use crate::player::{PlayerWorker,Instruction as PhysicsWorkerInstruction,SessionControlInstruction,SessionPlaybackInstruction};
|
||||
use crate::player::{PlayerWorker,Instruction as PhysicsWorkerInstruction,SessionControlInstruction};
|
||||
|
||||
pub enum Instruction{
|
||||
WindowEvent(winit::event::WindowEvent),
|
||||
@@ -11,53 +10,18 @@ pub enum Instruction{
|
||||
|
||||
//holds thread handles to dispatch to
|
||||
pub struct WindowContext<'a>{
|
||||
manual_mouse_lock:bool,
|
||||
mouse_pos:glam::DVec2,
|
||||
simulation_paused:bool,
|
||||
screen_size:glam::UVec2,
|
||||
window:&'a winit::window::Window,
|
||||
physics_thread:PlayerWorker<'a>,
|
||||
}
|
||||
|
||||
impl WindowContext<'_>{
|
||||
fn get_middle_of_screen(&self)->winit::dpi::PhysicalPosition<u32>{
|
||||
winit::dpi::PhysicalPosition::new(self.screen_size.x/2,self.screen_size.y/2)
|
||||
}
|
||||
fn free_mouse(&mut self){
|
||||
self.manual_mouse_lock=false;
|
||||
match self.window.set_cursor_position(self.get_middle_of_screen()){
|
||||
Ok(())=>(),
|
||||
Err(e)=>println!("Could not set cursor position: {:?}",e),
|
||||
}
|
||||
match self.window.set_cursor_grab(winit::window::CursorGrabMode::None){
|
||||
Ok(())=>(),
|
||||
Err(e)=>println!("Could not release cursor: {:?}",e),
|
||||
}
|
||||
self.window.set_cursor_visible(true);
|
||||
}
|
||||
fn lock_mouse(&mut self){
|
||||
//if cursor is outside window don't lock but apparently there's no get pos function
|
||||
//let pos=window.get_cursor_pos();
|
||||
match self.window.set_cursor_grab(winit::window::CursorGrabMode::Locked){
|
||||
Ok(())=>(),
|
||||
Err(_)=>{
|
||||
match self.window.set_cursor_grab(winit::window::CursorGrabMode::Confined){
|
||||
Ok(())=>(),
|
||||
Err(e)=>{
|
||||
self.manual_mouse_lock=true;
|
||||
println!("Could not confine cursor: {:?}",e)
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
self.window.set_cursor_visible(false);
|
||||
}
|
||||
fn window_event(&mut self,time:SessionTime,event:winit::event::WindowEvent){
|
||||
match event{
|
||||
winit::event::WindowEvent::DroppedFile(path)=>{
|
||||
match crate::file::load(path.as_path()){
|
||||
// Ok(LoadFormat::Map(map))=>self.physics_thread.send(TimedInstruction{time,instruction:PhysicsWorkerInstruction::ChangeMap(map)}),
|
||||
// Ok(LoadFormat::Bot(bot))=>self.physics_thread.send(TimedInstruction{time,instruction:PhysicsWorkerInstruction::LoadReplay(bot)}),
|
||||
Ok(LoadFormat::Map(map))=>self.physics_thread.send(TimedInstruction{time,instruction:PhysicsWorkerInstruction::ChangeMap(map)}),
|
||||
Ok(LoadFormat::Bot(bot))=>self.physics_thread.send(TimedInstruction{time,instruction:PhysicsWorkerInstruction::LoadReplay(bot)}),
|
||||
Err(e)=>println!("Failed to load file: {e}"),
|
||||
}
|
||||
},
|
||||
@@ -78,8 +42,6 @@ impl WindowContext<'_>{
|
||||
..
|
||||
}=>{
|
||||
match (logical_key,state){
|
||||
(winit::keyboard::Key::Named(winit::keyboard::NamedKey::Tab),winit::event::ElementState::Pressed)=>self.free_mouse(),
|
||||
(winit::keyboard::Key::Named(winit::keyboard::NamedKey::Tab),winit::event::ElementState::Released)=>self.lock_mouse(),
|
||||
(winit::keyboard::Key::Named(winit::keyboard::NamedKey::F11),winit::event::ElementState::Pressed)=>{
|
||||
if self.window.fullscreen().is_some(){
|
||||
self.window.set_fullscreen(None);
|
||||
@@ -87,70 +49,34 @@ impl WindowContext<'_>{
|
||||
self.window.set_fullscreen(Some(winit::window::Fullscreen::Borderless(None)));
|
||||
}
|
||||
},
|
||||
(winit::keyboard::Key::Named(winit::keyboard::NamedKey::Escape),winit::event::ElementState::Pressed)=>{
|
||||
self.manual_mouse_lock=false;
|
||||
match self.window.set_cursor_grab(winit::window::CursorGrabMode::None){
|
||||
Ok(())=>(),
|
||||
Err(e)=>println!("Could not release cursor: {:?}",e),
|
||||
}
|
||||
self.window.set_cursor_visible(true);
|
||||
},
|
||||
(keycode,state)=>{
|
||||
let s=state.is_pressed();
|
||||
|
||||
// internal variants for this scope
|
||||
enum SessionInstructionSubset{
|
||||
Control(SessionControlInstruction),
|
||||
Playback(SessionPlaybackInstruction),
|
||||
}
|
||||
macro_rules! session_ctrl{
|
||||
($variant:ident,$state:expr)=>{
|
||||
s.then_some(SessionInstructionSubset::Control(SessionControlInstruction::$variant))
|
||||
s.then_some(PhysicsWorkerInstruction::SessionControl(SessionControlInstruction::$variant))
|
||||
};
|
||||
}
|
||||
macro_rules! session_playback{
|
||||
($variant:ident,$state:expr)=>{
|
||||
s.then_some(SessionInstructionSubset::Playback(SessionPlaybackInstruction::$variant))
|
||||
};
|
||||
}
|
||||
impl From<SessionInstructionSubset> for PhysicsWorkerInstruction{
|
||||
fn from(value:SessionInstructionSubset)->Self{
|
||||
match value{
|
||||
SessionInstructionSubset::Control(session_control_instruction)=>PhysicsWorkerInstruction::SessionControl(session_control_instruction),
|
||||
SessionInstructionSubset::Playback(session_playback_instruction)=>PhysicsWorkerInstruction::SessionPlayback(session_playback_instruction),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if let Some(session_instruction)=match keycode{
|
||||
// TODO: bind system so playback pausing can use spacebar
|
||||
winit::keyboard::Key::Named(winit::keyboard::NamedKey::Enter)=>if s{
|
||||
if let Some(instruction)=match keycode{
|
||||
winit::keyboard::Key::Named(winit::keyboard::NamedKey::Space)=>if s{
|
||||
let paused=!self.simulation_paused;
|
||||
self.simulation_paused=paused;
|
||||
if paused{
|
||||
self.free_mouse();
|
||||
}else{
|
||||
self.lock_mouse();
|
||||
}
|
||||
Some(SessionInstructionSubset::Control(SessionControlInstruction::SetPaused(paused)))
|
||||
Some(PhysicsWorkerInstruction::SessionControl(SessionControlInstruction::SetPaused(paused)))
|
||||
}else{None},
|
||||
winit::keyboard::Key::Named(winit::keyboard::NamedKey::ArrowUp)=>session_playback!(IncreaseTimescale,s),
|
||||
winit::keyboard::Key::Named(winit::keyboard::NamedKey::ArrowDown)=>session_playback!(DecreaseTimescale,s),
|
||||
winit::keyboard::Key::Named(winit::keyboard::NamedKey::ArrowLeft)=>session_playback!(SkipBack,s),
|
||||
winit::keyboard::Key::Named(winit::keyboard::NamedKey::ArrowRight)=>session_playback!(SkipForward,s),
|
||||
winit::keyboard::Key::Named(winit::keyboard::NamedKey::ArrowUp)=>session_ctrl!(IncreaseTimescale,s),
|
||||
winit::keyboard::Key::Named(winit::keyboard::NamedKey::ArrowDown)=>session_ctrl!(DecreaseTimescale,s),
|
||||
winit::keyboard::Key::Named(winit::keyboard::NamedKey::ArrowLeft)=>session_ctrl!(SkipBack,s),
|
||||
winit::keyboard::Key::Named(winit::keyboard::NamedKey::ArrowRight)=>session_ctrl!(SkipForward,s),
|
||||
winit::keyboard::Key::Character(key)=>match key.as_str(){
|
||||
// "R"|"r"=>s.then(||{
|
||||
// //mouse needs to be reset since the position is absolute
|
||||
// self.mouse_pos=glam::DVec2::ZERO;
|
||||
// SessionInstructionSubset::Input(SessionInputInstruction::Mode(session::ImplicitModeInstruction::ResetAndRestart))
|
||||
// }),
|
||||
"R"|"r"=>session_ctrl!(Restart,s),
|
||||
_=>None,
|
||||
},
|
||||
_=>None,
|
||||
}{
|
||||
self.physics_thread.send(TimedInstruction{
|
||||
time,
|
||||
instruction:session_instruction.into(),
|
||||
instruction,
|
||||
});
|
||||
}
|
||||
},
|
||||
@@ -177,7 +103,7 @@ impl WindowContext<'_>{
|
||||
}
|
||||
}
|
||||
|
||||
fn device_event(&mut self,time:SessionTime,event:winit::event::DeviceEvent){
|
||||
fn device_event(&mut self,_time:SessionTime,_event:winit::event::DeviceEvent){
|
||||
}
|
||||
|
||||
pub fn send(&mut self,ins:TimedInstruction<Instruction,SessionTime>){
|
||||
@@ -198,23 +124,12 @@ impl WindowContext<'_>{
|
||||
surface:wgpu::Surface<'a>,
|
||||
config:wgpu::SurfaceConfiguration,
|
||||
)->WindowContext<'a>{
|
||||
let screen_size=glam::uvec2(config.width,config.height);
|
||||
let bot=include_bytes!("../../web-demo/bhop_marble_7cf33a64-7120-4514-b9fa-4fe29d9523d.qbot");
|
||||
let map=include_bytes!("../../web-demo/bhop_marble_5692093612.snfm");
|
||||
let bot=strafesnet_roblox_bot_player::bot::CompleteBot::new(bot).unwrap();
|
||||
let map=strafesnet_roblox_bot_player::map::CompleteMap::new(map).unwrap();
|
||||
let mut graphics=strafesnet_roblox_bot_player::graphics::Graphics::new(device,queue,config);
|
||||
graphics.change_map(&map);
|
||||
let graphics=strafesnet_roblox_bot_player::graphics::Graphics::new(device,queue,config);
|
||||
WindowContext{
|
||||
manual_mouse_lock:false,
|
||||
mouse_pos:glam::DVec2::ZERO,
|
||||
simulation_paused:false,
|
||||
//make sure to update this!!!!!
|
||||
screen_size,
|
||||
window,
|
||||
physics_thread:crate::player::PlayerWorker::new(
|
||||
surface,
|
||||
bot,
|
||||
graphics,
|
||||
),
|
||||
}
|
||||
|
||||
@@ -6,15 +6,21 @@ edition = "2024"
|
||||
[lib]
|
||||
crate-type = ["cdylib"]
|
||||
|
||||
[features]
|
||||
default = []
|
||||
webgl = ["wgpu/webgl"]
|
||||
|
||||
[dependencies]
|
||||
glam.workspace = true
|
||||
strafesnet_roblox_bot_player = { version = "0.1.0", path = "../lib" }
|
||||
strafesnet_common.workspace = true
|
||||
strafesnet_graphics.workspace = true
|
||||
strafesnet_roblox_bot_file.workspace = true
|
||||
strafesnet_snf.workspace = true
|
||||
wasm-bindgen = "0.2.108"
|
||||
wasm-bindgen-futures = "0.4.58"
|
||||
web-sys = { version = "0.3.85", features = ["HtmlCanvasElement"] }
|
||||
wgpu = "28.0.0"
|
||||
wgpu = { version = "28.0.0" }
|
||||
|
||||
[package.metadata.wasm-pack.profile.release]
|
||||
wasm-opt = ["-Oz", "--enable-bulk-memory","--enable-nontrapping-float-to-int"]
|
||||
|
||||
121
wasm-module/src/event.rs
Normal file
121
wasm-module/src/event.rs
Normal file
@@ -0,0 +1,121 @@
|
||||
use wasm_bindgen::prelude::wasm_bindgen;
|
||||
use strafesnet_roblox_bot_file::v0;
|
||||
use strafesnet_roblox_bot_file::v0::{EventType,Timed};
|
||||
use strafesnet_roblox_bot_player::bot;
|
||||
|
||||
/// A timeline event that has not been processed yet.
|
||||
#[wasm_bindgen]
|
||||
pub struct Event{
|
||||
time:f64,
|
||||
event:TimelineEvent,
|
||||
}
|
||||
impl Event{
|
||||
pub(crate) fn event_type(&self)->EventType{
|
||||
match &self.event{
|
||||
TimelineEvent::Input(..)=>EventType::Input,
|
||||
TimelineEvent::Output(..)=>EventType::Output,
|
||||
TimelineEvent::Sound(..)=>EventType::Sound,
|
||||
TimelineEvent::World(..)=>EventType::World,
|
||||
TimelineEvent::Gravity(..)=>EventType::Gravity,
|
||||
TimelineEvent::Run(..)=>EventType::Run,
|
||||
TimelineEvent::Camera(..)=>EventType::Camera,
|
||||
TimelineEvent::Setting(..)=>EventType::Setting,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
enum TimelineEvent{
|
||||
Input(v0::InputEvent),
|
||||
Output(v0::OutputEvent),
|
||||
Sound(v0::SoundEvent),
|
||||
World(v0::WorldEvent),
|
||||
Gravity(v0::GravityEvent),
|
||||
Run(v0::RunEvent),
|
||||
Camera(v0::CameraEvent),
|
||||
Setting(v0::SettingEvent),
|
||||
}
|
||||
|
||||
// helper macro for converting v0::Timed<v0::InputEvent> into Event
|
||||
// (used in Event::new)
|
||||
macro_rules! impl_into_event{
|
||||
($event:path,$variant:ident)=>{
|
||||
impl From<Timed<$event>> for Event{
|
||||
fn from(Timed{time,event}:Timed<$event>)->Self{
|
||||
Self{time,event:TimelineEvent::$variant(event)}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
impl_into_event!(v0::InputEvent,Input);
|
||||
impl_into_event!(v0::OutputEvent,Output);
|
||||
impl_into_event!(v0::SoundEvent,Sound);
|
||||
impl_into_event!(v0::WorldEvent,World);
|
||||
impl_into_event!(v0::GravityEvent,Gravity);
|
||||
impl_into_event!(v0::RunEvent,Run);
|
||||
impl_into_event!(v0::CameraEvent,Camera);
|
||||
impl_into_event!(v0::SettingEvent,Setting);
|
||||
|
||||
#[wasm_bindgen]
|
||||
impl Event{
|
||||
pub(crate) fn new(bot:&bot::CompleteBot,event:v0::EventType,event_index:usize)->Self{
|
||||
let mut event:Self=match event{
|
||||
EventType::Input=>bot.timelines().input_events[event_index].clone().into(),
|
||||
EventType::Output=>bot.timelines().output_events[event_index].clone().into(),
|
||||
EventType::Sound=>bot.timelines().sound_events[event_index].clone().into(),
|
||||
EventType::World=>bot.timelines().world_events[event_index].clone().into(),
|
||||
EventType::Gravity=>bot.timelines().gravity_events[event_index].clone().into(),
|
||||
EventType::Run=>bot.timelines().run_events[event_index].clone().into(),
|
||||
EventType::Camera=>bot.timelines().camera_events[event_index].clone().into(),
|
||||
EventType::Setting=>bot.timelines().setting_events[event_index].clone().into(),
|
||||
};
|
||||
event.time-=bot.timelines().output_events.first().unwrap().time;
|
||||
event
|
||||
}
|
||||
#[wasm_bindgen]
|
||||
pub fn time(&self)->f64{
|
||||
self.time
|
||||
}
|
||||
#[wasm_bindgen]
|
||||
pub fn type_id(&self)->u32{
|
||||
self.event_type() as u32
|
||||
}
|
||||
#[wasm_bindgen]
|
||||
pub fn into_inner(self)->wasm_bindgen::JsValue{
|
||||
match self.event{
|
||||
TimelineEvent::Input(input_event)=>InputEvent(input_event).into(),
|
||||
TimelineEvent::Output(output_event)=>OutputEvent(output_event).into(),
|
||||
TimelineEvent::Sound(sound_event)=>SoundEvent(sound_event).into(),
|
||||
TimelineEvent::World(world_event)=>WorldEvent(world_event).into(),
|
||||
TimelineEvent::Gravity(gravity_event)=>GravityEvent(gravity_event).into(),
|
||||
TimelineEvent::Run(run_event)=>RunEvent(run_event).into(),
|
||||
TimelineEvent::Camera(camera_event)=>CameraEvent(camera_event).into(),
|
||||
TimelineEvent::Setting(setting_event)=>SettingEvent(setting_event).into(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[wasm_bindgen]
|
||||
pub struct InputEvent(v0::InputEvent);
|
||||
#[wasm_bindgen]
|
||||
pub struct OutputEvent(v0::OutputEvent);
|
||||
#[wasm_bindgen]
|
||||
pub struct SoundEvent(v0::SoundEvent);
|
||||
impl SoundEvent{
|
||||
pub fn material(&self)->u32{
|
||||
self.0.material
|
||||
}
|
||||
pub fn sound_type(&self)->u32{
|
||||
self.0.sound_type as u32
|
||||
}
|
||||
}
|
||||
|
||||
#[wasm_bindgen]
|
||||
pub struct WorldEvent(v0::WorldEvent);
|
||||
#[wasm_bindgen]
|
||||
pub struct GravityEvent(v0::GravityEvent);
|
||||
#[wasm_bindgen]
|
||||
pub struct RunEvent(v0::RunEvent);
|
||||
#[wasm_bindgen]
|
||||
pub struct CameraEvent(v0::CameraEvent);
|
||||
#[wasm_bindgen]
|
||||
pub struct SettingEvent(v0::SettingEvent);
|
||||
@@ -1,8 +1,11 @@
|
||||
use wasm_bindgen::prelude::wasm_bindgen;
|
||||
use wasm_bindgen::JsValue;
|
||||
use strafesnet_roblox_bot_player::{bot,map,head,graphics};
|
||||
use wasm_bindgen::JsError;
|
||||
use strafesnet_roblox_bot_file::v0;
|
||||
use strafesnet_roblox_bot_player::{bot,head,time,graphics};
|
||||
use strafesnet_graphics::setup;
|
||||
use strafesnet_common::session::Time as SessionTime;
|
||||
|
||||
mod event;
|
||||
pub use event::*;
|
||||
|
||||
// Hack to keep the code compiling,
|
||||
// SurfaceTarget::Canvas is not available in IDE for whatever reason.
|
||||
@@ -25,31 +28,35 @@ pub struct Graphics{
|
||||
surface:wgpu::Surface<'static>,
|
||||
}
|
||||
#[wasm_bindgen]
|
||||
pub async fn setup_graphics(canvas:web_sys::HtmlCanvasElement)->Graphics{
|
||||
pub async fn setup_graphics(canvas:web_sys::HtmlCanvasElement)->Result<Graphics,JsError>{
|
||||
let size=(canvas.width(),canvas.height());
|
||||
|
||||
let instance=setup::step1::create_instance();
|
||||
let surface=setup::step2::create_surface(&instance,ToSurfaceTarget(canvas)).unwrap();
|
||||
let adapter=setup::step3::pick_adapter(&instance,&surface).await.expect("No suitable GPU adapters found on the system!");
|
||||
let (device,queue)=setup::step4::request_device(&adapter).await;
|
||||
let config=setup::step5::configure_surface(&adapter,&device,&surface,size);
|
||||
Graphics{
|
||||
let instance_desc=wgpu::InstanceDescriptor::from_env_or_default();
|
||||
let instance=wgpu::util::new_instance_with_webgpu_detection(&instance_desc).await;
|
||||
let surface=setup::step2::create_surface(&instance,ToSurfaceTarget(canvas)).map_err(|e|JsError::new(&e.to_string()))?;
|
||||
let adapter=instance.request_adapter(&wgpu::RequestAdapterOptions{
|
||||
power_preference:wgpu::PowerPreference::HighPerformance,
|
||||
force_fallback_adapter:false,
|
||||
compatible_surface:Some(&surface),
|
||||
}).await.map_err(|e|JsError::new(&e.to_string()))?;
|
||||
let (device,queue)=setup::step4::request_device(&adapter).await.map_err(|e|JsError::new(&e.to_string()))?;
|
||||
let config=setup::step5::configure_surface(&adapter,&device,&surface,size).map_err(|e|JsError::new(&e.to_string()))?;
|
||||
Ok(Graphics{
|
||||
graphics:graphics::Graphics::new(device,queue,config),
|
||||
surface:surface,
|
||||
}
|
||||
})
|
||||
}
|
||||
#[wasm_bindgen]
|
||||
impl Graphics{
|
||||
#[wasm_bindgen]
|
||||
pub fn render(&mut self,bot:&CompleteBot,head:&PlaybackHead,time:f64){
|
||||
// TODO: check f64 range
|
||||
let time=SessionTime::raw((time*SessionTime::ONE_SECOND.get() as f64) as i64);
|
||||
let time=time::from_float(time).unwrap();
|
||||
let (pos,angles)=head.head.get_position_angles(&bot.bot,time);
|
||||
self.graphics.render(&self.surface,pos,angles);
|
||||
}
|
||||
#[wasm_bindgen]
|
||||
pub fn resize(&mut self,width:u32,height:u32){
|
||||
self.graphics.resize(&self.surface,[width,height].into());
|
||||
pub fn resize(&mut self,width:u32,height:u32,fov_slope_x:f32,fov_slope_y:f32){
|
||||
self.graphics.resize(&self.surface,[width,height].into(),[fov_slope_x as f32,fov_slope_y as f32].into());
|
||||
}
|
||||
#[wasm_bindgen]
|
||||
pub fn change_map(&mut self,map:&CompleteMap){
|
||||
@@ -64,23 +71,37 @@ pub struct CompleteBot{
|
||||
#[wasm_bindgen]
|
||||
impl CompleteBot{
|
||||
#[wasm_bindgen(constructor)]
|
||||
pub fn new(data:&[u8])->Result<Self,JsValue>{
|
||||
pub fn new(data:&[u8])->Result<Self,JsError>{
|
||||
let timelines=v0::read_all_to_block(std::io::Cursor::new(data)).map_err(|e|JsError::new(&e.to_string()))?;
|
||||
Ok(Self{
|
||||
bot:bot::CompleteBot::new(data).map_err(|e|JsValue::from_str(&e.to_string()))?,
|
||||
bot:bot::CompleteBot::new(timelines),
|
||||
})
|
||||
}
|
||||
#[wasm_bindgen]
|
||||
pub fn duration(&self)->f64{
|
||||
self.bot.duration().into()
|
||||
}
|
||||
#[wasm_bindgen]
|
||||
pub fn run_duration(&self,mode_id:u32)->Option<f64>{
|
||||
let mode=v0::ModeID(mode_id);
|
||||
Some(self.bot.run_duration(mode)?.into())
|
||||
}
|
||||
}
|
||||
|
||||
#[wasm_bindgen]
|
||||
pub struct CompleteMap{
|
||||
map:map::CompleteMap,
|
||||
map:strafesnet_common::map::CompleteMap,
|
||||
}
|
||||
#[wasm_bindgen]
|
||||
impl CompleteMap{
|
||||
#[wasm_bindgen(constructor)]
|
||||
pub fn new(data:&[u8])->Result<Self,JsValue>{
|
||||
pub fn new(data:&[u8])->Result<Self,JsError>{
|
||||
let map=strafesnet_snf::read_map(std::io::Cursor::new(data))
|
||||
.map_err(|e|JsError::new(&e.to_string()))?
|
||||
.into_complete_map()
|
||||
.map_err(|e|JsError::new(&e.to_string()))?;
|
||||
Ok(Self{
|
||||
map:map::CompleteMap::new(data).map_err(|e|JsValue::from_str(&e.to_string()))?,
|
||||
map,
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -92,17 +113,97 @@ pub struct PlaybackHead{
|
||||
#[wasm_bindgen]
|
||||
impl PlaybackHead{
|
||||
#[wasm_bindgen(constructor)]
|
||||
pub fn new(time:f64)->Result<Self,JsValue>{
|
||||
// TODO: check f64 range
|
||||
let time=SessionTime::raw((time*SessionTime::ONE_SECOND.get() as f64) as i64);
|
||||
Ok(Self{
|
||||
head:head::PlaybackHead::new(time),
|
||||
})
|
||||
pub fn new(bot:&CompleteBot,time:f64)->Self{
|
||||
let time=time::from_float(time).unwrap();
|
||||
Self{
|
||||
head:head::PlaybackHead::new(&bot.bot,time),
|
||||
}
|
||||
}
|
||||
/// Simple api: call advance_time and then graphics.render()
|
||||
#[wasm_bindgen]
|
||||
pub fn advance_time(&mut self,bot:&CompleteBot,time:f64){
|
||||
// TODO: check f64 range
|
||||
let time=SessionTime::raw((time*SessionTime::ONE_SECOND.get() as f64) as i64);
|
||||
let time=time::from_float(time).unwrap();
|
||||
self.head.advance_time(&bot.bot,time);
|
||||
}
|
||||
/// Advanced api: In a loop, call next_event and pass the result to process_event to advance the playback head.
|
||||
#[wasm_bindgen]
|
||||
pub fn next_event(&mut self,bot:&CompleteBot)->Option<Event>{
|
||||
let next_event=self.head.next_event(&bot.bot)?;
|
||||
let event_index=self.head.get_event_index(next_event.event);
|
||||
Some(Event::new(&bot.bot,next_event.event,event_index))
|
||||
}
|
||||
/// Advanced api: In a loop, call next_event and pass the result to process_event to advance the playback head.
|
||||
#[wasm_bindgen]
|
||||
pub fn process_event(&mut self,bot:&CompleteBot,event:Event){
|
||||
self.head.process_event(&bot.bot,event.event_type());
|
||||
}
|
||||
#[wasm_bindgen]
|
||||
pub fn set_paused(&mut self,time:f64,paused:bool){
|
||||
let time=time::from_float(time).unwrap();
|
||||
self.head.set_paused(time,paused);
|
||||
}
|
||||
#[wasm_bindgen]
|
||||
pub fn get_scale(&mut self)->f64{
|
||||
let scale=self.head.get_scale();
|
||||
scale.num() as f64/scale.den() as f64
|
||||
}
|
||||
#[wasm_bindgen]
|
||||
pub fn set_scale(&mut self,time:f64,scale:f64){
|
||||
let time=time::from_float(time).unwrap();
|
||||
self.head.set_scale(time,scale.try_into().unwrap());
|
||||
}
|
||||
#[wasm_bindgen]
|
||||
pub fn get_head_time(&self,time:f64)->f64{
|
||||
let time=time::from_float(time).unwrap();
|
||||
let time=self.head.time(time);
|
||||
time.into()
|
||||
}
|
||||
/// Set the playback head position to new_time.
|
||||
#[wasm_bindgen]
|
||||
pub fn set_head_time(&mut self,bot:&CompleteBot,time:f64,new_time:f64){
|
||||
let time=time::from_float(time).unwrap();
|
||||
let new_time=time::from_float(new_time).unwrap();
|
||||
self.head.set_time(&bot.bot,time,new_time);
|
||||
}
|
||||
#[wasm_bindgen]
|
||||
pub fn get_run_time(&self,bot:&CompleteBot,time:f64,mode_id:u32)->Option<f64>{
|
||||
let time=time::from_float(time).unwrap();
|
||||
let time=bot.bot.time(self.head.time(time));
|
||||
let mode=v0::ModeID(mode_id);
|
||||
let run_time=self.head.state().get_run(mode)?.time(time);
|
||||
Some(run_time.into())
|
||||
}
|
||||
#[wasm_bindgen]
|
||||
pub fn is_run_in_progress(&self,mode_id:u32)->Option<bool>{
|
||||
let mode=v0::ModeID(mode_id);
|
||||
Some(self.head.state().get_run(mode)?.is_in_progress())
|
||||
}
|
||||
#[wasm_bindgen]
|
||||
pub fn is_run_finished(&self,mode_id:u32)->Option<bool>{
|
||||
let mode=v0::ModeID(mode_id);
|
||||
Some(self.head.state().get_run(mode)?.is_finished())
|
||||
}
|
||||
#[wasm_bindgen]
|
||||
pub fn get_fov_slope_y(&self)->f64{
|
||||
self.head.state().get_fov_y()
|
||||
}
|
||||
#[wasm_bindgen]
|
||||
pub fn get_speed(&self,bot:&CompleteBot,time:f64)->f32{
|
||||
let time=time::from_float(time).unwrap();
|
||||
let velocity=self.head.get_velocity(&bot.bot,time);
|
||||
|
||||
use glam::Vec3Swizzles;
|
||||
velocity.xz().length()
|
||||
}
|
||||
#[wasm_bindgen]
|
||||
pub fn get_game_controls(&self)->u32{
|
||||
self.head.state().get_controls().bits()
|
||||
}
|
||||
/// Returns an array of [pitch, yaw, roll] in radians. Yaw is not restricted to any particular range.
|
||||
#[wasm_bindgen]
|
||||
pub fn get_angles(&self,bot:&CompleteBot,time:f64)->Vec<f32>{
|
||||
let time=time::from_float(time).unwrap();
|
||||
let angles=self.head.get_angles(&bot.bot,time);
|
||||
angles.to_array().to_vec()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,11 +23,50 @@
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
.hud {
|
||||
position: fixed;
|
||||
bottom: 10px;
|
||||
left: 10px;
|
||||
display: flex;
|
||||
flex-direction: column; /* stack vertically */
|
||||
gap: 4px; /* space between timers */
|
||||
}
|
||||
|
||||
.timer {
|
||||
background: #000;
|
||||
color: #fff;
|
||||
padding: 4px 8px;
|
||||
font-family: sans-serif;
|
||||
font-size: 14px;
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
.controls {
|
||||
position: fixed;
|
||||
bottom: 10px;
|
||||
left: 120px;
|
||||
display: flex;
|
||||
flex-direction: row; /* stack horizontally */
|
||||
gap: 4px; /* space between timers */
|
||||
}
|
||||
</style>
|
||||
<script defer src="player.js" type="module"></script>
|
||||
<script defer type="module" src="iframe-helper.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<canvas></canvas>
|
||||
<canvas id="viewport"> </canvas>
|
||||
<div class="hud">
|
||||
<div id="hud_duration" class="timer">00:00:00</div>
|
||||
<div id="hud_timer" class="timer">00:00:00</div>
|
||||
</div>
|
||||
<div class="controls">
|
||||
<button id="control_reset">↪️</button>
|
||||
<button id="control_pause">⏯</button>
|
||||
<button id="control_backward">⬅️</button>
|
||||
<button id="control_forward">➡️</button>
|
||||
<button id="control_slower">⏪</button>
|
||||
<input type="text" id="control_speed" value="1.00x"></>
|
||||
<button id="control_faster">⏩</button>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -5,28 +5,110 @@ import init, {
|
||||
PlaybackHead,
|
||||
} from "./pkg/strafesnet_roblox_bot_player_wasm_module.js";
|
||||
|
||||
// Loading
|
||||
await init(); // load the wasm module
|
||||
|
||||
const b = await fetch("bhop_marble_7cf33a64-7120-4514-b9fa-4fe29d9523d.qbot");
|
||||
const m = await fetch("bhop_marble_5692093612.snfm");
|
||||
|
||||
const canvas = document.querySelector("canvas");
|
||||
const canvas = document.getElementById("viewport");
|
||||
|
||||
const graphics = await setup_graphics(canvas);
|
||||
const bot = new CompleteBot(new Uint8Array(await b.arrayBuffer()));
|
||||
const map = new CompleteMap(new Uint8Array(await m.arrayBuffer()));
|
||||
const playback = new PlaybackHead(0);
|
||||
const playback = new PlaybackHead(bot, 0);
|
||||
|
||||
graphics.change_map(map);
|
||||
|
||||
const startTime = performance.now();
|
||||
// HUD
|
||||
const hud_timer = document.getElementById("hud_timer");
|
||||
const hud_duration = document.getElementById("hud_duration");
|
||||
const MODE_MAIN = 0;
|
||||
|
||||
function timer_text(t) {
|
||||
const h = Math.floor(t / 3600);
|
||||
const m = Math.floor((t % 3600) / 60);
|
||||
const s = Math.floor(t % 60);
|
||||
const ms = Math.floor((t % 1) * 1000);
|
||||
return `${String(h).padStart(2, "0")}:${String(m).padStart(2, "0")}:${String(s).padStart(2, "0")}.${String(ms).padStart(3, "0")}`;
|
||||
}
|
||||
|
||||
hud_duration.textContent = timer_text(bot.run_duration(MODE_MAIN));
|
||||
|
||||
// Stuff
|
||||
const startTime = document.timeline.currentTime;
|
||||
function elapsed() {
|
||||
return (document.timeline.currentTime - startTime) / 1000;
|
||||
}
|
||||
|
||||
const control_speed = document.getElementById("control_speed");
|
||||
|
||||
var paused = false;
|
||||
var scale = 1;
|
||||
function set_scale(new_scale) {
|
||||
scale = new_scale;
|
||||
playback.set_scale(elapsed(), scale);
|
||||
control_speed.value = `${scale.toPrecision(3)}x`;
|
||||
}
|
||||
|
||||
const SEEK_DURATION = 1.0;
|
||||
|
||||
// Controls
|
||||
document.getElementById("control_reset").addEventListener("click", (e) => {
|
||||
playback.set_head_time(bot, elapsed(), 0.0);
|
||||
});
|
||||
document.getElementById("control_pause").addEventListener("click", (e) => {
|
||||
paused = !paused;
|
||||
playback.set_paused(elapsed(), paused);
|
||||
});
|
||||
document.getElementById("control_forward").addEventListener("click", (e) => {
|
||||
const time_now = elapsed();
|
||||
const playback_time = playback.get_head_time(time_now);
|
||||
const time_offset = playback.get_scale() * SEEK_DURATION;
|
||||
playback.set_head_time(bot, time_now, playback_time + time_offset);
|
||||
});
|
||||
document.getElementById("control_backward").addEventListener("click", (e) => {
|
||||
const time_now = elapsed();
|
||||
const playback_time = playback.get_head_time(time_now);
|
||||
const time_offset = playback.get_scale() * SEEK_DURATION;
|
||||
playback.set_head_time(bot, time_now, playback_time - time_offset);
|
||||
});
|
||||
document.getElementById("control_slower").addEventListener("click", (e) => {
|
||||
set_scale((scale * 4) / 5);
|
||||
});
|
||||
const regex = new RegExp("^([^x]*)x?$");
|
||||
control_speed.addEventListener("change", (e) => {
|
||||
const parsed = regex.exec(e.target.value);
|
||||
if (!parsed) {
|
||||
set_scale(1);
|
||||
return;
|
||||
}
|
||||
const input = Number(parsed.at(1));
|
||||
if (Number.isNaN(input)) {
|
||||
set_scale(1);
|
||||
return;
|
||||
}
|
||||
set_scale(input);
|
||||
});
|
||||
document.getElementById("control_faster").addEventListener("click", (e) => {
|
||||
set_scale((scale * 5) / 4);
|
||||
});
|
||||
|
||||
// Rendering
|
||||
function animate(now) {
|
||||
const elapsedMs = now - startTime;
|
||||
const elapsedSec = elapsedMs / 1000; // wasm expects seconds
|
||||
|
||||
// Advance the playback head to the current time
|
||||
playback.advance_time(bot, elapsedSec);
|
||||
var event = playback.next_event(bot);
|
||||
while (event && event.time() < elapsedSec) {
|
||||
playback.process_event(bot, event);
|
||||
event = playback.next_event(bot);
|
||||
}
|
||||
|
||||
// update the timer text
|
||||
const time = playback.get_run_time(bot, elapsedSec, MODE_MAIN);
|
||||
hud_timer.textContent = timer_text(time);
|
||||
|
||||
// Render the frame that the bot is at that time
|
||||
graphics.render(bot, playback, elapsedSec);
|
||||
@@ -37,10 +119,13 @@ function animate(now) {
|
||||
|
||||
requestAnimationFrame(animate);
|
||||
|
||||
// Resizing
|
||||
function resize() {
|
||||
canvas.width = canvas.clientWidth;
|
||||
canvas.height = canvas.clientHeight;
|
||||
graphics.resize(canvas.width, canvas.height);
|
||||
const fov_y = playback.get_fov_slope_y();
|
||||
const fov_x = (fov_y * canvas.width) / canvas.height;
|
||||
graphics.resize(canvas.width, canvas.height, fov_x, fov_y);
|
||||
}
|
||||
window.addEventListener("resize", resize);
|
||||
resize();
|
||||
|
||||
Reference in New Issue
Block a user