Math, Physics, Programming, Review

Review: Mathematics & Physics for Programmers by Danny Kodicek and John P. Flynt

MathAndPhysics

This book was quite an interesting read. Though a book of math and physics sounds like it would be boring, I found the text to be pretty engaging. At  688 pages, it’s not the longest technical resource, but the authors manage to pack a good deal in those pages. Of course, there is a lot of math in here, but that’s not all. Even some random topics like mazes and game theory pop up near the end. I really did enjoy the book and it seems worthwhile.

Some of the areas of focus include even basic number representations, arithmetic, algebra and trigonometry, vectors and calculus, to mass and acceleration, collision detection, force and motion, friction and more. Finally, in the last section, the authors cover some tangential topics like tile-based games, mazes, game theory and AI, even search techniques. Really, a good roster.

One of the main reasons I purchased this book, aside from general interest, was to gain some knowledge to apply to a custom physics engine. While that’s still (in my mind) a debatable goal, I do feel like Mathematics & Physics for Programmers has helped, at least with the general concepts.

Unfortunately, I did not try to implement any of the equations or pseudo code from the book, so I won’t comment on the accuracy of the code. It’s possible there were errors that I did not notice. I typically don’t base my implementations directly from books. I use the books to understand the big picture, to get a sense of what’s possible, and to understand the vocabulary and terms that I need to search for. Then I’ll find resources online when it comes to writing the code.

What I will say, though, is that the text is not as good as the other big 3d math books, specifically 3D Math Primer for Graphics and Game Development by Fletcher Dunn or Mathematics for 3D Game Programming and Computer Graphics by Eric Lengyel. For sure, if you are only buying one or two math books for game development, get either of those first. However, if you are like me and you’ve already read the popular books on the topic, this isn’t such a bad choice as a refresher or to round out your knowledge.

Gaming, Graphics, Programming, Review

Review: Game Programming Algorithms and Techniques: A Platform-Agnostic Approach by Sanjay Madhav

GameProAlgo

Game Programming Algorithms and Techniques is one of those books that tries to be as general as possible, and I believe the author was successful in that. Too many books target one specific piece of software or even one particular version of a framework and end up becoming dated rather quick. However, the core ideas in game development have not fundamentally changed in a while. Sure graphics get better, and there are more complexities to working with modern hardware, but the programming algorithms themselves are still very much the same.

Sanjay Madhav starts the book with an overview of some classic games, how a game loop works, handling timing in games, and the idea of game objects. Next he discusses 2D games, sprites, scrolling, and tile maps. There is a quick chapter on linear algebra. Then the author continues with a treatment of 3D graphics, including  coordinate spaces, lighting and shading, visibility and transformation. Handling input is covered as is sound. There is a chapter on physics, which I much appreciated, and then some quick coverage of cameras, artificial intelligence, user interface, scripting, and networking. Finally, the book closes with two example projects.

The author does a great job of explaining complex concepts in easy to understand language, especially in the math and physics chapters, which could be confusing otherwise. One of the pieces that I gained a lot from was the explanation of mouse picking 3D objects, which was described beautifully and made a lot of sense.  The chapter on scripting languages was also helpful and relevant.

Overall I enjoyed the book, and think it would be helpful to beginning programmers, or experienced coders in other fields looking to get into game development. I feel that for intermediate to advanced game programmers, much of this book will be a review. Not to knock the book for that, though, I think it’s a great book if you understand the audience it’s aiming for. I mean, there were even a few bits of information that were new to me, however much of the book was about stuff I’ve seen before.

That said, I do like to read texts of various levels, and even beginner books can help you look at familiar problems in new ways. So I think it’s very much worth reading, especially if you are just starting out in game development.

3D Modeling, Art, Review

Review: Anatomy for 3D Artists: The Essential Guide for CG Professionals by Chris Legaspi

Anatomy for 3D Artists

This book really is “The Essential Guide” for 3D character artists. Though you can probably make a decent model just following reference images and common sense, I think a solid basis of knowledge of the human form really is the foundation for taking your art to the next level of realism. If you are looking for that foundation, or just want to up your skills in the character department, look no further.

The chapter structure in Anatomy for 3D Artists has a variety of different artists tackling a few chapters each, giving the book some different flavor and allowing for these best-in-breed artists to highlight their strengths. It begins with 2D study, and has several chapters each detailing both male and female figures. This beginning part is very much foundational, and shows the basic proportions of the body as well as the basics of bone and muscle structure. This follows up with similar treatments of bone and muscles in a 3D context. Finally, they finish the book with some full sculpts of both male and female bodies in dynamic poses.

It really goes deep into the names and relationships between the bones and muscles, moreso than I was even expecting. And to put this into context, I went to art school for college and I don’t even recall ever going this deep. For example, the text is peppered with lines like: “The bone of the femur rotates inward around its longitudinal axis. The tensor fasciae latae, the gluteus medius, and parts of the gluteus minimus allow this movement.” I won’t lie, some of this descriptions are thick and I doubt I will remember the specifics. Though it is still helpful to understand, and you could always refer back to the text in cases of confusion. And, despite some of the heavily worded descriptions, the text remains very approachable.

Anatomy for 3D Artists is a great place to look, not only for guidance but also inspiration. They spared no expense at having literally every page packed with multiple full color illustrations of each step along the way. Especially for a book of this nature, pictures are key to understanding the material, and the presentation is beautiful. There’s also a few sections in the middle and end just to showcase finished artwork, which is appreciated.

One other great aspect, is that the instruction is not tied to any particular 3D modeling package. Though it’s clear most of the authors are using ZBrush, they stray from going into the specific technical aspects of the application. Pretty much all the instruction is general and could be applied to whatever software you or your studio prefers.

All in all, I consider this book to be a huge success and should be a key element of any character artist’s bag of tricks. Although there are other anatomy books going back years, this is one of the first specifically for 3D artists. I found it helpful and I think you will too.

C++, Gaming, Review

Review: Programming Game AI By Example by Mat Buckland

ProgrammingAI

Programming Game AI By Example by Mat Buckland is one of those books that comes highly recommended and was one I had been meaning to read for a long time. In fact, I originally purchased the paperback in 2006 and never got around to reading it. The interesting part is that the book is still very much relevant today and is not dated in the least. Well now maybe some of the engines and middleware have this stuff built in, but the fundamentals I think I still important to understand.

The book starts with a quick primer on math and physics. The basics are explained, like Cartesian coordinates, trigonometry, vectors, coordinate spaces, and some physics. Like most people reading a book of this level, the beginning was a light refresher. However, I’m a big stickler for reading books from cover to cover with no skipping around, so I did not mind a short recap. Next Buckland gets into state-driven design and demonstrates a simple command-line app using the concepts. I found this approach successful, and it was able to show the concepts without complex 2D or 3D math getting in the way.

He followed up with autonomous moving agents, mostly based on steering behaviors. I was already somewhat familiar with steering behaviors, but I found the author’s description and code to be clear and concise and explained the concept better than I’ve seen before. He then applies the previous topics to a simple soccer game. This was a great next step, and really compiled the knowledge being taught into something concrete. In the next chapter, the author went into graphs; what they are, how to use them, and some popular algorithms link Dijkstra and A*. I always wanted to know what A* was, and this book explains it fairly well.

Buckland then devotes a section to cover scripting languages and why they are useful. In this case, he chose Lua (not a bad choice) and explains some basics about the language, how to interface it with C++, and creates a simple finite state machine. This chapter is helpful even if you’re not coding AI and just need a scripting language for your game or engine (provided you like Lua). In fact, a lot of the concepts in this book are generic enough that they can be applied to multiple fields of interest for game developers.

Next, the author creates a simple overhead game framework used in the subsequent examples. Using this framework he then shows practical path planning, goal driven agent behavior, and finishes up with fuzzy logic. Fuzzy logic is another one of those buzzwords that always intrigued me but I never really understood. Buckland concludes with a quite excellent explanation of the concept.

Overall I found this book to be stellar on all accounts. I feel that any game developer could gain insight from this text, even if they aren’t primarily working with AI programming. The scripting coverage could be used in many games, and the algorithms covered are generic enough to apply to different disciplines. While this is the first book I’ve read on AI, I really can’t imagine a better introduction. Highly recommended.

Gaming, Review, Unity

Review: Getting Started with Unity 5 by Dr. Edward Lavieri

GettingStartedUnity5

Getting Started with Unity 5 is mostly what it bills itself as: a way to get started in Unity for beginners. The book is clearly targeting beginners, and takes the reader from having never used Unity to making a simple farming-type game. I enjoyed reading it (in the whole 3 days it took to finish), however I’m not sure exactly how much I learned (if anything at all).

At 195 pages, the book is not extremely thorough, but does cover a lot of the basic fundamentals of game development with Unity. Unfortunately, that coverage is brief and only really scratches the surface. Some of the topics featured include: downloading Unity (an easy one), the editor views like scene/game/project/etc., game design, importing assets, animation, C# scripting, UI, and sound. Looking at that list, it seems like a lot of stuff, but some chapters are barely even 20 pages long. Not that it’s bad as an introduction, it could be a good place to start, but I feel for experienced developers the book falls short.

Besides the brevity of the coverage, I found some of the instructions confusing. For example, on the topic of programming, the author explains how to code different animals in a farm to do similar things like eat or have babies. This would seem like a classic text-book example for using object-oriented programming principles. Instead, the author concocts some cryptic array of numbers, where a 0 means a pig and a 1 a chicken or something or another. Not to say that this won’t work, sure, it will compile. It’s just not a great way to teach programming concepts to a beginner.

I don’t especially like giving bad reviews, and I don’t want to say the book is bad. It’s titled as a “getting started” book and that’s just what it is. I’m just not sure it’s the best instruction for a beginner, and the programming sections in particular were lacking for me. There are not many Unity 5 specific books available today but, truthfully, much of what’s covered in this book would have worked the same in Unity 4. Even so, the older Unity books I’ve read were much more comprehensive and useful than this one. So if you’ve just started to learn now, this book may be worth picking up as a quick intro if you understand it’s not very deep at all. Experienced Unity developers should keep moving.

C++, Game Engine, Graphics, Review, Unreal

Review: Learning C++ by Creating Games with UE4 by William Sherif

LearningUnreal

Right here is a book with a clearly defined goal and an excellent execution. Learning C++ by Creating Games with UE4 by William Sherif takes you on a journey from being a total blank in C++ to coding some basic features of a 3D game. Even though I have been coding in C++ for years, I still enjoy reading novice level texts as sometimes they can teach you a new way of thinking about familiar problems. For me, it’s also important to have good book recommendations (especially for people starting out), and I actually discovered this book from a member of the Unreal Engine community looking for a review. So here it is.

William Sherif starts the book proper, with how to setup a project using either Visual Studio or XCode. This is actually a great design, and it’s thoughtful to include both operating systems (Linux is not officially supported by Epic yet, so I can’t knock the author on that one). When first starting with C++ programming, probably the hardest thing is not the syntax but understanding how to configure the project and settings in the IDE, so I like that this was covered first. Next Sherif moves onto the basics of programming: variables and memory (numbers and pointers), control flow (if, else, equality and comparison), looping (while and for loops), functions and macros, variable scoping, objects and classes, inheritance, and finishing up with dynamic memory allocation and arrays. Really quite a good foundation for learning C++. I found the explanation to be clear and concise, and the author did a good job of easing the reader into the information. C++ is a huge topic to cover, and there are volumes of text many times this size going deeper into the intricacies of the language. I wouldn’t actually fault the book for this, I think it’s a strength. Some novices may be overwhelmed by C++ if they start with something like Stroustrup’s 1,300 page tome. So I would say this is a great introduction to the language, and a great refresher if you’re coming back after a while.

The second half of the book is focused on Unreal development in particular. The author opens by discussing templates and containers in UE4, including some basic ones like TArray, TSet, TMap and then discussing the STL versions of these and how they differ in Unreal. He follows up with the first real example in the engine: an inventory system (with a UI) and the ability to pickup items in the world. I like this approach as it’s a real tangible task that many games would include. The author then shows how to code NPCs that are able to display a text message to the player. Next, Sherif talks about how to create monsters – basically enemy characters that can chase and attack the player. He closes with adding spell casting (including the code and setup of the particle system).

So this is not a book that will show you “How to Make a Complete AAA Game in 24 Hours” but I don’t think that was the intention. What the author does is introduce C++ at the right pace, and also show how to get started with applying that knowledge to developing games in Unreal 4. In some ways, it almost feels like two separate books: one on basic C++ programming, and another on coding in C++ for Unreal Engine 4. This is not necessarily a bad thing, and I think both parts are worthwhile. Really, this book would be most valuable to someone that has little experience with C++ and is also new to using C++ in UE4. If you are already a C++ pro, the first half of the book may seem too basic. However, I think the Unreal coverage can be useful to developers of varying skill levels.

Overall I enjoyed Learning C++ by Creating Games with UE4 and would entirely recommend it to anyone interested in gaining knowledge in C++ for Unreal. To be honest, this is one of the only books out there on the topic right now, so it sort of stands alone. I believe it’s taken me a little over a week to read the 342 page text. Certainly, it doesn’t cover everything you need to know (not even close) but it’s a great place to start. I’d also add that I read the book on the Kindle Fire HDX, and the formatting looked pretty good. The price on the e-book was also much more affordable, so now may be a good chance to upgrade if you’ve still been reading on ink and paper.

3D Engine, Graphics, Tutorial, Unreal

Tutorial: How To Make a Cube Roll On A Grid in Unreal Engine 4


In this tutorial, I will show how to make a cube roll from side-to-side on a grid. This project took me around 3 days to complete, though much of that was wrapping my head around basic things in UE4. Some of the areas explored here include setting up key bindings and action mapping, setting and clearing timers, and rotating around an arbitrary point.

First, you want to start by setting up the action mapping. What this does is basically binds an input button (like a keyboard key) to a particular action (really just a name that you make up). For this test I needed 4 keys for up, down, left and right. Since the arrow keys and WASD were already used by the default Unreal fly camera, I choose to employ the IJKL keys to move the cube around. These options are found in “Settings->Project Settings->Engine->Input->Bindings”.

UE4_Cube_Grid_01

Next, we will need to connect those actions to a function in order to make something happen on the screen. You can do this by creating an “InputAction” Blueprint and choosing the name you created (like “Action_Up”). I set these actions to call a function I created for this example called “StartMoving”. In some cases, you may want to bind the action to a custom event, which may simplify the code and allow for a cleaner Blueprint (as you can use events to effectively “jump” to other points in the same Blueprint without a line connecting them). In this case, I had to pass in some state (to know which direction the cube is moving) so using a function was better suited for the job.

UE4_Cube_Grid_02

The “StartMoving” function is not that complex. All it does it check first if the timer is active (to avoid registering input while the cube is already moving), save some state on the cube itself (the direction of movement and it’s last position), and then creates a timer to handle the animation.

UE4_Cube_Grid_03
The key part is the creation of the timer itself, using “SetTimer”, which is shown below. You can think of a timer as spawning another process or thread that can run concurrently with your main logic. The timer just calls a function of your choice (“MoveTween” in this example), at a specified time interval (use 0.0166 for a 60Hz animation cycle, which looks smooth enough). You can also set whether it loops or not, we use looping in this case.

UE4_Cube_Grid_06
Finally, we have the “MoveTween” function, which is what is called by the timer and what does all the math calculation to rotate around a particular axis and point in space. It’s also what animates the cube, and clears the timer at the end itself. It’s very useful to be able to spawn a timer, and then have it terminate itself when necessary. The full function is shown below.

UE4_Cube_Grid_04

Really, the core math of the method is done by two function included in UE4, “RotateVectorAroundAxis” and “RotatorFromAxisAngle”. We first create a axis based on the movement direction. Then we subtract the pivot point (in our case, the bottom edge of the cube), rotate around that axis, and then add the pivot point back to the location. The rotation around axis logic is actually based on an example shown on the Unreal Answer Hub, though it was modified to fit my purpose.

UE4_Cube_Grid_05

And that is basically it. I’ve even included the full project file below for you to download and experiment. I imagine this type of motion could be used for a type of puzzle game created in Unreal Engine 4. Download Link: UE4.7.4 Cube Motion Project Files

3D Modeling, Art, Game Engine, Graphics, Review

Review: Maya Studio Projects: Game Environments and Props by Michael McKinley

MayaGameEnvironments

This is a book with a solid focus, and I feel like it accomplishes it’s goal nicely. Basically what Maya Studio Projects is about is creating environment objects and props for games (as the title implies). There are 9 chapters, and each one chooses a different object to model. McKinley is very detailed in his explanation, and really shows each and every step needed to follow along. Some of the objects modeled include walls and floors, foliage, weapons, vehicles, buildings, lamps, and a simple object animation. Supposedly there is a DVD companion, but I got the Kindle e-book and usually don’t bother with looking at the discs.

What I like most about Maya Studio Projects: Game Environments and Props by Michael McKinley is that the book is very much geared toward game artists. While pre-rendered art and game art do require the same skills, there is a slightly different thought process and flow when you are working within the limitations of a real-time game engine. The author does not assume you are using any particular engine (though Unreal is named a few times) and the techniques can be used in almost any modern engine. However, the instruction steps are very much tailored for Maya. While this is great if you want to follow along, step for step, it may make it more difficult if you use another package. Also, I typically like to just read along and sometimes I felt the author was too specific in each step, making it harder to extract the general philosophy of modeling. This can be a pro or con depending on what you are looking for. I would have also enjoyed more pictures. Sometimes as much as 10 or 12 steps were made in text alone and it can be slightly confusing without a demonstrating photo.

To sum it up, this was a fine book and I learned a little bit. I would not say it was exceptional, but there was nothing grossly wrong with it. Certainly, if you are looking to create props with Maya (especially man-made objects) this is not a bad place to start. If you are using Maya LT for game development, this is a very relevant book since it (thankfully) doesn’t use really any of the features missing in the LT version. One slight disappointment, McKinley doesn’t actually show you how to make the nice art on the cover. Can’t hold that against him, though. I’d consider this a great beginner’s book, and should help to get you started with 3d game modeling.

3D Modeling, Review

Review: 101 Autodesk Maya Tips by Dave Girard

MayaTips

This was a short book, so I’ll give it a short review. Basically, 101 Autodesk Maya Tips is exactly what it sounds like: a compilation of quick tips for using Autodesk Maya. Some of the tips are as brief as one sentence, but a few are more involved. It seemed like the majority of the content was based around Mel scripting, and various ways to automate particular tasks. I have not worked with Mel scripting much, and am still trying to wrap my head around the interface and UI of Maya. Girard does, thankfully, include some more basic tips as well.

With a book like this, I was not expecting any grand revelations. The goal appears to be just to highlight some shortcuts and methods for getting more out of Maya. Certainly, I can’t complain about the price (at $3) and I finished the book in probably about an hour. All in all, I guess only really a handful of the tips were immediately useful to me, though it was great to see what’s possible. For that, I found it worth the meager cost and time investment. Hopefully you will find some value too in this quick read.

3D Engine, Graphics, Tutorial, Unreal

Tutorial: How To Make a Textured Spinning Cube Using Unreal Engine 4


 

Today I will show how to create a textured spinning cube using Unreal Engine 4. Making a cube spin is basically what I consider the “litmus test” of 3D engines. How long it takes you to figure this out will show how convenient or capable the engine is. While I might have skipped this test (by jumping straight into creating Pong) I thought it was worthwhile to go back and try it. Hopefully this tutorial will be helpful to some of you just getting started.

UE4_Rotate_Cube

First thing you should do is create a new blank project. I chose to make the project with the starter content (and deleting the furniture) however that won’t be important for this guide. Next look on the left-hand panel, make sure you are in place mode (the icon with the cube), and look under basic and find Cube. Now drag the cube into the scene. It will probably start inside the floor, so just press Q to go into move mode and then drag it up a little.

UE4_Rotate_Import

Since looking at a gray model is not that exciting, lets add some texture. In the Content Browser on the bottom, right-click in the empty area and select “Import to /Game…”. Then find your image file and press Open.

UE4_Rotate_Tex

You should see the new texture appear in the browser. Now drag this texture onto the cube model. You’ll see this automatically create a default material for you. With the cube still selected, click “Movable” in the Details panel on the right.

UE4_Rotate_Comp

The next step is to create the component Blueprint. You can do this by clicking the green “+Add Component” button on the top of the Details panel. Choose “New Blueprint Script Component”. In the pop-up window, pick Scene Component, click Next, type a name in, then click “Create Blueprint Class”.

UE4_Rotate_BP

In the new Blueprint window, you can delete the “Event Initialize Component” (though you can also leave it alone, won’t matter in this case). Pull off the output execution pin on “Event Tick” (it’s the white arrow looking thing on the upper-right). You should see a menu open. Start typing “rotation” and then pick “Add Relative Rotation”. In the Y field for “Delta Rotation” type in “1” and press Enter. Pull off the “Target” pin and type “parent” then click “Get Attach Parent”. Now you can save and compile the script.

UE4_Rotate_Play

Switch back to the main editor window and press “Play”. That’s it! Hopefully this tutorial was useful to some people (please let me know in the comments). I plan to produce more of these in the future, and they should gradually get more complex as I get more familiar with the engine.

It’s really quite amazing how quick and easy it is to work with Unreal. Using straight C++ and DirectX, one would be lucky to make a textured spinning cube in 2 hours, let alone 2 minutes. It really speaks to the robustness of the engine. Of course, I still have a long way to go in terms of learning the engine, so please follow me on this journey (and pray I don’t give up on this one).