Add tentacled boss planet encounter
This commit is contained in:
parent
0f7edff15a
commit
40f284dcdd
38 changed files with 1051 additions and 19 deletions
|
|
@ -37,9 +37,13 @@ const BLACK_HOLE_CHANCE: float = 0.05
|
|||
# from 0.08 after playtesting found that rate too scarce for how central
|
||||
# research points had become to progression.
|
||||
const RESEARCH_LAB_CHANCE: float = 0.16
|
||||
# A boss world is rarer than every ordinary discovery. Its roll uses a
|
||||
# separately seeded generator below, so adding it cannot rename or re-roll
|
||||
# any planet in an existing world.
|
||||
const BOSS_PLANET_CHANCE: float = 0.025
|
||||
|
||||
# DEV MODE ONLY: one of every planet type, parked in the chunks immediately
|
||||
# around the spawn so all four can be reached in seconds.
|
||||
# around the spawn so all five can be reached in seconds.
|
||||
#
|
||||
# This replaces the guaranteed gas giant that used to sit in the origin
|
||||
# chunk for every game. That was a play-testing convenience which had become
|
||||
|
|
@ -56,6 +60,7 @@ const DEV_PLANET_CHUNKS: Dictionary = {
|
|||
Vector2i(1, 0): PLANET_DEFINITIONS.ROCKY_ID,
|
||||
Vector2i(0, 1): PLANET_DEFINITIONS.RESEARCH_LAB_ID,
|
||||
Vector2i(1, 1): PLANET_DEFINITIONS.BLACK_HOLE_ID,
|
||||
Vector2i(-1, 0): PLANET_DEFINITIONS.BOSS_ID,
|
||||
}
|
||||
const DEV_PLANET_LOCAL_POS: Vector2 = Vector2(600.0, 600.0)
|
||||
|
||||
|
|
@ -143,20 +148,26 @@ static func planet_data_at_chunk(chunk: Vector2i) -> Dictionary:
|
|||
var black_hole_roll: float = rng.randf()
|
||||
# Same principle, its own independent roll (#63).
|
||||
var research_lab_roll: float = rng.randf()
|
||||
# Independent from the established generation stream: existing chunks keep
|
||||
# their old names and shapes when this new rare outcome is introduced.
|
||||
var boss_rng := RandomNumberGenerator.new()
|
||||
boss_rng.seed = hash("boss:%d:%d" % [chunk.x, chunk.y])
|
||||
var boss_roll: float = boss_rng.randf()
|
||||
# A stable per-chunk roll makes gas giants persistent landmarks rather
|
||||
# than a different resource whenever the scene reloads.
|
||||
var gas_giant: bool = biome_at_chunk(chunk) == Biome.SPACE
|
||||
var definition_id: String = PLANET_DEFINITIONS.GAS_GIANT_ID if gas_giant else PLANET_DEFINITIONS.ROCKY_ID
|
||||
# A rare third outcome, seeded the same deterministic way as everything
|
||||
# else here.
|
||||
if black_hole_roll < BLACK_HOLE_CHANCE:
|
||||
# Rare authored outcomes, seeded deterministically like everything else.
|
||||
if boss_roll < BOSS_PLANET_CHANCE:
|
||||
definition_id = PLANET_DEFINITIONS.BOSS_ID
|
||||
elif black_hole_roll < BLACK_HOLE_CHANCE:
|
||||
definition_id = PLANET_DEFINITIONS.BLACK_HOLE_ID
|
||||
elif research_lab_roll < RESEARCH_LAB_CHANCE:
|
||||
definition_id = PLANET_DEFINITIONS.RESEARCH_LAB_ID
|
||||
# Dev mode's fixed planting wins over every roll above. Applied last, and
|
||||
# AFTER all the rng draws, so switching it on cannot shift which random
|
||||
# values any other chunk consumes - a dev world and a normal one differ
|
||||
# only in these four chunks.
|
||||
# only in these five chunks.
|
||||
if not forced_definition_id.is_empty():
|
||||
definition_id = forced_definition_id
|
||||
var definition: Resource = PLANET_DEFINITIONS.get_definition(definition_id)
|
||||
|
|
|
|||
Loading…
Reference in a new issue