Building a Marble Game in Godot 4.4.1

Watch the video: Godot 4 Marble Game

This project started as an experiment to explore the upgraded physics engine in Godot 4.4.1. I wanted to build something simple, visually appealing, and mechanically satisfying — a marble game was the perfect fit. Rolling physics, precise control, camera smoothing, and interactive level elements all come together to create a polished, responsive experience.

🎮 What’s in the Game?

The marble is controlled using input-driven forces applied to a RigidBody3D, allowing realistic rolling movement and interactions with obstacles. The camera dynamically follows the marble, with rotation and zoom controls for better visibility and player feedback.

The level design takes inspiration from classic marble games, with ramps, platforms, and triggers that demonstrate what Godot 4’s physics system can handle out of the box. No third-party plugins were used — just native Godot tools and a lot of testing.

🧠 Why Godot?

Godot 4 is more than just a game engine — it’s a free, open-source, and lightweight tool that gives developers full control without the overhead. This game was built to showcase how powerful and accessible Godot 4 really is.

  • 💸 Free & Open-Source: No licenses, no royalties — ever.
  • 🪶 Lightweight & Efficient: Fast to load, easy on system resources, and works great even on modest hardware.
  • 🔌 GDExtension System: Extend engine functionality with C++ without touching the core engine code.
  • 🎮 Improved Input Handling: Responsive and consistent controls across mouse, keyboard, gamepad, and touch.
  • ⚙️ Smoother Physics & Interpolation: Realistic motion, better feel, and a more polished game experience.
  • 🛠️ Enhanced 3D Editor Tools: Powerful scene tools, gizmos, and debugging make 3D development intuitive.
  • 🌐 Cross-Platform Export: Build once, deploy to PC, mobile, web, and consoles.

These made the development process smoother and more enjoyable than ever.

🧰 Want the Project Files?

Here’s the full project code and a breakdown of the code on the channel. Subscribe and stay tuned for more in-depth tutorials, devlogs, and tips for building your own Godot 4 games.

ball.gd

extends RigidBody3D

@export var camera_3d : Camera3D

@export var movement_speed : float = 385.0
@export var max_velocity : float = 7.5
@export var jump_power : float = 6.0

var grounded = false

func _physics_process(delta):
	movement(delta)
	if linear_velocity.x > max_velocity:
		linear_velocity.x = max_velocity
	if linear_velocity.x < -max_velocity:
		linear_velocity.x = -max_velocity
	if linear_velocity.z > max_velocity:
		linear_velocity.z = max_velocity
	if linear_velocity.z < -max_velocity:
		linear_velocity.z = -max_velocity
	
	if Input.is_action_just_pressed("jump") and grounded:
		jump()

func movement(delta):
	var f_input = Input.get_action_raw_strength("backward") - Input.get_action_raw_strength("forward")
	var h_input = Input.get_action_raw_strength("right") - Input.get_action_raw_strength("left")
	
	var camera_tranform = camera_3d.get_camera_transform()
	
	var relative_camera_direction_z = camera_tranform.basis.z.normalized()
	var relative_camera_direction_x = camera_tranform.basis.x.normalized()
	
	var direction_f = f_input * relative_camera_direction_z
	var direction_h = h_input * relative_camera_direction_x
	
	apply_central_force(direction_f * movement_speed * delta)
	apply_central_force(direction_h * movement_speed * delta)

func jump():
	apply_central_impulse(Vector3.UP * jump_power)

camera.gd

extends Node3D

@export_category("Configurables")
@export var cam_v_max : float = 110.0
@export var cam_v_min : float = -75.0
@export var h_sensitivity : float = 0.1
@export var v_sensitivity : float = 0.1
@export var h_acceleration : float = 15.0
@export var v_acceleration : float = 15.0
@export var smooth_camera_tolerance : float = .3

var camrot_h : float = 0.0
var camrot_v : float = 0.0

@onready var bano = $"../Bano"
@onready var h_rotation = $HRotation
@onready var v_rotation = $HRotation/VRotation

# Called when the node enters the scene tree for the first time.
func _ready():
	#hide mouse at start
	Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)

func _physics_process(delta):
	global_position = lerp(global_position, bano.get_node("MeshInstance3D").global_position,smooth_camera_tolerance)
	
	camrot_v = clamp(camrot_v, cam_v_min, cam_v_max)
	
	h_rotation.rotation_degrees.y = lerp(h_rotation.rotation_degrees.y, camrot_h, delta * h_acceleration)
	v_rotation.rotation_degrees.x = lerp(v_rotation.rotation_degrees.x, camrot_v, delta * v_acceleration)
	rotation_degrees.z = 0
	
func _input(event):
	if event is InputEventMouseMotion:
		camrot_h += -event.relative.x * h_sensitivity
		camrot_v += -event.relative.y * v_sensitivity
	elif event is InputEventJoypadMotion:
		if event.axis == 2:
			camrot_h += -event.axis_value * h_sensitivity * 100
		elif event.axis == 3:
			camrot_v += -event.axis_value * v_sensitivity * 100

ground_ray.gd

extends RayCast3D

@export var ball : RigidBody3D
@export var ball_mesh : MeshInstance3D

func _physics_process(_delta):
	global_position = ball_mesh.global_position
	
	if is_colliding():
		ball.grounded = true
	else:
		ball.grounded = false

Follow along, learn with us, and let’s build amazing games in Godot 4.

Comments

24 responses to “Building a Marble Game in Godot 4.4.1”

  1. rifampicin half life Avatar

    These are actually impressive ideas in on the topic of blogging. You have touched some good points here. Any way keep up wrinting.

  2. zovirax cream children Avatar

    I’ll right away take hold of your rss feed as I can’t to find your e-mail subscription hyperlink or e-newsletter service. Do you’ve any? Kindly let me understand so that I may subscribe. Thanks.

  3. amoxicillin Avatar

    If you aren’t certain to use this Chaturbate hack tool and want to see it in motion first, you’ll be able to watch the video beneath.

  4. typical cialis prescription strength Avatar

    Perfect work you have done, this web site is really cool with great info.

  5. avanafil sildenafil tadalafil vardenafil Avatar

    I like what you guys tend to be up too. Such clever work and coverage! Keep up the awesome works guys I’ve added you guys to my blogroll.

  6. lisinopril equivalent doses Avatar

    It’s very effortless to find out any topic on net as compared to books, as I found this post at this website.

  7. 99ok123 Avatar

    Had a look at 99ok123 and all the games look proper! I may spend more time on this site in the future, for sure. Top notch!

  8. vvjllogin Avatar

    Okay, tried logging in on vvjllogin, it was really straightforward! No weird errors or anything. Super user-friendly. Might be good, give it a try!Check out vvjllogin.

  9. dbx777bet Avatar

    Trying my luck with dbx777bet! Heard they have some decent games and the payouts are legit. Fingers crossed! Check them out here: dbx777bet

  10. super kamagra pills Avatar

    Ahaa, its pleasant conversation on the topic of this article here at this webpage, I have read all that, so now me also commenting at this place.

  11. tetracycline 250 mg dosage Avatar

    Greetings! Very helpful advice within this post! It’s the little changes that make the most significant changes. Thanks for sharing!

  12. pin77 casino Avatar

    pin77 casino app login and register visit: pin77 casino

  13. levothyroxine Avatar

    I’ll right away seize your rss feed as I can’t find your email subscription link or newsletter service. Do you’ve any? Kindly let me understand so that I may just subscribe. Thanks.

  14. sildenafil Avatar

    I am sure this post has touched all the internet users, its really really good piece of writing on building up new weblog.

  15. antibiotics online pharmacy Avatar

    Way cool! Some extremely valid points! I appreciate you writing this post plus the rest of the site is very good.

  16. azithromycin buy india amazon Avatar

    Incredible! This blog looks exactly like my old one! It’s on a entirely different subject but it has pretty much the same layout and design. Great choice of colors!

  17. mebeverine hydrochloride and chlordiazepoxide Avatar

    I am sure this piece of writing has touched all the internet users, its really really good post on building up new blog.

Leave a Reply to 🤤💦 Sex Dating. Join ⇨ yandex.com/poll/83KivWDXMPec4g5zdPdmjT?hs=15800c557557c1f237d0e3317b80024b& Update Notification # IBXU5716957 🤤💦 Cancel reply

Your email address will not be published. Required fields are marked *