All skills
thedivergentai avatar

/godot-economy-system

@9d6e91e

Expert patterns for game economies including currency management (multi-currency, wallet system), shop systems (buy/sell prices, stock limits), dynamic pricing (supply/demand), loot tables (weighted drops, rarity tiers), and economic balance (inflation control, currency sinks). Use for RPGs, trading games, or resource management systems. Trigger keywords: EconomyManager, currency, shop_item, loot_table, dynamic_pricing, buy_sell_spread, currency_sink, inflation, item_rarity.

Use this Skill: https://skilld.dev/gh/thedivergentai/gd-agentic-skills/godot-economy-system

This session only. Nothing lands on disk.

referenceseconomy-elite-patterns.md

≈573 tokens on demand. Your agent reads this file only when SKILL.md points to it.

Economy Elite Patterns (load on demand)

MANDATORY for GPM analytics, dynamic item valuation, and shop/loot pedagogy beyond wallet + transaction golden path.

Wallet + shop tutorials (moved to scripts)

Concern Script
Balances / signals wallet_manager_singleton.gd
Validated spend/grant transaction_manager.gd
Shop stock + spread shop_item_data.gd, shop_system_logic.gd
Weighted loot loot_table_weighted.gd
Barter trade_contract_resource.gd

Buy/sell spread (WHY)

CAUTION: sell_price == buy_price enables infinite arbitrage. Typical sell = 50% of buy unless design says otherwise.

func calculate_sell_price(buy_price: int, markup: float = 0.5) -> int:
	return int(buy_price * markup)

Dynamic pricing

dynamic_price_modifier.gd — demand multiplier on base price.

GPM analytics

economy_logger.gd — custom Logger intercepting [ECON]:amount lines; computes gold-per-minute for inflation detection.

NEVER print() inside Logger._log_message — recursion crash.

Item value estimator

item_value_estimator.gd — rarity enum drives merchant buy/sell curves; always sell below buy.

Multi-item barter

class_name TradeOffer extends Resource

@export var items_required: Array[Resource] = []
@export var items_provided: Array[Resource] = []

func can_afford(inventory: Node) -> bool:
	for item in items_required:
		if not inventory.has_method(&"has_item") or not inventory.call(&"has_item", item):
			return false
	return true

Production: trade_contract_resource.gd.

Currency representation reminder

Type Store as
Soft currency int smallest unit
Premium / idle huge counts BigInt or scaled int — see SKILL decision tree
Multiplayer Server-authoritative ints

NEVER use float for exact coin counts (0.1 + 0.2 drift).

Source: SKILL.md on GitHub

1 warning16d4 checks · Risk SAFE
  • Gen Agent Trust Hub16d

    The skill provides patterns for Godot game economies. It is well-structured and follows development best practices, though it contains logic for processing external save data and log strings which constitutes a potential indirect prompt injection surface.

  • Socket16d

    No alerts

  • Snyk16d

    Risk: LOW · No issues

  • Runlayer7mo

    2/3 files flagged

Signed by skilld at 9d6e91e. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 3 weeks ago.

Activeupdated 2 months ago

README badge

README badge for thedivergentai/gd-agentic-skills/godot-economy-system