seed display
seeds are displayed in pause menu and intro map seeds from your previous run is displayed in settings after you die fixed some minor seed inconsistency
This commit is contained in:
@@ -94,6 +94,7 @@
|
||||
<label for="seed">randomization seed:</label>
|
||||
<input type="text" id="seed" name="seed" autocomplete="off" spellcheck="false" minlength="1" size="20" style="width: 120px;">
|
||||
<br>
|
||||
<span id="previous-seed" style="color:#bbb"></span>
|
||||
|
||||
<label for="difficulty-select" title="effects: number of mobs, damage done by mobs, damage done to mobs, mob speed, heal effects">combat difficulty:</label>
|
||||
<select name="difficulty-select" id="difficulty-select" style="background-color: #fff">
|
||||
|
||||
10
js/index.js
10
js/index.js
@@ -6,12 +6,17 @@ Math.hash = s => { for (var i = 0, h = 9; i < s.length;) h = Math.imul(h ^ s.cha
|
||||
// const date1 = new Date()
|
||||
// Math.seed = date1.getUTCDate() * date1.getUTCFullYear(); // daily seed, day + year
|
||||
// Math.seed = Date.now() //random every time: just the time in seconds UTC
|
||||
Math.seed = Math.floor(Date.now() % 100000000) //random every time: just the time in seconds UTC
|
||||
// Math.seed = Math.abs(Math.hash(String(Date.now()))) //update randomizer seed in case the player changed it
|
||||
|
||||
// document.getElementById("seed").placeholder = Math.seed = Math.initialSeed = Math.floor(Date.now() % 100000) //random every time: just the time in milliseconds UTC
|
||||
|
||||
|
||||
document.getElementById("seed").placeholder = Math.initialSeed = String(Math.floor(Date.now() % 100000))
|
||||
Math.seed = Math.abs(Math.hash(Math.initialSeed)) //update randomizer seed in case the player changed it
|
||||
Math.seededRandom = function(min = 0, max = 1) { // in order to work 'Math.seed' must NOT be undefined
|
||||
Math.seed = (Math.seed * 9301 + 49297) % 233280;
|
||||
return min + Math.seed / 233280 * (max - min);
|
||||
}
|
||||
document.getElementById("seed").placeholder = Math.seed //display seed in settings
|
||||
//Math.seed is set to document.getElementById("seed").value in level.populate level at the start of runs
|
||||
// console.log(Math.seed)
|
||||
|
||||
@@ -269,6 +274,7 @@ ${botText}
|
||||
<br>position: (${player.position.x.toFixed(1)}, ${player.position.y.toFixed(1)}) velocity: (${player.velocity.x.toFixed(1)}, ${player.velocity.y.toFixed(1)})
|
||||
<br>mouse: (${simulation.mouseInGame.x.toFixed(1)}, ${simulation.mouseInGame.y.toFixed(1)}) mass: ${player.mass.toFixed(1)}
|
||||
<br>
|
||||
<br>seed: ${Math.initialSeed}
|
||||
<br>level: ${level.levels[level.onLevel]} (${level.difficultyText()}) ${m.cycle} cycles
|
||||
<br>${mob.length} mobs, ${body.length} blocks, ${bullet.length} bullets, ${powerUp.length} power ups
|
||||
|
||||
|
||||
@@ -221,7 +221,10 @@ const level = {
|
||||
}
|
||||
},
|
||||
populateLevels() {
|
||||
if (document.getElementById("seed").value) Math.seed = Math.hash(document.getElementById("seed").value) //update randomizer seed in case the player changed it
|
||||
if (document.getElementById("seed").value) {
|
||||
Math.initialSeed = String(document.getElementById("seed").value)
|
||||
Math.seed = Math.abs(Math.hash(Math.initialSeed)) //update randomizer seed in case the player changed it
|
||||
}
|
||||
|
||||
if (simulation.isTraining) {
|
||||
level.levels = level.trainingLevels.slice(0) //copy array, not by just by assignment
|
||||
|
||||
@@ -1044,7 +1044,7 @@ const powerUps = {
|
||||
},
|
||||
pauseEjectTech(index) {
|
||||
if (tech.isPauseEjectTech || simulation.testing) {
|
||||
if (Math.random() < 0.03) {
|
||||
if (Math.random() < 0.04) {
|
||||
tech.removeTech(index)
|
||||
m.energy += 20.48;
|
||||
} else {
|
||||
|
||||
@@ -521,6 +521,14 @@ const simulation = {
|
||||
},
|
||||
firstRun: true,
|
||||
splashReturn() {
|
||||
|
||||
document.getElementById("previous-seed").innerHTML = `previous seed: <span style="font-size:80%;">${Math.initialSeed}</span><br>`
|
||||
document.getElementById("seed").value = Math.initialSeed = Math.seed //randomize initial seed
|
||||
|
||||
//String(document.getElementById("seed").value)
|
||||
// Math.seed = Math.abs(Math.hash(Math.initialSeed)) //update randomizer seed in case the player changed it
|
||||
|
||||
|
||||
simulation.clearTimeouts();
|
||||
simulation.onTitlePage = true;
|
||||
document.getElementById("splash").onclick = function() {
|
||||
@@ -695,6 +703,7 @@ const simulation = {
|
||||
// simulation.makeTextLog(`input.key.left<span class='color-symbol'>:</span> ["<span class='color-text'>${input.key.left}</span>", "<span class='color-text'>ArrowLeft</span>"]`);
|
||||
// simulation.makeTextLog(`input.key.down<span class='color-symbol'>:</span> ["<span class='color-text'>${input.key.down}</span>", "<span class='color-text'>ArrowDown</span>"]`);
|
||||
// simulation.makeTextLog(`input.key.right<span class='color-symbol'>:</span> ["<span class='color-text'>${input.key.right}</span>", "<span class='color-text'>ArrowRight</span>"]`);
|
||||
simulation.makeTextLog(`Math.seed <span class='color-symbol'>=</span> ${Math.initialSeed}`);
|
||||
simulation.makeTextLog(`<span class='color-var'>const</span> engine <span class='color-symbol'>=</span> Engine.create(); <em>//simulation begin</em>`);
|
||||
simulation.makeTextLog(`engine.timing.timeScale <span class='color-symbol'>=</span> 1`);
|
||||
// simulation.makeTextLog(`input.key.field<span class='color-symbol'>:</span> ["<span class='color-text'>${input.key.field}</span>", "<span class='color-text'>MouseRight</span>"]`);
|
||||
|
||||
@@ -3067,15 +3067,13 @@ const tech = {
|
||||
},
|
||||
{
|
||||
name: "particle collider",
|
||||
description: `<strong>clicking</strong> <strong class='color-m'>tech</strong> while <strong>paused</strong> <strong>ejects</strong> them<br><em><strong>3%</strong> chance to convert that tech into <strong class='color-f'>energy</strong></em>`,
|
||||
description: `<strong>clicking</strong> <strong class='color-m'>tech</strong> while <strong>paused</strong> <strong>ejects</strong> them<br><em><strong>4%</strong> chance to convert that tech into <strong class='color-f'>energy</strong></em>`,
|
||||
maxCount: 1,
|
||||
count: 0,
|
||||
frequency: 1,
|
||||
frequencyDefault: 1,
|
||||
allowed() {
|
||||
return tech.isPauseSwitchField
|
||||
},
|
||||
requires: "unified field theory",
|
||||
allowed() { return true },
|
||||
requires: "",
|
||||
effect() {
|
||||
tech.isPauseEjectTech = true;
|
||||
},
|
||||
|
||||
37
todo.txt
37
todo.txt
@@ -1,32 +1,33 @@
|
||||
******************************************************** NEXT PATCH **************************************************
|
||||
|
||||
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
|
||||
seeds are displayed in pause menu and intro map
|
||||
seeds from your previous run is displayed in settings after you die
|
||||
fixed some minor seed inconsistency
|
||||
|
||||
******************************************************** TODO ********************************************************
|
||||
|
||||
make railgun default fire mode for crouch harpoon?
|
||||
|
||||
buff perfect diamagnetism
|
||||
|
||||
make a seed/hash system that controls only the tech/guns/fields shown
|
||||
URL sharing could include a seed
|
||||
seed will control:
|
||||
seeded random at start done - random level boss, mob types list, level order, horizontal flip
|
||||
seeded random at start - random level boss, mob types list, level order, horizontal flip
|
||||
seeded random during run - tech, gun, field choices
|
||||
not seeded random - mob spawns, mob size, minor level differences, custom level boss choices, ammo rewards, tech effect randomness
|
||||
better to only seed things at the start of the run so it doesn't mess with power up choices
|
||||
put a seed display in top right corner of splash menu, or settings?
|
||||
normal seed = full UTC time
|
||||
make option for a daily seed: seed = day+year
|
||||
give 1 extra tech for doing the daily seeded run
|
||||
make the option for the daily run, a secret exit in the intro level?
|
||||
figure out how to convert text into seed
|
||||
display seed in pause menu
|
||||
make option for a daily seed: seed = day+year
|
||||
give 1 extra tech for doing the daily seeded run
|
||||
make the option for the daily run, a secret exit in the intro level?
|
||||
when you die
|
||||
randomize seed
|
||||
display new seed
|
||||
show previous run seed
|
||||
edit div in settings
|
||||
|
||||
|
||||
tech upgrade to anthropic to make it trigger at 50% life and 0%
|
||||
tech upgrade to anthropic principle to make it trigger at 50% life and 0% once per map
|
||||
|
||||
JUNK tech: https://bindingofisaacrebirth.fandom.com/wiki/Damocles
|
||||
|
||||
|
||||
Reference in New Issue
Block a user