Convert Figma logo to code with AI

TheCherno logoHazel

Hazel Engine

11,581
1,501
11,581
127

Top Related Projects

60,541

Dear ImGui: Bloat-free Graphical User interface for C++ with minimal dependencies

22,183

A simple and easy-to-use library to enjoy videogames programming

9,998

Gaming meets modern C++ - a fast and reliable entity component system (ECS) and much more

23,832

Fast C++ logging library.

12,827

A multi-platform library for OpenGL, OpenGL ES, Vulkan, window and input

3,722

Multi-Language Vulkan/GL/GLES/EGL/GLX/WGL Loader-Generator based on the official specs.

Quick Overview

Hazel is an open-source game engine project developed by The Cherno (Yan Chernikov) as part of his game engine series on YouTube. It aims to be a modern, cross-platform engine written in C++, designed to teach game engine architecture and implementation.

Pros

  • Comprehensive educational resource with accompanying video tutorials
  • Modern C++ design and implementation
  • Active development and community support
  • Cross-platform support (Windows, macOS, Linux)

Cons

  • Still in development, not production-ready
  • Limited documentation outside of video tutorials
  • Steep learning curve for beginners
  • Lacks some advanced features found in established game engines

Code Examples

  1. Creating a basic application:
class Sandbox : public Hazel::Application
{
public:
    Sandbox()
    {
    }

    ~Sandbox()
    {
    }
};

Hazel::Application* Hazel::CreateApplication()
{
    return new Sandbox();
}
  1. Adding a layer to the application:
class ExampleLayer : public Hazel::Layer
{
public:
    ExampleLayer()
        : Layer("Example")
    {
    }

    void OnUpdate() override
    {
        HZ_INFO("ExampleLayer::Update");
    }

    void OnEvent(Hazel::Event& event) override
    {
        HZ_TRACE("{0}", event);
    }
};

// In Sandbox constructor
PushLayer(new ExampleLayer());
  1. Rendering a simple shape:
void ExampleLayer::OnRender()
{
    Hazel::Renderer::BeginScene();
    
    Hazel::Renderer2D::DrawQuad({ 0.0f, 0.0f }, { 1.0f, 1.0f }, { 0.8f, 0.2f, 0.3f, 1.0f });
    
    Hazel::Renderer::EndScene();
}

Getting Started

  1. Clone the repository:

    git clone --recursive https://github.com/TheCherno/Hazel
    
  2. Run the setup script for your platform:

    • Windows: scripts/Setup.bat
    • macOS/Linux: scripts/Setup.sh
  3. Generate project files:

    • Windows: Run scripts/Win-GenProjects.bat
    • macOS/Linux: Run scripts/Linux-GenProjects.sh
  4. Open the generated project files in your IDE and build the project.

  5. Run the Sandbox project to see a basic example of the engine in action.

Competitor Comparisons

60,541

Dear ImGui: Bloat-free Graphical User interface for C++ with minimal dependencies

Pros of imgui

  • Lightweight and easy to integrate into existing projects
  • Extensive documentation and examples
  • Cross-platform support with minimal dependencies

Cons of imgui

  • Limited to immediate mode GUI, which may not suit all use cases
  • Requires more manual management of UI state
  • Less comprehensive feature set compared to full game engines

Code Comparison

imgui:

ImGui::Begin("Hello, world!");
if (ImGui::Button("Click me"))
    clicked++;
ImGui::Text("Button clicked %d times", clicked);
ImGui::End();

Hazel:

class ExampleLayer : public Hazel::Layer {
public:
    void OnImGuiRender() override {
        ImGui::Begin("Hello, world!");
        if (ImGui::Button("Click me"))
            clicked++;
        ImGui::Text("Button clicked %d times", clicked);
        ImGui::End();
    }
private:
    int clicked = 0;
};

Summary

imgui is a lightweight, immediate mode GUI library, while Hazel is a more comprehensive game engine. imgui excels in simplicity and ease of integration, making it ideal for quick prototyping or adding debug interfaces to existing projects. Hazel, on the other hand, provides a fuller set of game development tools and abstractions, which may be more suitable for larger-scale projects or those requiring more advanced features beyond just GUI.

22,183

A simple and easy-to-use library to enjoy videogames programming

Pros of raylib

  • More mature and stable project with a larger community and extensive documentation
  • Simpler API design, making it easier for beginners to get started
  • Cross-platform support for multiple programming languages (C, C++, Lua, Python, etc.)

Cons of raylib

  • Less flexible for advanced game engine features and customization
  • Limited built-in support for modern rendering techniques and advanced graphics features
  • Lacks a robust entity-component system for game object management

Code Comparison

raylib:

#include "raylib.h"

int main(void)
{
    InitWindow(800, 450, "raylib [core] example - basic window");
    while (!WindowShouldClose())
    {
        BeginDrawing();
            ClearBackground(RAYWHITE);
            DrawText("Congrats! You created your first window!", 190, 200, 20, LIGHTGRAY);
        EndDrawing();
    }
    CloseWindow();
    return 0;
}

Hazel:

#include "Hazel.h"

class ExampleLayer : public Hazel::Layer
{
public:
    void OnUpdate() override
    {
        HZ_INFO("ExampleLayer::Update");
    }

    void OnEvent(Hazel::Event& event) override
    {
        HZ_TRACE("{0}", event);
    }
};

class Sandbox : public Hazel::Application
{
public:
    Sandbox()
    {
        PushLayer(new ExampleLayer());
    }

    ~Sandbox()
    {
    }
};

Hazel::Application* Hazel::CreateApplication()
{
    return new Sandbox();
}
9,998

Gaming meets modern C++ - a fast and reliable entity component system (ECS) and much more

Pros of EnTT

  • Highly performant and lightweight Entity Component System (ECS)
  • More flexible and customizable for various game engine architectures
  • Extensive documentation and active community support

Cons of EnTT

  • Steeper learning curve due to its template-heavy design
  • Less beginner-friendly compared to Hazel's more structured approach
  • Requires more manual setup and integration with other systems

Code Comparison

EnTT:

entt::registry registry;
auto entity = registry.create();
registry.emplace<Position>(entity, 0, 0);
registry.emplace<Velocity>(entity, 1, 1);

Hazel:

Entity entity = CreateEntity();
entity.AddComponent<TransformComponent>();
entity.AddComponent<SpriteRendererComponent>();

Summary

EnTT is a powerful and flexible ECS library, while Hazel is a more comprehensive game engine framework. EnTT excels in performance and customization but requires more expertise to use effectively. Hazel offers a more structured and beginner-friendly approach but may be less flexible for advanced users. The choice between them depends on the specific needs of the project and the developer's experience level.

23,832

Fast C++ logging library.

Pros of spdlog

  • Focused solely on logging, providing a lightweight and efficient solution
  • Extensive feature set including asynchronous logging and custom formatting
  • Wide platform support and easy integration into existing projects

Cons of spdlog

  • Limited to logging functionality, not a full game engine framework
  • Lacks built-in GUI or rendering capabilities
  • May require additional libraries for more complex game development tasks

Code Comparison

spdlog:

#include "spdlog/spdlog.h"

int main() {
    spdlog::info("Welcome to spdlog!");
    spdlog::error("An error message with arg: {}", 42);
}

Hazel:

#include "Hazel.h"

class ExampleLayer : public Hazel::Layer {
public:
    void OnUpdate() override {
        HZ_INFO("ExampleLayer::Update");
    }
};

Summary

spdlog is a specialized logging library offering efficient and feature-rich logging capabilities. Hazel, on the other hand, is a comprehensive game engine framework that includes logging as part of its broader functionality. While spdlog excels in its focused approach to logging, Hazel provides a more complete solution for game development, including rendering, input handling, and other essential features. The choice between the two depends on the specific needs of the project and the desired level of abstraction for game development tasks.

12,827

A multi-platform library for OpenGL, OpenGL ES, Vulkan, window and input

Pros of GLFW

  • Mature and widely adopted cross-platform library for OpenGL, OpenGL ES, and Vulkan development
  • Lightweight and focused solely on window creation, input handling, and context management
  • Extensive documentation and community support

Cons of GLFW

  • Limited to low-level windowing and input functionality
  • Requires additional libraries for more advanced features like rendering and audio

Code Comparison

GLFW (basic window creation):

#include <GLFW/glfw3.h>

int main() {
    glfwInit();
    GLFWwindow* window = glfwCreateWindow(800, 600, "GLFW Window", NULL, NULL);
    while (!glfwWindowShouldClose(window)) {
        glfwSwapBuffers(window);
    }
    glfwTerminate();
}

Hazel (basic application setup):

#include "Hazel.h"

class ExampleLayer : public Hazel::Layer {
public:
    void OnUpdate() override {
        // Update logic
    }
};

class SandboxApp : public Hazel::Application {
public:
    SandboxApp() {
        PushLayer(new ExampleLayer());
    }
};

Summary

GLFW is a lightweight, cross-platform library focused on window creation and input handling, while Hazel is a more comprehensive game engine framework built on top of GLFW. GLFW provides lower-level control but requires additional libraries for advanced features, whereas Hazel offers a higher-level abstraction with built-in functionality for game development.

3,722

Multi-Language Vulkan/GL/GLES/EGL/GLX/WGL Loader-Generator based on the official specs.

Pros of glad

  • Focused solely on OpenGL loader generation, making it lightweight and easy to integrate
  • Supports multiple languages (C, C++, D, Nim, Pascal)
  • Actively maintained with frequent updates

Cons of glad

  • Limited scope compared to Hazel's full game engine functionality
  • Requires additional libraries and setup for a complete graphics pipeline
  • Less comprehensive documentation and examples

Code Comparison

Hazel (initializing a window):

auto window = Hazel::CreateScope<Hazel::Window>(Hazel::WindowProps("Hazel App"));
Hazel::Application::Get().PushLayer(new ExampleLayer());

glad (loading OpenGL functions):

if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress)) {
    std::cout << "Failed to initialize GLAD" << std::endl;
    return -1;
}

Summary

Hazel is a comprehensive game engine with a wide range of features, while glad is a focused OpenGL loader generator. Hazel provides a higher-level abstraction for game development, whereas glad offers more flexibility for custom graphics applications. The choice between them depends on the specific project requirements and the desired level of control over the graphics pipeline.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

Hazel License

Hazel

Hazel is primarily an early-stage interactive application and rendering engine for Windows. Currently not much is implemented, however (almost) everything inside this repository is being created within YouTube videos, found at thecherno.com/engine.


Getting Started

Visual Studio 2017 or 2019 is recommended, Hazel is officially untested on other development environments whilst we focus on a Windows build.

1. Downloading the repository:

Start by cloning the repository with git clone --recursive https://github.com/TheCherno/Hazel.

If the repository was cloned non-recursively previously, use git submodule update --init to clone the necessary submodules.

2. Configuring the dependencies:

  1. Run the Setup.bat file found in scripts folder. This will download the required prerequisites for the project if they are not present yet.
  2. One prerequisite is the Vulkan SDK. If it is not installed, the script will execute the VulkanSDK.exe file, and will prompt the user to install the SDK.
  3. After installation, run the Setup.bat file again. If the Vulkan SDK is installed properly, it will then download the Vulkan SDK Debug libraries. (This may take a longer amount of time)
  4. After downloading and unzipping the files, the Win-GenProjects.bat script file will get executed automatically, which will then generate a Visual Studio solution file for user's usage.

If changes are made, or if you want to regenerate project files, rerun the Win-GenProjects.bat script file found in scripts folder.


The Plan

The plan for Hazel is two-fold: to create a powerful 3D engine, but also to serve as an education tool for teaching game engine design and architecture. Because of this the development inside this repository is rather slow, since everything has to be taught and implemented on-camera. There is a much more advanced version of the engine in a private repository called Hazel-dev, accessible to supporters on Patreon. The plan for this project is to mostly take already implemented code from the Hazel-dev repository and integrate it into this one, done within videos and supported by explanations.

Main features to come:

  • Fast 2D rendering (UI, particles, sprites, etc.)
  • High-fidelity Physically-Based 3D rendering (this will be expanded later, 2D to come first)
  • Support for Mac, Linux, Android and iOS
    • Native rendering API support (DirectX, Vulkan, Metal)
  • Fully featured viewer and editor applications
  • Fully scripted interaction and behavior
  • Integrated 3rd party 2D and 3D physics engine
  • Procedural terrain and world generation
  • Artificial Intelligence
  • Audio system

Short term goals :

Note: this is subject to change at any time! Follow the roadmap over at hazelengine.com/roadmap.

By the end 2020, we want to make a game using the Hazel game engine. Not like the time I made a game in one hour using the engine, but this time by using the proper tools that would be required to make a game with Hazel. This means we need to add a full 2D workflow:

  • Design the game scene by using Hazelnut, the Hazel editor,
  • Test the game inside Hazelnut, including the ability to save/load the created game,
  • Load and play the game inside Sandbox.

We want everyone to be able to play the game on all desktop platforms (Windows, Mac and Linux). When this is implemented, another attempt at the "Creating a game in one hour using Hazel" will be made to see how far the engine has become.

Twitter Instagram Youtube Discord Patreon