2D Game stutter

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By YAGU

I made a 2D game and it stutters very noticeable.
It’s like the 3rd pic here: https://docs.godotengine.org/en/stable/tutorials/misc/jitter_stutter.html

I’ve read there that there are 2 issues:

  • The project
  • The OS

The second one, the OS is Windows in my case, and running the game in Fullscreen makes nothing better.
The project itself, well I’m creating games for several years now and from my understanding I don’t have a complex game.
I use a player that moves around by using “move_and_collide” and I have 7 enemies total, each one following a individual “Path2D”, each one with up to 8 points.
The player can shoot, then the game creates 2 bullets per second and they get destroyed when outside of the screen.
Enemies do the same thing.
Thats it.

I made similiar projects in Unity that never had any issues with being to complex.
So maybe there’s something I don’t know yet.

I tested the game on 2 different pc’s, both have a bit older hardware (fx 8350 with gtx 1060 gpu) and the second one (fx 4300 with gtx 1050) but from my understanding that should be more than enough, cause both can also still run games like “No Man’s Sky” without problems.

Any ideas?

Hard to tell without seeing the code. Can you share your project somewhere? (Github, Dropbox, …)

Thomas Karcher | 2021-04-20 10:45

:bust_in_silhouette: Reply From: timothybrentwood

when you are instancing the bullets are you using load() or preload()? if you’re using load() it’s more resource intensive at run time than using preload(). i suggest doing something like:

const var bullet_scene = preload("res://Bullet.tscn")
...
func fire():
    var bullet = bullet_scene.instance()
    bullet.position = blahblahblah
    ...

also make sure your bullets are actually getting freed like you think they are using the remote Scene Tree when running your game from the editor.