MoreEffectiveC

I decided to break from my 3D game engine book marathon and go to something more fundamental. More Effective C++ by Scott Meyers is one of those books I have  had on my wishlist for years but just hadn’t got around to reading yet.  I had read the original book  Effective C++ some years ago, and this sequel very much follows the same form. Though slightly dated now, it does cover a good amount of C++ design considerations that will show up in almost any decently complex C++ application.

The book covers a lot of OOP (object oriented programming) concepts and designs, and also a lot of the trouble you can get into using C++ without fully understanding what you are doing. Some of the coverage includes how to use abstract base classes and virtual functions. Specifically Meyers talks about memory management issues with construction and destruction, temporary objects, passing by value versus pointer/reference, and overloading copy/assignment constructors. He also discusses problems with using exceptions, explains how to write a smart pointer class (which is now obsolete with C++11, but still good to understand the implementation), using proxy objects, how to do lazy evaluation, and some various odds and ends.

Overall I found this to be a great text and very helpful, especially the discussion on inheritance and abstract base classes. If you really want to understand C++, warts and all, this should be a required text. However, please read the original title first, as it covers some more fundamental concepts than in the second text. Recommended.

 

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.

Freedom

Personally I hate spoilers, so I will keep this brief. Freedom™ is the sequel to the best-selling book Daemon by Daniel Suarez. If you haven’t read the original, you should go do that now. It’s great.

The premise of the first book is that of a famous game developer that dies, and spawns an AI that goes rouge and starts killing people. It then follows the investigation into the Daemon and the people that try to stop it. The whole thing is an action-packed ride, and is especially fun for anyone into computers or gaming as there are several scenes with hacking and bringing gaming concepts into real-life. There is also a science-fiction element with augmented reality glasses, autonomous robots and things of that nature. Top notch.

This second book, Freedom™, picks up where the first book left off. I don’t really want to explain further as I feel that would give away too much of the first book (if you haven’t read it). That said, I did enjoy this sequel. Granted, it was not as gripping as the original (but what sequel is?). There is a lot of action, but I feel some of the suspense of the first book was lost. However it was still enjoyable and worth reading.

3D Math

Mathematics for 3D Game Programming and Computer Graphics by Eric Lengyel is one of those books I have literally been eyeing for years and just never got around to reading. If you are not familiar, Eric Lengyel is the creator of the C4 Engine, and also the author of various game development books. He is well regarded in the community, so I assumed this was a must read title. After reading it, I still agree; it’s an excellent source of knowledge.

The book covers the basic stuff you would expect from a 3D math book: vectors, matrices, quaternions, intersections between various types of geometry, visibility, etc. Great, so the bases are covered. Lengyel goes a bit further, though, and discusses other topics that are very important in computer graphics. For example: lighting and shadowing, decals, curved surfaces, and physics (including fluid and cloth simulation). So a decent amount of topics are covered, but the chapters are still brief enough to finish each in one sitting.

While there are some implementation examples, the text is pretty light on the code. The code that is here is mostly based around OpenGL, however the concepts should still translate to DirectX. Not a huge issue. When needed, he does show code samples, but most of the copy is dedicated to math discussion and the equations.

Granted, some of the equations and proofs were dense and hard to follow. This was made worse by the fact that I was reading this on the Kindle, and the equations were made up of small images you couldn’t zoom in on. Having said that, I still understood most of the concepts, but there were a few times I felt overwhelmed. I can’t really fault the author for that, since his written explanations were all very clear and concise. It’s just some of the content is deep and complex, so be prepared.

All in all, I found this to be a great resource and you can never know enough math in this field. Unfortunately, I will still probably have to look up some of the equations online or in other books due to the low quality of the images in the e-book. But this is a minor complaint compared to the amount of information backed in this title. I would recommend this.

 

The guys at Sixense have just released a new video showing off the 5 STEM motion-tracking system that they are Kickstarting. The Sixense version of the Oculus Tuscany demo was already one of the more impressive examples of VR I have seen, and that was just using the Razer Hydra. This new demo ups the ante with a total of 5 trackers, resulting in a convincing full-body simulation. I have already backed the Kickstarter and I suggest, if you haven’t already, that you do too. This technology looks way too awesome to pass up.

It’s been quite a while since my last 3D game engine post, but I haven’t forgot about it. In fact, I’ve been so heads-down in research I haven’t really done any development at all. I still feel like there are a few more books I will need to read to be better prepared, but I guess that will always be the case. So I’ve decided to at least start some preliminary work on the engine itself. Honestly, I’ve barely even started but I thought this series would be more interesting if you saw the genesis of the engine. From absolutely nothing to, well, I hope something respectable.

Since I’m considering this the precursor to my first 3D engine, I am code-naming the project “Engine Zero”. Partly because this is sort of the “day zero” and partly because I’m a programmer and zero comes before one. Though it does look like there is a “Zero Engine” already, so I will have to come up with a better name once I am further along. So behold, the first screenshot of the engine below. Yes, it’s just a message box. You have to start somewhere, right?

Engine Zero 01

OK, so that took all of 5 minutes to whip together. But I have done some planning in terms of file management and source control. First off, the way Visual Studio organizes files by default is non-optimal. Having the source files mixed in with project/solution/temp files is not what I want. So I have made a folder just for source code, another for the build binaries, and a project folder for everything else. This feels a lot cleaner and will help keep the project more organized. You can see the structure below.

Engine Zero 02

Next up, I created a source control repository for the project. I ended up going with Subversion, as this will be fine for just coding by myself. I know everyone loves Git, but honestly I find the tools and front-ends for Subversion to be a lot more mature than with Git. If I can use a user-friendly GUI and save myself time, I’d rather do that over command-line hacking. However, I am not using source control as my sole backup method. I have the project folder backing up to an external hard-drive and to the cloud. Plus, it saves each file revision, so I could rollback changes even if I forgot to commit to SVN. It would literately take Armageddon to destroy this code. And, frankly, if it’s the end of the world I’ll probably have more important things to worry about than the integrity of my backups.

Anyway, I am still very excited about this project and think the potential is enormous. While there is not much room for yet another 3D engine, I think I have some innovative ideas to bring to the table that the community would be genuinely excited about. I don’t want to over hype things this early into development, or give away all my ideas, but if you stick around with me through this series, I think it’s going to be a fun ride.

3D Game Engine Programming
The quest to become a master of 3D engines has brought me to another book, 3D Game Engine Programming by Stefan Zerbst (with a forward from the legendary Andre LaMothe). This is one of the first books I’ve read in a while that wasn’t available on the Kindle, and it’s out of print, but I managed to find a used copy of the paperback without a problem. At a somewhat meaty 850 pages, it was a little cumbersome to read, especially laying down in bed. It’s really amazing how spoiled you get with new technology. Anyway, the book was great and I enjoyed the whole thing.

Though I have been reading a bunch of books on graphics programming, this one was a refreshing peek into the design of a 3D engine. It was also obvious that the engine was a living, breathing thing. Not just a sample created for the book. Zerbst covers a lot of ground here: rendering with DirectX9, sound, input, scene management, networking, a math library, even creating a simple level editor/low-poly modeler. And he goes in-depth, even to the point of hand-coding assembly for optimizing a vector class. And, somehow, he made it make sense.

I very much enjoyed the amount of code and the amount of discussion that followed each piece. There are tons of code samples throughout the book, with ample explanation as to what everything is doing. Though there were a few cases of long, multi-page code samples, for the most part the author kept things as concise as possible.

Another thing I liked was how Stefan Zerbst broke out each major component of the engine into it’s own DLL (i.e. one for graphics, one for sound, one for input, etc.). I think this is a great idea, and has the potential to speed up development without having to compile all these parts of the engine every time you need to test your game. This is certainly something I want to explore further with my engine.

Surprisingly, the book was not totally outdated considering it was first published in 2004 (almost 10 years ago, OMG!). Granted, there is some discussion of stencil shadows and the fixed-function pipeline but, for the most part, the basic concepts are still valid today. It’s also somewhat amazing (or amusing) that Microsoft created an API (DirectX9) that still going strong so many years later.

However, the book isn’t totally without fault. One thing that seemed a little strange was the authors liberal use of global variables for key parts of the engine. He would even say: “I am just using a global here to make things simple as an example, you may not want to do this in your engine” or something to that effect. I understand making things easy for illustration, but why not show us the right way to do it?

It’s not like one single book could ever cover all you need to know about writing 3D engines, certainly not in 850 pages. That being said, 3D Game Engine Programming is an awesome resource for the aspiring engine creator. It covers territory not seem in other books and really digs deep into the aspects that matter. All-in-all I found this text to be helpful and am glad to have it in my growing collection.

Practical Rendering

I was thoroughly impressed by Practical Rendering and Computation with Direct3D 11 by Jason Zink. Microsoft’s Direct3D API is certainly not for beginners, and neither is this book. But, at the same time, the author does a great job of explaining the material in a way that is approachable. The book assumes you are already comfortable with C++, and doesn’t hold your hand with the syntax. This is great, since you really should have an understanding of C++ before jumping into 3D graphics programming. It’s also not the kind of book that expects you to type in long pages of example code into your computer. In fact, there are not really any complete examples listed in the book at all. Instead the author chooses to highlight specific API calls and explain how different techniques can be implemented using the GPU.

This is in stark contrast to the last DirectX 11 book I read by Frank Luna. Luna’s text was great, don’t get me wrong. But it was very focused on producing functional demos to showcase certain effects (like shadow mapping or ambient occlusion). Instead Zink chooses to go totally knee-deep into the API itself and, as a reader, I came away much more confident that I understood the material. Just as an example, early on in the book there is a 100 page chapter just on resources. Most other tutorials would briefly show how to create a buffer, and then move on other stuff. Not here. In fact, the next 200 pages of the book is just about how the pipeline works. It’s really great, and rare to find such insight.

Don’t be fooled, there is certainly code in these pages, and there are a few examples. The book covers some topics like deferred rendering, multi-threaded graphics, dynamic tessellation, and physics. What I liked about the examples is that only the bare minimum amount of code was shown. Just enough to understand the key concepts without getting bogged down with boiler-plate code. It also made reading along much nicer, without having to feel like you need to get up every 5 minutes and type something in on a PC. Plus, the source code for the examples, and the author’s engine, are available for free online. So no need to type either way.

One thing I really enjoyed was the discussion on DirectCompute and on compute shaders. There are hardly any books covering DirectCompute, so it’s great to see so much space dedicated to the API. I am very interested in using this in my own engine, though it’s difficult to find information on the topic. Practical Rendering and Computation includes several chapters using compute shaders, for example to do image processing (blur). There was also a good amount of space given for tessellation. So if you are at all interested in these specific topics, it’s pretty much a no-brainer to get this book.

One other thing. Mad props to Jason Zink for being available to the community. You’ll find him on the gamedev.net forums, even helping out newbies with their 3D questions. Much respect.

All-in-all, this was quite an eye-opening read. I mean, after reading the Luna book and doing some online tutorials, I thought I knew about DirectX 11. Well, I knew something. But this book went much further than what I had previously seen on the topic. I would even recommend reading this *before* Frank Luna’s book, as I think that would flow a little better. Get the foundation solid, and then start learning how to code specific effects. Anyway, this book comes highly recommended by me if you are attempting to learn Direct3D.

Shadowrun Returns

Let me just say this right off the bat: Shadowrun for Super Nintendo is my all-time favorite game. All time. It was great. Set in a future cyberpunk theme urban sprawl, you are basically a gun for hire. Or at least you were. You wake up in a morgue back from the dead with no memory of your life. You spend the rest of the game trying to discover what happened. It had RPG elements, action elements, adventure elements. You could hack computers and get money or steal information. You could go to a bar and hire guns to help out on your mission. It had an innovative dialogue system where you would get words in your “dictionary” that you could ask people. You started with nothing, but as you talked to people you would get more words to ask. It was awesome. Especially for 1993.

While Shadowrun Returns might not quite match what I remember of the original SNES title, it does a damn fine job at what it does. Basically the world is similar, and even the main character from the SNES game makes a cameo. Magic has returned to the world, along with ogres and elves and all that. Shadowrunners rule the streets. From simple hired guns (street samurai) to hackers (deckers) to mages, there are lots of different classes to choose from. The story follows a string of mysterious murders and the investigation to find the killer. Well, there is more than that but I don’t want to give anything away. The game is what I would call a turn-based strategy RPG. There are lots of RPG elements and stats you can level up. This effects everything from your hit points, to the chance of success with any particular weapon. So this takes a note from the mechanics of the original pen-and-paper game. This works well, and the combat is still satisfying. There are also some cool missions, or at least one really good one at the end, where you have to hack into security systems and fight of guards on an espionage mission. Good stuff.

So the game is great, and you should buy it. However, I did feel like it was extremely linear.  In the Genesis version of the game (1994) you could take all sorts of side-missions to beef up your stats or make money. It was awesome. They had drug deals, extractions missions, VIP escorts (no, not that type of escort), hacking, the whole nine. In Shadowrun Returns there is only really one side-mission in the whole game. So you are basically watching a good interactive movie. Granted, it’s a 17-hour movie, and it’s great, but I would have liked more choice. There is also very little exploration, it mostly feels like an “on-rails” affair. That said, it’s still a blast and any fans of cyberpunk fiction will probably get a kick out of it.

All in all a great addition to the Shadowrun universe, and a refreshing break from all the first-person 3D games that are all the rage. I do wish it were a little longer, and more of an open-world, but I guess you can’t have everything. However, it appears the modding tools are good, and there is already a good amount of user generated content available. Plus, a DLC campaign is slated for early next year. This game has my cyber-seal-of-approval.

Vernor Vinge - Rainbows End

I went into this book not knowing much. Well I heard it was set in the future, and was recommended on some internet forums. So that was enough to pique my interest. After listening to the 14+ hours of the audio-book, I’m not sure I can say I know anymore.

OK, I will be blunt. I don’t think I enjoyed this journey. It was not that it was badly written. Vernor Vinge seems like a competent writer. It’s just that the story did not grip me, nor were the characters particularly recognizable or likable. I mean, I was not expecting something on the level of Snow Crash, but I was hoping for at least a passable sci-fi novel. I came up short.

When I say the story was lacking, maybe I should be more specific. I am not sure what happened in this book. In fact, I am not even sure anything happened at all. Well, that’s not entirely true. I know the main character is some old geyser that gets out of the hospital and doesn’t know much about modern technology. And they have these wearable computer contact lenses. That part is actually kind of cool. So the beginning half of the book is about this old guy trying to get hip to the new tech, going to high school again, and stuff like that. There is dialogue with his family members. There is some hint of hackers. This is all vaguely interesting, but a real story never materializes. I guess I am used to books where you are hooked in from the first page. Don’t expect that here. I kept thinking to myself: “OK, this is going to get better.” but sadly it never does.

Granted, about 10 hours into the book finally something, and I mean anything, started to happen. Without any spoilers, the characters go on a dangerous mission together. However, if a book has to make the reader wait until the end for even a hint of excitement, they have failed. To make matters worse, the whole premise didn’t make much sense to me. Weak characters, weak story, really no reason for me to care.

I feel bad, actually, giving this book such a horrid review. I am usually pretty forgiving, and I did give this title and honest chance. Unfortunately it let me down and there is not much more to it then that. Not sure what other people were talking about when they recommending this book. I appreciate the effort but, sadly, the book doesn’t deliver.