Son aktivite 1786343145

Revizyon cf06b51fdf8eea199c67addb6937a7d7cb9397ab

Qwen36-MTP-System-Power.md Ham
📊 Quick Energy Impact Reference

Category                Avg Power Draw  Recommended BG Behavior
───────────────────────────────────────────────────────────────────────────
AI Inference            🔋🔋🔋🔋🔋      Throttle rate; pause when idle
3D Physics/Rigidbodies  🔋🔋🔋🔋🔋      Disable off-tab; hard stop
Multiplayer Netcode     🔋🔋🔋          Keep alive; reduce tick/packet rate
Video Decode/Encode     🔋🔋🔋🔋        Pause while hidden
Clipboard/OS Sync       🔋              Event-driven only
Background Audio        🔋              Safe to run continuously
Timers/State Stores     🔋              Negligible

Key Concepts for concurrency/execution options:

  • call_deferred: Schedules a method to run at the end of the current frame/physics step. Good for safe scene tree manipulation, avoiding "node doesn't exist yet" errors.
  • await: Godot 4's async/await pattern. Replaces yield. Used for non-blocking waits (signals, timers, functions returning Future). Keeps main thread responsive.
  • Signals: Native Godot event system. Decouples systems, enables reactive UI/engine updates without polling. Essential for multi-tab state management.
  • Threading (Thread/Callable.bind()/@thread_sync): For heavy CPU tasks (AI inference, network I/O) that shouldn't block the main thread.
  • Process Modes (PROCESS_MODE_ALWAYS, INHERIT, PAUSE): Controls when nodes update across different UI states (modals, hidden tabs).
  • State Machines / Context Managers: Managing tab switches, engine lifecycles, and background vs active states without race conditions.

Concurrency/execution Summary

  • call_deferred: Scene Tree Safety
  • await & Futures: Non-Blocking Execution
  • Signals: Reactive State Management
  • Threading + Main Thread Sync: Heavy Workloads
  • Process Modes: Tab Visibility vs Runtime

Recommended Pattern for EnvoyOS

  • Central EnvoyStateManager (RefCounted/Node) that tracks tab focus, engine contexts, and energy tiers.
  • Use signals for all cross-module communication.
  • await only for explicit async operations (configs, network handshakes).
  • call_deferred or signals for scene tree edits during tab swaps.
  • Threading for heavy computations; marshal results back via signals.
  • Process modes tied to engine context (active/bg/off).
Tool             Purpose                                                    When to Use in EnvoyOS
─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
call_deferred()  Schedules a method to run at the end of the current frame  Safe scene tree edits during tab swaps, avoiding "node doesn't exist" or layout-calculation conflicts
await + Futures           Non-blocking suspension until an event completes              Loading configs, network handshakes, waiting for UI/engines to initialize without freezing the main thread
Signals                   Zero-polling, event-driven communication                      Decoupling tab focus from engine states, energy tier updates, cross-module notifications
Threading + @thread_sync  Offload heavy CPU work off the main thread                    AI inference, video decoding, clipboard polling, VOIP packet processing
ProcessMode               Controls when _process(), _physics_process(), and inputs run  Tying engine runtime to tab visibility vs true background execution
z-AIFIX.md Ham

Refer to this document to correct outdated code for Godot 4.6 gdscript using copy and paste git diffs to correct the mistakes.

Replace := [] with Array[Label] = []

  • var valid_rocks := []
  • var valid_rocks: Array[Label] = []
  • DisplayServer.vsync = DisplayServer.VSYNC_ENABLED # Fixed V-Sync prevents DWM composition stalls
  • DisplayServer.window_set_vsync_mode(DisplayServer.VSYNC_ENABLED) # Fixed V-Sync prevents DWM composition stalls

Replace Input.is_touchscreen_available() with DisplayServer.is_touchscreen_available()

  •   "Touchscreen": Input.is_touchscreen_available(),
    
  •   "Touchscreen": DisplayServer.is_touchscreen_available(),
    
  • "WebRTC Support": Engine.has_feature("web_view"),
  • "WebRTC Support": OS.has_feature("web") or ClassDB.class_exists("WebRTCPeerConnection"),
  •   col.color = Color.rand()
    
  •   col.color = Color(randf(), randf(), randf())
    

"yield" was removed in Godot 4. Use "await" instead.

Invalid call. Nonexistent function 'clear' in base 'VBoxContainer'.

  • kitchen_sink_box.clear()
  • for child in kitchen_sink_box.get_children():
  •   child.queue_free()
    

Cannot infer the type of "child" variable because the value doesn't have a set type.

  •   var child := control.create_item(root)
    
  •   var child: TreeItem = control.create_item(root)
    

Native class "Slider" cannot be constructed as it is abstract.

  •   HSeparator.new(), Slider.new(), HSlider.new(), ProgressBar.new(),
    
  •   VSlider.new(), HSeparator.new(), HSlider.new(), ProgressBar.new(),
    

Cannot infer the type of "child" variable because the value doesn't have a set type.

  •   var child := control.create_item(root)
    
  •   var child: TreeItem = control.create_item(root)
    

Replace: Invalid assignment of property or key 'border_width_all' with value of type 'int' on a base object of type 'StyleBoxFlat'.

  •   style.border_width_all = 2
    
  •   style.border_width_left = 2
    
  •   style.border_width_right = 2
    
  •   style.border_width_top = 2
    
  •   style.border_width_bottom = 2
    
  •   style.corner_radius_all = 16
    
  •   style.corner_radius_top_left = 16
    
  •   style.corner_radius_top_right = 16
    
  •   style.corner_radius_bottom_left = 16
    
  •   style.corner_radius_bottom_right = 16
    

Replace: PAUSE_MODE_PROCESS with PROCESS_MODE_ALWAYS

  • timer.pause_mode = Timer.PAUSE_MODE_PROCESS
  • timer.process_mode = Node.PROCESS_MODE_ALWAYS

FIX: for popup timer is not working because the ConfirmationDialog pauses the scene tree automatically when it is shown via popup_centered()

Even set timer.process_mode = Node.PROCESS_MODE_ALWAYS, the parent node (dialog) has a default process mode of PROCESS_MODE_INHERIT. When Godot pauses the SceneTree for the popup modal, the dialog stops processing, which forces the timer to stop processing regardless of its individual setting.To fix this, you must explicitly set the dialog to process always as well.
The Fix
Add dialog.process_mode = Node.PROCESS_MODE_ALWAYS right after you instantiate it

Why This Beats await or call_deferred. Prefer Signal-based hooks as they don't guess.

  • await get_tree().process_frame() guesses when layout will finish. If text rendering takes 2 extra frames (due to markdown parsing, font caching, or heavy UI), the scroll runs on outdated dimensions and snaps too early.
  • Signal-based hooks don't guess. They wait for Godot's layout server to explicitly report that sizing has changed, guaranteeing sb.max_value reflects the true content height before you read it.

Replace get_process_delta_time with get_process_delta_time

  • var dynamic_speed = speed * Node.get_process_delta_time() # Throws the error
  • var dynamic_speed = speed * get_process_delta_time()

Other Notes

  • system_input.fit_content_width = true
  • system_input.wrap_mode = TextEdit.LINE_WRAPPING_BOUNDARY
  • var hover_style = StyleBoxFlat.new(style) ❌
  • var hover_style = style.duplicate() # Correct way to copy a StyleBox
  • Time.get_ticks_msec() # Correct way to call get_ticks_msec