For a while, my mother was a semi-professional opera singer. As she would practice, she would sing in various languages that were not familiar to me — German and Italian being predominant. She would also make me watch various operas on video or when they would come on TV. When I expressed that I was somewhat bemused by the fact that I couldn’t understand what the singers were saying, she pointed out that the story was generally written out in the program. For those of you who haven’t had the pleasure of experiencing this process, it’s worse than sub-titles in that there is no synchronization between what you can understand and what they are actually doing. (Also, a darkened theater is less than conducive to reading along.)
At one point, I had discovered that some of the operas had been translated to English. I thought this was a perfectly acceptable solution to the problem… until my mother told me that “it’s just not the same”. Since my mother, despite being able to pronounce the German and Italian words as she sang, was not even remotely familiar with either language, I didn’t see how she could make the claim that they “just weren’t the same.” I suppose someone told her. Regardless, my position was that if I could understand the mildly adulterated version, it was far more valuable to me than not being able to comprehend the perfect original.
Twenty-five years later, I can see what she was talking about. Being reasonably adept in Spanish and having some French and German under my belt, I can see how there are certain things that just wouldn’t be able to make the jump from one language to another — at least not gracefully. Many idiomatic expressions are pretty dicey to translate. What’s more, when you are in a song or poem format and you really have your heart set on rhyming, good luck trying to keep that rhyme going in the new language. You can still get the point across but, without the rhyme, it won’t be as “elegant”.
Not My Native Tongue
That being said, I was recently privy to a conversation where a student in an introductory course on AI was being taught iterative deepening search in, of all things, Scheme. Now I don’t know enough about Scheme to fall one way or another… just as I don’t know enough about Italian to say whether or not the Verdi’s Aida is decent in its original language. (Of course, I don’t know enough Aida to tell you whether it is decent in English either.) However, in a game programming world dominated by C++, I would question the merits of teaching in anything other than C++.
“Oh, I remember how to do that… but I learned it in Scheme. How would I do this in C++?”
From a practical standpoint, the student is learning two things at the same time — the algorithm AND how to do it in Scheme. If you were to then ask the student to program you an iterative deepening search in your game, he now has to go through an extra layer of translation in order to do so. He has to say “Oh, I remember how to do that… but I learned it in Scheme. How would I do this in C++?” In essence, he now needs to look down at his program during the performance.
“It may be in a language you can understand… but it is just not the same content.”
On the other hand, there is just some stuff that you can’t pull off in other languages. What if you have access to some really nifty code, complete with complicated, upper end data structures that has been written in C++ (as is most of the code in books, for example) but the project requires you to script it in Lua or Python? While the scripting languages of today are getting more and more powerful, there are just some things that you either can’t do well in them or can’t do as quickly in them. (In fact, there are some things you simply can’t do at all.) So, while the original code may have been a thing of elegance and beauty, you now have something that kinda resembles it and may accomplish something of the same function… but its not as good as the original. At that point, just like the translated opera, it may be in a language you can understand (and even sing along with) but it is just not the same content.
Sharing Ideas vs. Sharing Code
The reason that I find this important is that the #2 item on last week’s poll, “What’s Holding Back Game AI?” was “Insufficient Code Sharing & Reuse”. In a way, this also spins out of my column from a few weeks back, “Programming, Pictures, Presentations or Prose?” where I talked about the best way of sharing knowledge and concepts. We are all used to sharing those via papers, lectures, message boards or what-not. However, it’s that sticky bit about sharing code that could generate problems — if not now, then possibly later.
“While I can certainly share an idea with him, this prevents me from sharing my code with him.”
For example, my brother is diligently working on a game project of his own. While he is a very good programmer, he swears entirely by VB. When he has asked me to help him by doing some AI work, I have had to turn him down. I simply don’t want to do it in VB despite the fact that I’m fluent in it. I’ll do VB for business apps, but not for my AI programming. There is too much of my existing code or stuff that I would cull from the likes of AI Game Programming Wisdom books that is written in C++. While I can certainly share an idea with him, this prevents me from sharing my code with him.
To his credit, though, one of the knocks on C++ is that it is stagnating while other things are moving forward. Because so much of our code base — and the associated knowledge — is lodged in C++, however, we may be left behind. I don’t know. I’m not playing Prophet here (I did the whole biblical thing 2 weeks ago), just pointing out that we are good and entrenched right now.
As another example, many of us veterans have pointed people in the direction of Craig Reynolds’ page on Steering Behaviors For Autonomous Characters, the original code that generated the cool little web examples was in Java. Sure, I could look at it… but even if I was fluent in Java, I wouldn’t be able to simply drop it into my own code. That has been remedied recently by creating C++ implementations of them as OpenSteer. Now, I can use those bits and pieces in my own code… unless, of course, I’m working for my brother in VB.
So is there a way that we can write our material so that it goes beyond the specifics of languages? I’m not so sure. Steve McConnell did a great job of removing some of the specifics of language in his perennial favorite style manual, “Code Complete“. In many places he gave examples that worked well in any language. In others, he simply gave short examples in many of the standard languages. However, I can’t see either one of those approaches working for either teaching or exchanging ideas. While you can explain the idea behind the iterative deepening search in English or even pseudo-code, you still have to teach people the appropriate data structures in order to create it… and data structures often have that prickly little bit about being very language-dependant.
So how much of this is a problem? Is there a way of getting beyond this divide? Should there be standards in teaching game AI such that what is taught is immediately applicable without modification in the production world (e.g. no Scheme)? Should all code-sharing in books be done in C++ and/or Lua? (It is already, but that may need to be enforced down the road.) Or, in a really whacked out idea, does the game world need to find a new home outside of C++?
Or should we all just bring little flashlights and try to follow along with the libretto in the dark of the opera house?