Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | GameDev252 |
My game will often spawn a large amount of “point tokens”, specifically when defeating a boss all of the boss’ active projectiles will at once be transformed into tokens that the player absorbs.
Even when hundreds of bullets are converted at once, there is no issue, not even a framedrop because I add them to a list and queue them to convert them over several frames, rather than doing them all at once, so it still looks instant while in reality the conversion is spread over 10-20 frames.
The issue is, when the player absorbs those point tokens, the game will consistently crash if there’s enough of them.
Right now this is what the code looks like for the point token itself:
func _on_Area2D_area_entered(area):
if position.y>60 || area.name=="Pointbox":
queue_free()
(Note that Pointbox is the name of the Area2D that detects collision with point tokens)
And this is what it looks like on the player’s side:
func _on_Pointbox_area_entered(area):
pass
# match area.Type:
# "W":
# HUD.WP+=1
# if Level<8 && HUD.WP>=HUD.MaxWP:
# LevelUp()
# "E":
# if HUD.Energy<HUD.MaxEnergy:
# HUD.Energy+=1
# "P":
# LargePointQueue+=1
# "P-":
# PointQueue+=1
Note that it’s pretty much not doing anything right now, as I was concerned my code was creating the errors elsewhere I disabled all of it temporarily, and still it consistently crashes. Supposedly, all there’s going on is a queue free on the token’s side and a pass on the player’s side, which should be minimal stress on the engine, despite how many tokens there are.
When it crashes, the window simply closes and the engine gives me no error reports. What’s more, I only recently updated to Godot version 3.5.1, before updating I was still using 3.2.3 and I was not experiencing these consistent crashes. I had an packed version still running on 3.2.3 with practically the same exact code, and recreating the circumstances never gives me any crashes, despite the crashes happening 2/3 times when doing it in 3.5.1.
If there’s anyone with any ideas or any help, please reply as I’ve wracked my head against this wall for quite a while now.