- Edited
Megalomaniak
Thank you! I think I figured out what's causing the stuttering.
I was doing something with multi-threading and I was making the process function wait for the thread to finish.
Megalomaniak
Thank you! I think I figured out what's causing the stuttering.
I was doing something with multi-threading and I was making the process function wait for the thread to finish.
Megalomaniak
Will increasing the resolution fix it?
According to Godot, the game is running at 60 fps. But I see this in the profiler, and the game jitters like hell.
I did everything I could think of. changed the physics fps, used forced fps, turned vsync off, used physics interpolation, changed the refresh rate of my monitor, But none of them fixed it.
The game isn't very resource intensive, all textures are 32x32, and I also tested it with post processing effects turned off.
If you know what's going on, please help me. Thanks.
I'm using Godot 3.5
Update: The game is 3D. The models are low poly. There are around 10 materials. I also looked at the profiler and the scripts aren't the cause, and they are also not doing anything fancy.
It ran fine on my old laptop (which is weaker)
But I found out something. I made the game more graphically demanding, and the fancier the graphics are, the less stuttering I get.
I fixed it. I played around with the gravity and jumping values and i finally made it work. Thanks.
@dotted said: 5000 seems like a large number. 5000 * 0.15
speed is 230 jump is 5000
flying: velocity.y += speed jumping: velocity.y = -jumpSpeed
velocity = velocity delta speed?
Thanks. But with 5000 * 0.15 as the jumpspeed the player barely even comes off the ground. And when i posted this, i deleted some of the variables from the code, But i forgot to delete the flying part.
I wanted to make a 2D platformer and couldn't make the jumping work. I used the same method to add jumping to my other games, but somehow this time it doesn't work, The player teleports in the air. Can anyone help me to make it work?
I am using Godot 3.2.3 and opengles 2.0
Here is the code I'm using:
extends KinematicBody2D
var speed = 230
export var gravity = 300
export var maxJumps = 2
var jumps
var jumpSpeed = 5000
var velocity = Vector2()
func _ready():
jumps = maxJumps
func _physics_process(delta):
velocity = Vector2.ZERO
if fly_enabled == false:
velocity.y += gravity
if Input.is_action_pressed("Left"):
velocity.x = -speed
$AnimatedSprite.play("Walking")
$AnimatedSprite.flip_h = true
$AnimatedSprite.speed_scale = 1
elif Input.is_action_pressed("Right"):
velocity.x = speed
$AnimatedSprite.play("Walking")
$AnimatedSprite.flip_h = false
$AnimatedSprite.speed_scale = 1
else:
$AnimatedSprite.play("Idle")
$AnimatedSprite.speed_scale = 0.25
if Input.is_action_pressed("Left") and Input.is_action_pressed("Right"):
velocity.x = 0
if fly_enabled:
if Input.is_action_pressed("Jump"):
velocity.y -= speed
if Input.is_action_pressed("Groundpound"):
velocity.y += speed
else:
if is_on_floor():
velocity.y = 0
jumps = maxJumps
if is_on_wall():
jumps = maxJumps
if jumps != 0:
if Input.is_action_just_pressed("Jump"):
velocity.y = -jumpSpeed #* delta * 8000 / 4
jumps -= 1
velocity = velocity * delta * speed
move_and_slide(velocity, Vector2.UP)