Skip to content

Repository files navigation

Godot Utility Management

A collection of powerful Godot 4.x plugins providing utility functions, async helpers, stat systems, and a visual upgrade tree editor for game development. I will add/tweak/change features as I see fit. I try to make the functions as general as possible, feel free to use them commercially aswell, no credits needed.

Plugins

Muhi-Utils+

A comprehensive utility plugin with helper classes for common game development tasks.

Features

  • Observable - Reactive value wrapper that emits signals when changed
  • TweenHelper - Pre-built animation effects (fade, bounce, shake)
  • RandomUtils - Advanced randomization utilities
  • CollectionUtils - LINQ-style array operations
  • AwaitUtils - Async operation helpers (wait, timeout, concurrent tasks)
  • Stat System - Flexible RPG-style stat system with modifiers

Examples

Observable Pattern:

var health = Observable.new(100)
health.changed.connect(func(new_value): print("Health: ", new_value))
health.value = 80  # Emits signal: "Health: 80"

Tween Animations:

# Fade in a sprite
TweenHelper.fade_in($Sprite2D, 0.5)

# Bouncy scale effect
TweenHelper.scale_bounce($Button, Vector2.ONE * 1.5, 0.3)

# Screen shake
TweenHelper.shake($Camera2D, 15.0, 0.4)

Random Utilities:

# Weighted random choice
var loot = RandomUtils.weighted_choice(
    ["common", "rare", "legendary"],
    [70.0, 25.0, 5.0]
)

# Random point in/on circle
var spawn_pos = RandomUtils.random_point_in_circle(100.0)

# Probability check
if RandomUtils.chance(0.25):  # 25% chance
    print("Critical hit!")

Collection Operations:

var enemies = [enemy1, enemy2, enemy3]

# Find first enemy with HP < 20
var weak_enemy = CollectionUtils.first(enemies, func(e): return e.hp < 20)

# Filter enemies by type
var bosses = CollectionUtils.where(enemies, func(e): return e.is_boss)

# Group by property
var by_faction = CollectionUtils.group_by(enemies, "faction")

# Get max/min by property
var strongest = CollectionUtils.max_by(enemies, "attack_power")

Async/Await Utilities:

extends Node

func _ready():
    # Wait for condition
    await AwaitUtils.wait_until(func(): return player.is_loaded)

    # Run tasks concurrently
    var results = await AwaitUtils.wait_all([
        func(): return await load_player_data(),
        func(): return await load_world_data(),
        func(): return await load_settings()
    ])

    # Task with timeout
    var result = await AwaitUtils.with_timeout(
        func(): return await slow_network_call(),
        5.0  # 5 second timeout
    )
    if result.timed_out:
        print("Request timed out!")

Stat System:

# Create a damage stat
var damage = Stat.new(50.0, Stat.ValueType.FLOAT, 0.0, 9999.0)

# Add modifiers from equipment
var sword_bonus = StatModifier.create_flat(15, "iron_sword")
damage.add_modifier(sword_bonus)

# Add percentage bonuses (stackable)
damage.add_modifier(StatModifier.create_percent_add(0.25, "strength_buff"))  # +25%
damage.add_modifier(StatModifier.create_percent_add(0.10, "damage_potion"))  # +10%

print("Final damage: ", damage.get_float())  # 87.75 = (50+15) * 1.35

# Remove modifiers by source
damage.remove_modifiers_by_source("damage_potion")

Upgrade Manager

A visual node-based editor for creating upgrade trees and progression systems for games.

Features

  • Visual Graph Editor - Drag-and-drop node-based upgrade tree creation
  • Connection System - Link upgrades to create dependency chains
  • Validation - Verify upgrade tree integrity before runtime
  • Save/Load - Persist upgrade trees to files
  • Runtime Integration - Execute upgrade functions in-game

Example Usage

  1. Create Upgrade Nodes:

    • Add upgrade nodes in the editor
    • Set title, description, and function name for each upgrade
    • Example: Title: "Damage Boost", Function: "increase_damage(10)"
  2. Connect Dependencies:

    • Drag from output to input connections
    • Create prerequisite chains (e.g., Tier 1 � Tier 2 � Tier 3)
  3. In-Game Integration:

extends Node

var upgrade_manager = UpgradeManager.new()

func unlock_upgrade(upgrade_name: String):
    # Your custom upgrade functions in UpgradeManager
    pass

func increase_damage(amount: int, dry_run: bool = false):
    if dry_run:
        return true  # Validation check
    player.damage += amount

Installation

  1. Copy the addons folder into your Godot project
  2. Open Project � Project Settings � Plugins
  3. Enable Muhi-Utils+ and/or Upgrade Manager
  4. For AwaitUtils, add it as an autoload singleton:
    • Project � Project Settings � Globals � Autoload
    • Add res://addons/muhi_utils_plus/await_utils.gd as AwaitUtils

Requirements

  • Godot 4.x

License

Created by Muhi

Contributing

Feel free to submit issues and enhancement requests!

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages