Though the above video might not seem like an overly impressive jump from the last, there’s actually a ton of work behind it. The new additions include a node-based scene graph hierarchy, more robust math libraries, and keyboard control using DirectInput. Plus, I’ve tried to abstract as much as I can into modular classes and remove the hard-coded hacks I had in there. Finally I hid away the Windows stuff into it’s own class so clients just need to create a normal main() function and can launch the window from there (removing much of the nasty Win32 looking code from sight).

Here is an example of launching an empty window with the engine:

int main(){
	Engine& engine = Engine::get();
	engine.create(1280, 720);

	while (engine.loop()){
		if (engine.control.keyPressed(KEY_ESCAPE)) break;


	return 0;

All in all a vast improvement even if the graphics aren’t too pretty yet (we’ll get there). Coming up next I want to build a 3rd person free camera to navigate around.


The demo is starting to shape up now, with texture mapping and some simple lighting (ambient and directional). To be fair, I’m not sure if I would really call this an “engine” quite yet. It’s still very much a bare-bones, hard-coded demo done in DirectX 11. But once I can get the features working, then I can properly abstract and generalize the functionality. I have plans to start implementing keyboard and mouse controls (probably using DirectInput) and then a simple camera system so I can move around in the space. I’d also like to get a model importer up and running, but I expect this to take some more time. Stay tuned.

Game Engine Gems

Game Engine Gems 1 By Eric Lengyel is a book I discovered on Amazon, but really hadn’t heard of or seen talked about anywhere else. I do recognize the editor, Eric Lengyel, as the creator of the C4 Engine and author of the classic textbook Mathematics for 3D Game Programming and Computer Graphics. So I was going in with high hopes. The book is a compilation of various short chapters focusing on a specific topic pertinent to game engine development. The contributors all appeared to be seasoned game developers from the likes of EA, Codemasters, NaughtyDog, and so forth. Really a great pool of talent and lots of interesting tidbits lay on these pages (or on the screen, rather, since I read it on my Kindle Fire tablet).

Some of the 28 different topics covered include: evaluating middleware, the game asset pipeline, volumetric rendering, path-finding, sound culling, stereoscopic 3d, multi-threading, memory pools, fluid dynamics, physically-based rendering, screen-space ambient occlusion, and some various odds and ends. Just looking at the list of topics you would think the work would be a 1,000 page tome. Unfortunately (or not, depending on your preference), the book is only around 350 pages. That did make for a quick light read, and I finished the whole thing within a few days. On the other hand, I felt like some of the topics were too brief and could have used more detail. In particular, the chapter on stereoscopic 3d was a joke and didn’t even touch upon how to write a stereo renderer. It talks about some different 3d methods used in films (active vs. passive 3d, etc.), which is interesting, but has nothing to do with game development. Seeing as that was one of the main reasons I picked up the book, I couldn’t help but feel slightly cheated. To be fair, many of the chapters are done well and did add to my knowledge of game engine development.

Most useful, I felt, were the chapters on multi-threading (there were a few) since this is a field I am pretty weak in. I also very much liked the chapter on sound culling, as it presents a pretty complete implementation and is something I never even considered but seems like a great optimization. One thing to keep in mind, is that this is not a cookbook. There is code in many chapters (well usually pseudo-code) but rarely is there anything you can expect to straight cut and paste. The way the book is organized, its more like general concepts and algorithms, in a manner to give you enough information to do your own research or implementation. I realize some people just want drop in solutions, and they probably won’t find that here. But if you are intelligent enough, you can take a concept and run with it. It’s up to you.

To be clear: Game Engine Gems won’t give you all you need to know to create a game engine. Far from it. It really doesn’t discuss a lot of basic things (like DirectX or OpenGL, which are barely touched upon) but chooses to highlight some specific narrow topics. I think it’s a great complement to more technical books you might find on game engine architecture or graphics programming in general. For sure, it is a worthy addition to my growing game development library. I’m also very much looking forward to the second book in the series, and really hope they deliver with the stereoscopic 3d coverage. Another one to recommend.


Today I have finally gotten a simple sort of animation working. It looks easy, but I made my life a lot harder by implementing by own math library. So far I have a Vector3D and a Matrix4x4 class almost finished. Well the Vector class is pretty much done. The Matrix class still needs some fleshing out, but I got it working well enough to spin a triangle. I realize I could have used the D3DX library (which is deprecated), or XNAMath (also deprecated), or DirectXMath (safe for now), but I thought making my own math functions would be a good learning experience. I did also have to reimplement D3DXMatrixLookAtLH and D3DXMatrixPerspectiveFovLH, but Microsoft is nice enough to list the equations in their documentation (thanks!).

In addition, I got a lot of help from this book, 3D Math Primer for Graphics and Game Development, which may be one of the best I’ve seen for 3D math. While there are other books, this text has very clear explanations, equations, and actual C++ implementations. I did try my best not to “cheat” and just copy the code, and instead based it on the equations listed. Unfortunately, I got cocky and wrote the length function without checking the reference, and left out the square root function call by accident (resulting in about a hour of debugging). Eventually I figured it out, but not after checking pretty much everything else with a fine-toothed comb. No worries, it’s working now.

Feels nice to see some movement on the screen. For this week I’d like to get a textured cube spinning. Also, I realized that DirectX 11 doesn’t come with a way to import models out-of-box. So pretty soon I will probably have to write a model importer (I’m looking at COLLADA now). Sometimes I wonder if all this work is really worth it, especially with Unreal Engine 4 at $19/month at the moment. I guess I do realize I can likely never hope to compete with the big commercial engines, but I still think this is a great exercise of the mind. We’ll see how long I can keep my faith.

engine zero triangle

So I buckled down and spent the better half of the day actually getting something to show on the screen. Yes, it’s still just a triangle, but it feels pretty satisfying after struggling to get it to work all morning. While there are tons of triangle tutorials online, and it would seem like a 20 minute hack, I ended up having some difficulty for a few reasons.

One, I decided last night to upgrade to Visual Studio 2013 so I could take advantage of C++11 and the 64-bit compiler. Right off the bat, this resulted in a bunch of warnings. I eventually found the instructions to clean this up here, and it ended up not being a big deal.

The second issue was with compiling the HLSL shader (currently, it just passes along the position and color attributes without any fancy math). It turns out the D3DX11CompileFromFile is deprecated as is the whole D3DX library. I guess I could have still used them anyway, but what fun is that? So I decided to remove the D3DX dependency and either move to newer functions, or reimplement certain classes completely.

Luckily there is a function called D3DCompileFromFile, which does the heavy-lifting of compiling a HLSL shader file. However, for some reason shader files from tutorials I was following did not seem to work correctly with the new additions. After tweaking it for a bit, and a lot of trial-and-error, I was able to get something built. I know it seems rather silly to have spent hours on this, but hopefully once I get this foundation built things will become easier. Here is the (dirt simple) shader file if anyone is having similar problems.

struct VS_OUTPUT {
   float4 pos : SV_POSITION;
   float4 color : COLOR0;

VS_OUTPUT VS(float4 pos : POSITION, float4 color : COLOR) {
   VS_OUTPUT output;
   output.pos = pos;
   output.color = color;
   return output;

float4 PS(VS_OUTPUT input) : SV_Target {
   return input.color;

Next up, I want to get in texture mapping, finish the Vector and Matrix classes, and make a spinning cube. Stay tuned.

Beginning D3D11

Beginning DirectX 11 Game Programming by Allen Sherrod is, what I’d consider, a great introduction into DirectX programming. Just to be clear, it’s really only an overview of the DirectX APIs (Direct3D, DirectInput, etc.) and not really a graphics or game programming book (despite the title). So there is very little in the way of actual gameplay type programming, as you never really get to the point of having any sort of game demo. In that same respect, you don’t really deal too much with computer graphics theory, though there is some brief coverage of lighting models in regards to shader programming. That said, what is in the text is a good start to learning the DirectX 11 API and getting some foundation knowledge of the Windows platform.

The book covers basic Win32 window creation, initializing Direct3D, error handling, basic 2D graphics concepts, font rendering, input handling (with Win32, DirectInput, and XInput), fundamental 3D math (vectors, matrices, coordinate systems), cameras, and 3D models. Overall a good amount of topics, and decent coverage of the building blocks for working with the DirectX 11 SDK. While I wouldn’t say the book is for “beginners” (as nothing involving DirectX or Win32 is really for novices), it doesn’t go into as deep a depth as something like the Frank Luna book (which covers more interesting topics like normal mapping and shadow maps). However, I did find the discussion at the end about loading the OBJ 3D file format into Direct3D to be unique, as most books do not go into this.

So do I think Beginning DirectX 11 Game Programming is worth reading? Certainly. It was an approachable read and the Kindle e-book was moderately priced at around $25. For sure, if you are working with the DirectX 11 SDK you will want all the help you can get. Granted, I think some of the other titles I’ve seen had more impressive demos, or deeper coverage, but I felt this was a fine introductory text. I’d even go as far to say that you should read this book first, as it presents the basic knowledge in a way that is much more to the point and not as daunting as some other resources.

The one thing, which is both exciting and sad, is that I believe this was the last DirectX 11 book available on Amazon that I haven’t read. I see there are a few newer books covering DirectX 11.1 or later, but I’d really like to stick to straight 11 due to Windows 7 compatibility. So, at this point, I think I maybe have got as far as the introduction books will take me and I will have to just start developing with it and learning as I go. Not a bad problem to have. Although I still have a few general game engine books in my backlog, I’m feeling more confidant about getting into the trenches of development with my engine and this book has definitely helped.

I know it has been quite some time since the last update, and I thought I would be much further by now. Truth be told, I have been a little distracted the last few months with things totally tangential to graphics programming. In any case, I’ve had some motivation recently to continue on the 3D game engine and began doing further research and reading. However, research doesn’t get results on it’s own. 90% of the time, you just have to start doing whatever it is you want to do whether you think you’re ready or not. So that brings us here, to this totally underwhelming screen shot.

Engine Zero Blank

Yes, it is a blank pink screen. You can calm down. What you are not seeing is some basic boiler-plate code to initialize DirectX 11, clear the back-buffer to a plain color, and the basic Win32 message pump. I have also started to give some structure to the application, with a namespace and class that encapsulates the Direct3D related code. Right now it is a bit hard-coded for a lot of stuff, but I wanted to get it working first and then I can refine and refactor as needed. I’m actually feeling really excited about the prospects of having my own 3D engine, and hope to power through a lot of this foundation stuff so I can get some interactive demos up and running. If everything goes well, I plan to publish updates in this series more frequently as I progress. Thanks for watching.

OGRE Cookbook

OGRE 3D 1.7 Application Development Cookbook by Ilya Grinblat & Alex Peterson was, I guess, what it advertised itself as; a quick cookbook of recipes using OGRE. What is was not was a good inspection of the OGRE engine itself. Really what the book amounted to was a series of short chapters, each tackling a specific programming problem. While there is nothing wrong with that, I felt like the book did not dig deep enough into the actual OGRE software and instead focused on other libraries or APIs you could combine with OGRE.

First of all, this book was heavy into MFC; nearly every chapter relied on it. I am not going to open a debate about MFC as I’m sure it will be heated. What I will say is that MFC is not supported on the free versions of Visual Studio (which is what I use) and obviously won’t work on Linux or Mac, or on mobile platforms, etc. It seems very short-sighted, and somewhat ugly, to take a great cross-platform, open-source tool and then marry it to Microsoft’s proprietary API. This also restricts the user-base significantly as now only Windows users with professional versions of Visual Studio can even run any of the samples. Huge loss here.

Aside from the MFC issue, there are actually some interesting tidbits found in the text. They show how to do basic mouse and keyboard input and move onto voice input and text-to-speech. There’s coverage of creating manual objects and using billboards, working with XML files, using lights and particle effects, scripted movement, animation, some effects like mirrors and video textures, and manipulating objects. So, yes, it does discuss a lot of key topics when working with OGRE, and from a cursory look this would seem just like what a beginner to the engine would need. However, I think the instruction would have been a lot better had they not relied on MFC.

Overall not a particularly long book, and the price was not bad for the Kindle e-book. Seeing as there are not very many books dedicated the OGRE, this is probably still worth getting if you are exploring the engine. That said, the other OGRE books I’ve read were much stronger in terms of actually focusing on the engine API itself and in a cross-platform manner.

Game Engine Design

Alan Thorn’s Game Engine Design and Implementation was quite an interesting read. Overall I thought it was good, but the book struggles at times to find it’s audience. On one hand, it covers a lot of great topics and there are some good code snippets to be found. On the other hand, it seems to jump around between APIs and frameworks and never really culminates with a complete engine. Even so, engine development is no breeze and any help in this area is much appreciated.

The text begins with the basics: downloading Visual Studio or Code::Blocks and configuring a development environment. It shows you how to create and call a DLL. Some brief coverage of the STL. All useful stuff. Then it moves on to some basic engine features, like logging errors and handling exceptions. Again a great place to start. It continues with a resource manager based on XML. Then a 2D scene manager and renderer using SDL. Supporting sound and music with the BASS library. Processing input with OIS. Then a renderer with DirectX 10. Great stuff. Then in the next chapter it throws out everything you just learned and jumps to working with OGRE. Don’t get me wrong, OGRE is a great API. But it seems strange for a book titled “Game Engine Design and Implementation” to use an off-the-shelf library and not code the, erm, implementation themselves. The book follows up with coverage of Bullet physics and ends with a brief overview of DX Studio, which is an all-in-one game engine solution.

While each chapter alone is very interesting and informative, I feel like the book as a whole lost it’s focus somewhere and the engine that you think you are creating at the beginning of the book never materializes. I almost feel bad, it’s like the author started with one premise of creating an engine from scratch, and then gives up half-way. I even agree that using pre-built tools are a good idea in many cases, and most people don’t want to re-invent SDL or OGRE or whatever. But there are other books that focus on these engines and frameworks. People picking up a book like “Game Engine Design and Implementation” probably are more interested in rolling their own engine.

That said, I still feel like the book was a worthwhile read and I did learn a little bit about some stuff and found it useful. Going in I had read the reviews on Amazon, and I knew the author was going to jump around with different libraries. Had I not known this I may have been more upset. As is, Alan Thorn is a competent writer and clearly knows a thing or two about game engines. I guess I just wish there was more of a focus on creating something cohesive and original and not just a jumble of introductions into different APIs. However, if you are on a journey (like me) of creating a 3D game engine you will need as much ammo as possible and this book certainly has a place in the arsenal. Just not the first place.

Getting Started w UDK

Right off the bat, I knew this was not going to be an in-depth resource. The book weighs in and a light 120 pages, though the title does say “getting started” so I least they were upfront about it. That said, I did find the book useful and feel it was a good intro text for people unfamiliar with UDK.

Getting Started with UDK by John P. Doran explains how to create a simple tower defense type game using the Epic UDK (Unreal Development Kit). UDK is a free version of the popular Unreal Engine 3, and is targeted toward indie developers. Though the software itself can be downloaded for free, there are various rules in the license as to how content created with the engine can be used. For example, there is a revenue sharing model if you make over a certain amount. Even so, it’s still a great piece of software and certainly a good deal at this price (who can beat free?).

Anyway, this book has only 4 chapters that take you through creating a game. It started with using CSG (constructive solid geometry) to block out a simple level. We use the editor to add various items to the map, like spawn-points for the enemies. Then it moves onto using Kismet, the built-in visual programming language, to add logic to the game. In this part we create some rules, for example, deducting life when the enemies reach the base. We also create some towers that shoot missiles at the enemies. Next we build a GUI and HUD using Flash and Scaleform, and finally cook and package the game for distribution.

I have been meaning to learn more about UDK for a while now, both for work and for my own personal benefit. Mainly, though, since I am working on my own engine I want to make sure I have a firm understanding of what’s out there so I know how to improve upon it. UDK seems very powerful, and it’s fun to play around with an engine that comes with a ton of AAA assets from the start. Working with the engine certainly gives me some ideas, and shows me some things that could be innovated on. I will certainly want to learn more, as I feel this book barely scratches the surface.

However, there were some parts I did not like. Namely, in the first section on Kismet the author skips a crucial step (connecting one node to another). Without this step, the code does not work all (but doesn’t produce any errors either) and the reader is left to wonder if they made a mistake. Thankfully the images in the book show the correct setup, so if you look closely you can figure this out. Even so, this seems like a huge oversight and it’s really sad when authors make careless mistakes like this. Maybe even worse is that almost none of the Kismet logic is explained at all. In the later part of the book there is one part where you are setting up Kismet code for maybe 30 minutes straight, following steps in the book, but without any sort of guidance or explanation. You do eventually get something that works, but with little knowledge of what you are doing in the process. Granted, much of it is self explanatory, but it really should be explained in some fashion.

All in all, this is not a horrible introductory text. If you are already familiar with UDK, you can probably skip this book, but for new-comers this may be an approachable resource. I still don’t feel like I understand even a fraction of the engine, but I do feel at least a bit more confident in moving to a more in-depth book. In addition, the Kindle e-book was a cheap $9.99, so I can’t complain on the price. For the most part, the formatting was good and the images were decent quality, in-color, and zoomable. On the downside, some of the Actionscript code was a little difficult to read due to the word-wrap, but this is a problem across-the-board with programming e-books. Anyway, for $10 this is a great bang-for-your-buck, even at the rather brief 120 pages. I did end up with a functional game at the end, and that counts for a lot.