Godot Engine – Open Source Game Engine

4.8 Stars
Version 4.2.1
60 MB
Godot Engine – Open Source Game Engine

Create Games for Free with Godot Game Engine

Godot Engine has emerged as one of the most exciting developments in game development, offering a completely free, open-source alternative to commercial engines like Unity and Unreal. With its intuitive design, unique scene system, and the custom GDScript language, Godot empowers developers of all skill levels to create 2D and 3D games without licensing fees or revenue sharing requirements.

The engine’s rapid growth reflects both its technical capabilities and the gaming industry’s desire for developer-friendly alternatives. When Unity announced controversial pricing changes in 2023, Godot experienced unprecedented adoption as developers sought engines that respected their creative freedom. This influx of users and contributors has accelerated Godot’s development, making it increasingly competitive with commercial alternatives.

Installation

Linux Installation

Flatpak (Recommended):

flatpak install flathub org.godotengine.Godot

Ubuntu/Debian:

sudo apt install godot3

Arch Linux:

sudo pacman -S godot

AppImage:

wget https://downloads.tuxfamily.org/godotengine/4.2/Godot_v4.2-stable_linux.x86_64.zip
unzip Godot_v4.2-stable_linux.x86_64.zip
chmod +x Godot_v4.2-stable_linux.x86_64
./Godot_v4.2-stable_linux.x86_64

macOS Installation

brew install --cask godot

Windows Installation

Download from official website or:

winget install GodotEngine.GodotEngine
# or
choco install godot

GDScript Basics

Hello World

GDScript resembles Python with game-specific additions:

extends Node

func _ready():
    print("Hello, Godot!")

func _process(delta):
    # Called every frame
    pass

Variables and Types

extends Node

var health: int = 100
var speed: float = 5.0
var player_name: String = "Hero"
var is_alive: bool = true
var position: Vector2 = Vector2(0, 0)

@export var damage: int = 10  # Visible in editor
@onready var sprite = $Sprite2D  # Get node when ready

Functions

func take_damage(amount: int) -> void:
    health -= amount
    if health <= 0:
        die()

func calculate_distance(target: Vector2) -> float:
    return position.distance_to(target)

func spawn_enemy() -> Enemy:
    var enemy = Enemy.new()
    return enemy

Scene System

Creating Scenes

Godot’s scene system is node-based:

# Scene structure
Player (CharacterBody2D)
??? Sprite2D
??? CollisionShape2D
??? AnimationPlayer
??? Camera2D

Instancing Scenes

extends Node

@export var enemy_scene: PackedScene

func spawn_enemy():
    var enemy = enemy_scene.instantiate()
    enemy.position = Vector2(100, 100)
    add_child(enemy)

Scene Transitions

func change_scene(scene_path: String):
    get_tree().change_scene_to_file(scene_path)

func reload_current_scene():
    get_tree().reload_current_scene()

func quit_game():
    get_tree().quit()

2D Game Development

Player Movement

extends CharacterBody2D

@export var speed: float = 300.0

func _physics_process(delta):
    var direction = Input.get_vector("ui_left", "ui_right", "ui_up", "ui_down")
    velocity = direction * speed
    move_and_slide()

Animation

@onready var anim = $AnimationPlayer

func _physics_process(delta):
    if velocity.length() > 0:
        anim.play("walk")
    else:
        anim.play("idle")
    
    if velocity.x < 0:
        $Sprite2D.flip_h = true
    elif velocity.x > 0:
        $Sprite2D.flip_h = false

Collision Detection

extends Area2D

func _on_body_entered(body):
    if body.is_in_group("enemies"):
        body.take_damage(10)
        queue_free()  # Destroy this object

3D Game Development

3D Player Controller

extends CharacterBody3D

@export var speed: float = 5.0
@export var jump_velocity: float = 4.5

var gravity = ProjectSettings.get_setting("physics/3d/default_gravity")

func _physics_process(delta):
    if not is_on_floor():
        velocity.y -= gravity * delta
    
    if Input.is_action_just_pressed("jump") and is_on_floor():
        velocity.y = jump_velocity
    
    var input_dir = Input.get_vector("left", "right", "forward", "back")
    var direction = (transform.basis * Vector3(input_dir.x, 0, input_dir.y)).normalized()
    
    if direction:
        velocity.x = direction.x * speed
        velocity.z = direction.z * speed
    else:
        velocity.x = move_toward(velocity.x, 0, speed)
        velocity.z = move_toward(velocity.z, 0, speed)
    
    move_and_slide()

Camera Control

extends Camera3D

@export var target: Node3D
@export var offset: Vector3 = Vector3(0, 5, 10)
@export var smooth_speed: float = 5.0

func _process(delta):
    if target:
        var desired_position = target.global_position + offset
        global_position = global_position.lerp(desired_position, smooth_speed * delta)
        look_at(target.global_position)

Signals and Events

Custom Signals

extends Node

signal health_changed(new_health)
signal player_died

var health: int = 100:
    set(value):
        health = value
        health_changed.emit(health)
        if health <= 0:
            player_died.emit()

Connecting Signals

func _ready():
    # Connect via code
    $Player.health_changed.connect(_on_health_changed)
    $Player.player_died.connect(_on_player_died)

func _on_health_changed(new_health):
    $HealthBar.value = new_health

func _on_player_died():
    get_tree().reload_current_scene()

Resources and Data

Custom Resources

# item_resource.gd
class_name ItemResource
extends Resource

@export var name: String
@export var description: String
@export var icon: Texture2D
@export var value: int
@export var stackable: bool = true

Saving and Loading

func save_game():
    var save_data = {
        "position": position,
        "health": health,
        "inventory": inventory
    }
    var file = FileAccess.open("user://savegame.save", FileAccess.WRITE)
    file.store_var(save_data)

func load_game():
    if FileAccess.file_exists("user://savegame.save"):
        var file = FileAccess.open("user://savegame.save", FileAccess.READ)
        var save_data = file.get_var()
        position = save_data["position"]
        health = save_data["health"]

Exporting Games

Export Templates

Install export templates from Editor > Manage Export Templates.

Command Line Export

# Export for Linux
godot --headless --export-release "Linux/X11" build/game.x86_64

# Export for Windows
godot --headless --export-release "Windows Desktop" build/game.exe

# Export for macOS
godot --headless --export-release "macOS" build/game.dmg

# Export for Web
godot --headless --export-release "Web" build/index.html

Asset Pipeline

Importing Assets

Godot automatically imports assets placed in project folder:

project/
??? assets/
?   ??? sprites/
?   ??? audio/
?   ??? fonts/
??? scenes/
??? scripts/
??? project.godot

Community and Resources

Asset Library

Access free assets directly from the editor or https://godotengine.org/asset-library

Documentation

# Built-in documentation
# Press F1 or Search Help in editor

Godot Engine represents the future of accessible game development, proving that professional-grade tools can be both free and open source. Whether you're creating your first game or migrating from commercial engines, Godot provides the capabilities needed to bring your creative vision to life without financial barriers.

Download Options

Download Godot Engine – Open Source Game Engine

Version 4.2.1

File Size: 60 MB

Download Now
Safe & Secure

Verified and scanned for viruses

Regular Updates

Always get the latest version

24/7 Support

Help available when you need it