17-09-2025
Go-dot away
I like to think that I have some talent when it comes to making things work. I can back this by telling you all about the micro games I've made, small programs for a unique task, or understanding operating systems. These all sound like impressive things no? Well, its not always what it seems. I commonly run into an issue when working on a project. I end up hyper-focusing on something small and insignificant so it comes out looking like perfection. Problem is, after I complete it I have no earthly idea how to progress from there so I end up gaining knowledge at an incredible rate, but the the depth of that knowledge is very shallow.
A solution to this problem is to be more introspective and think about the why of the way things work and not just how can I do it in this moment. Which is easier said than done as I'm learning when trying to make a game in Godot. So far, the engine seems very do it yourself while having a ton of defaults you can make use of. I've found that those features both hurt my understanding and help me move past it. See I enjoy creating something from scratch, hence my continued forays into Vulkan, so I know exactly how it works. Since, I did not personally develop Godot, I'm lacking the understanding of whats exactly is available and what I need to make. So I end up asking questions like Do I need to make custom physics, or is there something built in I can utilize and/or modify to my liking, or wtf is a node and where is everything in this god forsaken editor. Simple stuff I'm sure everyone struggles with, but its always a pain trying to figure out what out of the thousands of directions should I go and to what extent do I need to invest resources. This is especially true for creating reusable systems.
As an example of one bug I'm struggling with is as follows, I have been trying to implement the ability to jump, apply gravity, and apply friction so the player does not keep moving in one direction forever. Here is a code snippet of my __physics_process()
func _physics_process(delta: float) -> void:
var input := Vector3.ZERO
input.x = Input.get_axis("move_left", "move_right")
input.z = Input.get_axis("move_forward", "move_back")
# gets the camera relative horizontal direction
# change this later so we can move a different node seperately?
var horzDirection = Vector3.ZERO
if input != Vector3.ZERO:
horzDirection = (twist_pivot.basis * input).normalized()
if horzDirection != Vector3.ZERO:
var accel := movAccel
if Input.is_action_pressed("move_sprint"):
accel *= movBoostMult
movVelocity9.x += horzDirection.x * accel * delta
movVelocity9.z += horzDirection.z * accel * delta
else:
# apply Friction
if !is_on_floor():
movVelocity9.x *= movInAirFriction
movVelocity9.z *= movInAirFriction
else:
movVelocity9.x *= movGrouFriction
movVelocity9.z *= movGrouFriction
# this is dirty and should ONLY be used here as it isnt easily extensable
if Input.is_action_pressed("move_jump") and !Input.is_action_pressed("move_crouch"):
movVelocity9.y = maxSpeed
elif Input.is_action_pressed("move_crouch") and !Input.is_action_pressed("move_jump"):
movVelocity9.y = -maxSpeed
else:
movVelocity9.y = 0
# if horizontal speed is > current max speed then
var deterMaxSp = maxSpeed
if Input.is_action_pressed("move_sprint"):
deterMaxSp = maxSpeed * movBoostMult
var horiz_vec := Vector2(movVelocity9.x, movVelocity9.z)
if horiz_vec.length() > deterMaxSp:
movVelocity9.x *= deterMaxSp / horiz_vec.length()
movVelocity9.z *= deterMaxSp / horiz_vec.length()
# apply gravity
movVelocity9.y += -gravity * delta
velocity = movVelocity9
move_and_slide()
movVelocity9 = velocity
There are a few questions I do not currently have answers to. when do I need to apply deltatime, delta
, so the physics are independent of the framerate? why is gravity so heavy compared to when this was previously a RigidBody3D? should this just be a separate file so I can reuse it later? how do I do that? I'm hoping as the weeks trail on I figure out the answers to these questions. Who am I kidding I'll probably just end up with more questions. Games are a bit of a pain to develop, though I will admit it is kinda fun.