c4e7302567
- Introduced `civilization_benchmark.gd` and `legacy_quantity_math.gd` for benchmarking and legacy quantity calculations. - Created `test_dynamic_math.gd`, `test_frame_evolution.gd`, and `test_sparse_batches.gd` to validate mathematical operations and frame evolution logic. - Implemented `frame_budget.gd` to manage cooperative work on the main thread, ensuring no partially calculated state is published. - Added UID files for all new scripts to maintain unique identifiers.
31 lines
1.6 KiB
GDScript
31 lines
1.6 KiB
GDScript
extends RefCounted
|
|
const E = preload("res://world/owniverse/math/exact.gd")
|
|
|
|
static func seed(world, global, fragmented: bool = false, large: bool = false, stable: bool = false):
|
|
for id in world.catalog.entities:
|
|
world.state.amount[id] = 0
|
|
world.state.stats.total_amount[id] = 0
|
|
var entity = world.catalog.entities[id]
|
|
if entity.group_as != "":
|
|
world.state.amount[entity.group_as] = 0
|
|
world.state.stats.total_amount[entity.group_as] = 0
|
|
for id in ["RD", "BG", "TWD", "SNS", "MGT", "BH25", "SMBH", "SCD", "GEM", "LGG", "LSC", "LGF", "LGW", "LUB"]:
|
|
world.state.amount[id] = E.of("1e48")
|
|
world.state.amount.S = E.of("1e50")
|
|
world.state.amount.H = E.of("1e48")
|
|
world.state.binds.RD = {"HP": E.of("1e30"), "RP": E.of("1e30"), "GG": E.of("1e30"), "AB": E.of("1e30")}
|
|
var count = E.of("6e20") if large else 6000
|
|
for id in global.CivilizationRules:
|
|
if E.le(global.CivilizationRules[id].span, 0): continue
|
|
world.state.amount[id] = count
|
|
world.state.ethics[id] = {}
|
|
for ethic in ["m", "l", "w", "d", "c", "b"]:
|
|
world.state.ethics[id][ethic] = E.divide(count, 6)
|
|
world.state.batches[id] = []
|
|
var parties: int = 10 if fragmented else 1
|
|
for i in parties:
|
|
var lifespan = E.of(global.CivilizationRules[id].span) if stable else 1
|
|
world.state.batches[id].append({"amount": E.divide(count, parties), "created_from": i * 100, "created_to": 1000 + i * 100, "start_year": E.add(lifespan, i * 100), "end_year": E.add(lifespan, 1000 + i * 100)})
|
|
world.ledger.refresh_groups(world.state)
|
|
world.speed = 6
|