Friday, June 28, 2013

Introduction Part2 - The Plan

Before i get to the actual Plan, there are still some things i want to mention.

My Tools

 Over the years, i got used to a certain workflow. As i always wanted to know how things really work, and have control over everything in my Code i never used an IDE for long, instead i write my Code in a Texteditor(with code highlighting and block folding i admit ;) ) and compile at the shell. Over time i developed some Scripts to make some things easier, but most of the Time i do everything by Hand, and organize (well sort of ;) ) my Projects by myself in Folders. So here is my Development Environment:
for Coding:
  • Notepad++
  • MinGW-GCC 4.7
  • handwritten Compile- and Backup-Scripts
for Design:
  • Blender3D
  • GIMP 
and the Languages i mainly use:
  • C/C++ 
  • Assembler
  • GLSL
  • Python (for Blender Plugins when needed)
  • OpenCL (Maybe)
My Machines are running Win7 64bit, Win8 32bit, possibly Linux again ( any distro), and i may even have access to OsX Snow Leopard and Lion... but i will mainly code on Windows. At the moment i have no intention of going multiplattform, but i may do nonetheless... I am trying to be independent on third-party Libraries, so i will avoid them. Although i use glfw to create Windows and get a decent OpenGL-Context. And i might also use SDL, SLFW or Irrlicht for some side-projects to provide Features i have not yet implemented, but not for the final build of "Magrathea" - if i ever get to this Point ;).

The Codebase

the Past

As i said, i started several times to develop something like an Engine, but never finished one of these. Although once, i nearly got to the point where i could have said to have an working alpha... i could load textured, skeletal animated meshes from a selfmade Fileformat, Render them animated and with rudimentary Lighting and Shadows, and i had an ugly-but-working GUI... yeah nothing like modern Engines, but i made it all by myself and from scratch while still learning how to code! But then i realised, as i learned more and more, i needed to change a LOT, and this Project was not really modular, so i spent days on fixing all the Code after one little change - thats a big motivation killer! Then i realized, all my Rendering Code was based on OpenGL 1.0, which was OLD... and very inefficient! My Model-Viewer was running very slow, while just drawing ONE lowpoly Model, a Grid and the GUI. So i deceided to learn more about modern techniques - at this time i knew less than nothing about Shaders, Vertex Buffers etc... and by learning about that, i became so scared at the amount of work i had to put into it to change my Code. It would actually be easier to start all over again... so i did. But after that my motivation was so low i never again got an Engine to this Level - the best i got was a (still unfinished) basic Check Game, and some halfhearted attempts at recreating Parts of my old Engine - which was a nuisance  because of the unorganized and often changed old Pile of Code. Now it was Time to find a new way!

The Plan

Although it is my Long-Time-Goal to write a complete Engine, i will not try to do so right now! I will try to first build small independent Modules, by trying out everything that i am interested in, which i will later (when they all work as they should) combine to build an alpha of the Engine. And then Develop on top of that...
So at the Moment i am just searching for different techniques, technologies, methods, algorithms and try them out in an minimal Environment. Then i extract that piece of Code, make it modular and independent, and work on it as i find issues by using it in a different Test.
Here is what i have so far:
  • 3D Base Object 
    • Contains basic Information like ModelMatrix + Vectors (Position, Front, Right, Up), Bounding Sphere, Bounding Box, and Pointers to Parent and Childs
    • Is usable to set the Camera-Viewpoint
  • GL Shader Wrapper
    • Able to load Compile and Bind Shader Programs from File or as char Array from RAM
    • Setup Uniform Values
  • OpenCL Wrapper
    • Able to load Compile and Run CL Kernels from File or as char Array from RAM
    • Create Memory Locations and fill them with Data to process
    • Load Processed Data
  • A State Machine/Manager
    • Able to Manage Program-Flow or AI Decisions(at least i hope so) through States
  • GL Vertex Array (RAM) / Vertex Buffer/ Display List Wrapper
    • Collect Data
    • Setup and Draw Arrays or Buffers as needed or Compile as Display List
    • Not finished yet! Planned is a complete OpenGL Buffer Object Wrapper including:
      • Frame Buffer Objects
      • Pixel Buffer Objects
      • Vertex Array Objects 
  • Simple Worley Noise Generator
    • somewhat useful, but i want to revisit this together with some more noise algos
  • The Text Part of my Old ugly GUI
    • Does not Support Newlines yet
    • Needs revisiting when i am working on GUI Code
  • QuadTree Based Terrain
    • still has Seams where Two Patches of Different LOD meet
    • I did no Tests with Heightmap or Textures yet
    • needs heavy revisiting
  •  Basic PlanetObject Code
    • At the Moment just a Placeholder which Wraps six QT-Terrain Patches arround to form a Sphere
  • A Voxel Chunk Object
    • still in Testphase
    • I am still searching for an fitting algorithm for poligonization...
  • An Basic Command Parser
    • shall be revisited and converted to a fullfledged Console as soon as i have a working GUI
And here are some things i definitly plan to do:
  •  For the Basic Engine
    • SceneManager To manage and draw All Visible Objects and responsible for:
      • Shader selection
      • Instancing
      • Distance Deformation/Deplacement ( I will talk about that later)
      • Calling to Physics where needed
    • TextureManager To collect needed Textures and prepare them
    • Static and Animated Meshes (Voxel and Polygon based)
    • Proper lighting
  • For the Universe Generation
    • Newtonian Physics (for stellar Objects and Spaceflight)
    • Procedural City and Architecture Generators (I think i will contact +Miguel Cepero from Procworld for advice on this one, when im ready ;) )
    • Procedural Plant Generator
    • Procedural Landscape Generator (as soon as i have my Terrain Patches and Voxel Chunks running)
    • In general, learn as much as possible about procedural and fractal algorithms
  • Try out
    • Volumetric Clouds/Fog
    • Atmospheric Scattering Shaders
    • Voxel manipulation
    • Voxel Animation (I know this has been tried many times with mediocre results, but i cant resist ;) )
    • Different Methods of Voxel Representation and Storage
    • LOD based Hybrid Voxel/Polygon Terrain
    • Multilayered Planets (so you can actualy dig to the Core...)

A faraway Goal...

... i know, but i have no Deadlines and no pressure at all to finish anything. I have fun researching and trying things out though! So i will just go on and see where i end :) . I hope this Blog will help me stay motivated.
 I am Sorry for this second Wall of Text without Explanation for those who dont actually do Graphics Programming. Please, if you somehow found this Blog and read this far, ask Questions, give Feedback... I am new to the World of Blogging and dont know at all what i am doing here ;) . I just write down what comes to my Mind, and hope someone will read it and give Feedback. But as i know, people like Pictures, i made some Screenshots from two of my Testcases, and i will tell you a little bit about them - in the next Post.

No comments:

Post a Comment