2006/01/24

Diana called this morning and warned me that traffic was really bad. I I flipped around local stations to look for news and traffic updates, and noticed something that I'd never really paid attention to before. Morning news, either locally or nationally, is sickeningly sweet and wholesome. Everything is health news, puppies that need to be rescued, Rod Luck frightening little children who are doing some fundraising, weathermen doing their wacky weatherman stuff. Such a contrast to evening news broadcasts. My guess is that people don't want to face bad news when they first wake up, but I wonder what kind of newcast Darwinism went on that resulted in morning news being so innocent.

Adam Carrolla has taken over for Howard Stern, and after some listening, he is officially added to my list of things that I could do without. "Now... here's the thing about the penis..."

I recently concluded my .NET Programming Challenge here at work. I had people write software that would solve a given Sudoku puzzle, and judged them on accuracy and speed. Including my own, there were five submissions. More than I expected, but not as many as I hoped for. It was great to see what people came up with. We have some smart people working here! I had 20 puzzles, and let the code chew on each one, timing how long each puzzle took to solve, and summing up those times to get a total score. Well, the resolution of the normal Windows timer comes down to about 16 milliseconds, and one guys solution registered as taking 0ms per iteration, and therefore the sum came to 0 as well! Pretty impressive. That prompted me to look up how to do high-precision timing, and I learned how to programatically access a timer that ticks about 2.7 billion times a second (on this machine). The timings I got went out to about 18 decimal places. Pretty damn cool. If you ever to time something really fast, I'm your guy.

That's about all my news for now. I officially submitted my request for sabbatical time off. June 26th to August 8th. This fits in pretty nicely with Diana's time off from school, giving her a week or two on either end. Plans are in the formulation phase, and currently include visiting Alicia in Sweden, hopefully visiting Mike in Germany, seeing my old Viennese stomping grounds, and a number of other possibilities. Exciting!

2006/01/20

Sometimes I impress myself.

In the game I'm playing, most of the time I'm controlling a person or a car, and the point of view is from a camera that is behind and a little above the me. When I move the mouse, it moves the camera around, but it's focal point remains on the character.

When you move the mouse left and right, the camera moves left or right as you'd expect. However, when you push the mouse forward or backwards, people disagree if they think the camera should move up or down. For this reason, the game makes have an option that you can access call "Invert Mouse Vertical Axis", which you can change to suit your own preference.

My problem is, depending on if I'm in certain vehicles or not (namely in a plane or not), I sometimes like that setting on, and sometimes off. And I really can't handle it when it's set the wrong way. It's like trying to write while looking in a mirror... all flipped around. What I've been doing has been going into the Options menu in the game and flipping that setting when I get in and out of planes, but after doing that a few times, I figured there must be a better way.

I did some research, and found part of my answer. This game has a very active "modding" community, who reverse engineer the game and play around with the internals. Specifically, they found the specific point in memory where the "Invert Mouse" setting is held. If that point in memory is a 1, then it's on. If it's a 0, then it's off. They also have tons of other memory address, that hold your characters x/y/z position in the world, money, stats... everything.

So I did some programming last night. I was able to write a program that looked for the game process in active memory (so, the game had to be running first). I was able to read and write values anywhere in this process memory space, so I wrote some code to write a 1 to the "Invert Mouse" address. Then I went into the game, made sure the setting was off, and tried running my program. What should have happened was that the setting got turned on.

It totally should have worked, but didn't. Bogus.

What I eventually found was that the memory address for that one specific setting was incorrect. When I tried other address, like other settings and money and stuff, everything worked as advertised. But that one specific setting, the ONLY one that I cared about, was incorrect. I was extrememly frustrated to find that the hard part (tweaking memory) actually was pretty easy, and the easy part (finding the right spot to tweak, which I thought was well published) was unfounded.

I took a break and had dinner. Diana had gotten home, and we chatted about our days. It's good to take breaks from problems.

After dinner, I did some more websearching, and realized that most of the Options menu stuff was stored in a particular region of memory. Most started at something like 0xBA0000. So, I modified my code to read 100,000 bytes of memory from 0xBA0000 into one buffer, then pause, then do it again, and then compare the buffers byte-for-byte. I then loaded up GTA, and ran my program, reading in memory until it paused. Then I went back to the game, flipped the Invert Mouse setting, and then continued the program, reading in the same block of memory to a second buffer, hopefully with a flipped bit.

When I ran through the comparison, I found that the buffers differed at offset 26437 in my buffers! Could this be it?

I converted 26437 to hex (0x6745h) and added it to my base search address (0xBA0000) to get the specific location, 0xBA6745. This single byte should hold the value of 1 or 0, and modifing that byte will change the "invert mouse" setting.

I modified my program yet again to flip the bit at that memory address when I hit a certain key. I then tested by going into the game, setting the option, alt-tabbing out and pressing a key in my app, and going back into the game to see that the option flipped. It totally worked. Rockin'. I was as jubilant at that moment as I was frustrated an hour earlier.

The hard part, it turns out, was that I now want my app to be running in the background while I play the game. But even in the background, I want it to listen to key presses so that, in mid game, I can hit some magic key and that will flip the option on the fly. It turns out that writing a key-spy like that (called a "hook") isn't very straightforward in the programming language that I'm using. Apparently it's debateable if it's even possible just using the language I'm using. But, I've found sample code that does it using a combination of languages (managed C# calling a C++ dll for doing the hooking), and I should be able to use that for my purposes.

The coolest thing about all this, aside from my own satisfaction at solving a tricky puzzle, is now the world is my oyster. I know where the game holds my money, for instance, and if I wanted I could give myself a million, billion dollars. I could teleport all over the world (potentially). I could whatever car I wanted at the push of a button (potentially). And I'm not just talking about this game, but the potential for this kind of manipulation is generalized across not only games, but all applications.

I feel like I've taken a little step into a much bigger world. I almost want to start World of Warcraft againt, just to try writing hacks for it. (Maybe Grand Theft Auto *is* a bad influnce! :)

2006/01/19

So I'm about 30 hours into playing Grand Theft Auto: San Andreas, and have really enjoyed every second of it. I've played a ton of video games in my life, and know a good one when I see it. What I'm interested in, though, is how can I claim to be a generally upstanding, moral person, yet claim to enjoy a game with allows the player to have his character decapitate policemen with shotguns, murder innocent bystanders with baseball bats, or hire a prostitute and have sex with her and then run over to kill her and get his money back? When it's put it like that, I must sound like an absolute psycho to non-gamers.

It definitely should be noted that I'm not the only one who enjoys this game. It's gotten rave reviews and "Game of the Year" type awards from many mainstream, reputeable industry magazines, as well as being THE top seller for all console games in 2004. So are we ALL sociopaths? Obviously not. So what's going on here?

I wrote a very long essay trying to answer those questions and reconcile the apparent contradictions, but I deleted it. I figured that gamers already intrinsically know what I'm talking about, and at some level, non-gamers will never really understand (unless, of course, they became gamers themselves...? Maybe that understanding is part of the definition of what makes a "gamer"?)

I think it's fair to say that judging the game based on what I said above is like judging a novel by reading a page, or a movie by a single clip. Such a limited view not only removes all context, but also implies that the rest of the game is equally gory and reprehensible, which simply isn't true.

For those who have played the game, I just completed flight school and did each task until I got 100%'s on everything. Doing that unlocks a helicopter that can do Vigilante missions (called "Brown Thunder"). Pretty cool. Flying rocks.

In other news, I watched a movie called "Game Over", which is a (biased) documentary regarding Kasparovs contraversial 1997 match against IBM's "Deep Blue" computer. The main thrust of the movie is Kasparov whining about losing to Deep Blue, strongly insinuating that some sort of cheating went on (without presenting any sort of real evidence), and generally coming off like a whiny little girl. There were also interviews with the Deep Blue team, so we got at least a little bit of their side of the story, but it's hardly balanced. Basically Kasparov easily won in Game 1, and then got his ass handed to him in Game 2 (where the computer made some remakably "human" move, which shocked him psychologically), and he couldn't get over it, insisting that the only possible explanation is that a human intervened mid-game. So, pretty interesting to someone who's into both computers and chess, but I don't think I'd recommend it to the general public.

In yet other news, Diana's awareness of her sleepiness astounds me. Last night, we were laying in bed talking. She was quiet for a few seconds, and then said "here it comes..." and literally a few seconds later, she was asleep. It's almost like her body just shuts down, sometimes in spite of her brain. Really fascinating.

2006/01/11

So, Lost is coming back on TV tonight.

I used to be fired up about Lost, but in doing some web searching, I read an interview with the creators. There was a question that was something like "You don't give out enough information! We want to know what happens!" The upshot of the answer was "Well, we could end the show at the end of season 3, where they all get rescued and live happily ever after. However, if we pitch that idea to the producers, they'll fire us and find someone else to do the show and extend it as far as they can."

The more I think about it, the more this sucks.

I think Lost would make a great movie, or maybe even miniseries. But when they stretch things out for so long, I don't think I'll be able to hang with it. It's not just that I want to know what happens, but the more they stretch out the plot and tease me, the more the fact that I'm being psychologically maniuplated is charging to the forefront of my consciousness. I don't like being teased, and I don't like being toyed with. I realize this happens very frequently with regard to television (that's really the point, isn't it? Trick me into watching advertisements?), but at least most of the time it's on a subconscious level.

I think at some point I'll just snap and say "Screw it, I really don't care anymore." For now, I'll play their little game. But consider this fair warning. :)

Speaking of things I don't like, I've added "gum chewing" my list. There were lots of gum-chewers (and gum "crackers") on the cruise, sending chills down my spine. Also, we had a guy come and give a talk here at work, and he was chomping on his gum while giving his lecture. Gross. I don't know why I have such an aversion to mouth-noises, but I do, so I claim this as nothing but a personal issue.

Cell phones are bothering me more and more. My friends joke about how I hate cell-phones, which was never really true. But more and more it's becoming true. Specifically: I don't like when calls are dropped. I don't like the weird conversation pauses that happen when two people try to talk at the same time. And most of all, I don't like it when people assume that I have a cell phone, and then wonder how I get by without one.

Ok. Sorry, I just had to get those off my chest. Thanks for listening. I feel better now.

In other news, Diana and I watched some really good documentaries recently. The first was the Academy Award winner for Best Documentary called "Born into Brothels". It's about a woman who was (for some reason) living and photographing women in brothels in Calcutta. After living there, she quickly became enamored with the children of the prostitutes, and when they were curious about her camera, she began to teach them about photography. She fosters their interest, and eventually takes their pictures to galleries back in the US, sells them, and uses the proceeds to pay to get the children into good boarding schools and out of the brothers. Very emotional and inspirational.

On the DVD was a preview for a movie called "Murderball", which follows some members of the US Quadrapalegic Rugby team. Quadrapalegic, I learned, doesn't necessarily mean that one can't move their arms or legs, but rather, they have some level of impairment to all limbs (typically paralyzed legs, and partially paralyzed arms/hands). The movie was fascinating, and opened my eyes to our wheelchair bound breathren. Both highly recommended. Check 'em out!

2006/01/04

So late last week I hung out a bit with Eryn and Iwan and Sara. We saw some movies, had some food, went on a hike, all the time just chatting about whatever friends chatted about. I spent New Years with them as well as other friends. I don't want to get all mushy or anything, multiple times within the past week or so I've really appreciated what good people my friends are, and how much I enjoy being around them. I don't feel like I have that many friends, but I'm glad that I have the ones that I do.

For New Years a couple of us headed up to the Buhrs for a night of revelry and fun. A good time was had by all. I'm not normally a big drinker, but somehow found myself over-indulging (quite unintentionally!) and feeling pretty bad for much of the next day. Ugh. But all is well now, and my limits have been even more finely tuned. Nothing like starting the New Year with the resolution "I'm never drinking again!" Ha!

I bought "Grand Theft Auto: San Andreas" this weekend and have spent a bit of time playing it, and I'm really, really enjoying it. The game takes place in an LA-like city in the early 90's, and from what I know of South Central gangland LA (all gleaned from the music of NWA and Eazy-E, as well as a couple of movies), they pretty much nailed it. It's a great mix of free-form exploration and do-what-you-want, as well as structured missions and mini-games within the game. It has received very high reviews and awards from several reputable game magazines and sources, and I totally agree.

GTA has always been very contraversial in the media, and I'm sure I'll have more thoughts on that as I get through more of the game. The best comment, I think, is from the producers of the game who said that commenting on the game (which can take up to 50 or 100 hours) without playing it is like commenting on a book after reading a single page, or a movie just after watching a single scene. From what I've seen, I totally agree.

S'about it for now.