charredUtensil / groundhog

A procedural map generator for Manic Miners
MIT License
2 stars 0 forks source link

Air #29

Open charredUtensil opened 8 months ago

charredUtensil commented 8 months ago

Seems simple on paper, but I think figuring out what the air values should be for any given cavern is tricky, especially for a generated map that by definition will not be playtested before being played "for real". This might be something to compute while walking the cavern to prevent softlocks.

charredUtensil commented 5 months ago

It should be possible to get a baseline for how long it takes to build a support station under ideal conditions, then infer how much delay monsters might cause. It may also make sense to choose a limited number of hazards that can affect the spawn (or the cavern at large) of which air would be one.

charredUtensil commented 4 months ago

Under ideal conditions: a tiny cavern with no erosion, monsters, or landslides, I can speed-run a support station in 2500 air. I consider myself pretty good at this game, so if I gave the exact same challenge to an "average" player, I would double this number (I think this idea comes from Valve actually?). So we're up to 5000 as an absolute minimum.

I did another test with a pile of crystals and ore in a cavern with no walls to drill and used about 33% of the total air since my miners didn't have to drill any walls or clear any rubble.

Landslides add some fear and might cause players to be a bit more careful about which walls they drill. Players may reinforce walls before drilling them, which takes more time. This is kind of hard to quantify and has far more to do with an individual player's play style than the actual level. Ignore landslides.

Erosion that intersects with the spawn cave adds some work that scales with the breadth of the erosion. My speedruns take about 5 minutes and Hognose presently only generates erosion events at 30+10s intervals. This means if the player does nothing, the erosion takes 130 seconds to completely turn to lava. If the player does do something, it costs 2 ore at a time when ore is critical. Suppose it directly adds 10 miner-seconds per ore and round up to 30 for the ore that's not going to construction. Suppose the player will need to repair each erosion twice, and this adds 60 miner-seconds of air per ready-to-erode tile in spawn. I haven't really seen caves with more than 5 such erosions, so use that and get 300, then round up to 500 and say that's 10% of the total.

Next up are monsters. Existing monster spawn logic will not spawn monsters in the spawn cave until a cooldown is reached, but this doesn't stop players from expanding into other caves. This seems extremely likely for a variety of circumstances, so we need to assume monsters will be getting spawned. Assume the player has 9 miners and 2 are permanently assigned to Action Stations. They have 7 workers, and an additional 2 on defense, 2/7 is about 28%.

Hognose currently refuses to generate caves with or adjacent to lava or water, so ignore these in the calculation.

Finally, the ideal conditions I tested under were in a roughly circular cave within a 10x10 square. By bumping this up to 20x20, I need to use about 1.5x the air as my workers drill more rock and have to walk further.

So, the air required for a cavern is:

(2500 + 500 spawn radius) (1.10 if spawn has erosion) * (1.28 if monsters)

charredUtensil commented 4 months ago

And finally, validating this against actual numbers from the game. In the LRR levels, 6000 is about the expected amount of air for most levels, and the only ones with less than 5000 are the levels where the player starts with a base, which is a case I neglected to control for above. Levels with more are "special" ones that Hognose can't really generate yet.

🭬grep oxygen: LRR/*.dat LRR/abreathoffreshair.dat:oxygen:6000/6000 LRR/airraiders.dat:oxygen:1500/5000 LRR/backtobasics.dat:oxygen:3000/3000 LRR/breathless.dat:oxygen:4000/8000 LRR/dontpanic.dat:oxygen:3600/3600 LRR/fireandwater.dat:oxygen:3000/3000 LRR/frozenfrenzy.dat:oxygen:6000/6000 LRR/hotstuff.dat:oxygen:6000/6000 LRR/icespy.dat:oxygen:10000/10000 LRR/lakeoffire.dat:oxygen:6000/6000 LRR/lavalaughter.dat:oxygen:6000/6000 LRR/oresome.dat:oxygen:4000/6000 LRR/rockhard.dat:oxygen:6000/6000 LRR/rockyhorror.dat:oxygen:3000/3000 LRR/runthegauntlet.dat:oxygen:3000/3000 LRR/splitdownthemiddle.dat:oxygen:6500/8000 LRR/waterlotoffun.dat:oxygen:10000/10000 LRR/waterworks.dat:oxygen:10000/10000