Godot Version
4.5.1.stable
Question
Hello, I developed with some friends a simple game for a Game Jam. We already sent the submission, but we’re still working on it to learn more.
During this time, in my main PC (AMD Ryzen 3 3600X + RTX 5070) the game didn’t show any important issues during normal execution, but now I’m in an office PC (AMD Ryzen 5 5600G + AMD Radeon Graphics Integrated) and the game is freezing for 1.5s periodically every 5-10 seconds even in the main menu.
I’ve been researching about how to use the Debug > Profiler, but I’m still not getting it. Right now, I’ve only been abled to detect these periodic spikes where my Process Time goes up to 9000%, but I don’t know where it is coming from. I’ll attach some screenshots (in spanish)to give some context, in hopes some of you can help me.
This is the profiler, where there are consistent, but not rythmic, lag spikes. During this time, the game freezes.
Then, here’s the Visual Profiler, where I don’t see any issue with the CPU or GPU. Also, during execution I’ve opened the Task Manager and the CPU and GPU usage were so low (5% or so). I don’t know if everything is running on 1 core and it’s bottlenecking or what.
CPU/GPU usage during execution in the main menu:
And then, we have the current Tree where these spikes are happening:
MusicHandler only has one Play function
GameHandler is mainly used for signal handling (set/get values).
It does have a _process function that loads 192 big sprites at start up, but that functionality is executed in the background and when it finishes it sets the _process function to sleep. Therefore, I believe it musn’t come from here:
func _process(_delta: float) -> void:
if fish_loaded:
return
if not check_finished:
var fish_path: String = paths_levels[level_idx][path_idx]
var status := ResourceLoader.load_threaded_get_status(fish_path)
if status != ResourceLoader.THREAD_LOAD_LOADED:
return
path_idx += 1
if path_idx >= paths_levels[level_idx].size():
path_idx = 0
level_idx += 1
if level_idx >= paths_levels.size():
check_finished = true
level_idx = 0
path_idx = 0
print("All fish resources ready")
return
var path: String = paths_levels[level_idx][path_idx]
fish_sprites[level_idx].append(
ResourceLoader.load_threaded_get(path)
)
path_idx += 1
if path_idx >= paths_levels[level_idx].size():
path_idx = 0
level_idx += 1
if level_idx >= paths_levels.size():
fish_loaded = true
set_process(false)
print("Fish loaded")
And on the MainMenu script I only have this:
extends Control
@onready var tutorial: Label = $VBoxContainer/Tutorial/Tutorial
@onready var tutorial_scene: PackedScene = preload("res://ui/tutorial/tutorial.tscn")
@onready var menu_music: AudioStream = preload("res://music/menu.mp3")
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
GameHandler.load_fishes_in_background()
MusicHandler.load_track(menu_music)
MusicHandler.play()
func _on_start_button_pressed() -> void:
get_tree().change_scene_to_file("res://game/game.tscn")
func _on_exit_button_pressed() -> void:
get_tree().quit()
func _on_tutorial_pressed() -> void:
var pop_up_tutorial = tutorial_scene.instantiate()
add_child(pop_up_tutorial)
I don’t know where the issue is, but I suspect of the 192 1080x1080 sprites. Nevertheless, after 15s or so after the start of the game, all the sprites have already been loaded and saved in memory. Also, the lag is spiking in the main menu even after the GameHandler’s _process (responsible of loading these 192 sprites) has been set to false, so it shouldn’t be a zombi process repeating stuff.
Thanks for any potential solution or advice.
Note: Many things in out project is a total chaos, but we know it. This is our first group project and it had a very little time limit due to the Game Jam. We made some bad decisions that we will not do again cuz we learnt ![]()
![]()




