Add comprehensive civilization evolution tests and enhance civilization state management
- Introduced a new test script for civilization evolution (`test_civilization_evolution.gd`) to validate the evolution mechanics, including population dynamics, ethical transitions, and war impacts. - Updated `README.md` to include instructions for running the new civilization evolution tests. - Modified `test_civilization_state.gd` to accommodate changes in civilization rules and ensure proper validation of ethical stages. - Enhanced `test_descriptions.gd` to check for accurate population counters and state validation. - Adjusted `test_life.gd` to reflect updates in life version management. - Improved `civilization_state.gd` to include habitat budget calculations and transition management. - Added `civilization_evolution.gd` to handle the logic for civilization evolution, including population drift, warfare, and colonization mechanics. - Updated `owniverse.gd` and `owniverse_entity.gd` to integrate new evolution logic and ensure proper initialization of entities.
This commit is contained in:
+10
-1
@@ -69,10 +69,19 @@ func format_number(value: float, digits: int = 0) -> String:
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
CivilizationRules.clear()
|
||||
for row: Dictionary in _read_from_csv("res://data/civilization_rules.txt").values():
|
||||
if not CivilizationRules.has(row.stage):
|
||||
CivilizationRules[row.stage] = {"home": row.home, "span": float(row.span), "stars": float(row.stars), "ethics": {}}
|
||||
CivilizationRules[row.stage] = {"home": row.home, "span": float(row.span), "stars": float(row.stars), "ethics": {},
|
||||
"colonizes": row.colonizes == "1", "fights": row.fights == "1", "diplomacy": row.diplomacy == "1", "worships": row.worships == "1"}
|
||||
CivilizationRules[row.stage].ethics[row.ethic] = row
|
||||
var stages: Array = CivilizationRules.keys()
|
||||
stages.sort()
|
||||
for i in stages.size():
|
||||
CivilizationRules[stages[i]].next = stages[i + 1] if i + 1 < stages.size() else "Ct"
|
||||
CivilizationRules[stages[i]].previous = stages[i - 1] if i > 0 else "C0.1"
|
||||
CivilizationRules[stages[i]].colony = stages[maxi(0, i - 2)]
|
||||
CivilizationRules.Ct = {"home": "", "span": 0.0, "stars": 0.0, "ethics": {}, "next": "Ct", "previous": "C4.4", "colonizes": false, "fights": false, "diplomacy": false, "worships": false}
|
||||
LifeRules = _read_from_csv("res://data/life_rules.txt")
|
||||
OwniverseEntities = _read_from_csv("res://data/owniverse_entities.txt")
|
||||
OwniverseItems = _read_from_csv("res://data/owniverse_items.txt")
|
||||
|
||||
@@ -190,8 +190,18 @@ func validate_data(data: Variant) -> String:
|
||||
for ethic in saved.ethics[id]:
|
||||
if ethic not in ["m", "l", "w", "d", "c", "b"]:
|
||||
return "invalid ethic " + str(ethic)
|
||||
if saved.has("life_version") and saved.life_version not in [1, 2]:
|
||||
if saved.has("life_version") and saved.life_version not in [1, 2, 3]:
|
||||
return "invalid state.life_version"
|
||||
if saved.has("civilization_remainders") and not _number_map(saved.civilization_remainders, false, false):
|
||||
return "invalid state.civilization_remainders"
|
||||
if saved.has("civilization_stats") and not _number_map(saved.civilization_stats):
|
||||
return "invalid state.civilization_stats"
|
||||
if saved.has("civilization_homes"):
|
||||
if not saved.civilization_homes is Dictionary:
|
||||
return "invalid state.civilization_homes"
|
||||
for id in saved.civilization_homes:
|
||||
if not _number_map(saved.civilization_homes[id], true):
|
||||
return "invalid civilization homes"
|
||||
if saved.has("life_remainders") and not _number_map(saved.life_remainders, false, false):
|
||||
return "invalid state.life_remainders"
|
||||
if saved.has("resource_remainders"):
|
||||
|
||||
Reference in New Issue
Block a user