Devlog 1 - Smooth Operator

Image of a player sprite in the Godot editor
He's a smooth operator

Hey all – I'm back and I'm here to talk about the camera system in my upcoming Godot game based on the popular game, Vampire Survivors. Read the previous blog post if you want to learn more about my motivation around the game engine and project organization decisions.

So for this devlog installment I want to bring focus into the smooth camera system. Rather than just being a direct copy of Vampire Survivors, I wanted to add a few features to differentiate it – the first one being a camera that the player can control the zoom level on-the-fly, this was talked about in the last post.

The other feature I wanted to add was a smooth camera system based on the player movement. I feel like smooth movement adds a dynamic feeling to the gameplay. In the future I could extend this further to add camera shake and other in-game fx.

_Smooth Camera Movement

Version 1 – Simple


For the first iteration I simply just added a lerp function when setting the camera's position on each process tick. You can see in the above video that it works, but not well.

The main issue with lerping based on the player's position is that the camera will always be playing catch-up with the player. Thus the effective view area is shrunk as the player loses visibility in the most critical direction– the direction they are moving in.

Okay... so lets try something else.

Version 1.5 - Offset Lerp


Due to the trailing lerp issue, the simple solution that popped into my head was to add a static offset to the player position in the direction of player movement. This worked however the lerp to the offset when movement began was pretty jarring. So I set out to fix that issue.

It was also in this iteration where I found out I wasn't multiplying my lerp step by delta in the process function 🤦

Version 2 – Delayed offset lerp


Much better!

Well kinda... this is better than the previous but I still think it need some work down the line.

In this iteration I added a slight delay between initial player movement and when the "lerp offset" is enabled.

Also now with the the delta time being factored into the lerp calculation it feels like the camera glide is much smoother (it could also just be a placebo lol).

To achieve this in Godot, I am utilizing the built-in timer functionality in the engine. The timer is enabled whenever the script detected movement from the player, and once the timer completes a trigger function is executed which adjusted the camera lerp offset.

Screenshot from the Godot editor for my player node containing a Timer node
Godot Timer nodes are super cool once you get the hang of it!

All of these parameters can (and will) be adjusted in the future. Once I get some more time actually playing the game I'll probably change the offset delay.


Anyways, let me know what you think!

For those of you with a keen-eye, you would've notice a weapon floating around the player in the last video! I've been working on a weapon system over the past few days whenever I had some downtime. In the next blog post I'll touching on that implementation!