Friday, May 30, 2008

Playing around with ~/.gvfs/

A few days ago I discovered that I had a new folder, named .gvfs/ in my home directory, so I started some digging on what that was good for. Turned out that gvfs in combination with gio is a replacement for gnome-vfs. So here some things you can do with gvfs. First of there is a heap of new tools, called gvfs-*, there are things like gvfs-mkdir, gvfs-ls and such. They work similar to the regular Unix tools except that they work on top of gvfs and gvfs can, as gnome-vfs before, do fun stuff like access the http or ssh, so you can do things like:

% gvfs-cat

Which is cool, but not yet all that exciting, since you could do the same thing with curl. It becomes more interesting when you access a filesystem via ssh, for example stuff like:

% gvfs-cat ssh://user@host/home/user/.bashrc

You might notice that the ssh example will not work out of the box, complaining about stuff not being mounted. So we do a:

% gvfs-mount ssh://user@host

And it will work then. This brings us back to ~/.gvfs/, which is used to store the mounted directories. If you go there you will find that you now have a directory called ~/.gvfs/sftp on host which you can access normally with all your everyday Unix tools. You can of course also mount samba directories the same way:

% gvfs-mount smb://host/share

Doing a:

% ls -l /usr/lib/gvfs/gvfsd-*

Will show you all the available backends.

Friday, May 23, 2008

World of BoreCraft

A week ago I decided it was time to look into what all those 10 million gamers are doing in the World of Warcraft. So I did create a 10 day trial account to try it out. One of the nice things about WoW is that it runs almost flawless in Linux, it doesn't provide native binaries, but Wine pretty much just works with it. No need to go hunt for cracks or anything, since it works out of the box, which is a pretty rare thing these days, where even game demos are often boggled down by copy protection which Wine can't handle.

So first thing one notices is that the game doesn't really have a proper way to create custom characters, while one can change hairstyle and color, one has no control over the body shape, which makes all possible characters look very much alike. Later in the game you don't really have much control over your clothing either, since at any given level there really isn't much to choice from.

Next step then of course was to actually enter the world with my newly created human female warlock. The world itself looks good. It's technically a little out of date, but on the other side that is why I can play it in the first place on my not-so-brand-new PC, so I won't complain about that. One thing that however looks a little weird is the size of everything in that world, building, doorways and such all look way to huge compared to the character size, like everything was scaled up by factor two or so. Another thing that is a little annoying, is that the whole world is heightmap based. While this is nothing unusual, it looks rather simplistic compared to a game like Gothic for example which features real 3D terrain. A heightmap can't handle vertical walls, so all the mountains looks very much smoothed and unrealistic. This also has some annoying sideeffects for movement, since every now and then you bounce along a mountain only to be stopped by a tile with a too high elevation, it becomes an invisible wall. WoW is by no means the only game that suffers from this, plenty do, but it is just as annoying today as it was 10 years ago. Real 3D terrain is just so much better then a simple 2D heightmap.

So graphics asside, what else does the game have to offer? Quests, plenty of quests. The annoying part here is that they are all rather repetative. You have those quests in which you have to kill five wild boar and then those in which you have to kill ten wild boar and sometimes even those where you have to collect the remains of boars you killed. But that is basically all you ever do, at least up to level 20, which is how far I have played. Every now and then you also get a quest that involves a little travel from point A to point B, but its also extremely streight forward, there is no thinking involved or searching or anything. You just wander around and kill stuff, the quest text itself can be completly ignored, since it doesn't really matter. Sometimes quests involved not killing a random animal, but some specific animal. In those quests another big issue of the game pops up, the complete utter lack of persistence. If you kill that big evil animal it will respawn a minute later. If the place is just a bit busy and somebody else already killed it, you basically have to just sit there and wait for it to respawn. This respawning which happens with all quests I have played is really annoying, since it takes any meaning of what you do away. Not only that, in some mission it also wreaks the gameplay a bit. From time to time the thing you have to kill is deep down in a mine, so you go down there, kill creatures along the way and then when you are down, everything has already respawned and on your way up you have to rekill all the same enemies over again. That is pretty annoying and just looks really stupid. If somebody else cleaned up the place befor you, it can also happens that you are suddenly surrounded by enemies, since they will respawn right behind you.

With all that killing you of course collect a bunch of loot, while I can understand while a wild boar would give you meat, I have a hard time to understand why it would give you a piece of armor or gold. It just seems rather arbitary and not very meaningful. Couldn't they have left the gold and armor away and instead let it to the player to sell the meat and other animal parts instead? You of course can already do that, but you still get much more armor and weapons from animals then you buy at a shop. And speaking about items, its also a little annoying that you can't drop items, if you try to drop them they get destroyed. So you never will find items lying on the ground, but always just in a killed enemy and very seldomly also in a treasure cheast.

A few other random annoyancies are the day/night cycles which happen in real time, instead of accelerated game time, so if you always play at the same time you will never see a sunrise in the game world. It also means that quests and NPCs aren't based on day/night cycles, night simply gives everything a blueish color instead of having an impact on the game world. Another issue is that you get very little explanation why you can't use a piece of armor or a weapon. In the shops the items that you can't use are marked red, but thats basically it. You don't get a "You need this ability" or a "Warlocks can't wear that", but just a "I can't wear that" without explanation. Also voice acting is very limited in the game, in the intro you hear a few worlds, you character says some, but none of the NPCs talk. The lack of ability to easily transfer a character to another server is also not something pretty.

Anyway, so all that down what do I think of the game? Well, not much. The game is relativly easy to get into, but its also a little boring and pointless, because there is no real challange in all the leveling up and quest solving. If you are the right level for a quest you won't have much problem and if you are the wrong one you won't stand a chance. The whole experience gets very linear by this, since you never can leave your predefined areas. You of course can walk everywhere, but if some "level ??" character can kill you with a single hit that trip won't be a long one. You also won't really get much story to hear, because there really isn't one and how can there in a world without progress. When it comes to quest your gui automatically takes care of how many boars you have to kill befor completion, so you can just skip the text. The game really gets the most interesting if you try to bent the rules, when you join a few high level characters in a fight that is way over your level or such, but then the game also is pretty good at destroying that fun, because you really don't stand a chance against a high level enemy, if he hits you, you are dead.

I have only played up to level 20 with my character, so I haven't seen everything, but on the other side I think I have seen enough. World of Warcraft is pretty much MMORPG cliche in perfection. There are no suprises or unexpected events, the whole game just flows along in an easy consumable and but also pointless repeatative way. I think for me the whole lack of persistant and linearity was the biggest annoyancy. Killing five boars is stupid, but when they stay dead it at least feels like you have accomplished something, here it doesn't. The game world size is also issue here, while it does look big and gives you long ways to travel, it really is rather empty. I have seen only two major cities so far and the rest is just a bunch houses and farmland. There simply isn't much to explore, rather soon you have seen everything and then are stuck with leveling up. That you can freely travel around as a ghost of course makes exploration also rather easy. And speaking about the long ways to travel, having a something heavy to place on your "W" key really helps to make long travels a little more endurable. One thing I haven't yet understood is why there are no Orcs, sure I have seen NPC Orcs, but so far I haven't seen any player controlled Orcs or other members of the horde. Not sure what is up with that, but there really doesn't seem to be much if any overlap between those two fractions, likely there will be stuff higher levels, but it still annoys to not actually having seen a member of a non alliance-race with my character.

I still have two days on that trial account, maybe I'll use them for a bit more sideseeing as a ghost, but on the other side I think its really time to go back to some good games, since World of Warcraft starts to get really boring and repetative.

Thursday, May 15, 2008

Security through blind faith

Looks like security through obscurity was yesterday, today people tend to prefer security through blind faith as amazingly demonstrated by the Debian/OpenSSL fuckup. So what happened there? Clueless Debian maintainer messed around with code that they didn't understand and tried to fix bugs that weren't there, result was that the random number generator of OpenSSL wasn't all that random any more, in fact, not at all.

The amazing thing about this is how easy it is to detect this missshape, you don't need to know much about crypt or really anything for that matter. All you need to know is that the keys generated by ssh-keygen should be random and thus unique. They however aren't, easily demonstrated with a bit of Shell. Just launch three terminals and start:

First Terminal:
# generate keys
for i in `seq 1 1000000`; do
ssh-keygen -t rsa -N "" -f /tmp/keys/key${i};

Second Terminal:
# Check if there are collisions:
while true; do
sleep 30;
md5sum *.pub | cut -c "1-33" | sort |uniq -c | sort -n | grep -v "^ 1";

Third Terminal:
# Launch lots of processes to let the PID overflow
while true; do /bin/echo -n .; done

The third terminal isn't even needed, it will just speed up the process quite a bit, because the PID is the only thing of random left in the key generation process. You can reboot to accomplish the same if you prefer.

This teaches us that even the most trivial things aren't checked when it comes to security. People pack stuff, mess around with it, ship it to millions of users and never once actually check that what they ship actually performs as intended. Its really kind of shocking how easy it is to detect this misshape and how it could go been undetected for so long. There seems to have been a lot of blind faith involved that stuff will 'just work' without ever questioning or checking that it actually does what it was supposed to do.

Tuesday, May 13, 2008

Pingus Post Mortem and a little more

Pingus isn't dead yet and neither are other games I am or was involved with, however its time to sum up a few things up that have been learned in the progress of writing those games.

Wiki: collects garbage

Copyright ensuring proper license is hard

Contributors how they come and go and why they don't have a clue

S-Expressions are cool:

Keep your file parsing code out of my app:

Steel and get stolen:

Focus on your goal (Lincity):

User contributed content:

Quality control:

Build in level editor vs external one

ClanLib vs SDL:

Building portable binaries:

Release early and often:

French don't speak english, where is Japan, Germany is cool, USA too, Finaland, Schweden as well

Friday, May 09, 2008

PSP as ebook reader

This is old stuff, but I don't I have mentioned them before. The PSP can be relatively easily abused as eBook reader device, all one has to do is convert the pages to JPEGs and then view them in the build in image viewer, no firmware hacking required. To accomplish that I have hacked together two tools:
  • svn co svn://
  • svn co svn://
They are not really end user ready, but should get the job done. There are of course also other alternatives out there and you can of course also try to use the build-in HTML reader, which however sucks at normal .txt so you would have convert to .html first, for which I have a tiny script here:
When it comes to PDF one can convert them via pdftoppm to ppm images and then via ImageMagicks convert to JPEGs (works a lot faster then PNG on the PSP, in case anyone wonders).

Since I have the OLPC XO-1 I have moved all my book reading to that device, but the PSP still does a decent enough job.

Sunday, May 04, 2008

Getting 1680x1050 to work on a Geforce5200fx

It is the year 2008 and I still have to fiddle with Modelines... ugh. So here the little story of how I made a Philips Brilliance 200W work with a Nvidia Geforcefx 5200:

Try number one was simply using the config tools and hope for the best, but that got me:

(WW) NVIDIA(0): No valid modes for "1680x1050"; removing

and a display running at 1024x768, not so great. Next try involved:

sudo get-edid | parse-edid

That however just gave me:

Your EDID is probably invalid.

Not great either. So what now? This one was basically pure luck, the nvidia-settings tools actually has an option that lets you save the edid data, data saved and run through parse-edit, and success:

# EDID version 1 revision 3
Section "Monitor"
# Block type: 2:0 3:ff
# Block type: 2:0 3:fc
Identifier "Philips 200W"
VendorName "PHL"
ModelName "Philips 200W"
# Block type: 2:0 3:ff
# Block type: 2:0 3:fc
# Block type: 2:0 3:fd
HorizSync 30-93
VertRefresh 56-85
# Max dot clock (video bandwidth) 170 MHz
# DPMS capabilities: Active off:yes Suspend:no Standby:no

Mode "1680x1050" # vfreq 59.852Hz, hfreq 65.179kHz
DotClock 146.000000
HTimings 1680 1784 1960 2240
VTimings 1050 1053 1059 1089
Flags "+HSync" "+VSync"
# Block type: 2:0 3:ff
# Block type: 2:0 3:fc
# Block type: 2:0 3:fd

But that would be just all to easy, testing that modeline out brought me back to step number one:

(WW) NVIDIA(0): No valid modes for "1680x1050"; removing

The final hint that made things work was found in this little blog post. and the magic word was:
Option "ModeValidation" "NoMaxPClkCheck"

Add that to your "Device" section and you are ready to go. The Monitor is now displaying native 1680x1050 and it only took me like an hour...

Update: Looks like all this actually doesn't create a working setup for me. While 1680x1050 works fine for webbrowsing, I get numerous blackouts (screen going black for a second, then back to normal) as soon as the graphic card gets something to do, either when watching video or some OpenGL. So for most part I am still stuck at 1280x1024, which works fine with that monitor/graphic-card combination. I haven't yet tested what happens when I use VGA instead of DVI.

Update2: VGA with the same configuration seems to work mostly ok so far, no more blackouts, but picture quality is noticeably lower then with DVI, maybe a better VGA will help.