mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Create distribution map for dungeons
* tl;dr T0 - 27%, T1/T2 - 22%, T3/T4 - 11%, T5 - 5%. Before every dungeon had 16% chance to be created.
This commit is contained in:
parent
ecd61df49b
commit
0ec6a4e5ff
@ -1,24 +1,25 @@
|
||||
/// Distribution of different dungeon levels.
|
||||
///
|
||||
/// first number is dungeon level, integer
|
||||
/// second number is probability, any normal positive float (not a NaN, for example)
|
||||
/// second number is weight, any normal positive float (not a NaN, for example)
|
||||
///
|
||||
/// Values are relative to each other,
|
||||
/// lesser probability means there will be less dungeons.
|
||||
/// lesser weight means there will be less dungeons of that tier.
|
||||
///
|
||||
/// General rules:
|
||||
/// 1) Probability should not be less or equal to zero
|
||||
/// 2) Keep it synced with number of dungeon levels
|
||||
/// 3) Keep these pairs sorted from lowest to highest tier
|
||||
/// 1) Weight should not be less then zero
|
||||
/// 2) At least some of weights shouldn't be a zero
|
||||
/// 3) Keep it synced with number of dungeon levels
|
||||
/// 4) Keep these pairs sorted from lowest to highest tier
|
||||
///
|
||||
/// Tips:
|
||||
/// 1) Set every probability to 0.0 and left one with any other number
|
||||
/// and you will have map full of dungeons of same level
|
||||
([
|
||||
(0, 1.0),
|
||||
(1, 1.0),
|
||||
(2, 1.0),
|
||||
(3, 1.0),
|
||||
(4, 1.0),
|
||||
(0, 5.0),
|
||||
(1, 4.0),
|
||||
(2, 4.0),
|
||||
(3, 2.0),
|
||||
(4, 2.0),
|
||||
(5, 1.0),
|
||||
])
|
||||
|
@ -70,7 +70,12 @@ impl Dungeon {
|
||||
let difficulty = DUNGEON_DISTRIBUTION
|
||||
.choose_weighted(&mut ctx.rng, |pair| pair.1)
|
||||
.map(|(difficulty, _)| *difficulty)
|
||||
.expect("this can never fail");
|
||||
.unwrap_or_else(|err| {
|
||||
panic!(
|
||||
"Failed to choose difficulty (check instruction in config). Error: {}",
|
||||
err
|
||||
)
|
||||
});
|
||||
|
||||
let floors = 3 + difficulty / 2;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user