Skip to content

Instantly share code, notes, and snippets.

View eilume's full-sized avatar

eilume

View GitHub Profile
@eilume
eilume / layered_visual_2d.gd
Last active January 10, 2024 18:15
Custom Godot 4 script for creating parallax-like "layered" visual 2D node(s)
extends Node2D
class_name LayeredVisual2D
# TODO: add visibility checks, to cull rendering + updating layers if not within screen rect
@export var source_node_path: NodePath
@export var source_node_bounds: Rect2
@export_group("Layer", "layer_")
@export var layer_count: int = 4
@eilume
eilume / profiler.gd
Last active January 10, 2024 18:13
Produces manual profiling results to Godot 4, utilizing Google's Trace Event Format for analysis with profiler tools!
extends Node
# Produces manual profiling results, utilizing Google's Trace Event Format for analysis with profilers tools!
# - Details of the format here: https://docs.google.com/document/d/1CvAClvFfyA5R-PhYUmn5OOQtYMH4h6I0nSsKchNAySU/preview
#
# Instructions:
# - Add as an autoload to your project, preferably first if your other autoloads want to (maybe) use this during `_ready()`
# - Call `start_benchmark(_label: StringName)` to signal the start of a function/scope/etc, the label is unused and purely for code reading clarity
# - Call `end_benchmark(label: StringName)` to end the profile for a function/scope/etc
# - Then during runtime, the profiling results will be stored and on runtime exit, serialized for usage externally