Friday, March 19, 2010

Fooling around with Ioquake3 game engine

I am a big fan of the Quake 3 Arena (Q3A) game. I stumbled upon the Ioquake3 opensource Q3A game engine. I thought it would be fun to play with the code and see what happened in the game. I decided to mod the Plasma gun effect to use BFG style "bullets". That should increase the level of fun. Well, it turns out I only need to change one line of code. A quick look at code/game/g_weapon.c in the source code is enough to make the change.
This is how the BFG firing function code:

void BFG_Fire ( gentity_t *ent ) {
gentity_t *m;

m = fire_bfg (ent, muzzle, forward);
m->damage *= s_quadFactor;
m->splashDamage *= s_quadFactor;
}

And this is how the Plasma gun firing function code:

void Weapon_Plasmagun_Fire (gentity_t *ent) {
gentity_t *m;

m = fire_plasma (ent, muzzle, forward);
m->damage *= s_quadFactor;
m->splashDamage *= s_quadFactor;

}

Replacing the call to fire_plasma() with a call to fire_bfg() changes the "bullet" coming out from a plasma gun.
However, this is only a quick hack and it only works correctly on arenas which has a real BFG gun. Otherwise the rendering output of the "hacked" plasma gun is incorrect because it only shows swirling black rectangle toward the enemy.
All-in-all it's a nice experience for me :).

Resuming Erratic SVN Checkout

I've just stumbled upon disconnected SVN checkout session in a 3G connection. The whole repository that I was working with is more than 200 MB. Now, what to do? It turns out, you can "resume" the SVN checkout session. Simply cd to the root directory of your incomplete local copy of the repository, carry out an "SVN cleanup" and the proceed "SVN update" to resume the checkout. As simple as that. This is a sample broken session:

darmawan@darkstar:~/tmp$ svn co https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2 --username guest

.. disconnected bla..bla..bla..

To resume the session, I do this:

darmawan@darkstar:~/tmp$ cd edk2
darmawan@darkstar:~/tmp/edk2$ svn cleanup
darmawan@darkstar:~/tmp/edk2$ svn up

That's it. If you experience another hiccups, simply "svn cleanup" and "svn update" again. If your connection is very unreliable, you can create a script to automate the process.