Kevin Vance - I did something yesterday that I've never done before, in my 21 years…

Entries | Archive | Friends | Friends' Friends | User Info

05:20 pm

Monday, September 20th, 2004
Previous Entry Share Next Entry
I did something yesterday that I've never done before, in my 21 years on Earth. And now I must write this entry...

I bought a console! Having never owned a Nintendo, or a Sega, or a Playstation--ever--I came back from Best Buy yesterday with the $99 Nintendo GameCube, with Metroid Prime included.



So I guess now I'm a console gamer. But at long last, I can return to my Ikaruga.



Interesting story about that Ikaruga screen shot. My monitor has a nice pivot ability, and Ikaruga has a nice display-the-screen-vertically ability. This sounded great, until I actually tried it. Of course, the result was an upside-down game. My monitor only pivots one way, the game only pivots the other way.

You can imagine my dismay.

I fumbled around for an hour with Xrandr, the resize and rotate extensions for X. These, of course, were useless since nvidia did not decide to support rotation in their linux driver. I tried using the X software rotate (available when you disable Xrandr), but that made tv input unavailable.

I found a temporary solution using mplayer's flip and mirror filters, with its tv input:

mplayer -fs -vf lavcdeint,mirror -flip -tv driver=v4l2:device=/dev/video0:input=1 tv://

This is not really usable for games, however. It was not smooth. Probably related to the fact that mplayer is pulling in the frames at 30fps and showing them at 30fps deinterlaced. A good tv application pulls the frames and shows them at 60fps deinterlaced. Sadly, the only good tv application for linux does not have a rotation feature. So, I did what any desperate hacker would do, and added these lines to xvoutput.c:

// This is insane
uint16_t *wdata = (uint16_t *)image_data;
int end = (input_width*input_height)-1;
for(int i = 0; i <= end/2; i++) {
  wdata[i] ^= wdata[end-i+1];
  wdata[end-i+1] ^= wdata[i];
  wdata[i] ^= wdata[end-i+1];
}


This is probably the most terrible thing I've programmed since starting my computer science education. We go right into the VIDEO OUTPUT CODE, and swap the pixels right in the XvShm buffer to get a 180 degrees rotation. But I was in a hurry, dammit!

Also, Metroid Prime is pretty fun too. Imagine, circle-strafing with one of these funky console controllers.



Edit: Maybe I should start posting all my code to LJ, since apparently that's the only time I read it to myself. Did you notice the funny end-1, which was corrected in the main loop with ~600000 increment instructions per frame? It's funny to me how 600000 instructions every 16ms just has no impact on performance at all. But for correctness:

int end = input_width*input_height;
for(int i = 0; i <= end/2; i++) {
  wdata[i] ^= wdata[end-i];
  wdata[end-i] ^= wdata[i];
  wdata[i] ^= wdata[end-i];
}

Link )Reply )

Comments
[User Picture]From: czircon
2004-09-20 09:43 pm (UTC)

Oh, how I envy you with your platinum Gamecube and your TV input and your pivoting monitor and your coding skills and your copy of Ikaruga. But not your cheap memory card.
(Reply) (Thread)
[User Picture]From: myth
2004-09-20 10:06 pm (UTC)

That is awesome

I'd been thinking of doing the same thing, now that the price is right. (I have an SP, but it's not the same thing.) Why'd you choose GC over PS2 or xbox?
(Reply) (Thread)
[User Picture]From: endril
2004-09-20 10:12 pm (UTC)
There isn't an Ikaruga for PS2 was probably his reason. Although PS2 does have a lot of good games
And zzz xbox. The selection of good games for Xbox is very limited. And it's MICRO$OFT$$$$$ OMG EVIL
(Reply) (Parent) (Thread)
[User Picture]From: kvance
2004-09-20 10:37 pm (UTC)

Re: That is awesome

Endril got it right. When I bought Ikaruga this spring, I knew was pretty much doomed to buy a GameCube at some point. I was hoping I'd get a new roommate who had one, but it didn't happen.

My little brother has a PS2, which I've used a few times. If Ikaruga wasn't a factor, I probably have gone with that. There are a ton of PS2 games, but Frequency and Amplitude alone seal the deal for me.

The only game I even know about for XBox is Halo 2. For some people, that may be worth the $150 :)
(Reply) (Parent) (Thread)
[User Picture]From: harvey
2004-09-21 05:17 am (UTC)

Re: That is awesome

It all comes down to the games, yo. You have to go with what you want to play.
(Reply) (Parent) (Thread)
[User Picture]From: brad
2004-09-20 10:37 pm (UTC)
Heh, nice rotation code with the xors there. :P
(Reply) (Thread)
[User Picture]From: kvance
2004-09-20 10:56 pm (UTC)
There's a funny story about that too, and the punchline is "hey, why am I doing 2 memcpys?"
(Reply) (Parent) (Thread)
[User Picture]From: nearby
2004-09-20 11:16 pm (UTC)
kev, you are totally awesome for hax0ring the video code to make Ikaruga work properly on your monitor. I pretty much envy everything czircon does, plus what appears to be a wireless controller
(Reply) (Thread)
[User Picture]From: czircon
2004-09-21 02:34 am (UTC)

Ha ha, I already have a wireless controller. But you have Ikaruga, so I guess it cancels out.
(Reply) (Parent) (Thread)
[User Picture]From: teknotus
2004-09-20 11:44 pm (UTC)
It seems to me that in both versions you are accessing one past the end of the array in the first iteration.
(Reply) (Thread)
[User Picture]From: kvance
2004-09-21 12:07 am (UTC)
Ah yeah. I'm thinking it got this way because if you do the obvious thing and have the end-1, then the U and Y channels get swapped for the entire image. In fact, I'm certain that's how the -1 +1 thing got there in the first place :)
(Reply) (Parent) (Thread)
[User Picture]From: kvance
2004-09-21 12:36 am (UTC)
So, if one wanted to do this *correctly*, it would look more like:

int end = input_width*input_height*2-1;
for(int i = 0; i < end/2; i += 4) {
  xorswap(image_data[i] , image_data[end-i-1]); // Y_0
  xorswap(image_data[i+1], image_data[end-i-2]); // U_0
  xorswap(image_data[i+2], image_data[end-i-3]); // Y_1
  xorswap(image_data[i+3], image_data[end-i]); // V_0
}


I can't believe I'm thinking about this instead of playing my new gamecube doing my operating systems assignment.
(Reply) (Parent) (Thread)
From: thedexter
2004-09-21 12:19 am (UTC)

heh, from amazon:

This game is quite good in graphics and sounds. Gameplay, however, is absolutely hard. I can't make it past the second boss and that is on easy mode. I must say that it is not your conventional shoot and evade kind of game. You must also change polarities(change the color of your ship between white and black) to be able to survive. This technique requires precission. I still think that you have to be a Jedi to play this game. Overall is a good game but only if you have the patience.

---

I'd never heard of the game, but it sounds neat. I'll pick it up... sometime.
(Reply) (Thread)
[User Picture]From: kvance
2004-09-21 12:41 am (UTC)

Re: heh, from amazon:

He's right about patience. Anyone can pick this game up and play for 5 minutes (before burning through all their continues), because the basic rules are pretty simple. But the levels are downright sadistic.. in a good way!
(Reply) (Parent) (Thread)
From: ex_md744
2004-09-21 04:12 am (UTC)

Re: heh, from amazon:

I have reason to belive I would have little to fear from Ikaruga... BUT there is this Japanaese fan game. 150 levels or something. 15 megsish. I can't beat the first boss. At all. http://lovelove.rabi-en-rose.net/rk/ss.php
(Reply) (Parent) (Thread)
[User Picture]From: kvance
2004-09-21 04:38 am (UTC)

Re: heh, from amazon:

Sounds great! What file is it, exactly? I can not read this site. I am downloading wanko501b.exe, as some sort of guess.
(Reply) (Parent) (Thread)
From: ex_md744
2004-09-21 05:22 am (UTC)

Re: heh, from amazon:

That's it. You have to run config before it'll let you do anything. You have to put a name into the text field box. (tab1)
The second tab is controls.
The third is graphics options. hmmm I have this summarize dsomewhere


The website hints at hundreds of levels, but I can't pass the first.

There are three weapons, a rapid fire cannon, a homing beam weapon that destroys targets you've previously locked onto, and a high damage sword.

You control the yaw, sometimes the pitch, and the x,y and sometime z position of your ship.

There is a 'hyper'-like button. If you push just that and a direction, you jump a few inches in that direction. It does NOT jump through beam weapons or enemies. It may jump through small bullets, or it may just be luck, maybe it makes your hit zone smaller. Using the hyper button and your other weapons at the same time produces various effects. The cannon does very high damage in one shot. The beam weapon hits everything on your sensor screen. The sword becomes a shield that destroys bullets.

There is also a reload button that you may use in conjunction with your weapons, since they all have limited clips. Your hyper abilities are limited to 3 uses/levels per ship, though you can replenish those levels by racking up points.
-------------------------------------
The second tab is control, like I said.
The button on the left is joypad quick bind, the one on the right is for the keyboard
The bind order is...
Shot
Ray
Blade
Rotate right
Rotate left
Reload
Dash/Overdrive
Credit
Start

---------------------
The third tab is graphics.
The first dropdown is fullscreen or windowed. (The lower option is fullscreen)
The second dropdown is vsync on/off
I forget what the third is. The second option is 'have it' the first is 'no'
(Reply) (Parent) (Thread)
[User Picture]From: stargazer
2004-09-21 11:21 am (UTC)

Re: heh, from amazon:

I have reason to belive I would have little to fear from Ikaruga...

That's what I told myself too. Now look at me. I've played for forty hours and I still can't beat the goddamn game!@#$%! Let alone do well at it.

(Reply) (Parent) (Thread)
[User Picture]From: nearby
2004-09-21 01:36 am (UTC)

Re: heh, from amazon:

I have played this game and also endorse its purchase. I could swear the levels get exponentially harder (there's only 5).
(Reply) (Parent) (Thread)
[User Picture]From: kartos
2004-09-21 01:08 am (UTC)
I'm so proud of you!

Its a shame that Dynasty Warriors: Empires is only on PS2, I think you might like it.

In December I will have to lend you my PoP cube version, so you can see how shitty the sound it. One minutei ts deathly quiet, the next Farah is screaming in your ear! AIEEEEE!! Not to mention you should be buying Prince of Persia, the Warrior Within for Cube!
(Reply) (Thread)