Balancing

This commit is contained in:
Dan 2026-01-28 20:18:44 +00:00
parent 90d6c5c926
commit 22d7326565
6 changed files with 116 additions and 105 deletions

View file

@ -1,4 +1,4 @@
[gd_resource type="Resource" script_class="UnlockDataCollection" load_steps=10 format=3 uid="uid://b4c01yrmp1wf2"]
[gd_resource type="Resource" script_class="UnlockDataCollection" load_steps=12 format=3 uid="uid://b4c01yrmp1wf2"]
[ext_resource type="Script" uid="uid://bg1ymgbdcwc0j" path="res://resources/UnlockDataCollection.gd" id="1_gdehu"]
[ext_resource type="Script" uid="uid://biqqffne7dd8r" path="res://resources/UnlockDataResource.gd" id="2_1js7i"]
@ -8,13 +8,13 @@ script = ExtResource("2_1js7i")
unlock_id = 1
unlock_name = "Marketing"
unlock_description = "Affects the amount people are willing to pay for your whittling"
base_cost = 200
base_cost = 100
is_scaling = true
max_rank = 5
cost_ladder = [200, 1200, 6000, 25000, 80000]
effect_scaling_multiplier = 1.6
max_rank = 8
cost_ladder = [100, 350, 1000, 3000, 9000, 28000, 80000, 220000]
effect_ladder = [1.08, 1.18, 1.3, 1.45, 1.65, 1.9, 2.3, 3.0]
base_modifiers = {
"sale_price_modifier": 1.5
"sale_price_modifier": 1.08
}
metadata/_custom_type_script = "uid://biqqffne7dd8r"
@ -23,14 +23,13 @@ script = ExtResource("2_1js7i")
unlock_id = 2
unlock_name = "Wood"
unlock_description = "Increases the amount of wood produced per click"
base_cost = 100
base_cost = 30
is_scaling = true
max_rank = 4
cost_ladder = [100, 400, 2000, 8000]
effect_scaling_type = 0
effect_linear_increase = 5.0
max_rank = 5
cost_ladder = [30, 100, 300, 900, 2500]
effect_ladder = [2.0, 3.0, 5.0, 7.0, 10.0]
base_modifiers = {
"wood_per_click_modifier": 5.0
"wood_per_click_modifier": 2.0
}
metadata/_custom_type_script = "uid://biqqffne7dd8r"
@ -39,11 +38,11 @@ script = ExtResource("2_1js7i")
unlock_id = 3
unlock_name = "Demand"
unlock_description = "How many whittled products can be purchased per tick"
base_cost = 300
base_cost = 120
is_scaling = true
max_rank = 4
cost_ladder = [300, 1500, 8000, 35000]
effect_scaling_multiplier = 2.0
max_rank = 7
cost_ladder = [120, 400, 1200, 4000, 12000, 38000, 110000]
effect_ladder = [2.0, 3.0, 5.0, 7.0, 10.0, 14.0, 18.0]
base_modifiers = {
"purchase_rate_modifier": 2.0
}
@ -54,12 +53,11 @@ script = ExtResource("2_1js7i")
unlock_id = 4
unlock_name = "Efficiency"
unlock_description = "How many things you can produce per whittle"
base_cost = 150
base_cost = 60
is_scaling = true
max_rank = 5
cost_ladder = [150, 800, 4000, 18000, 60000]
effect_scaling_type = 0
effect_linear_increase = 1.0
max_rank = 6
cost_ladder = [60, 400, 1800, 8000, 35000, 140000]
effect_ladder = [2.0, 3.0, 4.0, 5.0, 6.0, 8.0]
base_modifiers = {
"efficiency_modifier": 2.0
}
@ -69,8 +67,8 @@ metadata/_custom_type_script = "uid://biqqffne7dd8r"
script = ExtResource("2_1js7i")
unlock_id = 5
unlock_name = "Wholesale"
unlock_description = "Sell multiples of 100 at 20% extra income"
base_cost = 18000
unlock_description = "Sell multiples of 100 at 20% less income"
base_cost = 35000
base_modifiers = {
"UNLOCK_ONESHOT_WHOLESALE": 1.0
}
@ -81,12 +79,11 @@ script = ExtResource("2_1js7i")
unlock_id = 6
unlock_name = "Multicraft"
unlock_description = "Just craft more stuff"
base_cost = 30000
base_cost = 6000
is_scaling = true
max_rank = 2
cost_ladder = [30000, 100000]
effect_scaling_type = 0
effect_linear_increase = 1.0
max_rank = 5
cost_ladder = [6000, 20000, 55000, 140000, 320000]
effect_ladder = [1.0, 2.0, 3.0, 4.0, 5.0]
base_modifiers = {
"multicraft_increase_modifier": 1.0
}
@ -97,18 +94,47 @@ script = ExtResource("2_1js7i")
unlock_id = 7
unlock_name = "Autowood"
unlock_description = "Automatically gather a percent of a clicks wood per tick"
base_cost = 500
base_cost = 150
is_scaling = true
max_rank = 5
cost_ladder = [500, 2000, 8000, 25000, 70000]
effect_scaling_type = 0
effect_linear_increase = 0.15
cost_ladder = [150, 600, 2000, 6500, 20000]
effect_ladder = [0.1, 0.2, 0.35, 0.55, 0.8]
base_modifiers = {
"autowood_modifier": 0.15
"autowood_modifier": 0.1
}
metadata/_custom_type_script = "uid://biqqffne7dd8r"
[sub_resource type="Resource" id="Resource_premium"]
script = ExtResource("2_1js7i")
unlock_id = 8
unlock_name = "Premium Crafts"
unlock_description = "Your reputation for quality allows higher prices"
base_cost = 8000
is_scaling = true
max_rank = 5
cost_ladder = [8000, 25000, 70000, 160000, 350000]
effect_ladder = [1.08, 1.18, 1.3, 1.45, 1.65]
base_modifiers = {
"premium_price_modifier": 1.08
}
metadata/_custom_type_script = "uid://biqqffne7dd8r"
[sub_resource type="Resource" id="Resource_reputation"]
script = ExtResource("2_1js7i")
unlock_id = 9
unlock_name = "Reputation"
unlock_description = "Loyal customers provide steady passive income"
base_cost = 4000
is_scaling = true
max_rank = 5
cost_ladder = [4000, 12000, 35000, 90000, 200000]
effect_ladder = [4.0, 10.0, 22.0, 42.0, 75.0]
base_modifiers = {
"reputation_income": 4.0
}
metadata/_custom_type_script = "uid://biqqffne7dd8r"
[resource]
script = ExtResource("1_gdehu")
unlocks = Array[ExtResource("2_1js7i")]([SubResource("Resource_gdehu"), SubResource("Resource_1js7i"), SubResource("Resource_xbpe0"), SubResource("Resource_nbe0w"), SubResource("Resource_ppuju"), SubResource("Resource_chx6j"), SubResource("Resource_f82ch")])
unlocks = Array[ExtResource("2_1js7i")]([SubResource("Resource_gdehu"), SubResource("Resource_1js7i"), SubResource("Resource_xbpe0"), SubResource("Resource_nbe0w"), SubResource("Resource_ppuju"), SubResource("Resource_chx6j"), SubResource("Resource_f82ch"), SubResource("Resource_premium"), SubResource("Resource_reputation")])
metadata/_custom_type_script = "uid://bg1ymgbdcwc0j"

View file

@ -18,10 +18,7 @@ extends Resource
@export var cost_linear_increase: int = 100 # Only used if cost_scaling_type is Linear
@export var cost_ladder: Array[int] = [] # Fixed costs per rank (overrides scaling if defined)
@export_subgroup("Effect Scaling")
@export_enum("Linear", "Exponential") var effect_scaling_type: int = 1 # Default to Exponential
@export var effect_scaling_multiplier: float = 1.2 # Exponential: multiplier per rank
@export var effect_linear_increase: float = 0.1 # Linear: flat increase per rank (e.g., 0.1 = +10% per rank)
@export var effect_ladder: Array[float] = [] # Effect values per rank
@export_group("Base Modifiers")
@export var base_modifiers: Dictionary = {}
@ -44,44 +41,27 @@ func get_next_cost() -> int:
## Returns the current modifiers based on rank
func get_current_modifiers() -> Dictionary:
# If not unlocked yet, return empty modifiers
if not is_unlocked or current_rank == 0:
return {}
# Rank 1 should give base modifiers without scaling
if current_rank == 1:
return base_modifiers.duplicate()
# Rank 2+ applies scaling
return get_modifiers_at_rank(current_rank)
## Returns modifiers for a specific rank (useful for preview)
func get_modifiers_at_rank(rank: int) -> Dictionary:
if not is_scaling or rank == 0:
if rank == 0:
return {}
# For one-shot unlocks or empty ladder, return base_modifiers
if effect_ladder.size() == 0:
return base_modifiers.duplicate()
# Rank 1 returns base modifiers without scaling
if rank == 1:
return base_modifiers.duplicate()
var scaled_modifiers = {}
var ladder_index = rank - 1
if ladder_index >= effect_ladder.size():
ladder_index = effect_ladder.size() - 1 # Use last value if rank exceeds ladder
var result = {}
for key in base_modifiers.keys():
var base_value = base_modifiers[key]
if effect_scaling_type == 0: # Linear scaling
# Linear: add flat increase per rank above 1
# e.g., base 1.5 (+50%), linear 0.1 (+10%), rank 2 = 1.6 (+60%), rank 3 = 1.7 (+70%)
var additional_ranks = rank - 1
scaled_modifiers[key] = base_value + (effect_linear_increase * additional_ranks)
else: # Exponential scaling
# Exponential: scale the bonus part from rank 1
# The bonus at rank 1 is (base_value - 1.0)
# At higher ranks, multiply this bonus by multiplier^(rank-1)
var base_bonus = base_value - 1.0
var scaled_bonus = base_bonus * pow(effect_scaling_multiplier, rank - 1)
scaled_modifiers[key] = 1.0 + scaled_bonus
return scaled_modifiers
result[key] = effect_ladder[ladder_index]
return result
## Convert a modifier value to a percentage string
func _modifier_to_percentage(value: float) -> String:
@ -132,17 +112,17 @@ func get_modifiers_comparison_string() -> String:
var current = get_current_modifiers()
var next_rank = get_next_rank()
var next = get_modifiers_at_rank(next_rank)
var lines = []
# If no current modifiers (not unlocked yet), show next only
if current.is_empty():
var lines = []
for key in next.keys():
var display_name = key.replace("_", " ").capitalize()
var next_pct = _modifier_to_percentage(next[key])
lines.append("%s: %s" % [display_name, next_pct])
return "\n".join(lines)
var lines = []
for key in current.keys():
var display_name = key.replace("_", " ").capitalize()
var current_pct = _modifier_to_percentage(current[key])