Skip to content

Aakarsh911/KiaakGameEngine

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

58 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Kiaak Game Engine

Kiaak is a lightweight, modern 2D game engine written in C++17 designed for rapid prototyping and game development. It features an integrated visual editor, component-based architecture, and Lua scripting support, making it ideal for indie developers and educational purposes.

License C++ Platform

๐ŸŽฎ What is Kiaak Engine?

Kiaak is a complete 2D game development solution that provides:

  • Visual Scene Editor - Drag-and-drop interface for building game scenes
  • Component System - Flexible entity-component architecture
  • Real-time Rendering - OpenGL-based 2D graphics pipeline
  • Physics Simulation - Built-in 2D physics with collision detection
  • Scripting Support - Lua integration for gameplay logic
  • Asset Management - Project-based workflow with organized asset handling
  • Cross-platform - Runs on Windows, macOS, and Linux

โœจ Key Features

๐ŸŽจ Visual Editor

  • Scene Hierarchy - Tree view of all game objects in your scene
  • Inspector Panel - Edit component properties in real-time
  • Asset Browser - Manage textures, scripts, and other resources
  • Play/Edit Modes - Test your game without leaving the editor
  • Camera Controls - Pan, zoom, and navigate your scenes with ease
  • Gizmo Tools - Visual transform handles for moving objects

๐Ÿงฉ Component System

  • Transform Component - Position, rotation, and scale
  • Sprite Renderer - 2D texture rendering with transparency support
  • Camera Component - Orthographic cameras with zoom control
  • Rigidbody2D - Physics simulation for dynamic objects
  • Collider2D - Collision detection and response
  • Script Component - Lua scripting for custom behavior
  • Tilemap System - Efficient tile-based level creation
  • Animator - Animation system for sprites and objects

๐ŸŽฏ Core Engine Systems

  • Scene Management - Multiple scenes with seamless switching
  • Project System - Organized folder structure (assets/, scenes/)
  • Serialization - Save/load scenes and project data
  • Input Handling - Keyboard and mouse input processing
  • Timer System - Fixed timestep and variable timestep updates
  • 2D Physics - Collision detection and rigid body dynamics
  • Shader System - Custom GLSL shader support

๐Ÿ’ป Scripting & Extensibility

  • Lua Integration - Write gameplay logic in Lua
  • Hot Reloading - Modify scripts without restarting
  • Component Scripting - Attach custom behaviors to game objects
  • Engine API Access - Full access to engine systems from scripts

๐Ÿ› ๏ธ Technical Architecture

Core Systems

Kiaak Engine
โ”œโ”€โ”€ Core/
โ”‚   โ”œโ”€โ”€ Engine.cpp           # Main engine loop and initialization
โ”‚   โ”œโ”€โ”€ Scene.cpp            # Scene management and object containers
โ”‚   โ”œโ”€โ”€ GameObject.cpp       # Entity system with components
โ”‚   โ”œโ”€โ”€ Transform.cpp        # Position, rotation, scale handling
โ”‚   โ”œโ”€โ”€ Camera.cpp           # Orthographic camera system
โ”‚   โ”œโ”€โ”€ Timer.cpp            # Frame timing and delta time
โ”‚   โ””โ”€โ”€ Project.cpp          # Project and asset path management
โ”œโ”€โ”€ Graphics/
โ”‚   โ”œโ”€โ”€ Renderer.cpp         # OpenGL rendering pipeline
โ”‚   โ”œโ”€โ”€ Shader.cpp           # GLSL shader loading and management
โ”‚   โ”œโ”€โ”€ Texture.cpp          # Texture loading and binding
โ”‚   โ”œโ”€โ”€ SpriteRenderer.cpp   # 2D sprite rendering component
โ”‚   โ””โ”€โ”€ VertexArray.cpp      # OpenGL vertex array abstraction
โ”œโ”€โ”€ Editor/
โ”‚   โ”œโ”€โ”€ EditorCore.cpp       # Editor initialization and management
โ”‚   โ””โ”€โ”€ EditorUI.cpp         # ImGui-based user interface
โ””โ”€โ”€ Physics/
    โ”œโ”€โ”€ Physics2D.cpp        # 2D physics world simulation
    โ”œโ”€โ”€ Rigidbody2D.cpp      # Dynamic physics bodies
    โ””โ”€โ”€ Collider2D.cpp       # Collision shapes and detection

Dependencies

  • GLFW - Cross-platform windowing and input
  • OpenGL - Hardware-accelerated 2D/3D graphics
  • ImGui - Immediate mode GUI for the editor
  • GLM - Mathematics library for graphics
  • Lua 5.4 - Embedded scripting language
  • Sol2 - Modern C++ to Lua binding
  • GLAD - OpenGL function loading

๐Ÿš€ Getting Started

Prerequisites

  • CMake 3.10 or higher
  • C++17 compatible compiler (GCC 7+, Clang 5+, MSVC 2017+)
  • OpenGL 3.3+ support
  • Git for cloning dependencies

Building on Linux/macOS

# Clone the repository
git clone https://github.com/Aakarsh911/kiaak-game-engine.git
cd kiaak-game-engine

# Install dependencies (Ubuntu/Debian)
sudo apt-get install cmake build-essential libglfw3-dev libgl1-mesa-dev

# Install dependencies (macOS with Homebrew)
brew install cmake glfw glm

# Build the engine
mkdir build && cd build
cmake ..
make -j4

# Run the engine
./KiaakEngine

Building on Windows

# Clone the repository
git clone https://github.com/Aakarsh911/kiaak-game-engine.git
cd kiaak-game-engine

# Install dependencies using vcpkg (recommended)
vcpkg install glfw3 glm

# Build with CMake
mkdir build && cd build
cmake .. -DCMAKE_TOOLCHAIN_FILE=[vcpkg root]/scripts/buildsystems/vcpkg.cmake
cmake --build . --config Release

# Run the engine
Release\KiaakEngine.exe

๐Ÿ“– Usage Guide

Creating Your First Project

  1. Launch the Engine: Run the KiaakEngine executable
  2. Create Project Structure: The engine automatically creates:
    • assets/ - Store textures, sounds, and other resources
    • scenes/ - Scene files (.scene format)
  3. Scene Editor: Use the visual editor to build your game world

Basic Workflow

// Example: Creating a game object with components
auto* gameObject = scene->CreateGameObject("Player");

// Add transform component (automatically added)
auto* transform = gameObject->GetTransform();
transform->SetPosition(0.0f, 0.0f, 0.0f);

// Add sprite renderer
auto* sprite = gameObject->AddComponent<SpriteRenderer>();
sprite->SetTexture("assets/player.png");

// Add physics
auto* rigidbody = gameObject->AddComponent<Rigidbody2D>();
rigidbody->SetMass(1.0f);

auto* collider = gameObject->AddComponent<Collider2D>();
collider->SetSize(1.0f, 1.0f);

Lua Scripting Example

-- player_controller.lua
local Player = {}

function Player:Start()
    self.speed = 5.0
    self.transform = self.gameObject:GetTransform()
end

function Player:Update(deltaTime)
    local input = Engine.GetInput()
    local x, y = 0, 0
    
    if input:IsKeyPressed("A") then x = x - 1 end
    if input:IsKeyPressed("D") then x = x + 1 end
    if input:IsKeyPressed("W") then y = y + 1 end
    if input:IsKeyPressed("S") then y = y - 1 end
    
    local currentPos = self.transform:GetPosition()
    self.transform:SetPosition(
        currentPos.x + x * self.speed * deltaTime,
        currentPos.y + y * self.speed * deltaTime,
        currentPos.z
    )
end

return Player

๐ŸŽฎ Editor Controls

Navigation

  • Middle Mouse + Drag: Pan camera
  • Mouse Wheel: Zoom in/out
  • Space: Reset camera to origin

Object Manipulation

  • Left Click: Select objects
  • G + Drag: Move selected object
  • R + Drag: Rotate selected object
  • S + Drag: Scale selected object

Editor Modes

  • Tab: Toggle between Edit and Play mode
  • Ctrl+S: Save current scene
  • Ctrl+N: Create new scene

๐Ÿ“ Project Structure

When you create a project, Kiaak organizes files as follows:

MyGame/
โ”œโ”€โ”€ assets/              # Game resources
โ”‚   โ”œโ”€โ”€ textures/       # Image files (.png, .jpg)
โ”‚   โ”œโ”€โ”€ scripts/        # Lua script files (.lua)
โ”‚   โ””โ”€โ”€ shaders/        # GLSL shader files (.vert, .frag)
โ”œโ”€โ”€ scenes/             # Scene files
โ”‚   โ”œโ”€โ”€ MainScene.scene # Scene data in text format
โ”‚   โ””โ”€โ”€ Level1.scene    # Additional game scenes
โ””โ”€โ”€ last_project.txt    # Project path persistence

๐Ÿ”ง Extending the Engine

Creating Custom Components

// Custom component example
class HealthComponent : public Kiaak::Core::Component {
public:
    HealthComponent(int maxHealth) : maxHP(maxHealth), currentHP(maxHealth) {}
    
    void TakeDamage(int damage) {
        currentHP = std::max(0, currentHP - damage);
        if (currentHP <= 0) {
            // Handle death
        }
    }
    
    bool IsAlive() const { return currentHP > 0; }
    
private:
    int maxHP;
    int currentHP;
};

Adding Custom Shaders

// custom_shader.vert
#version 330 core
layout (location = 0) in vec2 aPos;
layout (location = 1) in vec2 aUV;

uniform mat4 transform;
uniform float time;

out vec2 vUV;

void main() {
    vec2 pos = aPos;
    pos.y += sin(pos.x * 10.0 + time) * 0.1;  // Wave effect
    
    vUV = aUV;
    gl_Position = transform * vec4(pos, 0.0, 1.0);
}

๐Ÿค Contributing

We welcome contributions! Please follow these guidelines:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Development Setup

# Clone your fork
git clone https://github.com/yourusername/kiaak-game-engine.git
cd kiaak-game-engine

# Add upstream remote
git remote add upstream https://github.com/Aakarsh911/kiaak-game-engine.git

# Create development build
mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Debug
make -j4

๐Ÿ› Known Issues & Limitations

  • 3D Support: Currently only supports 2D rendering
  • Audio System: Audio playback not yet implemented
  • Networking: No multiplayer or networking features
  • Mobile Platforms: Desktop platforms only (Windows, macOS, Linux)
  • Asset Pipeline: Limited asset import/export capabilities

Happy Game Development! ๐ŸŽฎ

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages