mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Merge branch 'xacrimon/rng-init-noise' into 'master'
Update some deps, fix hashbrown not compiling and rework the ad-hoc PRNG for RandomField. See merge request veloren/veloren!500
This commit is contained in:
commit
542ac41e7a
103
Cargo.lock
generated
103
Cargo.lock
generated
@ -5,6 +5,14 @@ name = "adler32"
|
||||
version = "1.0.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "ahash"
|
||||
version = "0.2.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"const-random 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "aho-corasick"
|
||||
version = "0.6.10"
|
||||
@ -515,6 +523,24 @@ name = "conrod_winit"
|
||||
version = "0.63.0"
|
||||
source = "git+https://gitlab.com/veloren/conrod.git#d603363488870eae9df91ba45ba795509c8a6ab4"
|
||||
|
||||
[[package]]
|
||||
name = "const-random"
|
||||
version = "0.1.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"const-random-macro 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"proc-macro-hack 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "const-random-macro"
|
||||
version = "0.1.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"proc-macro-hack 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rand 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "constant_time_eq"
|
||||
version = "0.1.4"
|
||||
@ -625,7 +651,7 @@ dependencies = [
|
||||
"itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rand_core 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rand_os 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rand_xoshiro 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rayon 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@ -1455,6 +1481,16 @@ dependencies = [
|
||||
"serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hashbrown"
|
||||
version = "0.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"ahash 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"autocfg 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "heaptrack"
|
||||
version = "0.3.0"
|
||||
@ -2464,6 +2500,16 @@ dependencies = [
|
||||
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro-hack"
|
||||
version = "0.5.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"syn 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "0.2.3"
|
||||
@ -2635,13 +2681,13 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rand"
|
||||
version = "0.7.0"
|
||||
version = "0.7.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"getrandom 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rand_chacha 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rand_core 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rand_hc 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
@ -2660,7 +2706,7 @@ version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"c2-chacha 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rand_core 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -2678,7 +2724,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "rand_core"
|
||||
version = "0.5.0"
|
||||
version = "0.5.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"getrandom 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@ -2697,7 +2743,7 @@ name = "rand_hc"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"rand_core 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -2737,7 +2783,7 @@ version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"getrandom 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rand_core 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -2762,7 +2808,7 @@ name = "rand_xoshiro"
|
||||
version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"rand_core 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -3593,7 +3639,7 @@ dependencies = [
|
||||
"mio-extras 2.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"notify 5.0.0-pre.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rand 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rand 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rayon 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_derive 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@ -3615,7 +3661,7 @@ dependencies = [
|
||||
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"prometheus 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"prometheus-static-metric 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rand 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rand 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ron 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rouille 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"scan_fmt 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@ -3669,7 +3715,7 @@ dependencies = [
|
||||
"num 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"portpicker 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rand 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rand 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rodio 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ron 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@ -3687,15 +3733,14 @@ dependencies = [
|
||||
name = "veloren-world"
|
||||
version = "0.3.0"
|
||||
dependencies = [
|
||||
"hashbrown 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"hashbrown 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"minifb 0.12.0 (git+https://github.com/emoon/rust_minifb.git)",
|
||||
"noise 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rand 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rand 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rand_chacha 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"vek 0.9.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"veloren-common 0.3.0",
|
||||
"zerocopy 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -3885,27 +3930,9 @@ name = "xml-rs"
|
||||
version = "0.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "zerocopy"
|
||||
version = "0.2.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"zerocopy-derive 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zerocopy-derive"
|
||||
version = "0.1.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"synstructure 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[metadata]
|
||||
"checksum adler32 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "7e522997b529f05601e05166c07ed17789691f562762c7f3b987263d2dedee5c"
|
||||
"checksum ahash 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)" = "e96e12a0287c75063711e04484e9b140d4a59ec074d3fe5f0b1cc90e0e992665"
|
||||
"checksum aho-corasick 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)" = "81ce3d38065e618af2d7b77e10c5ad9a069859b4be3c2250f674af3840d9c8a5"
|
||||
"checksum aho-corasick 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)" = "58fb5e95d83b38284460a5fda7d6470aa0b8844d283a0b614b8535e880800d2d"
|
||||
"checksum alga 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d708cb68c7106ed1844de68f50f0157a7788c2909a6926fad5a87546ef6a4ff8"
|
||||
@ -3966,6 +3993,8 @@ dependencies = [
|
||||
"checksum conrod_core 0.63.0 (git+https://gitlab.com/veloren/conrod.git)" = "<none>"
|
||||
"checksum conrod_derive 0.63.0 (git+https://gitlab.com/veloren/conrod.git)" = "<none>"
|
||||
"checksum conrod_winit 0.63.0 (git+https://gitlab.com/veloren/conrod.git)" = "<none>"
|
||||
"checksum const-random 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "7b641a8c9867e341f3295564203b1c250eb8ce6cb6126e007941f78c4d2ed7fe"
|
||||
"checksum const-random-macro 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c750ec12b83377637110d5a57f5ae08e895b06c4b16e2bdbf1a94ef717428c59"
|
||||
"checksum constant_time_eq 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "995a44c877f9212528ccc74b21a232f66ad69001e40ede5bcee2ac9ef2657120"
|
||||
"checksum core-foundation 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "286e0b41c3a20da26536c6000a280585d519fd07b3956b43aed8a79e9edce980"
|
||||
"checksum core-foundation 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "25b9e03f145fd4f2bf705e07b900cd41fc636598fe5dc452fd0db1441c3f496d"
|
||||
@ -4062,6 +4091,7 @@ dependencies = [
|
||||
"checksum guillotiere 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "182af928b4435d8fbef910535586ecdca95ab4068493769c090e6573477f5e35"
|
||||
"checksum gzip-header 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0131feb3d3bb2a5a238d8a4d09f6353b7ebfdc52e77bccbf4ea6eaa751dde639"
|
||||
"checksum hashbrown 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e1de41fb8dba9714efd92241565cdff73f78508c95697dd56787d3cba27e2353"
|
||||
"checksum hashbrown 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2bcea5b597dd98e6d1f1ec171744cc5dee1a30d1c23c5b98e3cf9d4fbdf8a526"
|
||||
"checksum heaptrack 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8a5f3c2341045ae29cc6d1004caf4c043addd7b658f9d11464fd6914dff6609b"
|
||||
"checksum hibitset 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)" = "6527bc88f32e0d3926c7572874b2bf17a19b36978aacd0aacf75f7d27a5992d0"
|
||||
"checksum hound 3.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8a164bb2ceaeff4f42542bdb847c41517c78a60f5649671b2a07312b6e117549"
|
||||
@ -4176,6 +4206,7 @@ dependencies = [
|
||||
"checksum portpicker 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5b497d05c16fe00939445c00a4fe2fa4f3d3dfc9c0401a3ab5c577afda2debb9"
|
||||
"checksum ppv-lite86 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "e3cbf9f658cdb5000fcf6f362b8ea2ba154b9f146a61c7a20d647034c6b6561b"
|
||||
"checksum pretty_env_logger 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "717ee476b1690853d222af4634056d830b5197ffd747726a9a1eee6da9f49074"
|
||||
"checksum proc-macro-hack 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)" = "e688f31d92ffd7c1ddc57a1b4e6d773c0f2a14ee437a4b0a4f5a69c80eb221c8"
|
||||
"checksum proc-macro2 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "cd07deb3c6d1d9ff827999c7f9b04cdfd66b1b17ae508e14fe47b620f2282ae0"
|
||||
"checksum proc-macro2 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "1b06e2f335f48d24442b35a19df506a835fb3547bc3c06ef27340da9acf5cae7"
|
||||
"checksum proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)" = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759"
|
||||
@ -4194,12 +4225,12 @@ dependencies = [
|
||||
"checksum rand 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "552840b97013b1a26992c11eac34bdd778e464601a4c2054b5f0bff7c6761293"
|
||||
"checksum rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c618c47cd3ebd209790115ab837de41425723956ad3ce2e6a7f09890947cacb9"
|
||||
"checksum rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "6d71dacdc3c88c1fde3885a3be3fbab9f35724e6ce99467f7d9c5026132184ca"
|
||||
"checksum rand 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d47eab0e83d9693d40f825f86948aa16eff6750ead4bdffc4ab95b8b3a7f052c"
|
||||
"checksum rand 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "3ae1b169243eaf61759b8475a998f0a385e42042370f3a7dbaf35246eacc8412"
|
||||
"checksum rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "556d3a1ca6600bfcbab7c7c91ccb085ac7fbbcd70e008a98742e7847f4f7bcef"
|
||||
"checksum rand_chacha 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "03a2a90da8c7523f554344f921aa97283eadf6ac484a6d2a7d0212fa7f8d6853"
|
||||
"checksum rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b"
|
||||
"checksum rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc"
|
||||
"checksum rand_core 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "615e683324e75af5d43d8f7a39ffe3ee4a9dc42c5c701167a71dc59c3a493aca"
|
||||
"checksum rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19"
|
||||
"checksum rand_hc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7b40677c7be09ae76218dc623efbf7b18e34bced3f38883af07bb75630a21bc4"
|
||||
"checksum rand_hc 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c"
|
||||
"checksum rand_isaac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ded997c9d5f13925be2a6fd7e66bf1872597f759fd9dd93513dd7e92e5a5ee08"
|
||||
@ -4324,5 +4355,3 @@ dependencies = [
|
||||
"checksum x11-dl 2.18.4 (registry+https://github.com/rust-lang/crates.io-index)" = "be65e1342a3baae65439cd03306778831a3d133b0d20243a7fb83fd5cf403c58"
|
||||
"checksum xdg 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d089681aa106a86fade1b0128fb5daf07d5867a509ab036d99988dec80429a57"
|
||||
"checksum xml-rs 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "541b12c998c5b56aa2b4e6f18f03664eef9a4fd0a246a55594efae6cc2d964b5"
|
||||
"checksum zerocopy 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "992b9b31f80fd4a167f903f879b8ca43d6716cc368ea01df90538baa2dd34056"
|
||||
"checksum zerocopy-derive 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "b090467ecd0624026e8a6405d343ac7382592530d54881330b3fc8e400280fa5"
|
||||
|
@ -8,11 +8,10 @@ edition = "2018"
|
||||
common = { package = "veloren-common", path = "../common" }
|
||||
vek = "0.9.9"
|
||||
noise = "0.5.1"
|
||||
hashbrown = { version = "0.5.0", features = ["serde", "nightly"] }
|
||||
lazy_static = "1.3.0"
|
||||
rand = "0.7.0"
|
||||
hashbrown = { version = "0.6.0", features = ["serde"] }
|
||||
lazy_static = "1.4.0"
|
||||
rand = "0.7.2"
|
||||
rand_chacha = "0.2.1"
|
||||
zerocopy = "0.2.8"
|
||||
|
||||
[dev-dependencies]
|
||||
minifb = { git = "https://github.com/emoon/rust_minifb.git" }
|
||||
|
@ -103,50 +103,46 @@ pub struct WorldSim {
|
||||
}
|
||||
|
||||
impl WorldSim {
|
||||
pub fn generate(mut seed: u32) -> Self {
|
||||
let seed = &mut seed;
|
||||
let mut gen_seed = || {
|
||||
*seed = seed_expan::diffuse(*seed);
|
||||
*seed
|
||||
};
|
||||
pub fn generate(seed: u32) -> Self {
|
||||
let mut rng = ChaChaRng::from_seed(seed_expan::rng_state(seed));
|
||||
|
||||
let mut gen_ctx = GenCtx {
|
||||
turb_x_nz: SuperSimplex::new().set_seed(gen_seed()),
|
||||
turb_y_nz: SuperSimplex::new().set_seed(gen_seed()),
|
||||
chaos_nz: RidgedMulti::new().set_octaves(7).set_seed(gen_seed()),
|
||||
hill_nz: SuperSimplex::new().set_seed(gen_seed()),
|
||||
turb_x_nz: SuperSimplex::new().set_seed(rng.gen()),
|
||||
turb_y_nz: SuperSimplex::new().set_seed(rng.gen()),
|
||||
chaos_nz: RidgedMulti::new().set_octaves(7).set_seed(rng.gen()),
|
||||
hill_nz: SuperSimplex::new().set_seed(rng.gen()),
|
||||
alt_nz: HybridMulti::new()
|
||||
.set_octaves(8)
|
||||
.set_persistence(0.1)
|
||||
.set_seed(gen_seed()),
|
||||
temp_nz: SuperSimplex::new().set_seed(gen_seed()),
|
||||
dry_nz: BasicMulti::new().set_seed(gen_seed()),
|
||||
small_nz: BasicMulti::new().set_octaves(2).set_seed(gen_seed()),
|
||||
rock_nz: HybridMulti::new().set_persistence(0.3).set_seed(gen_seed()),
|
||||
cliff_nz: HybridMulti::new().set_persistence(0.3).set_seed(gen_seed()),
|
||||
warp_nz: FastNoise::new(gen_seed()), //BasicMulti::new().set_octaves(3).set_seed(gen_seed()),
|
||||
.set_seed(rng.gen()),
|
||||
temp_nz: SuperSimplex::new().set_seed(rng.gen()),
|
||||
dry_nz: BasicMulti::new().set_seed(rng.gen()),
|
||||
small_nz: BasicMulti::new().set_octaves(2).set_seed(rng.gen()),
|
||||
rock_nz: HybridMulti::new().set_persistence(0.3).set_seed(rng.gen()),
|
||||
cliff_nz: HybridMulti::new().set_persistence(0.3).set_seed(rng.gen()),
|
||||
warp_nz: FastNoise::new(rng.gen()), //BasicMulti::new().set_octaves(3).set_seed(gen_seed()),
|
||||
tree_nz: BasicMulti::new()
|
||||
.set_octaves(12)
|
||||
.set_persistence(0.75)
|
||||
.set_seed(gen_seed()),
|
||||
cave_0_nz: SuperSimplex::new().set_seed(gen_seed()),
|
||||
cave_1_nz: SuperSimplex::new().set_seed(gen_seed()),
|
||||
.set_seed(rng.gen()),
|
||||
cave_0_nz: SuperSimplex::new().set_seed(rng.gen()),
|
||||
cave_1_nz: SuperSimplex::new().set_seed(rng.gen()),
|
||||
|
||||
structure_gen: StructureGen2d::new(gen_seed(), 32, 24),
|
||||
region_gen: StructureGen2d::new(gen_seed(), 400, 96),
|
||||
cliff_gen: StructureGen2d::new(gen_seed(), 80, 56),
|
||||
structure_gen: StructureGen2d::new(rng.gen(), 32, 24),
|
||||
region_gen: StructureGen2d::new(rng.gen(), 400, 96),
|
||||
cliff_gen: StructureGen2d::new(rng.gen(), 80, 56),
|
||||
humid_nz: Billow::new()
|
||||
.set_octaves(12)
|
||||
.set_persistence(0.125)
|
||||
.set_frequency(1.0)
|
||||
// .set_octaves(6)
|
||||
// .set_persistence(0.5)
|
||||
.set_seed(gen_seed()),
|
||||
.set_seed(rng.gen()),
|
||||
|
||||
fast_turb_x_nz: FastNoise::new(gen_seed()),
|
||||
fast_turb_y_nz: FastNoise::new(gen_seed()),
|
||||
fast_turb_x_nz: FastNoise::new(rng.gen()),
|
||||
fast_turb_y_nz: FastNoise::new(rng.gen()),
|
||||
|
||||
town_gen: StructureGen2d::new(gen_seed(), 2048, 1024),
|
||||
town_gen: StructureGen2d::new(rng.gen(), 2048, 1024),
|
||||
};
|
||||
|
||||
// "Base" of the chunk, to be multiplied by CONFIG.mountain_scale (multiplied value is
|
||||
@ -298,11 +294,11 @@ impl WorldSim {
|
||||
}
|
||||
|
||||
let mut this = Self {
|
||||
seed: *seed,
|
||||
seed: seed,
|
||||
chunks,
|
||||
locations: Vec::new(),
|
||||
gen_ctx,
|
||||
rng: ChaChaRng::from_seed(seed_expan::rng_state(*seed)),
|
||||
rng,
|
||||
};
|
||||
|
||||
this.seed_elements();
|
||||
|
@ -17,7 +17,7 @@ impl<K: Hash + Eq + Clone, V> HashCache<K, V> {
|
||||
pub fn with_capacity(capacity: usize) -> Self {
|
||||
Self {
|
||||
capacity,
|
||||
map: HashMap::default(),
|
||||
map: HashMap::with_capacity(1024),
|
||||
counter: 0,
|
||||
}
|
||||
}
|
||||
|
@ -1,3 +1,4 @@
|
||||
use super::seed_expan;
|
||||
use super::Sampler;
|
||||
use vek::*;
|
||||
|
||||
@ -17,22 +18,7 @@ impl Sampler<'static> for RandomField {
|
||||
|
||||
fn get(&self, pos: Self::Index) -> Self::Sample {
|
||||
let pos = pos.map(|e| u32::from_le_bytes(e.to_le_bytes()));
|
||||
|
||||
let mut a = self.seed;
|
||||
a = (a ^ 61) ^ (a >> 16);
|
||||
a = a.wrapping_add(a << 3);
|
||||
a = a ^ pos.x;
|
||||
a = a ^ (a >> 4);
|
||||
a = a.wrapping_mul(0x27d4eb2d);
|
||||
a = a ^ (a >> 15);
|
||||
a = a ^ pos.y;
|
||||
a = (a ^ 61) ^ (a >> 16);
|
||||
a = a.wrapping_add(a << 3);
|
||||
a = a ^ (a >> 4);
|
||||
a = a ^ pos.z;
|
||||
a = a.wrapping_mul(0x27d4eb2d);
|
||||
a = a ^ (a >> 15);
|
||||
a
|
||||
seed_expan::diffuse_mult(&[self.seed, pos.x, pos.y, pos.z])
|
||||
}
|
||||
}
|
||||
|
||||
@ -51,14 +37,6 @@ impl Sampler<'static> for RandomPerm {
|
||||
type Sample = u32;
|
||||
|
||||
fn get(&self, perm: Self::Index) -> Self::Sample {
|
||||
let a = self
|
||||
.seed
|
||||
.wrapping_mul(3471)
|
||||
.wrapping_add(perm)
|
||||
.wrapping_add(0x3BE7172B)
|
||||
.wrapping_mul(perm)
|
||||
.wrapping_add(0x172A3BE1);
|
||||
let b = a.wrapping_mul(a);
|
||||
b ^ (a >> 17) ^ b >> 15
|
||||
seed_expan::diffuse_mult(&[self.seed, perm])
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,16 @@
|
||||
use zerocopy::AsBytes;
|
||||
/// The zerocopy crate exists and can replace this function.
|
||||
/// We should evaluate using it when we have multiple usage spots for it.
|
||||
/// For now we have this safe alternative.
|
||||
fn cast_u32x8_u8x32(a: [u32; 8]) -> [u8; 32] {
|
||||
let mut r = [0; 32];
|
||||
for i in 0..8 {
|
||||
let a = a[i].to_ne_bytes();
|
||||
for j in 0..4 {
|
||||
r[i * 4 + j] = a[j];
|
||||
}
|
||||
}
|
||||
r
|
||||
}
|
||||
|
||||
/// Simple non-cryptographic diffusion function.
|
||||
pub fn diffuse(mut x: u32) -> u32 {
|
||||
@ -8,9 +20,19 @@ pub fn diffuse(mut x: u32) -> u32 {
|
||||
x = x.wrapping_add(0xd3a2646c) ^ (x << 9);
|
||||
x = x.wrapping_add(0xfd7046c5).wrapping_add(x << 3);
|
||||
x = (x ^ 0xb55a4f09) ^ (x >> 16);
|
||||
x = x.wrapping_add((1 << 31) - 13) ^ (x << 13);
|
||||
x
|
||||
}
|
||||
|
||||
/// Diffuse but takes multiple values as input.
|
||||
pub fn diffuse_mult(v: &[u32]) -> u32 {
|
||||
let mut state = (1 << 31) - 1;
|
||||
for e in v {
|
||||
state = diffuse(state ^ e);
|
||||
}
|
||||
state
|
||||
}
|
||||
|
||||
/// Expand a 32 bit seed into a 32 byte RNG state.
|
||||
pub fn rng_state(mut x: u32) -> [u8; 32] {
|
||||
let mut r: [u32; 8] = [0; 8];
|
||||
@ -18,8 +40,5 @@ pub fn rng_state(mut x: u32) -> [u8; 32] {
|
||||
x = diffuse(x);
|
||||
*s = x;
|
||||
}
|
||||
let bytes = r.as_bytes();
|
||||
let mut a: [u8; 32] = [0; 32];
|
||||
a.copy_from_slice(bytes);
|
||||
a
|
||||
cast_u32x8_u8x32(r)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user