Friday, 26 June 2009

Roll Up! Roll Up!

What a week! Editing 2da files is a laborious task. Hopefully, however, after my long search and many calculations to try to make the cost of items more “reasonable”, I am nearing the end. It was an encouragement to have Rob McGinnis (McGnome) point out in a comment that even they found this “a pain”. (It’s good to know I struggle with the best.) Besides that, I have taken time to improve my Scalable System a little further, to now include a way to allow crafters to increase the power of an item they craft at an extra cost. Lastly, I have added a new GUI to replace the previously edited official “Store” GUI that gives extra information about a store. Check out each section that may interest you below.

The Cost of Items

First of all, let me share with you all the 2da files I have edited so far (that appear to have an impact on the cost of items), and information I have learned about them. I currently have the following edited 2da files sitting in my override folder:

Armorrulestats: To alter cost of masterwork & mithral items.
Baseitems: To correct shields costs and alter the ItemMultiplier factor where needed.
Iprp_arcspell: To alter arcane failure costs. (5-50%)
Iprp_bonuscost: To alter ability costs. (1-12)
Iprp_chargecost: To alter costs related to number of uses and charges.
Iprp_damagereduction: To alter damage reduction costs. (1-40)
Iprp_damagetype: To alter factors involved with various damage types. (Cold etc.)
Iprp_feats: To alter costs of feats.
Iprp_immuncost: To alter cost of immunity percentage. (5-100%)
Iprp_immunity: To alter cost of a specific immunity. (Poison etc.)
Iprp_meleecost: To alter enhancement value costs, including AC. (1-20)
Iprp_resistcost: To alter damage resistance costs. (Resist 5/- to Resist 50/-)
Iprp_skillcost: To alter costs of skills (ranks). (1-50)
Iprp_spellvcost: To alter costs of spell level related benefits. (0-9)
Iprp_spells: To alter spell costs. (A factor that can vary with other files.)
Iprp_srcost: To alter spell resistance costs. (10-40)
Iprp_weightcost: To alter weight reduction costs. (1-80%)
Itempropdef: Contains a factor used in calculating costs. (*)
Itemprops: To correct (remove) some invalid property entries from the toolset. (*)

(*) My thanks go to Sunjammer for extra information regarding these two files, as they have a number of errors that can confuse the builder. I recommend their download and use. For more information, visit Sunjammer’s website.

I am not sure how many more 2da files there may be left to consider, as I am only part way through checking the effect of my alterations on the costs of items. However, I can say that with these altered files, the costs have dropped considerably and cover most of the items I have checked to date. I did have to revise my original cost values for the Iprp_spells file I reported last week, as I learned they had a large impact on items that could cast spells. However, after a little more alteration, the costs settled down again. I do still have a number of craft items to check costs on, but now that the core costs have settled down, I hope to check these costs some time next week and correct any that don’t make sense.

The Scalable System

If you read the blog last week, you may have noticed that I have slightly altered some of my original idea to help form a better overall system. I decided to do this to allow the possibility of being able to buy items (scrolls, potions or wands) that would cast at a higher level if the PC paid a higher price for said item. For example, a PC can now buy a Potion of Cure Light Wounds at any level the store has available and gain the advantages of the more powerful brew after paying more for it. Check out the screen shot below to see a store with two different versions of the Cure Light Wounds potion. NB: Paying extra for such a little difference in benefit may not be worth it in many cases, but in cases where duration is subject to caster level, then paying extra for a longer duration may be worth considering.

However, the real benefit of this system is for when a PC crafts a scroll, potion or wand. Upon completion of the crafting (and if scaling for the spell cast is possible), the player will be offered a new GUI for them to pay extra to ensure the item crafted will cast at a minimum level when used. (See screenshot.) Note that levels offered will be between 1 and 19th level, with levels incapable by the caster and levels below a minimum innate level of the spell being made “unavailable”. This will be very useful for PCs who can craft items such as Wand of Fireballs, and want to ensure the fireball cast from it meets a minimum level. The same holds true for crafted scrolls and potions too. There are two caveats for crafted items, however:

1) A minimum level only applies to damage/cure amounts and/or duration. Spell Resistance and DC rolls are still based on the users spell capabilities or the item’s innate caster level. (The lowest caster level required to cast the spell.)

2) Merchants, if they even entertain buying crafted items, will not normally pay more than it costs to make an item at its lower level costs.

In the last day, I have been editing the spell scripts that require the extra code to handle this, and testing has proven everything works fine. Scrolls still cast at the caster’s highest spell capability, whereas potions and wands now cast at the level they have been crafted. In the case of a scroll having a minimum level higher than the caster’s highest caster level, then the scrolls minimum cast level will be used instead.

Store Information

In a previous blog, I showed you how I had extra store information shown in its title bar. Well, now I have introduced a new GUI that will open at the time of purchase that will allow a player to trade more efficiently. It will show such things as “Store Gold”, “Maximum Buy Price” and “Identify Costs”. Check out the screen shot for a visual.

Friday, 19 June 2009

Counting The Costs!

Here is my problem: Why would a player bother to use an amethyst (normally 100gp value) and some powdered silver (normally 50gp value) to craft some Holy Water worth around 25gp on average? It just does not make any sense. Furthermore, the clerics who tend to supply Holy Water would quickly go out of business at these costs, no matter how charitable they are.

This is why I have to confess at having to sort out another “mechanic’s problem” before I can get back to writing the plot. Furthermore, this is just one example of a complete system rife with cost anomalies that would drive a player to despair if they looked closely enough. But it’s only a fantasy world, I hear you say. I know I could have just gone with the flow, but after having put so much effort into encouraging crafting, why have the whole thing spoiled due to bad game economics?

2DA Nightmares!
Sorting through the tangled web of 2da files that handles cost has not been easy, and I have discovered a number of further “problems” along the way. One file in particular has grabbed my editing attention: iprp_spells.2da. Examining this file, I discovered a large discrepancy between the costs of casting spells of the same level. Some spells even did not have a properly calculated cost element in place, meaning some high level spells could be cast at a cost cheaper than a 1st level spell!

This was not the only 2da file with problems. The baseitems.2da also needed some editing to help bring prices back in line with D&D costs (e.g. shields and everything else halved), and also to help alleviate the cost of preparing potions (multiply factor). To sort out the problem of craft items being worth more than the final product (like the Holy Water above), I ended up reworking some of the costs of the individual crafting items (reducing their worth) and changed one or two of the items required for various items in the crafting.2da file. This also meant I had to update the information in my crafting tome that PCs can find in the game. I will also need to re-evaluate all the costs in the nx2_crafting.2da file as well to reflect a more consistent cost when crafting items using the various materials that have changed price.

Finally, I am also working through the des_crft_spells.2da because there are some spells that can currently be made into potions that should not be able to. I am following the rule that potions only work on the imbiber. E.g. It’s absurd to consider a Light potion can be brewed to allow a PC to cast Light on a fellow PC.

I spent quite some time working out the formulae for calculating costs of items before I found this piece of information in the itempropdef.txt file, which confirmed what I had already figured plus gave me the missing factor that was to be found in the itempropdef.2da.

E Cost

A factor that determines the final cost of an item. The actual calculation may or may not involve summing all the "cost" values of item properties, squaring this value, multiplying by 1000, adding this to the base value of the item, then squaring the sum of all the negative "cost" values, subtracting this from the positive/beneficial sum, then multiplying this value by the base item multiplier.

With this new knowledge in mind, I started to examine why certain items calculated at certain costs and discovered that some 2da files had errors in them. As one example, notice how the costs for adding the 70% of weight reduction to an item costs more than better values. I have altered the iprp_weightcost.2da file to use the following figures to correct for errors and alter for Althéa costs. (NB: Although I have kept the rows in the same order, this table is not meant to represent the actual 2da file, but a table to show my figures and results. I decided to cost weight reduction at roughly 10gp per 1% reduction.):

Updated With Correct Values November 2014
Consistent Costing
Another issue with the iprp_spells.2da file is that it contains the costs of setting a spell on an item at different levels. The problem with this is (in my opinion) is that it automatically defaults to the highest level (and therefore costs) for the PC. This just serves to add further confusion for the player when using one of these varying level spells, because one time a spell may cost X amount to craft an item, while another time it has increased to Y. To resolve this issue, I calculated what I believed to be the correct cost for each spell level as if cast by the lowest spell caster level possible, so that now, a player knows exactly how much it costs to craft an item with a particular spell. Check the table below for my current set cost figures and the equivalent item values.

Scalable Power

From this, I also developed the “Scaleable Power” system, which has always been a part of the Althéa scroll system: Casting power (for scrolls) scales to the user rather than the original creator. Furthermore, as long as a PC can use an item, it will automatically cast at the user’s highest spell casting level, regardless of magic type. E.g. A 1st level wizard / 15th level cleric would be able to cast a Fireball scroll as if caster level 15, because they have at least one level in wizardry that allows them to be able to read the scroll. However, I have introduced one check that must also be satisfied: The user must have a Wisdom, Intelligence or Charisma score equal to the spell level + 10 to be able to use the magic in the item. E.g. In the above example, the PC must have a Wisdom score (most likely key attribute in this case) of at least 13 (as Fireball is a 3rd level spell).

Both scrolls and wands scale in this way, with one further exception for the wand: The power of a wand will only scale if the PC knows the spell it is casting. (Awaiting new SpellKnown function in patch v1.23) If they do not know the spell, then the wand casts at the lowest level that the spell can be cast, with a minimum of 5th level (the level any crafter has to be to craft the wand in the first place). E.g. A Wand of Ice Storm used by a 17th level cleric would only cast at 7th level. (The lowest level to cast Ice Storm.) However, the same wand in the hands of a 10th level wizard who knows the Fireball spell would cast at 10th level. UPDATE: I have introduced another part to the craft system that means wands will now only cast at the level they are created. I will explain more in my next post.

Potions are always set to work at the lowest level that the spell could be cast, but at a minimum of 3rd level (the level any crafter has to be to brew the potion in the first place). NB: There are some “Special Brew” potions (E.g. Heal) that do work at higher levels, but are outside the ability of the PC to craft. PCs can only brew potions that are 3rd level or lower. UPDATE: Potion crafting has also altered. Again, I will explain more in my next blog.

There is a downside to all this, of course, and that is I have to add a small amount of code to every spell script that requires power scaling. (That is a lot of scripts!) Now, considering this, I may opt to only scale certain spells (even though any spell is potentially possible), simply due to time constraints.

And this is where I ask the readers to give me feedback on “MUST HAVE” spells to scale with use. Please leave any comment you think will be helpful. Thanks!

Friday, 12 June 2009

Fixing The World's Economy

By the title, I mean the World of Althéa of course and not ours, unfortunately. ;) How did I get into this and end up avoiding plot writing again you may ask? It was as I was working on the first conversations where a player can try to start to get different equipment for their PCs when I was reminded of the horrible economic values placed on items in NWN universe. Some may not mind seeing figures run into the hundreds and thousands of gold pieces, but I find the figures somewhat distasteful. For those who may have played PnP (pen and paper) D&D, the idea of having a shop full of magic items was never heard of, and the best the player could hope for was the chance of buying scrolls and potions, or possibly a few very low magic items like arrows and bolts if they happened to be in the right place at the right time.

In NWN, however, it is not uncommon to see in a store a plethora of magic items starting from a few hundred and run into the many hundreds of thousands of gold. Wheel in my cart-load of gold as I want the set of plus five swords third row from the left please. ;) Now, I know this has been done to simply help the running of a world where a certain balance must be maintained while still offering the player choices, but I sill cannot swallow the idea for my own world, and is why I have been altering many of the cost elements within the game. And even then, limiting the stores to minor magic items only.

From experimentation, I have found that altering the baseitems, iprp_meleecost, iprp_skillcost (and yet to be tested iprp_feats) 2da files appears to do what I hoped for by reducing the costs of items considerably. Of course, this then adds the problem of ensuring balance is maintained for players who wish to craft items (hopefully a little cheaper) and potentially even selling them to make a little gold. To this end, I have had to go through nearly every item that can be crafted to see if its final base price is not too high compared to other items and manually edit every item where needed. It is a very boring job and I still have a way to go. :( But, at the end of things, I hope the economy structure will look a lot less "unrealistic" and more in line with old PnP style gaming than the amazing rich world of the CRPG.

On the back of this, I altered some of the XML code that displays the store GUI to show the store's name (if added) and any limit to their gold (so that players can see how much the store has in gold left to buy items from them). The code is dynamic, meaning it updates as the store buys or sells items reflecting their current gold remaining. (See image to the left.) In the same image you can see how the prices of some of those items will be a lot lower than you may be used to paying. Note, however, the world economy reflects this in that treasures found will be more reasonable to the same scale. This is important because gold does weigh something in Althéa! Therefore, if you are playing a weak character, you may even consider a strong companion simply to help carry the treasure found. :)

Another aspect of this is that I want the player to be encouraged to craft (and enchant) their own items as much as possible. As I have said before, items will be available to purchase, but part of becoming a successful adventurer in the world will be to acquire rarer materials and craft items for themselves.

Friday, 5 June 2009

A Beginning ... (Part Two)

I feel like I am back to the point I was when I wrote A Beginning ... last March. Once again I have just finished doing some decorating this week and feel like I can finally get back to the module ... and again, at the point of actually writing the plot! To this end, I have made a design decision to stop working on other ideas (i.e. Holy Books) and get back to the side-quests themselves. After all, it's all well and good having an "interactive" world, but no good if there is not much to actually do in it in the way of a story. And considering the results of the poll are starting to shift in the direction of "action" over "reading", then I thought I would go with the flow. ;) Don't worry, I intend to keep the conversations and reading material in place, but simply decided to start coding for the quests for now rather than any more books that can be found.

Basically, the campaign journal and conversations are starting to get more attention, and I have currently picked out one path that the player will be playing at the start of the game that helps determine the background to which they approach the module (which is also why the plot progress has increased to 3%). As regular readers may recall, the player has a choice of backgrounds at the start of the game: Do they start as if familiar with the story so far (if they played Soul Shaker) or are they starting completely afresh? Each path requires careful attention in the early conversations to ensure the player is made familiar with the story without implying the wrong background. Hopefully, once the start of the game has been done, the conversation paths should get a little easier as the choice of path becomes less intrusive to the new plot.

The Current Poll

The poll still has 17 days to run and I am still interested in any outstanding results and comments. The "action" choice currently leads roughly 58% to 42% (in one translation), and even this result has helped me to reconsider not spending too much time on creating "books" that take quite some time to do if they are not going to serve much purpose in game. I am trying to be careful what I say here, because I do not want to suggest that those who like books will be disappointed, because I hope they won't be. I have simply decided that I will concentrate on placing reading material that may be of benefit to everyone rather than one or two players, and will instead be designed to appeal in other ways.

Real Life Interaction

On a final note, I have finished the code that handles "bashing" of doors when there are witnesses around. Witnesses can be those NPCs in earshot as well as visual range. Of course, if players have the ability to cast silence on the area and are out of sight of witnesses, then they can still bash the door. :) Some doors bashed this way will move the party one point towards chaotic, and so those who prefer to stay within the law will prefer to find alternative ways to get past a door, even if it is as simple as getting permission. ;)