seeded random

all runs are now seeded
seed defaults to the last 8 digits of UTC time in milliseconds
set a custom randomization seed in settings
seed controls:
    at start - boss list, mob type list, level list, horizontal flip
    during run - tech, gun, field choices, some custom level randomization
doesn't control: mob spawns, mob size, some minor level differences, specific level boss choices, ammo reward values, specific tech effects

bug fix with ground state
This commit is contained in:
landgreen
2022-02-06 08:52:39 -08:00
parent 496cc83878
commit 775f45b863
10 changed files with 105 additions and 48 deletions

View File

@@ -566,7 +566,8 @@ const powerUps = {
}
}
if (options.length > 0) {
return options[Math.floor(Math.random() * options.length)]
// return options[Math.floor(Math.random() * options.length)]
return options[Math.floor(Math.seededRandom(0, options.length))]
}
},
choiceLog: [], //records all previous choice options
@@ -650,7 +651,8 @@ const powerUps = {
}
if (options.length > 0) {
const choose = options[Math.floor(Math.random() * options.length)]
// const choose = options[Math.floor(Math.random() * options.length)]
const choose = options[Math.floor(Math.seededRandom(0, options.length))]
const isCount = tech.tech[choose].count > 0 ? `(${tech.tech[choose].count+1}x)` : "";
if (tech.tech[choose].isFieldTech) {
@@ -813,7 +815,10 @@ const powerUps = {
}
}
if (options.length > 0) {
return options[Math.floor(Math.random() * options.length)]
// console.log(`random: ${Math.seededRandom(0, options.length)}`)
return options[Math.floor(Math.seededRandom(0, options.length))]
// return options[Math.floor(Math.random() * options.length)]
}
},
choiceLog: [], //records all previous choice options