Thursday, April 07, 2011

Final Fantasy XI: Fields of Valor

Tmiv and I got started playing FFXI yesterday and almost immediately ran into a new questing system that was added to the game. (Well, it was added in 2008 so 'new' is a bit of a misnomer. But I'd never heard of it before!) The basic idea is there's a big floating book located at the entrance to a zone and you can ask it for a quest. You get to pick from a list of quests for the zone which all seem to be kill n of mob X and maybe m of mob Y. Kill everything on the list and immediately get rewarded with a pretty substantial amount of bonus experience, gil (FFXI's main currency), and tabs (the Fields of Valor specific currency). Return to the book and you can pick up a new quest. However, only the first quest each day gives all the rewards. Subsequent quests just give the bonus experience.

As an aside, they also substantially buffed the experience earned for killing monsters slightly below you in level. That change coupled with these quests apparently let pretty much any job in the game solo reasonably well now. When I used to play at level 9 I was lucky to kill a monster worth 15 experience. Yesterday I was getting 150 from the same level differenced mob.

That all seems pretty straightforward but the question I had was what good were tabs. Is it worth making sure you come back every day to earn the tabs or should you just do the quests for the experience? Well, tabs do two things for you. You can spend trivial amounts of them to gain temporary buffs to help you solo. (They're the equivalent of white mage buff spells or eating food. So certainly useful but not game breaking.) Or you can save up a bunch of them to force special bosses to spawn. (FFXI seems to be really big on collecting trinkets to spawn bosses.) For an idea of scale here I was getting 30 tabs per quest and it would cost 15 to get protect cast on me. It costs 100-450 to summon a boss.

Before you spawn the boss you make a bet with the book that summons the boss. You can bet gil and if you win the fight you get twice as much back. You can bet beastman seals (items that mobs randomly drop which you can cash in to summon bosses) to get back 75 experience per seal if you win. Or you can bet a piece of gear and if you win you get the gear back with random stats added on to it. You can only bet unmodified items which are unbound. In all 3 cases there are restrictions as to what you can bet as well based on the level of the monster. (The easiest boss has a limit of 3 seals, 150gil, or a level 5 item.)

Fighting bosses is fun so I want to collect tabs just to fight more of them but the rewards seem pretty underwhelming. I guess buying extra copies of vendor gear to get bonus stats is nice when it comes to leveling other jobs but it doesn't seem like the sort of thing I need to obsess over maxing out.

There is also a restriction on how often you can summon one of these bosses. You can only summon one per earth day. (Resets at midnight in Japan or 11am my time.) You can bring a full party of 6 to the fight and each of the 6 people can summon their own boss. Also, I should clarify that the quests themselves can be done once per Vana'diel day which is 57 minutes and 36 seconds long. (25 game days per real day.)

My gut feeling is the bonus to experience and gil is nice and the quests provide focus in terms of what to kill so it seems reasonable to do but if you skip over it you're not missing much.

Wednesday, April 06, 2011

Final Fantasy XI: Leviathan - Windurst

And so it begins. I was talking with Tom last night and he was gung-ho about playing FFXI. So much so that we decided to start playing last night. Then we were hit with a 4 hour file download, an hour install, and an 8 hour (at least) update. My update was still going when I left for work so there may well be more to come.

We needed to pick a server and it turns out they're currently in the process of combining servers due to declining populations. They had 24 servers before and are going to end up with 16 after the merge. There are no real stats for server sizes but an auction hall scanning site which tracked accounts using the auction halls on each server indicated that they were lining up servers 9-16 with 17-24 in size and doing 2 to 1 merges. I figured it was probably best to pick a server that wasn't going to be merged soon one way or another and picked the coolest name from the top 8: Leviathan! Brings back memories of playing Levia-Stasis in T2 when I moved to Waterloo way back in 1998.

Now, the FFXI world has 3 factions which compete for resources. If I understand it correctly the basics are each zone is controlled by one of the 3 factions (or possibly by a 4th NPC faction - the Beastmen!) Controlling a zone lets you buy gear there and easily teleport in. You take control from other factions by leveling in the zones, and I think you get a bonus to your 'valour points' by leveling in a zone controlled by other factions so they change around a lot. Each faction also has their own main storyline and since the primary goal of doing this is to do the storylines it seems like we should all be the same faction. (You can change later on to do all the missions.) There are 5 playable races in the game each associated with one of the factions but any race can start with any faction. You get a small bonus for picking the matching faction. (A ring with minor stats that can be equipped at level 1. The Windurstian one has 1 agi, 1 int, and 3mp.) You can eventually buy the ring with the conquest points if you are a non-matching race. It doesn't seem like a huge deal but especially starting out every bit counts, right?

What are the races and why do they matter? Well, stats matter more in FFXI than they do in WoW for sure. (If I remember right the stats get used in direct subtraction comparisons so having more hit than your opponent has dodge is very good and it could come down to 1 or 2 stat points to get there.) Also since mana regen is pretty much non-existent (at least at low levels) the size of your mana pool can be a big deal. The 5 races are:

Hume - human - average stats in pretty much everything
Elvaan - elf - higher str, vit, max hp, and mnd - lower agi, int, and max mp
Mithra - cat woman - higher dex and int - lower cha
Taru Taru - gnome - higher max mp, agi, int - lower max hp, str
Galkan - giant man - higher max hp, str, vit - lower max mp, cha

Generally speaking this means that if you want to be a spell caster you want to be a Taru Taru. I found a stat calculator and assuming it works correctly then at level 30 a BLM/WHM would have 370 mana and 41 as a Taru Taru and 204 mana and 33 int as a Galkan. That's almost twice as much base mana and an extra 8 points of int which impact damage or hit chance or both. It's pretty clear the Galkan is abysmally bad at casting compared to a Taru Taru.

Tanking is the opposite. Switch to WAR/MNK instead and the story changes. The Galkan has 674 health and 38 vit. The Taru Taru has 491 health and 30 vit. That's an absurd difference.

The other 3 races are more balanced with Elvaans being physical beaters who miss more often, Humes being ok at everything, and Mithra hitting more often but being less charismatic.

To look at it another way, here are the stat orderings at level 30 for a red mage with paladin as a support job. (No idea if that's a good idea or not but it has mana from both jobs so it should help demonstrate things.)


hp - Galka (567), Elvaan (506), Mithra (475) = Hume (475), Taru Taru (384)
mp - Taru Taru (297), Mithra (204) = Hume (204), Elvaan (173), Galka (125)
Str - Elvaan (35), Galka (33), Hume (31), Mithra (29), Taru Taru (27)
Dex - Mithra (36), Hume (29) = Taru Taru (29) = Galka (29), Elvaan (28)
Vit - Galka (37), Elvaan (33), Hume (30), Mithra (29) = Taru Taru (29)
Agi - Mithra (30), Taru Taru (29), Hume (26), Galka (25), Elvaan (22)
Int - Taru Taru (37), Mithra (30) = Hume (30), Galka (29), Elvaan (26)
Mnd - Elvaan (37), Hume (33) = Galka (33), Mithra (31) = Taru Taru (31)
Cha - Hume (30) = Elvaan (30) = Taru Taru (30), Mithra (26) = Galka (26)


And what do the stats do? hp and mp should be obvious, I would hope. After that:

Strength - do more damage with physical attacks
Dexterity - hit more often & crit more often with physical attacks, huge boost to sneak attack
Vitality - take less damage, do and/or receive more healing, do more damage with jump?!?
Agility - get hit less often & get crit less often with physical attacks, hit more often with ranged attacks, give less rage to the enemy with physical attacks
Intelligence - do more damage with black magic, take less damage from black magic, pick locks better?!?
Mind - do more damage with white magic, take less damage from white magic, heal more
Charisma - makes bards, dancers, and beastmasters better

Personally I intend to play lots of jobs and not focus on one type in particular so I think Taru Taru and Galka are out. Elvaan have a fair bit less mana than the other two and don't seem to gain anything terribly useful in the process. (They are probably the most powerful healers per spell cast but can cast fewer spells, and they hit hardest but hit and crit less often.) Humes make minor gains in strength, vitality, mind, and charisma but lose a lot in dexterity and agility compared to Mithra. Apparently they added a class that rolls dice and throws cards like Setzer in FFVI which is my ultimate goal and it seems like they want all stats but especially high agility. So I was down between being a Hume or a Mithra and I figured I'd just pick the one that started in the same town as whatever Tom picked. He wanted to go straight melee damage which heavily favours Mithra I think since they get such a huge amount of Dex, so that's what we're going with.

Mithra and Taru Taru both make Windurst their home, so that's where we're starting to get free rings. It sounds like a couple other people are interested in playing, so if you do please head to Leviathan and start in Windurst!

- edit: I should point out that many people say race doesn't really matter and you should pick what you want to look at regardless of anything else. I suspect those people have enough powerful gear to make up the deficiencies which I don't expect having but it is something to keep in mind. -

Tuesday, April 05, 2011

THREE!

Commander Data sent the number 3 through space and time to break a time loop and save the USS Enterprise from perpetual destruction. It took the solo ninja 3 tries but the end result is the same. The time loop has been broken! Garland will no longer go insane and resurrect elemental fiends to send him back in time so he can resurrect them again. Woo!

Monday, April 04, 2011

Final Fantasy XI

I did some asking around and found 3 people who could be convinced to play Final Fantasy XI with me and another one who wants to play but has to wait until May. Silly teacher type people. I figured it might help to actually say what kind of game it is to try to get more people interested. But I haven't played in something like 6 years, so I needed to do some digging myself to find out what had changed since then. It turns out, not a whole lot. Some expansions with more levels, classes, and content. Some more PvP options. And some "quality of life" improvements like getting to choose what server you play on, easier traveling between locations, and sensible changes to the weapon skill system. The biggest thing I discovered in my poking around is that I do, in fact, really want to play the game again.

Sunday, April 03, 2011

Flip Out?

I made it down to Chaos with this configuration. (I forgot I couldn't actually leave the dungeon so I gained the 50th level inside. It was a good one, but I couldn't save it, so I'll probably be 24 hit points worse next time. Or I may scum it to make sure I get about that many).

I got to take 6 actions total. Haste, 4 Sabers, and a melee attack in the 1700 range. I'd entered in my 8th command when he killed me. Sadly despite having a 50% chance to cast a spell he only cast 2 of them in his 8 actions. His 3rd spell has no game effect, so I had a good shot of killing him if he'd cast it. His 4th spell heals him to full, so if he'd cast more spells early on before I attacked at all I also would have won. A few more tries and I've probably got this, but the dungeon is so unbelievably huge that it takes an awfully long time to try. I don't think I have it in me to try again now, so I'm going to play some League of Legends games. Maybe I'll come back to it later tonight before bed, Maybe I'll try again tomorrow. Certainly he will die by Tuesday!

Saturday, April 02, 2011

Swords For $400, Alex

This is actually a word that begins with a bloody S! I am talking, of course, about SABRE! I picked the item up that allows me to cast this spell today and decided to give it a spin on the boss of that dungeon, the Kraken. The fight was like a scene from a ninja movie. The boss punched the ninja in the face and the ninja got mad. He started running around like crazy (IE: I used defense sword until I was invincible) and the boss kept swinging and swinging but never could hit the ninja again. Then the ninja started to taunt the boss, brandishing his sword but not actually doing anything noticeable with it. Look, a sword! After showing the Kraken his sword 10 times to scoop up an extra 160 damage and 100 hit the ninja cast fast on himself and finally moved in for the kill. One action, 16 swings, and a very, very dead Kraken.

Friday, April 01, 2011

Pointers

Welcome to Ziggyny's Coding Emporium. Today we're going to be discussing pointers using the random encounter system of the video game Final Fantasy as a starting point and ending up with the rough idea behind linked lists.

First off, how would you imagine the random encounter system works? Me, I'd think that every time you took a step the game would make a check. 10% chance that you get into a fight every step, say. When that check returned true, randomly figure out what the monsters were based on where the fight was taking place. I'd be wrong. It turns out that when the game is turned on and again after every random encounter the game picks  a number and stores that value in a variable, and every time you take a step that value gets decremented. When it hits 0 or lower you get into a fight. So as soon as a fight ends you know exactly how many steps it will take to get into your next fight. (Or at least you would if you had access to that variable.)

Only it turns out that number isn't random at all, either. The first fight on the overworld takes place after 15 steps. The next one is after 24 steps. Then 32. Then 29. It turns out there's a list of 90 step number for the overworld and the game just loops through them all. There are similar lists for ocean and dungeon fights. (Ocean fights are much less frequent, dungeons are slightly less frequent.)

When the fight starts the game picks a fight for you, but there's actually no randomness involved here either. Every zone has 8 possible fights it could be. The game has a list of 256 numbers. The first fight you get when you turn the power on is the fight associated with the first number in that list, which it turns out is 3. Then a 4, then another 3, then a 6, and so on. People have actually used this deterministic nature to plot out exact movement patterns through dungeons to get specific random encounters. (You can't run from some fights in the game, so if you want to beat the game at minimum level you need to never encounter those fights!) The only way to change what fight you're going to do is to change zones. You'll still fight the 3rd fight, it will just be the 3rd one from a different list.

What does all this have to do with pointers? Well, how are those 256 numbers actually stored? You could have a variable for each one and use one gigantic module to track where you are in the list but that's really inefficient. A trick you can use is to use an array which lets you use one variable to store all 256 numbers and then a second variable to store an index into the array. The index is simply a number which tells you where to look in your huge array for the data you need. The programming language takes into account where the data actually is in memory. All you care about is the variable for your array and the variable for your index. But what is the language actually doing? It actually treats all of memory as one big array of its own. The variable you use to refer to your array is just an index itself into the gigantic memory array. Your array variable, in a sense, is just a number.

In C, it's more than just a number in a sense. It's a number period. This number is called a pointer because it 'points' to the specific section of memory the language set aside for you but all it is is an index into an array. The memory system doesn't know what you've stored there. It doesn't care in the slightest. An interesting thing about arrays in C is there's no actual array substance at all. If you allocate the memory for, say, 256 8-bit values you might think it's doing something specific to break up a 2048 bit chunk of memory into a bunch of 8-bit sections for you, but it doesn't. It just takes a contiguous chunk of memory sized 2048, sets it aside, and tells you where it starts. How does the index work then? Well, the system does know the size of the values you're storing so it can work out where it is. A[0] starts right at the start of the array. A[1]? It's exactly 8 bits ahead of A[0] because you're storing 8-bit values. So the system actually turns A[1] into A+8*1. A[200]? It's at A+8*200. (Ever wondered why arrays start at index 0?)

So our array solution was actually a pointer solution without even knowing it!


This is all well and dandy when we know our data isn't going to change, but what happens if we're writing a more dynamic data system? One where we might want to add or delete items from the middle of the list? If you think about it, in our array solution a given entry in the array implicitly  'knew' where the next item in the array was. It was at the location in memory 8 bits ahead of where the current entry is. A[151] obviously follows A[150]. But what if we want to delete A[151]? (Our subscribers whined that the fights referred to by A[151] were too hard and demanded we nerf the game by taking them out.) With an array and the implicit pointer to the next entry we're in trouble. Our best bet is to copy the value from A[152] into A[151]. And then A[153] into A[152]. And so on until we've copied them all. And then we have to change our check for when we hit the end of the array to loop back to the start to check for 255 instead of 256. It's all a big mess.

Even worse, what if the word came down from the president of the company that the users want super-rare fights to spring up. They want a 257th possible outcome, and they want it to come after A[180]. Following the idea above, we could copy A[255] to A[256] and then A[254] to A[255] and so on until we've made room for the new value. Hold on now! We only asked the memory manager for 2048 bits of memory and now we're using 2054. In some languages this would result in an error of some kind. In C the system just doesn't care. It'll let you write into that section of memory regardless of what it's actually supposed to be. (This is how many security flaws came about, by sticking something really big into a section of memory and overwriting actual code!) This is obviously a big, big problem. But we can't just tell the president to screw off or we'll get fired. So we need to allocate 8 new bits of memory somewhere and then remember somehow that we go from A[180] to the new value to A[181]. Probably we do this with a bunch of if statements and eventually end up with terrible, terrible code.

The real problem above is that we were relying on implicit pointers to the next value. What if we could assign an explicit pointer to the next value? That way if we had to add or remove values in our list we could change the explicit pointers and keep the right connections around. Well, we know pointers are simply numbers, so we could change our data from being an 8-bit number to being an 8-bit number AND a pointer. The size of the pointer variable depends on the operating system, but if you're on a 32-bit computer it'll be 32 bits in size. On the NES I'd imagine it would have been 8 bits. This will double the amount of space our data will occupy but it will let us add or remove items easily.

So, instead of allocating one big block of 2048 bits we'd get the system to give us 256 blocks of 16 bits. The first 8 bits will have our number. The second 8 bits will be a pointer to the next allocated block. Maybe it's the next one in memory. Maybe it's somewhere else entirely. We don't care. All we care about is the location of the very first number. After we're done with that number we don't even care about that anymore. So we could update our pointer variable to bits 9-16 of the section of memory it's pointing to! We can even get rid of our 'end of list' check by making the last entry point back to the first one. Now if we need to add an extra number we can allocate space for it and adjust a couple pointers and we're done.


Linked lists are often represented something like above. Pointers are represented with arrows and are made to seem more complicated than they are. The above picture (stolen ruthlessly from wikipedia) has 3 distinct blocks of memory. The circles are just numbers. Numbers that can be thought of as an index into the gigantic array which is memory. You can change the number in the circle to change the index of the array. Or you can follow the arrow and change the value on the other side to change the value stored in the array. Getting the syntax right can be tricky with all the *s and &s but the important thing to keep in mind is pointers are just numbers. There's nothing mythical about them and they're so useful because they can be manipulated as numbers.

Thursday, March 31, 2011

Ding-Dong! The Lich Is Dead!

It took 8 tries last night but I finally killed Lich. He killed me 4 times and his trash killed me 3 times but the 8th time I got him. The crazy thing is the 4 times he killed me he landed a slow at about half health and then I got to fight for a long time before he finally killed me. On the kill he didn't even get to cast slow. Several crits in a row coupled with him melee attacking (and failing to paralyze) did him in. (In retrospect it turns out I was using the wrong weapon against Lich the whole time and should have had 3 more damage and 40 more hit against him. That hit would be just for chance to hit and not extra swings, I think, so not a huge deal but every bit counts!)

So, now what? I need to level to 50, become a ninja, gather all the gear I want, and kill a bunch of bosses. Ninja is the first step I think since I need to do that before I hit level 43 if I want all my spell charges. I may need to gear up a little to pull that off so I should also look for easily obtainable treasure chests containing useful stuff. In particular, stuff I may need/want:

Katana - Floating Castle
Light Axe - Sea Shrine
Heal Rod - Castle of Ordeals
Mage Rod - Sea Shrine
Defense Sword - Waterfall
Thor Hammer - Mirage Tower
Masamune - Temple of the Past
Opal Bracelet - Sea Shrine
Black Robe - Floating Castle
Flame Shield - Volcano
Ice Shield - Ice Cavern
Ribbon - Waterfall OR Sea Shrine OR Floating Castle
Heal Helm - Mirage Tower OR Floating Castle
Zeus Gauntlet - Castle of Ordeals
Power Gauntlet - Sea Shrine
ProRing - Floating Castle OR Gaia

In order to change into a Ninja I need to do the Ice Cavern to get the airship and I need to do the Castle of Ordeals to get the tail. Mirage Tower, Sea Shrine, and Floating Castle all require the airship to access. I really want a ribbon so I think my plan is going to be head for the Waterfall, the Ice Cavern, and then the Castle of Ordeals. Then I'll kill some fiends by doing Sea Shrine, Mirage Tower, and Floating Castle. I'll stop to level if things get tough but I have a feeling once I get a ribbon and a proring that I'll be ok. I will have to make sure I don't level off of any of the dungeon bosses though (I am still scumming, after all) so I may just level to 50 after I become a ninja to be safe.