Tuesday, August 26, 2008

Writing a zoomable image viewer

Image viewer these days still suck pretty much, the major issue is that they only have two modes of viewing: full size view and thumbnail view, which with todays megapixel cameras however becomes impractical, since the loading times for a full size views are to long to make browsing the images in full size comfortable, while browsing thumbnails gives you to little detail to be very useful. Switching between the two modes is also an annoyingly modeful process.

There however is an easy fix, instead of generating only one thumbnail, one can generate multiple thumbnails at different sizes. If one for example cuts the size of an image in half and saves the result as thumbnail and repeats that process till one is at a 1 pixel image one can cover all thumbnails with only a 33% increase in storage (in practice more like 50% due to overhead) over the original data. These multilevel thumbnails allow then a much quicker access to higher zoom levels of an image. A nice benefit of the JPEG format is that it can provide these thumbnails much quicker then decoding the full size image, even a 60MB JPEG can be thumbnailed in a few second vs minutes it might take when loading the full size wiew. I implemented this approach a while back, result being available at:

svn co svn://svn.berlios.de/windstille/trunk/griv-old

This approach however has one fatal flaw, since a thumbnail itself might be huge, loading times might get unacceptable again when dealing with huge image, i.e. the 50% thumbnail for a 1 gigapixel image is still 0.25 gigapixel, far to huge to load in a speedy manner. That problem however is again solve quite easily when one cuts the thumbnails into fixed size tiles. So instead of loading the whole thumbnails, one simply loads the thumbnails required to display the subsection of an image on the screen. If one has all the thumbnails available image browsing becomes pretty much instantly with this approach, since the amount of data that has to be loaded stays constant, no matter how large the original image data. I again implemented this approach:

svn co svn://svn.berlios.de/windstille/trunk/griv

One flaw with this approach is that the thumbnail generation itself is still a costly process. While small thumbnails can be generated quickly by libjpeg, generating tiles for a huge image, still requires decoding the whole image instead of just a subsection of it. I am not sure if libjpeg or the JPEG format itself offers a way for quick cropping of an image, so that stays an unsolved problem for now.

Anyway, the viewer itself at it is now works, its still pretty buggy and featureless but it already allows to explore large collections of images in a completly fluent manner with little or no loading times, depending if the tiles have been pregenerated or are generated on demand. It also allows to view gigapixel images, the tile generation itself can take a while for that, but viewing will be instantanious after that. In terms of space it requires currently 150% storage for tiles, since it doesn't only generate thumbnails, but also tiles for the image at its original size. Using load on demand of course cuts that storage requirement down quite a bit.

Before the thing can be turned into an official release I still need to change the name, since 'griv' is already taken and do a little bit of bug fixes.

PS: This technology is nothing new, it has been used by Google Earth and similar application for quite a while, Microsofts Photosynth also does something like that and there are a bunch of Flash applications for accomplishing similar things, I however don't know any off-line Free Software image viewer that provides such a feature set.

Tuesday, August 19, 2008

TuxPuck Graphics

Last two days I did a few graphics for TuxPuck, work in progress currently look like this:
Update: Woops, fixed little error in the game title.

German censorship and online gaming

Well, today I learned that creating an US Playstation 3 network account gives you access to a ton more demos then an official German account. I have to ask why? Even USK16 game demos are missing from the German Playstation Shop, which includes pretty much all high-profile titles on the Playstation3 console. Xbox360 has similar problems from what I know. While Germany's game rating can already annoy a lot when you want to order something online, it gets really ridiculous when it comes to only shops like the one on the Playstation3, since there doesn't seem to be any way at all to get access to those demos other then by using some fake data to get a USA account for the Playstation3 shop. Quite annoying situation with no clear fix. Wondering if Sony is doing that to conform with the law or more because they are trying a hard then they need to confirm with law.

Saturday, August 16, 2008

Primal: For once a good game...

More or less by accident I came across Primal for Playstation2 and was pleasantly surprised. While doing a little cleanup I came across on old video game magazine that mentioned the game, never heard of it before, but it looked interesting and ratings seems to be ok'ish (80/100), so I bought it. The basic setup is quite a bit similar to The Longest Journey or Dreamfall, a normal girl from this dimension, gets sucked up into another one and go on and save the world, while being supported by a small Gargoyle creature which follows you around and which you can also control. The game is seperated into four realms, each pretty much completly different then the other, which gives a nice chance on each realm switch. The four realms have to be explored one after another, so you don't actually have to travel forward and back to them, even so I think you could (never tried).

The basic gameplay is a little unusual and yet very familiar, its not quite like Tomb Raider and not quite like Drakan, but also not quite like Dreamfall. Its kind of has elements of all of them. You do have a quite large world to explore, so in that sense it feels like a large scale RPG like Drakan, you can also smash barrels just like in Drakan, but you don't actually have RPG elements, its more of an adventure game in which you just walk along solving puzzles in a mostly linear fashion. But you don't have an inventory and you don't talk to characters via the usual multiple choice dialog, the worlds (since there are four of them) are quite empty for most part. You do quite a bit of climbing in this game, but not as extensively as you do in a Tomb Raider. What however sets this game apart is that you can't actually do that much beside walking, you don't have a jump button, you don't have an inventory, you don't have a look at command and you can't just punch around. While exploring the only thing that you can do is switch characters, the whole navigation happens automatically, so when you reach a ledge you will jump automatically and such. You do have a use button, but that only works when standing in front of a usable object, it will do nothing for an unusable object, not even the "I can't use that" thing, which can make the game a little confusing, since usable objects are not highlighted by any means. On the other side it also makes satisfying gameplay, since you have to solve puzzles by understanding the situation and not by just clicking on every highlighted object. You have also your Gargoyle friend which will give you a hint on a button press, which will most often guide you in the right direction. You also have a map that will show you where you have to go next. So while you can get lost a little bit from time to time, you for most part have a pretty good idea of what you should be doing.

Due to the lack of inventory and talkable characters the puzzles in this game are all environment based, you have doors to open, switches to press and such. Every now and then you even have to carry a special object around. The whole puzzeling is made interesting since you control not one character but two, both with different abilities. The Gargoyle can climb stone walls and carry things, while the girl does the fighting and can also swim later in the game. Many times in the game it is your job to prepare the path with one character, so that the other can follow. While at times there is a little repetition in the puzzleling, doors and switches after all all kind of look and work the same, you still have a good bit of varity and the puzzles are all pretty logical and straight forward, so no frustrating mind bending required.

Beside the puzzling the game also features fighting monsters, kind of similar to Tomb Raider in that the monster fighting never becomes the central part of the game, but still is quite a lot when compared to a more regular adventure game like Dreamfall. The fighting itself is a little unusual as well, it for most part feels like a regular 'beat the other guy up' kind of thing that you get in Zelda or a lot of other games. However the enemies can take quite a bit of beating and its not overly clear when you hit them and they hit you, i.e. at the end of a fight you will often be left with little energie left, while othertimes you come out without hardly been hit once. It feels all rather random with your doing having only small impact on the result. Its not really a game breaker issue, since you can refuel your energie at your Gargoyle friend and you can also just run past the monsters, so there is a little bit of strategy going on and some fun to be derived from that. Enemies also stay dead once beaten and continue to lie around for the rest of the game and they also give you energie that you can use to restore your health or when in human form your health will restore automatically. So for most part of the game you won't have much trouble with the enemies, but a bit of work to manage your energie levels properly. While the fighting is far from perfect, it works well at giving you a bit of varity inbetween the puzzeling.

Dieing is also kind of interesting in this game, since you don't actually die, but are thrown out of the current world back into the normal world, in which you lie in a hospital in coma, your Gargoyle friend can then go back to one of those stargates that connect the worlds to get you back. When you wait for to long, you might actually die completly, but I haven't tested that one yet. Dieing however is pretty much a non issue in this game, due the automatic jumping you can never kill yourself by jumping down the wrong cliff, the only way to die is by fighting enemies, but even there you always fall back to human form first.

The characters in this game are well fleshed out and interesting and the overall story is decent too, but it lacks a little bit of a connection, since all four realms are completly seperate and you don't really have much story cross realm borders, beside the two main characters of course. The ending also leaves a bit to be desired, its pretty much what you expect, with no real supprise. The story overall however is decent enough and certainly one of the more interesting onces I have seen in a while.

The graphics are pretty nice for PS2 and feature some good particle effects, the game also supports progressive scan as well as widescreen and supports plenty of languages that you can switch between at any time. Some making-of stuff is included as well. So on the technical side its very solid.

Overall the game is pretty good, but not without its short comings. The focus on exploration is a nice change compared to all the shooters I have played recently. However at times it can also get a little lengthy, since the ways you have to walk are not the shortest. The fighting is also mostly button mashing, not really annoying, but also not all that interesting. But the characters and story make up for all the short comings it might have on the gameplay side and with its strong focus on adventuring, while not actually being a classic adventure game, you also have a type of game that you don't see very often.

PS: On the Playstation3 the game shows in some areas graphical glitches, the glitches are however limited to specific areas (whenever you have many trees with leaves) and mostly only happen in the first realm.

Tuesday, August 12, 2008

Uncharted: There is a gun in my adventure soup...

Time for another little PS3 review: Uncharted: Drakes Fortune. A game that tries to be a mix of Tomb Raider with Gears of War shooting mechanics. Nothing wrong with it, since after all shooting was never Tomb Raiders strong point and Gears is pretty good at it. So what could go wrong...

The core problem of Uncharted is that it is way more shooter then adventure game. It not only has those shooter sequences like Tomb Raider, but it has pretty much bad guys all over the place. If there are platforms to jump on, you can expect bad guys before that and after that and often even in between. I don't mind shooting by itself, but Uncharted really overdoes it a lot. You are never free to just explore something, you always have to shoot your way through a horde of bad guys. And even more annoying the shooting isn't even very good. It never feels like your shooting actually accomplishes anything, its just something that slows you down. You shoot people because they are there, not because you have a good reason for doing so. The shooting is also plagued by a constant rarity of ammunition. If you can only carry 100 bullets, but have to fight 20 guys in a row, each requiring 5 bullets at least, things easily can get messy and you stand there empty handed. You can of course pick up new ammunition that the enemies drop, but that isn't easy when being under constant fire and the enemies also have the tendency to die far away from you. So for most part you can only try to head shot people and hope for the best. The game also features some hand to hand melee combat, but that feels utterly useless, since when you fight a horde of bad guys, you just don't have the time to go melee when everybody is shooting at you. Another little annoyance is that the enemies don't seem to be overly clever, once alerted they will instantly start shooting, even if you are still two rooms away with no line of sight. Just feels weird hearing all those gun shots when there is nobody around they could be shooting at. The enemies also have the annoying tendency to approach from all sides at once, so you often end up right in the middle with no clear way to go into cover, which means you basically have to simply learn where the enemies respawn by try&error. And speaking about try&error, quite often the reset points feel a little far away from each other. Its never 'game breaking' issue, but certainly an annoyance to have to fight through the same guys again and again. Since most of the fights are also pretty much the same thing over and over again, you get a lot of repetition in the shooting. Its just not very fun.

Now the other part of the game is adventuring and puzzle solving, but that sadly is a very very tiny part, close to non existent actually, since there are like two classical puzzles in the whole game. The game does allow you to look into Drakes diary, which by itself that sounds like cool little thing, however it only works in a tiny few selected areas and you can only view the page that is relevant to the current puzzle, so just browsing in the diary doesn't work, which is very disappointing and makes the whole feature look way to restricted. The whole jumping also doesn't have much puzzles in them, unlike Tomb Raider your path is for most part extremely clear, since there really is only one way to go. So instead of trying to figure out how to get from one point to the other, you just follow the predefined path, no thinking needed. Sometimes this even gets borderline ridiculous, since there have been more then one case where I actually grabbed a vine without even realizing it was there. Not only demonstrates this that the graphics aren't also that easy to make out as they should be, it also shows how linear this game really is. The jumping also has the problem of being pretty boring. In Tomb Raider: Legend you have quite a bit dynamic in it, Lara might miss to properly grab a ledge, requiring player interaction, the player might tap a button to speed her up when climbing a ladder and small things like that. In Uncharted you have none of that, which steels the game of a lot of the elegance and fun that Tomb Raider: Legend had.

Another little annoyance is that the game doesn't really do much with the other characters. You quite often are running around with another character on your side, but beside giving you a little extra firepower, they don't really do much for you or you for them. Ico and Prince of Persia:SoT showed a lot of nice things that can be done with a second character, but Uncharted leaves that area pretty much untouched.

One good part of the game was the story, while relatively cliche and predictable, it simply was fun to watch and well executed. Nothing that nocks you of your socks, but a pleasant surprise compared to all the other game elements. The final boss fight was also kind of nifty, since it was more old school 'figure-out-the-pattern' then just plain shooting action.

Overall the game however was quite a disappointment. Way to much mediocre shooting and close to none puzzling. Giving that the story and the overall setting would have had plenty of room for puzzles and adventuring there was just way to little actually in the game. And as a shooter, the game just fails as well, because the shooting just isn't fun. The story saves the game from being a complete disappointment, but the gameplay was a lot more lackluster then I would have expected from such a high profile title. The game also happens to be very short, so that you can easily finish it in a day.

Some other random annoyances in the game: Quick time events are used extremely seldom, making it near impossible to react to them on the first try. Motion controls are there, but rather terrible, aiming the grenades feels very weird, since you only control the angle with motion, not the direction, that is done via the analogstick. Its also used to shake of some enemies in the game, which however is way to hard, since its very tricky to actually shake the controller in time, when you are resting your arms. Balancing via motion controller seems to be ok, but its so rarely used, that its hard to tell if it actually worked properly.

Another little random positive thing: The game features quite a ton of artwork and photos as bonus, nothing fundamentally new in gaming, but quite extensively done here, nice way to fill up the space that a BluRay disc offers. The game also allows you to select between a ton of languages, with audio and subtiles independently, which is a very nice thing to.

Wednesday, August 06, 2008

Shutting down a OLPC XO-1 via the Terminal

When one tries to shutdown a OLPC XO-1 via the normal halt command one will get a bit of weirdness. No idea what exactly happens, but the device doesn't fully shutdown, but instead gets into a weird mode where the power LED is still on, but the machine no longer reacts properl. No idea if this state is good for anything or just a bug.

Anyway when one actually wants to shutdown the XO-1 properly, one simply can do it the same way as the Sugar GUI does it, by sending dbus message to the power managment, which the following command will do:

dbus-send \
--system \
--dest=org.freedesktop.Hal \
--type=method_call \
--print-reply \
'/org/freedesktop/Hal/devices/computer' \

The XO-1 then shuts down as normal and is properly 'off' once done.

Wikipedia fucking sucks...

Wikipedia starts to really suck more and more each day, valuable information gets purged and replaced with useless junk. Nicely seen in the PSP Homebrew article, the old one listed tons of information about the topic, while the new one is completly useless, devoid of any real info and just some general blabla that isn't really helpful for anybody. This isn't the first time this has happened and certainly not the last and it nicely shows that vandalism isn't the problem of Wikipedia, the problem are the admins and wannabe admins that constantly go around doing nothing but destroying information. Its really annoying and its sad that it now also is starting problems in the english language Wikipedia, which so far always did much better then the german one.

Playstation 3 Network Foobar

This week I had a little fun trying to get the Playstation3 online. It all started out rather harmlessly, Playstation3's auto-detect for the network connection worked well enough on the first day and produced a working setup or so it seemed. However this setup turned out to just not work very often, half the time it would just go "DNS Error 80710103" for no apparent reason and endless retries wouldn't help to login to the Playstation Network, even so normal web browsing worked most of the time. Even more weird, running the auto-detection again for the network setup would often not work. A few hours try&error later I managed to get a connection up and running reliably by manually setting the DNS server to the ISP one, instead of to the router. That seemed to work. However that wasn't very satisfing so I tweaked around a bit more.

Just for the fun of it I replaced my iptables/masquerading configuration with another one. The new one worked for most part, but had a little problem with not allowing package forwarding from eth0 to eth0, which I needed to reach a few wireless devices which where in a different subnet. However I hadn't yet figured that one out. So I was just blinding ping'ing around a bit and found something suspecious:


worked, while:

ping router

also worked, but only with a multiple second delay between ping request. Doing a strace on the second ping request showed:

write(4, "RESOLVE-ADDRESS\n", 28) = 28
read(4, "-15 Timeout reached\n", 1024) = 20

That didn't look good. Turned out that the problem here was lack of reverse mapping in my DNS configuration, maradns to be preciece, adding the necesarry: PTR router.localdoman.

lines to my /etc/maradns/db.localdomain solved that issue and made ping work fast with both IPs and hosts.

The problem with the lack of forwarding from the subnet to the subnet was solved with a quick:

iptables -A FORWARD -i eth0 -o eth0 -j ACCEPT

Now does this help the Playstation3? Doesn't seem so, still get a 80710103 error most of the time I try auto-detect. With all stuff manually entered it currently works, but no idea why or for how long, since only entering the DNS manually didn't work either this time.

Update: Setting the DNS manually on the Playstation3 to the one provided by the ISP instead of the router fixed the problem (same problem with both cable and WLAN connection). No idea why this is the case, since all other devices, even the PSP, work just fine with the router DNS.