Skip to main content
CodeSpeedTest
Languages
Start TypingJump into a test — pick any languageAdaptive TrainingUnlock chars as you master themPractice DrillsFocused sessions targeting weak spotsDaily ChallengesNew coding challenges every dayRace ModeCompete against others in real timeAI OpponentRace against an AI at your WPM levelTournamentsLive coding speed tournamentsArcade GamesZType, Overkill Survival, Glyphica & moreGamificationXP, coins, badges & quests
LeaderboardGlobal rankings for every languageCertificatesEarn verifiable Bronze / Silver / Gold certsActivityDaily streaks & historical analyticsProfileYour stats, badges & achievements
Browse Languages500+ languages with real code examplesBlogTips, guides & deep divesFree ToolsWPM calculator, typing speed report & moreFAQCommon questions answeredGetting StartedNew to CodeSpeedTest?AboutOur story & missionSupportGet help — Pro users get priorityContactGet in touch with the team
Pricing
  1. Home
  2. /
  3. Learn
  4. /
  5. Urho3d

Learn Urho3d - 10 Code Examples & CST Typing Practice Test

Urho3D is an open-source, cross-platform 2D and 3D game engine written in C++ with optional AngelScript and Lua scripting. It provides a lightweight, flexible environment for building games and real-time simulations.

View all 10 Urho3d code examples →
Urho3D Simple Counter ExampleUrho3D Move Cube ExampleUrho3D Rotate Object ExampleUrho3D Keyboard Input ExampleUrho3D UI Button ExampleUrho3D Light ExampleUrho3D Camera Follow ExampleUrho3D Particle ExampleUrho3D Physics Cube ExampleUrho3D Animated Model Example

Learn URHO3D with Real Code Examples

Updated Nov 24, 2025

Explain

Urho3D is C++-based with scripting support via AngelScript and Lua for rapid prototyping.

It supports both 2D and 3D graphics, physics, networking, audio, and scene management.

Used by indie developers, hobbyists, and educators for games, simulations, and interactive applications.

Core Features

Node and component system

3D and 2D model support (OBJ, FBX, glTF)

Camera and lighting system

Physics and collision detection

Audio, input, GUI, and particle systems

Basic Concepts Overview

Scene graph: hierarchical node structure

Node: basic object container

Component: adds functionality to nodes

Resource cache: manages models, textures, audio

Event system: signal-slot messaging

Project Structure

Main.cpp - entry point

Scenes/ - scene files

Resources/ - models, textures, audio

Scripts/ - AngelScript/Lua files

Components/ - custom C++ or scripts

Building Workflow

Create project in IDE or use prebuilt template

Initialize engine and create Scene

Add Nodes and attach Components

Load resources (models, textures, audio)

Set up camera, lighting, physics, and input

Test and deploy

Difficulty Use Cases

Beginner: simple 2D scene

Intermediate: 3D game with physics

Advanced: shader effects and post-processing

Expert: networked multiplayer or VR

Enterprise: cross-platform game deployment

Comparisons

Urho3D vs Unity: lightweight C++ engine vs full-featured editor-based engine

Urho3D vs jMonkeyEngine: C++/AngelScript vs Java, more 2D support

Urho3D vs Godot: flexible C++ core vs GUI-rich editor

Urho3D vs Unreal: lightweight open-source vs AAA engine

Urho3D vs LibGDX: C++/3D+2D vs Java/2D+3D hybrid

Versioning Timeline

2007 - Urho3D created by Jukka Jylänki

2010 - First stable releases

2013 - AngelScript integration

2015 - Improved 2D support

2025 - Current version with modern graphics and scripting updates

Glossary

Scene: root structure of objects

Node: positionable object container

Component: functionality attached to nodes

ResourceCache: asset manager

Event system: message/event handling

Installation Setup

Install C++ compiler and CMake

Download Urho3D source or prebuilt binaries

Build engine using CMake

Set up IDE project (Visual Studio, Xcode, CLion)

Run sample projects to verify setup

Environment Setup

Install C++ compiler and CMake

Set up IDE (Visual Studio, CLion, Xcode)

Download/build Urho3D

Configure project paths

Run sample projects

Config Files

Main.cpp

Scenes/

Resources/

Scripts/

Components/

Cli Commands

cmake - configure build

make - build engine

make run - execute project

ctest - run tests

scripts/build_tools - optional helpers

Internationalization

UTF-8/Unicode support

String tables for multiple languages

Localized assets optional

Dynamic text switching

Custom font rendering

Accessibility

Keyboard and mouse support

Touch input on mobile

Gamepad/controller support

Customizable controls

High-contrast rendering optional

Ui Styling

2D/3D HUD via UI components

Custom fonts and textures

Dynamic GUI elements

Layered UI rendering

Optional third-party GUI libraries

State Management

Scene-level state via Nodes

Node-specific state via Components

Global settings via singletons

Event-driven state changes

Persistent data via file or database

Data Management

3D/2D models

Textures and materials

Audio assets

Scene nodes and components

Player progress and save files

Architecture

Scene -> root container for nodes

Node -> position, rotation, scale, parent-child hierarchy

Components -> behavior attached to nodes (Mesh, Light, Camera, RigidBody)

Application class -> main entry point

Event system -> handles signals and messages

Rendering Model

Scene graph traversal

Shader-based rendering

Lighting and shadow systems

Particle and post-processing effects

Level-of-detail (LOD) management

Architectural Patterns

Node-component system

Event-driven messaging

Resource caching

Application class for main loop

Service locator pattern for shared systems

Real World Architectures

2D/3D desktop games

Mobile games

Educational simulations

VR/AR prototypes

Interactive visualizations

Design Principles

Lightweight C++ core

Node-component architecture

Open-source and extensible

Cross-platform support

Integrated physics and shaders

Scalability Guide

Use LOD and batching for large scenes

Optimize physics updates

Profile CPU/GPU usage

Use memory-efficient assets

Reuse Components and Nodes where possible

Migration Guide

Upgrade old projects to latest engine version

Check deprecated APIs

Update resources/formats if needed

Test physics and rendering compatibility

Validate cross-platform builds

Performance Notes

Use batching for static geometry

Limit draw calls and polygon counts

Level-of-detail (LOD) for models

Profile CPU/GPU usage

Use object pooling for frequent spawns

Security Notes

Sanitize input from networked clients

Secure online resources

Use HTTPS for downloads

Avoid storing sensitive data in plain text

Validate multiplayer events

Monitoring Analytics

FPS counter

Memory profiling

Input event logging

Render profiling

Integrate analytics if needed

Code Quality

Use modular Components

Organize project structure

Document code

Profile and optimize performance

Follow C++ best practices

Practical Examples

2D platformer

3D racing game

Physics-based puzzle

VR prototype

Interactive 3D visualization

Troubleshooting

Fix missing resource paths

Resolve shader compilation errors

Debug physics collisions

Handle input mapping correctly

Optimize scene for performance

Testing Guide

Test on desktop and mobile

Verify physics and collisions

Check rendering on different GPUs

Test input and controls

Profile memory and CPU usage

Deployment Options

Windows executable

macOS app bundle

Linux binary

Android APK

iOS app package

Tools Ecosystem

Urho3D editor (third-party)

Resource management tools

Shader editing utilities

Sample projects

Profiling and debugging tools

Integrations

Bullet Physics

Tiled map editor (for 2D)

Third-party GUI libraries (ImGui, CEGUI)

Networking libraries (RakNet, ENet)

VR support via OpenVR/OpenXR

Productivity Tips

Use example projects for faster setup

Reuse Components

Profile performance early

Use LOD for large models

Batch static geometries

Challenges

Create a simple 2D/3D scene

Add physics interactions

Implement camera and input controls

Integrate GUI elements

Deploy to desktop and mobile

Learning Path

Learn C++ fundamentals

Understand scene graph and node/component system

Practice physics integration

Implement custom shaders

Deploy to multiple platforms

Skill Improvement Plan

Week 1: C++ basics and Hello Urho3D

Week 2: Scene graph and nodes

Week 3: Physics and collision handling

Week 4: Shaders, lighting, and post-processing

Week 5: Cross-platform builds and optimization

Interview Questions

Explain Urho3D scene graph and node system

How do Components work?

Describe the Event system

How to optimize large scenes?

How does physics integrate in Urho3D?

Cheat Sheet

Scene = root container

Node = object container

Component = adds behavior

ResourceCache = manages assets

Event system = messaging/signals

Books

Learning Urho3D

Urho3D Game Development Cookbook

C++ Game Development with Urho3D

Advanced Urho3D Projects

2D & 3D Game Programming with Urho3D

Tutorials

Official Urho3D tutorials

YouTube examples and walkthroughs

Community guides

Sample projects included with engine

Third-party blog tutorials

Official Docs

https://urho3d.github.io/documentation/

https://github.com/urho3d/Urho3D

https://urho3d.github.io/community/

Community Links

Urho3D forums

GitHub repository

Discord community

StackOverflow tags

YouTube tutorials

Community Support

Urho3D forums

GitHub repositories

Discord community

StackOverflow

YouTube tutorials

Monetization

Paid PC/mobile games

In-app purchases on mobile

Educational licensing

Ad integration via SDK

VR/AR commercial projects

Future Roadmap

Enhanced mobile performance

Better 2D workflow

Expanded VR/AR support

Improved scripting integration

More community tutorials/examples

When Not To Use

Non-programmer drag-and-drop prototyping

AAA visual fidelity projects

Projects requiring large asset marketplaces

Extensive multiplayer frameworks

Teams unfamiliar with C++ or scripting

Final Summary

Urho3D is a lightweight, C++-based 2D/3D engine with scripting support.

It supports cross-platform deployment and flexible scene graph architecture.

Best suited for C++ developers and hobbyists creating games, simulations, or prototypes.

Offers open-source flexibility with integrated physics and rendering systems.

Less suitable for rapid drag-and-drop development or AAA projects.

Faq

Is Urho3D free?

Yes - fully open-source under MIT license.

Does it support 2D?

Yes - both 2D and 3D are supported.

Which platforms are supported?

Windows, macOS, Linux, Android, iOS.

Is it beginner-friendly?

Moderate; requires C++ or scripting knowledge.

Does it have a visual editor?

Limited; third-party editors exist but not core engine.

Code Sample Descriptions

1

Urho3D Simple Counter Example

#include <Urho3D/Engine/Application.h>
#include <Urho3D/Input/Input.h>
#include <Urho3D/Engine/Engine.h>
#include <Urho3D/UI/Text.h>

using namespace Urho3D;

class CounterApp : public Application {
public:
    CounterApp(Context* context) : Application(context), count(0) {}

    void Setup() override {}
    void Start() override {
        text = new Text(context_);
        text->SetText("Count: 0");
        text->SetFont(GetSubsystem<ResourceCache>()->GetFont("Fonts/Anonymous Pro.ttf"), 40);
        GetSubsystem<UI>()->GetRoot()->AddChild(text);
    }

    void Stop() override {}
    void Update(float timeStep) {
        Input* input = GetSubsystem<Input>();
        if (input->GetKeyDown(KEY_UP)) count++;
        if (input->GetKeyDown(KEY_DOWN)) count--;
        text->SetText("Count: " + String(count));
    }
private:
    int count;
    SharedPtr<Text> text;
};

URHO3D_DEFINE_APPLICATION_MAIN(CounterApp)

A minimal Urho3D C++ example demonstrating a counter incremented by keyboard input.

Let’s Try →
2

Urho3D Move Cube Example

#include <Urho3D/Engine/Application.h>
#include <Urho3D/Scene/Scene.h>
#include <Urho3D/Graphics/StaticModel.h>
#include <Urho3D/Graphics/Model.h>
#include <Urho3D/Input/Input.h>
#include <Urho3D/Graphics/Renderer.h>

using namespace Urho3D;

class MoveCubeApp : public Application {
public:
    MoveCubeApp(Context* context) : Application(context) {}

    void Setup() override {}
    void Start() override {
        scene_ = new Scene(context_);
        Node* node = scene_->CreateChild("Cube");
        node->CreateComponent<StaticModel>()->SetModel(GetSubsystem<ResourceCache>()->GetModel("Models/Box.mdl"));
        cubeNode = node;
    }

    void Stop() override {}
    void Update(float timeStep) override {
        cubeNode->Translate(Vector3(0,0,1)*timeStep);
    }

private:
    SharedPtr<Scene> scene_;
    Node* cubeNode;
};

URHO3D_DEFINE_APPLICATION_MAIN(MoveCubeApp)

Moves a cube forward continuously using Urho3D nodes.

Let’s Try →
3

Urho3D Rotate Object Example

#include <Urho3D/Engine/Application.h>
#include <Urho3D/Scene/Scene.h>
#include <Urho3D/Graphics/StaticModel.h>
#include <Urho3D/Graphics/Model.h>

using namespace Urho3D;

class RotateApp : public Application {
public:
    RotateApp(Context* context) : Application(context) {}

    void Setup() override {}
    void Start() override {
        scene_ = new Scene(context_);
        Node* node = scene_->CreateChild("RotatingCube");
        node->CreateComponent<StaticModel>()->SetModel(GetSubsystem<ResourceCache>()->GetModel("Models/Box.mdl"));
        cubeNode = node;
    }

    void Update(float timeStep) override {
        cubeNode->Yaw(50*timeStep);
    }

private:
    SharedPtr<Scene> scene_;
    Node* cubeNode;
};

URHO3D_DEFINE_APPLICATION_MAIN(RotateApp)

Rotates an object around the Y-axis every frame.

Let’s Try →
4

Urho3D Keyboard Input Example

#include <Urho3D/Engine/Application.h>
#include <Urho3D/Input/Input.h>
#include <Urho3D/Scene/Scene.h>
#include <Urho3D/Graphics/StaticModel.h>
#include <Urho3D/Graphics/Model.h>

using namespace Urho3D;

class InputApp : public Application {
public:
    InputApp(Context* context) : Application(context) {}

    void Setup() override {}
    void Start() override {
        scene_ = new Scene(context_);
        Node* node = scene_->CreateChild("Player");
        node->CreateComponent<StaticModel>()->SetModel(GetSubsystem<ResourceCache>()->GetModel("Models/Box.mdl"));
        playerNode = node;
    }

    void Update(float timeStep) override {
        Input* input = GetSubsystem<Input>();
        if(input->GetKeyDown(KEY_W)) playerNode->Translate(Vector3(0,0,1)*timeStep);
        if(input->GetKeyDown(KEY_S)) playerNode->Translate(Vector3(0,0,-1)*timeStep);
    }

private:
    SharedPtr<Scene> scene_;
    Node* playerNode;
};

URHO3D_DEFINE_APPLICATION_MAIN(InputApp)

Responds to keyboard input to move a character.

Let’s Try →
5

Urho3D UI Button Example

#include <Urho3D/Engine/Application.h>
#include <Urho3D/UI/Button.h>
#include <Urho3D/UI/UI.h>
#include <Urho3D/UI/Text.h>

using namespace Urho3D;

class UIButtonApp : public Application {
public:
    UIButtonApp(Context* context) : Application(context) {}

    void Setup() override {}
    void Start() override {
        Button* button = GetSubsystem<UI>()->GetRoot()->CreateChild<Button>();
        button->SetPosition(300,200);
        button->SetSize(200,80);
        Text* buttonText = button->CreateChild<Text>();
        buttonText->SetText("Click Me");
        buttonText->SetFont(GetSubsystem<ResourceCache>()->GetFont("Fonts/Anonymous Pro.ttf"),40);
        button->SubscribeToEvent(button, E_RELEASED, URHO3D_HANDLER(UIButtonApp, HandleButton));
    }

    void HandleButton(StringHash eventType, VariantMap& eventData) {
        URHO3D_LOGINFO("Button Clicked!");
    }
};

URHO3D_DEFINE_APPLICATION_MAIN(UIButtonApp)

Creates a simple UI button and responds to click events.

Let’s Try →
6

Urho3D Light Example

#include <Urho3D/Engine/Application.h>
#include <Urho3D/Graphics/Light.h>
#include <Urho3D/Scene/Scene.h>

using namespace Urho3D;

class LightApp : public Application {
public:
    LightApp(Context* context) : Application(context) {}

    void Setup() override {}
    void Start() override {
        scene_ = new Scene(context_);
        Node* lightNode = scene_->CreateChild("Light");
        Light* light = lightNode->CreateComponent<Light>();
        light->SetLightType(LIGHT_DIRECTIONAL);
        lightNode->SetDirection(Vector3(-1,-1,0));
    }

private:
    SharedPtr<Scene> scene_;
};

URHO3D_DEFINE_APPLICATION_MAIN(LightApp)

Adds a directional light to the scene.

Let’s Try →
7

Urho3D Camera Follow Example

#include <Urho3D/Engine/Application.h>
#include <Urho3D/Graphics/Camera.h>
#include <Urho3D/Scene/Scene.h>
#include <Urho3D/Graphics/StaticModel.h>
#include <Urho3D/Graphics/Model.h>

using namespace Urho3D;

class CameraFollowApp : public Application {
public:
    CameraFollowApp(Context* context) : Application(context) {}

    void Setup() override {}
    void Start() override {
        scene_ = new Scene(context_);
        Node* playerNode = scene_->CreateChild("Player");
        playerNode->CreateComponent<StaticModel>()->SetModel(GetSubsystem<ResourceCache>()->GetModel("Models/Box.mdl"));

        cameraNode = scene_->CreateChild("Camera");
        Camera* camera = cameraNode->CreateComponent<Camera>();
    }

    void Update(float timeStep) override {
        cameraNode->SetPosition(Vector3(0,50,-100)+Vector3(0,0,0));
    }

private:
    SharedPtr<Scene> scene_;
    Node* cameraNode;
};

URHO3D_DEFINE_APPLICATION_MAIN(CameraFollowApp)

Makes the camera follow a moving object.

Let’s Try →
8

Urho3D Particle Example

#include <Urho3D/Engine/Application.h>
#include <Urho3D/Scene/Scene.h>
#include <Urho3D/Particles/ParticleEmitter.h>

using namespace Urho3D;

class ParticleApp : public Application {
public:
    ParticleApp(Context* context) : Application(context) {}

    void Setup() override {}
    void Start() override {
        scene_ = new Scene(context_);
        Node* node = scene_->CreateChild("Emitter");
        node->CreateComponent<ParticleEmitter>()->SetEffect(GetSubsystem<ResourceCache>()->GetParticleEffect("Particle/Fire.xml"));
    }

private:
    SharedPtr<Scene> scene_;
};

URHO3D_DEFINE_APPLICATION_MAIN(ParticleApp)

Attaches a particle emitter to a node.

Let’s Try →
9

Urho3D Physics Cube Example

#include <Urho3D/Engine/Application.h>
#include <Urho3D/Physics/PhysicsWorld.h>
#include <Urho3D/Scene/Scene.h>
#include <Urho3D/Graphics/StaticModel.h>
#include <Urho3D/Graphics/Model.h>

using namespace Urho3D;

class PhysicsApp : public Application {
public:
    PhysicsApp(Context* context) : Application(context) {}

    void Setup() override {}
    void Start() override {
        scene_ = new Scene(context_);
        Node* cube = scene_->CreateChild("Cube");
        cube->CreateComponent<StaticModel>()->SetModel(GetSubsystem<ResourceCache>()->GetModel("Models/Box.mdl"));
        cube->CreateComponent<RigidBody>();
        cube->CreateComponent<CollisionShape>()->SetBox(Vector3::ONE);
    }

private:
    SharedPtr<Scene> scene_;
};

URHO3D_DEFINE_APPLICATION_MAIN(PhysicsApp)

Applies physics to a cube object.

Let’s Try →
10

Urho3D Animated Model Example

#include <Urho3D/Engine/Application.h>
#include <Urho3D/Scene/Scene.h>
#include <Urho3D/Graphics/AnimatedModel.h>
#include <Urho3D/Animation/AnimationController.h>

using namespace Urho3D;

class AnimatedApp : public Application {
public:
    AnimatedApp(Context* context) : Application(context) {}

    void Setup() override {}
    void Start() override {
        scene_ = new Scene(context_);
        Node* node = scene_->CreateChild("Robot");
        AnimatedModel* model = node->CreateComponent<AnimatedModel>();
        model->SetModel(GetSubsystem<ResourceCache>()->GetModel("Models/Jack.mdl"));
        node->CreateComponent<AnimationController>()->PlayExclusive("Models/Jack_Walk.ani",0,true);
    }

private:
    SharedPtr<Scene> scene_;
};

URHO3D_DEFINE_APPLICATION_MAIN(AnimatedApp)

Animates a model using an animation controller.

Let’s Try →

Frequently Asked Questions about Urho3d

What is Urho3d?

Urho3D is an open-source, cross-platform 2D and 3D game engine written in C++ with optional AngelScript and Lua scripting. It provides a lightweight, flexible environment for building games and real-time simulations.

What are the primary use cases for Urho3d?

2D and 3D PC games. Mobile games (Android/iOS). Educational simulations. Real-time visualizations. Interactive prototypes

What are the strengths of Urho3d?

Lightweight and fast. Open-source and fully C++ accessible. Good 2D and 3D support. Cross-platform deployment. Active community and example projects

What are the limitations of Urho3d?

No official visual editor (third-party editors exist). Smaller community compared to Unity/Unreal. Documentation less extensive than major engines. Networking is basic; advanced multiplayer requires custom work. Less beginner-friendly without C++ experience

How can I practice Urho3d typing speed?

CodeSpeedTest offers 10+ real Urho3d code examples for typing practice. You can measure your WPM, track accuracy, and improve your coding speed with guided exercises.

Learn Other Programming Languages

CReactPythonC++RustTypeScriptKotlinPHPJavaC#RubyMqlCqlN1qlCypherGremlinPartiqlHaskellElixirFsharpView all languages →
CodeSpeedTest

Improve your coding speed, code accuracy, and programming syntax WPM with practice sessions across 500+ programming languages.

Quick Links

HomeAboutFeaturesGetting StartedLanguages

Legal & Support

Pro ⚡ PricingContactPrivacy PolicyTerms of Service

Connect

CodeSpeedTest on GitHubCodeSpeedTest on TwitterEmail CodeSpeedTest

© 2026 CodeSpeedTest. All rights reserved.