🛠️ Akincraft Development Guide

Learn how to build and customize your own voxel engine

Getting Started

Prerequisites

Clone & Setup

git clone https://github.com/AkiUse306/akincraft.git
cd akincraft

Java Stack

cd java
./gradlew build      # Build the project
./gradlew run        # Run the game

C++ Stack

cd cpp
mkdir -p build && cd build
cmake ..
cmake --build .
./akincraft_cpp

Engine Architecture

Project Structure

java/ ├── src/main/java/akincraft/ │ ├── App.java # Main entry point │ ├── World.java # World management │ ├── Chunk.java # Chunk data structure │ ├── Entity.java # Game entities │ ├── Renderer.java # Rendering system │ ├── Physics.java # Physics engine │ └── Inventory.java # Inventory system ├── build.gradle.kts # Build configuration └── gradlew # Gradle wrapper cpp/ ├── src/ │ ├── App.cpp/h # Main application │ ├── World.cpp/h # World system │ ├── Chunk.cpp/h # Chunk management │ ├── Renderer.cpp/h # OpenGL renderer │ ├── Entity.cpp/h # Entity system │ └── Physics.cpp/h # Physics ├── CMakeLists.txt # Build configuration └── build/ # Build output

Core Systems

System Responsibility Key Classes/Files
World Chunk management and terrain generation World.cpp/java, Chunk.cpp/java
Renderer OpenGL rendering and mesh generation Renderer.cpp/java
Entity Players, mobs, and game objects Entity.cpp/java, EntityManager.cpp/java
Physics Collision detection and movement Physics.cpp/java (implicitly in movement code)
Inventory Item management and crafting Inventory.cpp/java, Item.cpp/java

Game Loop

// Pseudocode - Main game loop
while (game_running) {
    // Input
    handle_input();
    
    // Update
    update_world();
    update_entities();
    update_physics();
    update_inventory();
    
    // Render
    generate_chunk_meshes();
    render_scene();
    
    // Frame timing
    sleep_to_target_fps();
}

Customizing Your Game

Adding Block Types

Location: Look for BlockType.h (C++) or block type definitions in Java
// Example: Adding a new block type
enum BlockType {
    AIR = 0,
    STONE = 1,
    DIRT = 2,
    GRASS = 3,
    // ADD YOUR BLOCKS HERE
    CUSTOM_ORE = 50,
    CUSTOM_WOOD = 51,
    // ...
}

Modifying Block Colors

Each block type needs a color for rendering. Find the texture/color mapping in:

Tweaking World Generation

The procedural generation uses noise functions. You can customize:

Adding Custom Entities

// Extend Entity class with your custom entity
class MyCreature : public Entity {
    virtual void update(float deltaTime) override {
        // Your custom logic here
        move_towards_player();
        attack_if_close();
        take_damage_if_hit();
    }
};

Creating New Biomes

To add a new biome:

  1. Define biome properties (temperature, humidity, height)
  2. Add block palette for the biome
  3. Modify terrain generation to use biome data
  4. Add unique entities/features to the biome

Adding Major Features

1. Multiplayer Support

Note: Java version has networking foundation

2. Advanced Crafting System

// Define recipes
Recipe iron_pickaxe = {
    input: [iron_ingot, iron_ingot, iron_ingot,
            stick, stick],
    output: pickaxe,
    pattern: [
        [I, I, I],
        [_, S, _],
        [_, S, _]
    ]
};

3. Mob AI System

4. Enhanced Lighting

5. Weather System

// Weather states
enum WeatherType {
    CLEAR,
    RAIN,
    THUNDERSTORM,
    SNOW
};

// Update weather
void update_weather(float deltaTime) {
    weather_timer += deltaTime;
    if (weather_timer > weather_duration) {
        change_to_random_weather();
        weather_timer = 0;
    }
}

6. Persistent Data Storage

Development Tips

Performance Optimization

Testing Your Changes

Resources