20050226

Consumption frenzy

Got the books! Yay!

Quickly read Money 201 and managed to be uplifted and depressed at the same time. Looks like I've been doing many things right, but a few wrong. Unfortunately, to do those things right, I'll require more money. Or slack off on pre-paying parts of the mortgage. But I hate paying interest, regardless of what finance books say. I should write my own book, maybe.

Read Exceptional C++ style rather quickly. I feel relatively good about it--it's a good book, and it looks like I'm not too rusty. But, to my dismay, I'm also not that interested in all those dark corners anymore (something I've alluded to in previous posts). Still, I wish the "smaller language screaming to get out" Bjarne Stroustrup mentioned when talking about C++ would come to light. The closest I've found so far is Python, and its library is growing a bit messy.

Speaking of libraries, I've had the opportunity to look in the Java libraries for a few things. I was trying to get some substring appends to be efficient. Unfortunately, StringBuffer does not have an append(String, int, int) operation--only an append(char[], int, int) operation. So I had to call substring() (which is bad, but better from a garbage generation point of view than toCharArray() or whatever it's called). Man, I wish for the nth time I could get access to the internal array. Actually, StringBuffer could, if the String's array were package-private, and in my view, this would be a very sensible design.

Anyhow, I look around for a solution, and it looks like Writer has a substring write operation. So, I think, maybe I can change my code to work through a writer instead. But, being curious, I wonder if they just go through the whole array char-by-char, or maybe chunk stuff in a pooled buffer.

The answer is: none of the above. They call substring().

Also annoying, they don't let you create a StringWriter on an existing StringBuffer, but you have access to the underlying StringBuffer anyhow. This is incredibly non-symmetrical and quite stupid.

Coming from the C++ world, I find myself constantly annoyed by the sheer lack of rigor in the design of the core parts of the Java libraries. Newer parts (such as the Collections system) show more care, but some very fundamental classes (such as java.lang and java.io classes) show sloppiness. So, you get new classes that have better concepts, such as java.nio and Collections. But what can they do about String? It's such a fundamental type, and yet they give no way to easily extend it. You can't even access the internal array. Of course, that's done for safety reasons (so nobody can modify the string in place, since the string is supposed to be immutable), but you can still access it anyhow with reflection and a custom class loader. Worse, as far as I can tell from the StringBuffer code, it's not as efficient as it could be, because it goes through the public interface of the string object.

This may sound like a nit, but efficient string manipulation is extremely important. You want to have a language that lets you do as much as you can with as few temporary buffers as possible. Especially when object allocation and garbage collection are as slow as in many JVMs. I've had many sites run out of memory because they did extra copies of incoming requests and outgoing responses. Granted, they shouldn't do that, but given the API provided, it's the most natural way. I mean, I keep seeing (and writing!) code that does such things as "string("+s+")" even though it's inefficient. If it's inefficient, why is it the most natural way of doing things? At least, in C++, the compiler has a chance to collapse the temporaries! The specifications of the Java language prevent any sort of optimization for this construct. Bad.


Rant aside, I got one other thing--Xenosaga II. So far, I like it, although I couldn't fully believe it when they asked me to switch disks (I was a mere 8 hours in the game...). I hope the second disk is a bit longer. A lot of online reviews have complained how it's tedious and so on, but if they had a bit of a longer memory, they'd recall that Xenogears was pretty much the same. This new game feels more like the original Xenogears, with its long dungeons and somewhat higher level of difficulty. There's very few boss fights I finished in a singly try; I usually get killed at least once. This is a refreshing change from most modern RPGs, like Final Fantasy X-2 (which never felt very difficult--you have so much flexibility with jobs, and changeover is so fast, that it's hard to get stuck in an attrition battle with your enemy).

A couple of things are somewhat suboptimal with the game, though. First, I don't know why they messed with KOS-MOS' voice acting. It was excellent in the first Xenosaga, perfectly neutral and emotionless, except for a few (intentional) occasions. The new acting varies, going between somewhat neutral and somewhat whining. It just doesn't work; KOS-MOS is supposed to kick ass, not whine.

I'm also annoyed by the poor treatement they gave Yuki Kajiura's soundtrack. It's an awesome soundtrack, but in the game, the tracks are often cut before they finish (unforgiveable in a game that uses voice acting! The player does not control the rate of delivery, so efforts should be made to time the script to the music; Xenosaga I pulled it off much better), cover them with too much sound effects (disminishing their impact), and sometimes use them in strange contexts. How dare they make Kajiura's work sound so bland!

Load time in combat isn't that wonderful either. However, it's possible to level up relatively quickly, which puts a lot of tedium out of it. I prefer to have less more-difficult fights than to have to fight weak enemies 100 times to level up (like I've done often in FF VII). I might as well put a rubber band on the "O" button if I'm going to do that. I prefer games to treat me like a thinking being than like an automaton who just presses "O".

On the plus side, the fact that there's almost no segments with no BGM helps me enjoy the game quite a bit. The non-movie soundtrack is nothing really earth-shattering, but some tracks are very, very solid. Unlike many reviewers, I don't think it was a mistake to move from a symphonic soundtrack to a synthetic one. Symphonic soundtracks are popular in SF themes, mostly due to Star Wars and Star Trek. But synthetic soundtracks can work well, too--witness early Babylon 5. It's a matter of balance. Strong melodies should accent strong points, and trance-like tracks should be used for BGM in more repetitive parts.

And you gotta love the new character models. Too bad the hands are done with a thumb, index and block containing the three remaining fingers, all the time. That trick is used in Final Fantasy X and X-2 when there's too many characters in the scene, but Xenosaga II uses it all the time. It's a bit sloppy. But the nice face models and expressions make up for it.

I'll post a full review when I've finished the game. Which, at the rate I'm playing, will probably be next week-end or so.

No comments: