• Home
  • About
    • Doğancan Algül photo

      Doğancan Algül

      Doğancan Algül's Personal Website

    • Learn More
    • Email
    • LinkedIn
    • Instagram
    • Github
  • Posts
    • All Posts
    • All Tags
  • Projects

Astutia

29 Jun 2019

Introduction

Astutia, the best project in my life yet. This happened when I was playing around with OpenGL. OpenGL is the best thing I learned after the C programming language in computer engineering. Because it opened me lot’s of information I wanted to consume. I am in love with how computers use math to create graphics. 20 minutes into my first OpenGL research, I decided to pursue a career around it.

Anyway, Astutia was created according to a task system. I try to use the divide and conquer method in every project I do. There is lot’s of subtasks but in the big picture here are my goals about Astutia:

  1. Box
  2. Different Boxes
  3. Selecting Boxes
  4. Box Chunks
    1. Randomized Box Chunks
    2. Optimized Random Chunks (Biomes)
  5. Save System
  6. Inventory System
  7. Different Objects to Use
  8. Craft System
  9. Enemies

This is still my game goals list in the project and I admit it is a little mixed with my code goals list. I skipped 4.2 because it was over my head for that time. Shortly after that, I stopped working on this project entirely on task 5.

Process

I have 21 hours of footage. I recorded most of the time I spent on this project from the Premake creation to OpenGL research readings.

File Systems

Since this part is not visual I will cut short. Before even creating my main.c, I created the git repository, merged required libraries and created the files required for Premake.

OpenGL End

After the necessary files, I needed to have a graphical environment. Thus I first created a triangle on the screen. Then I attached 2 triangles and created a square. After giving color to each pixel using their position I got this:

An OpenGL Square with Color

Camera Movement

The camera movement is pretty straightforward. Since the screen can’t move, just move everything around. But since there is lot’s of math to do I had some bugs like these:

Rotating the OpenGL square issues

Cube systems

Then I tried to turn the square into a cube and rotate that. Note for future a box rotating vertically is weird without the perspective.

Here is a shot when the box didn’t want to be a box:

Scattered box picture —-

And here is a box rotating vertically in front of you:

Ortho box rotation

But then I just studied the math behind it and suddenly all my coding problems went away too. Here is a good looking box:

A real OpenGL Box Isn’t it beautiful?

Textures

After that, I dressed up my little box. First, it didn’t want to wear anything. Then it wore a dirt texture and finally grass texture. I want to point out that the box is my limitation with aesthetics. I am a left-brain guy.

Black OpenGL Box Dirt OpenGL Box

Grass OpenGL Box

Skybox

This is not a big thing. But I realized with a skybox everything looked a little better. It made the game a whole.

Skybox

Box Chunks

As other programmers would know, If I can create one from one thing then I can create an array of the same thing.

An Array of Grass OpenGL Box Array of Grass from Up

After that, I became curious about how to ray trace player’s selection. So I made a box removal task. Just to try out and it worked perfectly. Now I could draw on my game.

Map editing on OpenGL

But let’s get real this is nothing compared to Minecraft’s massive maps. So buckle up. After my floor of grass, I made some map generations.

Big mass of Grass

But it was so massive it only had a couple of fps while rendering. And yes this is where I implemented fps counter as well. Because I needed a statistic about my performances. After a little playing around I found a better size for my chunks and I added render range. Render range helped me not to render the whole map.

Good fps forest of grass

Here is my diameter of rendering:

Dirt Range

Then, my imagination went wild.

pyramid of boxes pyramid of boxes crossed

In the end, I decided to go with this kind of a map style:

Minecraft kind of a map with OpenGL

Map Generation

I didn’t like that my map is limited. So I made a map generation system. That created new chunks as I moved. There were some bugs at the beginning,

Map distortions

But it worked in the end.

Alpha Map Generator

Save System

This is where I left my game. The save system is tricky and it needs the whole game’s system plans to work.

Result

This is how I fell in love with computer graphics. I love this project and maybe I will continue on this. But my main focus is now finishing a project and this one will never be finished. Because as original Minecraft, I can add new things all the time.

The video of this project may take a while. There is too much footage to edit.

I am not an OpenGL Guru but I will be glad to respond to any questions!



openglc++astutiaminecraft Share Tweet +1