Tuesday 12 February 2013

A Quick Introduction to KGLT

Those of you that follow me on Twitter, or have the pleasure to listen to my waffling in person, will know that I'm working on a game engine - although I'm still not convinced that's the right terminology. Let's call it a "game framework".

There's a well known saying in the game development world, it goes like this: "Write games, not engines". And, it's actually really good advice, there are plenty of game engines out there, many of them open source and free to use commercially. On top of that, writing a game engine is hard, really hard. It probably is the most difficult user-space application that you can write, and only the insane or brilliant even attempt it.

I must be insane.

Now that I've painted a clear picture of why writing a game engine is an extraordinarily bad idea, let me explain why that's pretty much exactly what I'm doing.

Every so often I grab an old PC game from my shelf, shove it in the DVD drive and prod around the folder tree. If I find something that looks like it could be a new texture format, or model format, I can't resist firing up a Hex editor and trying to decipher it. I've had some moderate success too. I successfully reverse engineered the Ignition texture format for example. And it was during one of these reverse engineering stints that I realized I needed a game engine.

The reason was that, reverse engineering something like a 3D model format is a bit of trial and error, for example "Is that set of floating point data the vertex positions or the vertex normals?" might be the kind of thing you can't decipher just by looking at it in hexidecimal. This is why I needed a game engine, I needed a way to construct a mesh from what I thought was mesh data, and I needed to be able to iterate quickly if a certain block of data wasn't what I thought it was.

After trying a few game engines, I couldn't find anything that did exactly what I wanted. I found loads that did far more than I wanted, but I just needed something simple. And then KGLT was born.

I started by creating an OpenGL window with SDL, then I needed a way to create meshes, then a way to manage those meshes, then a way to skin those meshes, then I needed to render them faster... before I knew it I had been coding this thing for a year and it had grown beyond what I set out to do, hell, I never did get around to reverse engineering that format!

So, now KGLT exists. It's on my GitHub and it provides a really simple API for building up a 2D or 3D scene. It's written in C++ (although you don't need to worry about memory management or any of that nonsense, it's all taken care of). The whole thing is based around a few core concepts:
  • When you create a Window, it owns a Scene.
  • Each Scene can have multiple SubScenes, although a Scene starts out with one.
  • You can add each SubScene to the Pipeline for rendering by specifying a viewport, camera, target and priority.
  • To render things, you create Entities from Meshes. A Mesh can be shared across Entities.
KGLT is different to other game engines, it doesn't try to be ultra-flexible, or ultra-powerful, or all encompassing. It just provides a common framework for building on top of, a bit like Django in the web world.

KGLT is still in heavy development, but it would be good to get feedback/other contributors. So if you are into game development and you fancy playing around with it, give it a go! Let me know how you get on!


  1. Hey, thank you for sharing these details. I gave up my job at focus Transcription Company four months ago and I have been learning about game development since then. And with months of knowledge and practice, I am confident that I can test my luck in heavy development as well. I am looking up to this opportunity. Will you be kind enough to tell me how can I reach up to you people?

  2. Oh my goodness, you're off to an excellent start. I am convinced that you can also undertake substantial development extremely successfully. I too work withBolt web design as a professional branding consultant, and your blog is incredibly beneficial to me.

  3. Thanks for sharing.I found a lot of interesting information here. A really good post, very thankful and hopeful that you will write many more posts like this one.
    Source: website design service uk

  4. First you got a great blog .I will be interested in more similar topics. i see you got really very useful topics, i will be always checking your blog thanks. professional content writing services

  5. The blog that you have written is informative . I found the exact information that I was looking for and it has helped me a lot.
    Source : O2hair

  6. Now that I've made it abundantly apparent why creating a game engine is a terrible idea, allow me to explain why that's essentially professional web design services what I'm doing.

  7. A personal commercial (also known as an elevator speech, personal introduction, 30-second commercial, etc.) is a quick, effective way to make an impressive introduction. You will use your personal commercial when introducing yourself to a potential employer at a job fair, an interview, or anytime you are asked to introduce yourself professionally. Click here

  8. The Federal Communications Commission awarded the station the call letters KGLT.[3] and transmits from Bozeman and throughout southern Montana, including translators spa massage center karachi in Helena and Livingston.

  9. The rise of social media has significantly impacted the world of fashion and accessories. Instagram trends and hashtags create a sense of community among GOLD BRASS RING enthusiasts, fostering engagement and the sharing of personal styles and experiences.

  10. carbonated bubble clay mask offers a novel and effective way to cleanse the skin deeply, unclog pores, and refresh the complexion. Its bubbling action, while entertaining, serves a purpose in providing a thorough cleansing experience

  11. Every so often I grab an old PC game from my shelf, shove it in the DVD drive and prod around the folder tree looks beautiful. If you are facing any issue in writing thesis please contact Medical Thesis Writing Help in USA

  12. "Really enjoyed the blog – easy to understand and super interesting! you can also check for the how to use a breast pump

  13. Informative post! I learned a lot in a short read. for more video production services near me