Skip to content

gulla0/godot-bot-evolution-plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

1 Commit
Β 
Β 
Β 
Β 

Repository files navigation

EvoAI for Godot 4.3+ (v1.4)

Production-grade Evolutionary AI.

The Contract

  1. Inputs: get_evo_inputs() must return normalized floats (approx 0.0 to 1.0).
  2. Lifecycle: Evolution runs on EvoManager.end_wave(). Genes inherit on spawn (_ready).

πŸš€ Instant Demo Script

Attach this to a CharacterBody3D. It uses safe references and triggers evolution automatically.

extends CharacterBody3D

var brain: EvoBrain # Reference to avoid string-path errors

func _ready():
    # 1. Create Brain
    brain = EvoBrain.new()
    brain.species_id = "demo_bot"
    add_child(brain)
    
    # 2. Listen to decisions
    brain.action_selected.connect(_on_action)
    
    # 3. Simulate Wave End (for testing)
    get_tree().create_timer(10.0).timeout.connect(func():
        EvoManager.end_wave()
        print(">> WAVE ENDED. Genes Saved.")
        get_tree().reload_current_scene()
    )

# 4. Provide Senses
func get_evo_inputs() -> Array[float]:
    # Visible, Distance, Health, Ammo
    return [1.0, 0.5, 1.0, 1.0]

# 5. Act & Reward
func _on_action(action_id: int):
    var moves = ["PATROL", "CHASE", "FLANK_L", "FLANK_R", "PEEK", "SHOOT", "RETREAT", "RELOAD"]
    print("Action: ", moves[action_id])
    
    if action_id == 5: # Shoot
        # Use variable reference, not $NodePath
        brain.reward_action(1.0)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published