Related

In the fall of 1915, after ten years of analysis, Albert Einstein presented his gravitational field equations of general relativity in a series of lectures at the Royal Prussian Academy of Sciences. The final lecture was delivered on November 25th, 104 years ago.

Yet it wasn’t until a month or so ago that I got a bug up my butt about general relativity. I was focused on some of the paradox-like results of the special theory of relativity and was given to understand, without actually understanding, that the general theory of relativity would solve them. Not to dwell in detail on my own psychological shortcomings, but I was starting to obsess about the matter a bit.

Merciful it was that I came across The Perfect Theory: A Century Of Geniuses And The Battle Over General Relativity when I did. In its prologue, author Pedro G. Ferreira explains how he himself (and others he knows in the field) can get bitten by the Einstein bug and how one can feel compelled to spend the remainder of one’s life investigating and exploring general relativity. His book explains the allure and the promise of ongoing research into the fundamental nature of the universe.

The Perfect Theory tells its story through the personalities who formulated, defended, and/or opposed the various theories, starting with Einstein’s work on general relativity. Einstein’s conception of special relativity came, for the most part, while sitting at his desk during his day job and performing thought experiments. He was dismissive of mathematics, colorfully explaining “[O]nce you start calculating you shit yourself up before you know it” and more eloquently dubbing the math “superfluous erudition.” His special relativity was incomplete in that it excluded the effects of gravity and acceleration. Groundbreaking though his formulation of special relativity was, he felt there had to be more to it. Further thought experiments told him that the gravity and acceleration were related (perhaps even identical) but his intuition failed to close the gap between what he felt had to be true and what worked. The solution came from representing space and time as a non-Euclidean continuum, a very complex mathematical proposition. The equations are a thing of beauty but also are beyond the mathematical capabilities of most of us. They have also been incredibly capable of predicting physical phenomena that even Albert Einstein himself didn’t think were possible.

From Einstein, the book walks us through the ensuing century looking at the greatest minds who worked with the implications of Einstein’s field equations. The Perfect Theory reads much like a techno-thriller as it setts up and then resolves conflicts within the scientific world. The science and math themselves obviously play a role and Ferreira has a gift of explaining concepts at an elementary level without trivializing them.

Stephen Hawking famously was told that every formula he included in A Brief History of Time would cut his sales in half. Hawking compromised by including only Einstein’s most famous formula, E = mc2. Ferreira does Hawking one better, including only the notation, not the full formula, of the Einstein Tensor in an elaboration on Richard Feynman’s story about efforts to find a cab to a Relativity conference as told in Surely You’re Joking, Mr. Feynman. The left side of that equation can be written as, Gμν. This is included, not in an attempt to use the mathematics to explain the theory, but to illustrate Feynman’s punch line. Feynman described fellow relativity-conference goers as people “with heads in the air, not reacting to the environment, and mumbling things like gee-mu-nu gee-mu-nu”. Thus, the world of relativity enthusiasts is succinctly summarized.

The most tantalizing tidbit in The Perfect Theory is offered up in the prologue and then returned to at the end. Ferreira predicts that this century will be the century of general relativity, in the same way the last century was dominated by quantum theory. It is his belief we are on the verge of major new discoveries about the nature of gravity and that some of these discoveries will fundamentally change how we look at and interact with the universe. Some additional enthusiasm shines through in his epilogue where he notes the process of identifying and debunking a measurement of gravitational waves that occurred around the time the book was published.

By the end of the book, his exposition begins to lean toward the personal. Ferreira has an academic interest in modified theories of gravity, a focus that is outside the mainstream. He references, as he has elsewhere in the book, the systematic hostility toward unpopular theories and unpopular researchers. In some cases, this resistance means a non-mainstream researcher will be unable to get published or unable to get funding. In the case of modified gravity, he hints that this niche field potentially threatens the livelihood of physicists who have built their careers on Einstein’s theory of gravity. In fact, it wasn’t so long ago that certain aspects of Einstein’s theory were themselves shunned by academia. As a case in point, the term “Big Bang” was actually coined as a pejorative for an idea that, while mathematically sound, was too absurd to be taken as serious science. Today, we recognize it as a factual and scientific description of the origin of our universe. Ferreira shows us a disturbing facet of the machinery that determines what we, as a society and a culture, understand as fundamental truth. I’m quite sure this bias isn’t restricted to his field. In fact, my guess would be that other, more openly-politicized fields exhibit this trend to an even greater degree.

Ferreira’s optimism is infectious. In my personal opinion, if there is to be an explosion of science it may come from a different direction that what Ferreira implies. One of his anecdotes involves the decision of the United States to defund the Laser Interferometer Space Antenna (LISA), a multi-billion dollar project to use a trio of satellites to measure gravitational waves. To the LISA advocates, we could be buying a “gravitational telescope,” as revolutionary in terms of current technologies as radiotelescopy was to optical telescopes. The ability to see further away and farther back in time would then produce new insights into the origins of the universe. But will the taxpayer spend billions on such a thing? Should he?

Rather than in the abstract, I’d say the key to the impending relativity revolution is found in Ferreira’s own description of the quantum revolution of the past century. It was the engineering applications of quantum theory, primarily to the development of atomic weapons, that brought to it much of the initial focus of interest and funding. By the end of the century, new and practical applications for quantum technology were well within our grasp. My belief is that a true, um, quantum leap forward in general relativity will come from the promise of practical benefit rather than fundamental research.

In one of the last chapters, Ferreira mentions that he has two textbooks on relativity in his office. In part, he is making a point about a changing-of-the-guard in both relativity science and scientists, but I assume he also keeps them because they are informative. I’ve ordered one and perhaps I can return to my philosophical meanderings once I’m capable of doing some simple math. Before I found The Perfect Theory, I had been searching online for a layman’s tutorial on relativity. Among my various meanderings, I stumbled across a simple assertion; one that seems plausible although I don’t know if it really has any merit. The statement was something to the effect that there is no “gravitational force.” An object whose velocity vector is bent (accelerated) by gravitational effects is, in fact, simply traveling a straight line within the curvature of timespace. If I could smarten myself up to the point where I could determine the legitimacy of such a statement, I think I could call that an accomplishment.

Artificial, but Intelligent? Part 2

I just finished reading Practical Game AI Programming: Unleash the power of Artificial Intelligence to your game. My conclusion is there is a lot less to this book than meets the eye.

For someone thinking of purchasing this book, it would be difficult to weigh that decision before committing. The above link to Amazon has (as of this writing) no reviews. I’ve not found any other, independent evaluations of this work. Perhaps you could make a decision simply by studying the synopsis of this book before you buy it. Having done that, it is possible that you’d be prepared for what it offered. Having read the book, and then going back and reading the Amazon summary (which is taken from the publisher’s website), I find that it more or less describes the book’s content. In my case, I picked this book up as part of a Humble Book Bundle, so it was something of an impulse buy. I didn’t dig too hard into the description and instead worked my way through the chapters with my only expectations being based on the title.

Even applying the highest level of pre-purchase scrutiny only gets you so far. The description may indicate that the subject matter is of interest, but it is still a marketing pitch. It gives you no idea of the quality of either the information or the presentation. Furthermore, I think someone got a little carried away with their marketing hype. The description also tosses out some technical terms (e.g. rete algorithm, forward chaining, pruning strategies) perhaps meant to dazzle the potential buyer with AI jargon. The problem is, these terms don’t even appear in the book, much less get demonstrated as a foundation for game programing. I feel that no matter how much upfront research you did before you bought, you’d come away feeling you got less than you bargained for.

What this book is not is a exploration of artificial intelligence as I have discussed that term previously on this website. This is not about machine learning or generic decision-making algorithms or (despite the buzz words) rule-engines. The book mentions applications like Chess only in passing. Instead, the term “AI” is used as a gamer might. It discusses a few tricks that a game programmer can use to make the supposedly-intelligent entities within a game appear to have, well, intelligence when encountered by the player.

The topic that it does cover does, in fact, have some merit. The focus is mostly on simple algorithms and minimal code required to create the impression of intelligent characters within a game. Some of the topics I found genuinely enlightening. The overarching emphasis on simplicity is also something makes sense for programmers to aspire to. There is no need to program a character to have a complex motivation if you can, with only a few lines of code, program him to appear to have such complex motivation. It is just that I’m not sure that these lessons qualify as “unleashing the power of Artificial Intelligence” by anyone’s definition.

But even before I got that far, my impression started off very bad. The writing in this book is rather poor, in terms of grammar, word usage, and content. In some cases, misused words become so jarring as to make it difficult to read through a page. Elsewhere, there will be several absolutely meaningless sentences strung together, perhaps acknowledging that a broader context is required but not knowing how to express it. At first, I didn’t think I was going to get very far into the book. After a chapter or so, however, reading became easier. Part of it may be my getting used to the “style,” if one can call it that. Part of it may also be that there is more “reaching” in the introductory and concluding sections but less when writing about concrete points.

I can’t say for sure but it is my guess, based on reading through the book, that the author does not use English as his primary language. I sometimes wondered if the text was written first in another language and then translated (or mistranslated, as the case may be) into English. Beyond that, the book also does not seem to have benefited from the work of a competent editor.

The structure of the chapters, for the most part, follows a pattern. A concept is introduced by showcasing some “classic” games with the desired behavior. Then some discussion about the principle is followed by coding example, almost always in Unity‘s C# development environment. This is often accompanied by screenshots of Unity’s graphics, either in development mode or in run-time. Most of the chapters, however, feel “padded.” Screenshots are sometimes repetitious. Presentation of the code is done incrementally, with each new addition requiring the re-printing of all of the sample code shown so far along with the new line or lines added in. By the end of the chapter, adding a concept might consist of two explanatory sentences, 3 screenshots, and two pages of sample code, 90% of which is identical to the sample code several pages earlier in the book. This is not efficient and I don’t think it is useful. It does drive the page count way up.

I want to offer a caveat for my review. This is the first book I’ve read from this publisher. When reading about some of their other titles, it was explained that the books come with sample source code. If you buy the book directly from the publisher’s website (which I did not), the sample code is supposed to be downloaded along with the book text. If you buy from a third party, they provide a way to register your purchase on the publisher’s site to get access to the downloads. I did not try this. If this book does have downloaded samples that can be loaded into Unity, and those samples are well-done, that has a potential for adding significant value over the book on its own.

Back to the chapters. When I start going through the chapters, again it feels like there is some “padding” going on to make the subject matter seem more extensive than it is. The book starts with two chapters on Finite State Machines FSM and how that logic can be used to drive an “AI” character’s reactions to the player. Then the book takes a detour into Unity’s support for a Finite State Machine implementation of animations, which has its own chapter. This is most irrelevant to the subject of game AI and also, likely, of little value if you’re not using Unity.

After the animation chapter, we head back into the AI world with a discussion of the A*, and the Theta* variant thereof, pathfinding algorithm. This discussion is accompanied by a manual optimization solution of a simple square-grid based 2D environment, describing each calculation and illustrating each step. I do appreciate the concrete example of the algorithm in action. Many explanations of this topic I’ve found on-line simply show code or pseudo-code and leave it to the “student” to figure it all out. In this case, I think he managed to drive the page count up by and order of magnitude over what would have been sufficient to explain it clearly.

The final chapters show how Unity’s colliders and raycasting can be used to implement both collision avoidance and vision/detection systems. These are two very similar problems involving reacting to other objects in the environment that, themselves, can move around. As I said earlier, there are some useful concepts here, particularly in emphasizing a “keep it simple” design philosophy. If you can use configurable attributes on your development tool’s existing physics system to do something, that’s much preferable to generating your own code base. That goes double if the perception for the end user is indistinguishable, one method from the other. However, I also get the feeling that I’m just being shown some pictures of simple Unity capabilities, rather than “unleashing the power of AI” in any meaningful sense.

A few year’s back, I was trying to solve a similar problem, but trying to be predictive about the intent of the other object. For example, if I want to plot an intercept vector to a moving target but that target is not, itself, moving at a constant rate or direction, I need a good bit more math than the raycasting and colliders provide out of the box. Given the promise of this book’s subject matter, that might be a problem I’d expect to find, perhaps in the next chapter.

Alas, after discussing the problem of visual detection involving both direction and obstacles, the book calls an end to its journey. With the exception of the A* algorithm, the AI solutions consist almost entirely of Unity 3D geometry calls.

Although the book claims to be written in a way such that each chapter can be applied to a wide range of games, I feel like it narrows its focus as it progresses. The targeted game is, and I struggle with how to describe it so I’ll just pick an example, the heirs to the DOOM legacy. By this, I mean games where the player progresses through a series of “levels” in order to complete the game. What the player encounters through those levels is imagined and created by the designer so as to construct the story of the game. The term AI, then, distinguishes between different kinds of encounters, at least as far as the player perceives them. For example, the player might find herself rushing across a bridge, which starts to collapse when they reach the middle. This requires no “AI.” There is simple programmed in that, when the player reaches a certain point on the bridge, call the “collapseBridge” routine. If she makes it past the bridge and into the next chamber, where there are a bunch of gremlins that want to do her in, the player starts considering the “AI” of those gremlins. Do they react to what the player does, adopting different tactics depending on her tactics? If so, she might praise the “AI.” By the books end, the focus is entirely on awareness of and reaction between mobile elements of a game which, by defining the problem as such, is the subset of games in this category.

My harping on the narrow focus of this book goes to the determination of its value. If this book were free or very low cost, you would have to decide whether the poor use of English and the style detract from whatever useful information is presented. The problem with that is the price this book asks. The hardcopy (paperback) of the book is $50.00. The ebook is $31.19 on Amazon, discounted to $28 if you buy directly from the publisher’s site. All of those seem like a lot of money, per my budget. Now, my own price I figure to have been $7. I bought the $8 bundle package over the $1 package purely based on interest in this title. This is the first book in that set I’ve read, so if some of the others are good, I might consider the cost to be even lower. Still, even at $5, I feel like I’ve been cheated a bit by the content of this book.

The bundle contained other books from this same publisher, so I’ll plan to read at least one other before drawing any conclusions about their whole library. Assuming that the quality of this book is, in fact, an outlier, this is still a risk to the publisher’s reputation. When one of your books is overpriced and oversold, the cautious buyer should assume that they are all overpriced and oversold. Looking at the publisher’s site, this book has nothing but positive reviews. It’s really a blemish on the publisher as a whole.

Although I won’t go so far as to say “I wish I hadn’t wasted the time I spent reading this,” I can’t imagine any purchaser for whom this title would be worth the money.