Sunday, January 27, 2008

How to create good passwords

Good password is hard to crack and easy to remember. One extreme is having easy-to-remember passwords like your spouse's name or birthday's date, other extreme are elaborate passwords that you tend to forget. Here's the best of both worlds, my favourite method for creating good passwords:

1) pick some catchy lyrics from a middle of less known song (you can also use poems or quotes). Compose password from first letters of each word of the sentence. Here's an example:

lyrics: "I want to lay you down on a bed of roses"
(from Bon Jovi - Bed of Roses)

password: iwtlydoabor

Now you've got a password that's both difficult to crack and easy to remember - well, the song and method for getting password are easy to remember, not the actual password, we're using a bit of primitive cryptography here. Make sure that the selected excerpt is not too obvious (refrain of Yesterday, popular proverbs, poems like "roses are red, violets are blue" etc).

This password is better than 90% of other passwords used on the internet and resistant to dictionary attack, but it still it's possible to crack it by brute force. To prevent that, we need a mixed case password with numbers and special characters.

2) replace characters by similar looking numbers: o by 0, i by 1, e by 3...

iwtlydoabor -> iwtlyd0ab0r

"o" was replaced by "0" (zero).

3) use the same replacement technique for special characters: 1 for !, a for @, s for $...

iwtlyd0ab0r -> !wtlyd0ab0r

"i" was replaced by "!".

4) it's good to have a system for placing upper case characters. I tend to write lower case for consonants and upper case for vowels (or the other way):

!wtlyd0ab0r -> !wtlYd0Ab0r

5) I also like to convert original sentence into slang, for example:

"I want to lay you down on a bed of roses" ->
-> "I wanna lay u down on a bed of roses."

!wtlyd0ab0r -> !wlUd0Ab0r

Well, I think that's quite a strong password. Make sure that you're able to remember your new password, perhaps even write it down for first few days. Write down just the original lyrics if you're afraid that someone else might accidentally read it, that should be enough to figure out rest of the password. Also, don't over-combine the encryption or you might forget all encryption steps - use only one number or special character replacement, leave out some steps.

Here's another password-related tip: don't have just one password for several accounts. It's similar to dilemma between easy and hard passwords - it's insecure to use only one password for everything because if someone gets it, he's got all of your passwords. On the other hand, if you use many passwords for many acounts, it's almost guaranteed that you forget some. If some of your passwords can be retrieved or reseted by email, don't worry much about them, but be very cautious when selecting a password for that email.

Sunday, January 20, 2008

Gothic 3 skills, tips and tricks

This is a small guide to Gothic 3 for people who don’t want to waste learning points on useless skills. Some general gameplay tips are also included.

I played the game with last official patch v1.12, some bugs I’m going to mention might be fixed in later community patches (v1.5 is the most recent). Also, I haven’t played as mage yet, so these hints probably won’t be much useful to you if you want to use magic a lot.

Essential skills

There are three basic classes in Gothic 3: fighter, archer and mage. I prefer the mix of fighter and archer. I haven’t yet played as mage so I can’t give you any tips on that yet. I recommend these skills for non-magic character (I don’t list their pre-requirements):

  • Fighting: sword master, orc slayer, strong shield parry, regeneration
  • Hunting: bow master, orc hunter
  • Magic: none
  • Smithing: forge ore weapons, prospector, sharpen blade
  • Thieving: pick difficult locks, make excuses
  • Alchemy: none
  • Other: endurance of the wolf, resistance to cold, resistance to heat

Useless skills

Hunting

  • sneak on wild animals - you can just shoot them from distance or outrun them with a sword.

Smithing

  • forge pure ore weapons – don’t waste your time and learning points on this skill. You won’t be able to get any recipes for pure ore weapons. You can’t get much better weapon that self-forged and sharpened bastard sword. It’s just not worth the effort.

    Note: You can learn this skill only from Hammer Clan’s smith and it involves a very flustrating quest where you gotta get approval from 3 other ore smelters in Nordmar, but two of them run out of villages in the meantime and you end up wandering around Nordmar and looking for them for hours (and after you finally find them, then you’ll find out the “pure ore” skill is actually worthless :)). Someone on forums suggested following tip for this quest: smiths walk out villages right after you get the quest. So quicksave, teleport to Fire Clan and follow its smith to find out its destination. Then quickload and follow the the smith of Wolf Clan.

    Update: It's tricky to get pure ore recipes and weapons. There are special unnamed chests in the game containing rare items. The more of these chests you open, the rarer items you find, including pure ore recipes and weapons. As far as I can tell, there's no other way to get them.

    IMHO it sucks, because how can you figure that out by yourself while playing the game?! You can't, unless you read the walkthrough. Best weapons should be available through quests, not by this random "system".

    And then there's another question - is it worth it? As I've checked the weapon descriptions, best weapon has about 160 damage. Self-forged and sharpened bastard sword has 110 damage and it's quite easy to raise damage by increasing your strength, so I don't think that pure ore weapons are worth the trouble it takes to get them.

    More info about unnamed chests and their content

Thieving

  • pick impossible locks – while not really a useless skill, it’s better to put your points elsewhere. Chests with impossible locks are rare in the game and you can open them with „open locks“ scroll, just make sure you always have some in your inventory.

    Update: If you decide to search for special unnamed chests containing rare items, this skill will be useful to you in the long run, because they all have impossible locks.

  • pick pockets – not very effective unless you put half of your learning points into thieving skill. I learned to pick difficult pockets and it usually just annoyed me – you steal by choosing a option in dialogue, so dialogue window opens for persons who have nothing to say and it hinders you, you’re often caught and then you gotta quickload which hinders you even more, so I didn’t even bother stealing, except when clicking on "pickpocket" dialogue option by mistake, usually followed by quickload.

    In few cases when you need to rob someone, there’s a workaround: whack him and then use “amnesia” spell scroll (when you cast it upon unconcious person, he/she forgets your crimes).

Alchemy

  • Don’t put your learning points into alchemy, learn it from books instead, there’s a lot of them in the game. You actually don’t need to have high alchemy skill - you will mostly brew only health and endurance potions and you can do that from the start of the game.
  • Don’t waste your time trying to learn how to make poisons and how to use them to poison your weapon or arrows. Make poison skill is bugged, you can’t learn it. You can learn how to poison weapon, but I wasn’t able to actually do it, when I finally got me some poison from trader in Mora Sul. I think it might be bugged as well. Finally, you can learn to poison arrows, but it’s not very practical skill because poisons are very hard to come by.
  • Brew permanent potions – not a very useful skill. You brew them from king sorrel and certain plants with permanent effects. These plants raise your attributes by themselves, permanent potions just double their effect (for example: dragonroot raises strength by 1 point, potion made from it raises strength by 2 points). Problem is that you won’t find many king's sorrel plants in the game, so you can brew only a few permanent potions. Just eat permanent effect plants instead of making potions from them.

    Update: There are about 50 king's sorrels to be found so if you search for them you will easily earn more points then you use to learn Permanent potion skill. Thanks for the tip, Percy.

  • Brew transformation potions – this might come in handy, but I prefer druid stones, which you can use over and over again, while transformation potion can be used only once. My favorite beast to transform into is snapper, which is very fast and has high endurance, so it’s convenient for running long distances. You can get snapper druid stone from druid in camp south of Geldern.

Other

  • Resistance to weakness – you won’t need it at all.
  • Resistance to poison – you will rarely need it, get some antitode potions instead (and if you don’t have them, just keep drinking drink healing potions, poison will subside after a while).

Other skills I didn’t mention are in between essential and useless category – I didn’t found them especially useful, but they’re not a waste of learning points either.

General tips

  • If you equip shield, you get armor bonus. (You don’t have to actually use it.)
  • Most effective fighter equipment is bastard sword (self-forged, sharpened and blessed) and paladin shield (because of the armor bonus) – you can get both without too much hassle. There are better weapons than bastard sword, but you can finish the game thrice in time it would take you to get them, so they aren’t simply worth it.
  • When you fight with companions, watch the distance – you can easily whack them by accident and then they might turn against you. However, they are very useful as a shield - usually they can’t die, so put them in the „first line“ as a primary target for enemy attack and whack enemies from behind or shoot them from distance.
  • You can make a lot of money by forging and selling weapons, especially bastard swords, which you can sell for 4800 gold coins (probably more if you can haggle). It’s also good to have prospector skill, because then you get twice as much ore from ore veins. Learn it as soon as possible so you have more ore at your disposal.
  • If you want to get somewhere far away, there’s a lot of enemies in your way and you’re too inexperienced to beat them, just run through them and jump like crazy while you’re at it. You can outrun most of your opponents. It’s good to learn endurance of the wolf skill and have some endurance potions ready, because you can’t run if you have no endurance points left.
  • If you want to be an archer, I recommend you to learn to handle bows and ignore crossbow skills. Only advantage of crossbow is its dependence on strength attribute, which is higher than your dexterity if you’re a fighter. But bows also deal good amount of damage and are faster - speed matters a lot in long-range combat, you can shoot a few arrows, then run back a shoot some more. With crossbow you usually have only one shot, because it takes a long time to fire a bolt.
  • Spellcasters are the most dangerous opponents in the game, especially if they are among group of fighters. Here’s how to beat them: learn resistance to heat and cold. Increase both by amulets, rings and armor. When you spot a spellcaster, make sure your endurance is at maximum and run to them. Jump, dodge and hide behind obstructions to avoid their spells. Once you reach them, they’re easy to beat in close combat with series of quick attacks, just keep whacking them.
    If you encounter group of two or three spellcasters, try to separate them from each other. Lure them into wilderness, where monsters keep them busy. Get some companion which will act as a shield.
  • Archers and crossbowmen, are not as dangerous as spellcasters, but they still pose a big threat, especially if there’s a small group of them when you‘re conquering a camp or liberating a town.
    Firstly beat archers, then warriors - you want to avoid situation when you’re surrounded by fighters and archers shoot at you from distance. If you run close to archers and start swinging sword, they usually stop using bows and draw close-range weapons instead, which is cool because you don’t have to worry about them anymore.
  • You can get one of the best helmets early in the game: First paladin’s helmet. It’s in Geldern, in the shamans’ house, on the table. Just steal it, it’s easy.
  • Fancy a good shield? How about a paladin shield, the best shield in the game? Easiest way how to get one is to take it from renegade paladin Kurt at the pass to Varant – just be prepared to fight a lot of bandits before you get to him.

Sunday, January 13, 2008

Ruby on Rails: How to set url_for defaults

I work as a Ruby on Rails programmer, so from time to time I'm going to post something about this language. Recently I implemented HTTPS into Rails application and had to figure out how to set defaults for url_for method: complete url (not only relative path) and http protocol. It's a little bit complicated, so here I am posting how I did that, it might save someone a couple of hours.

So, how do we set defaults for url_for method? First obvious solution would be to copy and paste this method from action controller into our application controller and add some code at the beginning of the method:

1
2
3
4
5
6
7
8
def url_for(options = nil) #:doc:

  # added url_for defaults
  options[:path_only] ||= false
  options[:protocol] ||= 'https'

  case options || {}
...

Of course that would be a lame solution, it's a bad idea to rewrite core methods (unless they are meant to be rewritten, for example the method I'll mention in next paragraph). If someone change this core code in future (which is quite possible), it might break the application.

Instead you can use default_url_options method to set url_for defaults. This method return a hash of url_forparameters, which is empty by default. So you can just write this into your application controller:

1
2
3
def default_url_options(options)
  { :only_path => false, :protocol => 'https' }
end

And we're done, right? No, that's not enough. It took me a while to figure out why certain URLs still don't work - URLs in views won't be affected by default_url_options, because they use url_for helper method, not the one from action controller. Yes, there are actually two url_for methods in Rails, one in controller, other in helper (url_helper.rb). And while you can rewrite defaults for the controller, but can't rewrite some defaults for helper - :only_path parameter is hardcoded to true, we want it to be false. What to do?

It's easier to fix than it seems. Just add this line into application controller:

1
helper_method :url_for

This causes that controller url_for method will be used also as helper method and it rewrites core url_for helper method, so default parameters will be applied on all URLs.

That's all, hopefully this will help someone.

Sunday, January 6, 2008

Gothic 3 review

Here we go, my first game review ever, but everybody has to start somewhere. I know there’s a lot of Gothic 3 reviews out there on the internet and it’s a year old game, but I also think I’ve got something new to say about it.

Gothic 2 is one of my favourite role-playing games and Gothic 1 is in my top twenty, so I expected a lot from the third sequel. Now after I’ve finished it I can say that Gothic 3 isn’t as good as I’ve expected, but it’s a good game and it’s worth playing.

Story

Gothic 2 ended with hero sailing on a ship to Myrtana with his friends after he saved the island of Khorinis from the menace of dragons and orcs. Upon his arrival to Myrtana he finds out that the country has been conquered by orcs thanks to the help of Xardas. King’s castle barely holds out behind a magic barrier surrounding the capital city and there’s also handful a rebels hiding in the woods and caves, not much else is left from the kingdom. Orcs seem to be searching for something in digs around Myrtana and ancient ruins in the southern desert inhabited by mysterious hashishins…

If you don’t know who the hell is Xardas and what did you do on Khorinis, you won’t get much wiser during the game, as it doesn’t explain past events at all and throws you right into the middle of things. This isn’t very user friendly approach to newcomers, a small recap at the beginning (what happened so far, who is who) would be nice. I have one more problem with the story – it has inadequate presentation. It’s kinda difficult to get a bigger picture on what’s going on. Even the most important people (Xardas, king Rhobar, your friends) talk to you just a little bit even when there’s lot to say. For example, king Rhobar threw you into prison back in Gothic 1 – when you meet him, you get over it in about two sentences, then he gives you some quests. Dialogues with old friends were a disappointment for me, they were too brief and sterile, in "tell me about this city and give me some quest" style.

Graphics and sound

Gothic 3 has one of the best graphic presentations in RPG ever, just look at the pictures around. However, it’s also one of the slowest RPGs ever, and graphics can easily get ugly if you scale down resolution and range of sight. It seemed to me that the game actually should be faster, that the engine is not optimalized, and I guess that the game stutters even on the high-level PCs. On my relatively fast computer (Athlon 64 X2 3800+, 2GB RAM, Radeon x1950 Pro 512 MB) the FPS was decent on a high resolution (1024x768) and details, with occasional stuttering.

Soundtrack is excellent, recorded by live orchestra and ethnic bands, it’s as professional as any soundtrack for a Hollywood A movie. Sounds are decent, except for moaning of people when they get hit, it sounds like they aren’t fighting, but f... :)

Gameplay

Main quest is basically just an excuse to explore the land and do a whole lot of side quests. For example, your first task is to find Xardas and you know he’s built a tower somewhere in the north, but you can’t go north yet because the country is full of beasts and you need to be stronger to beat them. So you start doing quests, get experience, get more quests because virtually everyone you meet gives you another quest, gotta finish some because your log is a mess… and several days later you’re stronger and not a step closer to the north. Finally you arrive to the border town and find out that to be allowed to go to further you have to get some reputation with orcs first by doing quests for inhabitants of town... This system is cool, it creates a non-linear, free-roaming gameplay. Problem is that quests get quite repetitive after time, most of them are simple go-there-kill-that variety.

There are several factions in the game: rebels, orcs, hashishins, nordmarians, rangers and nomads. The faction system gives you much more freedom then in previous Gothics – you can side with more than one faction at the same time and your deeds have only effect on your reputation, you can still do quests for another factions. It’s common that rebels tell you to liberate a town occupied by orcs, but before you do it, you can do all the quests for the orcs in that town to get some experience. You can actually get enough reputation to talk to their leader, who wants you to annihilate rebel camp nearby, where you originally came from. Or you can do it the other way around, go to orcs first and then to rebel camp as an orcs mercenary.

Levelling

Levelling system is almost the same as in previous Gothics. When you level up, you get ten learning points (but not extra life points anymore), which you can spent on raising attributes and learning new skills. You can either pray on altar or find a teacher, who will train you for a certain amount of gold. Only few teachers in game can teach you high-level skills and you have to get high reputation within their faction first. Experience really makes a difference, at the start you have hard time to slay even the weakest monster, later in the game you’re cutting through packs of beasts and single-handedly slaying whole camps of orcs.

Levelling is generally easier than in previous Gothics, where you were really missing learning points spent in wrong skills. In Gothic 3 I learned quite a lot of useless skills, but still got enough experience to learn what I needed, and actually I finished the game with about 70 extra learning points which I didn’t need to spent because my character was strong enough.

Combat

There are three means of fighting in world of Gothic: close-range weapons, long-range weapons and magic. I can’t say much about magic, my character was half-figher, half-archer. Originally I wanted to be just a figher, but later I also developed archer skills later because close-range combat was often very flustrating. After you get some experience, decent weapon and armor, you can beat a couple of orcs, but you can’t beat a single wild boar! There are several styles of attack available: fast, medium, strong... but only thing that usually works is non-stop fast attack done by furious mouse-clicking. Winning a fight over group of enemies is usually more a matter of luck than skill, and often you have to „heroically“ flee from battle for a while to heal yourself. Other people can join your party; they are useless as fighters, but very useful as a „shield“ – most of attacks concentrate on them and you can attack opponents from behind and can pick them one at a time, which is effective, but not exactly the way of warrior as I would imagine. Long-range combat is a great addition to close-range combat, you can choose between bows and crossbows. Bows are faster, but do less damage. You can use several special kinds of arrows: fire arrows, knock-down arrows and poisoned arrows, although the last ones are very rare. Combined with high endurance (so you can sprint for a long time), archery is the best option for outdoor fighting– if you don’t kill an opponent until he comes to you, just run away a bit and fire another couple of arrows.

I can’t really say much about a magic: mages use magical staves instead of conventional weapons, you can study several different kinds of magic because each faction has its specific spells (Innos offers basic attack and defense spells, Beliar has lots of summoning spells, druids specialize in transformation magic...), and generally you’ll be quite weak at the beginning, but become very strong near the end of the game.

Each way of combat has its basic attribute - strength for combat, hunting for archery and ancient knowledge for magic - and related set of skills which require various levels of given attribute. For example, you can’t become master swordfighter until your strength isn’t at least 200. Except combat skills you can study smithing, thieving, alchemy and few extra skills like endurance in sprint or resistance to fire and ice.

Myrtana Broadsword Massacre

Some people like to let off steam in RPG. Then you can read a posts in gaming forums like this one: “I went to one town and killed everyone, then I annihilated second town, then another… AHAHAHAHAHA!” Well, if you are into this kind of virtual misbehaviour (to put it mildy), look no further, because in Gothic 3 it’s actually part of storyline. Near the end of the game you have to hack’n’slash cities full of orcs and people, where there’s you alone or with a small party against tens of enemies – I usually lost count of the humans/orcs going against me, but it could be easily over hundred in some cities. So, if you like to cause mayhem in RPG and even get rewarded for it, look no further. Personally I got the impression from it that developers were running out of time and so instead of proper endings they just used what they have to conlude the game somehow, but that’s just my opinion. What is and what should never be

From Gothic 1 you could feel that you didn’t just played the game, you “lived” the game. Unfortunately, this feeling is lost in Gothic 3. In my opinion this time Piranha Bytes “byted” larger piece that they could chew. They wanted to make their most grandiose game for a conclusion of the trilogy, the biggest world, and not just medieval age and orcs, let’s put in desert wasteland with hashishins praying to Beliar and frozen wastes of the north with barbarians… and before you knew it, the world has become too large and producer screams into your phone to finish the game ASAP, so let’s just take what we made so far and wrap it up. The game is obviously rushed, especially the second half. Piranha Bytes deserved more time and patience from their publisher after the success of Gothic 2.

Even with latest official patch, this game is still very bugged, you cannot even learn some skills (to make poisons, for example). Or you spend lots of time and effort to learn forging of pure ore weapons to find out that this skill is practically useless, because there’s no pure ore nor recipes available. You can get one of the best swords early in the game (self-forged and sharpened broadsword) and there’s not much motivation to search for even better sword because you don’t really need it and in time it would take to find it you can finish all three game endings. Either make better weapons more easily accessible or make the game harder, dammit!

Conclusion

All in all, Gothic is a good game with lots of rough edges. It seems like the it was rushed and released several months ahead – unballanced gameplay elements, many bugs, unoptimalized engine. On the other hand, Gothic 3 offers vast, beautiful and atmospheric world with lots of quests to do (if somewhat repetitive), cities and nations to conquer and treasures to find. It’s really nice just to roam around the outdoors and discover new landscapes, settlements, caves… and there’s always something to do, nearly everybody has some quest for you.

If you’re a fan of Gothic series, then you’ll like Gothic 3, but probably not as much as Gothic 1 and 2. If you’re new to Gothic, I’d suggest start with Gothic 2, it’s simply better than Gothic 3 and you don’t need high-end computer to run it on highest resolution and details.

Tuesday, January 1, 2008

New Year, New Blog

I like the idea of starting new blog on 1st January, the New Year. This is not my first blog, but my previous attempts ended soon after their foundation. The last one had only one posting - a picture of a coffee mug. But I hope this will be different, that I actually will publish my thoughts here regularly (let's say at least once a week).

I write a diary, but before I started to writing it regularly, I've several times founded a diary which ended up with only 2-3 entries per year. Hopefully it will be the same case with blogs and hopefully in this case I'll kick myself into maintaining this blog.

In my next post I'll review Gothic 3, an epic role-playing game I've just finished. However, I won't write only about computer games, I'll plan to post some stuff on Ruby and Rails and just general ramblings like this one :). Sorry for my Engrish, it's not my native language, I'm Czech, but I think I'm quite capable of writing in English, I just need to flex my grammar and stylistic skills a bit, give me some time.