Author Topic: Hard coded limit?  (Read 571 times)

Legacy_Eagles Talon

  • Full Member
  • ***
  • Posts: 192
  • Karma: +0/-0
Hard coded limit?
« on: May 07, 2011, 07:22:04 am »


               I seem to remember an old developer bud of mine saying that each category of placeable, item, etc (i.e. Misc Small) had a hard coded limit to the number of itmes in the graphics file.  Is this true to anyone's knowledge.  If so, what might that limit be? 

It might have been just the graphic file as opposed to the list category.  i.e only so many pictures of gems or potion bottles etc.

I'm looking to add some more custom content, but I'm afraid that if this is true we may be approaching critical mass.
               
               

               
            

Legacy_The Amethyst Dragon

  • Hero Member
  • *****
  • Posts: 2981
  • Karma: +0/-0
Hard coded limit?
« Reply #1 on: May 07, 2011, 08:17:38 am »


               For simple items with icons, there's a limit of 256 icons for each item type (numbers 000-255).  You can always add more simple misc. item types to baseitems.2da if you need more room for expansion

Three-part/layer icons can have up to 246 icons for each part/layer (numbers 010-255).  These are shown in the toolset as model (1-25), with colors for more varients (0-9 possible, except 0-5 on model 25).  This goes for things like potions, and weapons (and Project Q items split into multiple parts).  Weapons need models for every part/layer, and every weapon model needs an associated icon part.

I think that #255 limit goes for almost every item type.  Maybe for armor, too, but not sure on that, since that's one item type I've not messed with over the years.

As far as a limit to the number you can have in each section of the game palette...I'm not sure if there is one or not.  I've never hit one myself.  There's just the 16k limit on total blueprints (monstes/items/triggers/etc....pass that one and players can still play, but the DM client freezes/crashes).
               
               

               
            

Legacy_Eagles Talon

  • Full Member
  • ***
  • Posts: 192
  • Karma: +0/-0
Hard coded limit?
« Reply #2 on: May 07, 2011, 08:27:05 am »


               Thanks Amethyst Dragon.  that was quite helpful.

One question.  On the "adding simple misc. item types to baseitems.2da"  Does that mean I could add another say.."Potions2" categore to get another 256 potions available? Or is it just "misc."?
               
               

               
            

Legacy_Rubies

  • Hero Member
  • *****
  • Posts: 508
  • Karma: +0/-0
Hard coded limit?
« Reply #3 on: May 07, 2011, 03:07:52 pm »


               

Three-part/layer icons can have up to 246 icons for each part/layer (numbers 010-255).


I've always been told it was 1-25 - I'm totally confused now! '<img'>
               
               

               
            

Legacy_Khuzadrepa

  • Sr. Member
  • ****
  • Posts: 347
  • Karma: +0/-0
Hard coded limit?
« Reply #4 on: May 07, 2011, 03:52:35 pm »


               

Rubies wrote...

Three-part/layer icons can have up to 246 icons for each part/layer (numbers 010-255).


I've always been told it was 1-25 - I'm totally confused now! '<img'>

In the toolset, you have 25 different options in the dropdown.  However, using color variants, you can add more.  You see, there is nothing preventing you from adding completely different models as color variants for a specific model.  You just have to do a little more work in the toolset when setting the appearance for an item.
               
               

               
            

Legacy_Rubies

  • Hero Member
  • *****
  • Posts: 508
  • Karma: +0/-0
Hard coded limit?
« Reply #5 on: May 07, 2011, 09:59:25 pm »


               Makes a lot of sense, since I've been recolouring the models for the different colours - no idea why I didn't think of that. Thanks for the useful info. '<img'>
               
               

               
            

Legacy_The Amethyst Dragon

  • Hero Member
  • *****
  • Posts: 2981
  • Karma: +0/-0
Hard coded limit?
« Reply #6 on: May 08, 2011, 12:01:53 am »


               

Eagles Talon wrote...
One question.  On the "adding simple misc. item types to baseitems.2da"  Does that mean I could add another say.."Potions2" categore to get another 256 potions available? Or is it just "misc."?

You can add a "potions 2" item type, but it won't get the drinking animation when used...that's hardcoded for regular potions (the same goes for scrolls and the reading animation, shields and proper equipping to the left forearm node, torches and the "torch holding" animations, etc.).  Pretty much any item type that has a special animation/pose associated with it's use won't have those if you try to add a similar item type.

New miscellaneous items that just use an inventory icon you can add as many as you want to the baseitems.2da file.  I suggest doing a copy & paste of the type of item you want, then alter what's needed after that in the entry.

Note: New item types after a certain line number in the 2da (probably around 128 or so) will work fine in-game, but when unidentified and picked up by a PC, the combat info/log window will show the acquired  item type as a "bad strref"...this is just a limit to the game engine and isn't cause for alarm.  The proper item type will display both in the inventory screen normally and in the description when examined.




As far as the 3-part/layer items go, it's set up like this:

Example: default longsword
In the toolset, you'll see a "part number" and a "color number" for the top, middle, and bottom.  Part numbers start with 1 and can go up to 25 (if models get added via hak file).  Color numbers are usually 1, 2, 3, or 4 (with the different colors simply variants on the same shape as color 1.

That Part 1, Color 1 item is actually using model and icon number 011...the 1st two digits of the file names are the part number, the last digit is the color.  Part 3, Color 2 is model and icon number 032.

Example 2: default longsword with custom content additions
By adding icons and models, you can greatly expand on available appearances.  Still using the longsword, in the hak you can add new part numbers and "colors".  Just make sure to add the "color variants" to "part 1" first, otherwise you can't access those "colors" in the higher "part" numbers.

So, if we want to be able to fully expand on possibilities for blade appearances, we need to add both models and icons for colors 0, 5, 6, 7, 8 and 9 to top part number 1.
*_t_010
*_t_015
*_t_016
*_t_017
*_t_018
*_t_019

With the upper limit on this being #255, that mean "part 25" is limited to "colors" 0 to 5.
*_t_250
*_t_251
*_t_252
*_t_253
*_t_254
*_t_255

This works for any of the 3-part/layer item types...weapons, potions, wands, rods, staves, and any new such items you decide to add.

Any such item types that don't have an equipable 3D model associated with them (rods, wands, potions, any misc. items) don't need new models, just the icons.  You do need new models if your module uses a hak that makes wands and rods equipable, otherwise you'll end up with PCs holding plain brown sacks.

Technically, I think you might even be able to make new 3-part "misc." item types that just use inventory icons.  You'd loose the spots for icons numbered 0-9, but be able to have a single item type with 3 layers of 246 appearances...just make sure each section (top, middle, and bottom) has one appearance that's just black with a solid black alpha channel in the icon (for a "blank"), and you could have up to 735 (245 * 3)  different misc. icon appearances with a single item type.
               
               

               


                     Modifié par The Amethyst Dragon, 07 mai 2011 - 11:04 .
                     
                  


            

Legacy_WoC_Builder

  • Sr. Member
  • ****
  • Posts: 425
  • Karma: +0/-0
Hard coded limit?
« Reply #7 on: May 11, 2011, 11:04:36 pm »


               I am trying to add additional custom content to our weapons selections, and am having a related issue.  In some of my weapon types, I cannot seem to get some appearances selectable beyond Model 10.  I tried renaming model to skip over 10, seeing as that was done for other weapons that are successful in achieving higher model numbers.  I looked in the baseitems.2da we use, and all weapons are set to 255, so that is not the issue.

Is there something I am missing in the explanation above that would account for my problem?  5t is driving me to yank hair, the fact that some weapons can get to that number, but others cannot.
               
               

               
            

Legacy_OldTimeRadio

  • Hero Member
  • *****
  • Posts: 2307
  • Karma: +0/-0
Hard coded limit?
« Reply #8 on: May 12, 2011, 12:53:04 am »


               @AmethystDragon: Thanks for the info!

To anyone: From a couple of threads like this one (starting here) I've noticed that people have mentioned that some hardcoded 2DA functionality might "wrap around" after line 256.

In the thread I link to, the issue is just the "acquired item" message when picking up an unidentified item which is a new base item on line 257 or greater, I believe.  I take Khuzadrepa's post as an indication that one might be able to truly extend the selection of existing base items  lower than row 256 (a large shield, for instance) by taking the row of the original base item, padding out to 255/256 (?) rows beyond it and having the "extended" entry in that 2DA row.

I'm sure sometime before I die I'll try to get around to testing the idea out but I wanted to throw the question out there and see if anyone has tried this before/would be interested in trying it.  I would much rather somebody find out if this idea has a payoff rather than sitting on it until I can test it myself.

Has anyone ever tried this sort of thing before and can offer up what their experiences were?  Any takers?
               
               

               
            

Legacy_Khuzadrepa

  • Sr. Member
  • ****
  • Posts: 347
  • Karma: +0/-0
Hard coded limit?
« Reply #9 on: May 12, 2011, 03:41:48 am »


               

OldTimeRadio wrote...
To anyone: From a couple of threads like this one (starting here) I've noticed that people have mentioned that some hardcoded 2DA functionality might "wrap around" after line 256.

In the thread I link to, the issue is just the "acquired item" message when picking up an unidentified item which is a new base item on line 257 or greater, I believe.  I take Khuzadrepa's post as an indication that one might be able to truly extend the selection of existing base items  lower than row 256 (a large shield, for instance) by taking the row of the original base item, padding out to 255/256 (?) rows beyond it and having the "extended" entry in that 2DA row.

I'm sure sometime before I die I'll try to get around to testing the idea out but I wanted to throw the question out there and see if anyone has tried this before/would be interested in trying it.  I would much rather somebody find out if this idea has a payoff rather than sitting on it until I can test it myself.

Has anyone ever tried this sort of thing before and can offer up what their experiences were?  Any takers?

This is a REALLY interesting idea.  I never got the time to go beyond confirming what tdonadio was asking, however, Ben Harrison (I think) had played around with the armor 2da and had gotten some similar properties when wrapping like this.  There is a thread about that on the old forum somewhere, when I get a chance I'll try to dig it up.
I might take a swing at playing with this tomorrow.  Maybe I'll test potions to start.  Good thought OTR!!
               
               

               
            

Legacy_OldTimeRadio

  • Hero Member
  • *****
  • Posts: 2307
  • Karma: +0/-0
Hard coded limit?
« Reply #10 on: May 12, 2011, 02:54:47 pm »


               Cool, thanks!  I'm sure I'm not the only one who appreciates whatever time you might be able to toss at looking into this.

'<img'>
               
               

               
            

Legacy_Khuzadrepa

  • Sr. Member
  • ****
  • Posts: 347
  • Karma: +0/-0
Hard coded limit?
« Reply #11 on: May 12, 2011, 03:38:56 pm »


               Well, no good news to bear.

I tested by taking the vanilla torch and creating a new item type with it in a baseitems.2da from 1.69 that I padded out to line 269, and added the new type as line 270 (which I verified using the unidentified acquire bug mentioned earlier to be the correctly displaced 'torch' line.)  The character/item would not hold up the item like a torch from line 15. '<img'>

AmethystDragon appears to be right, it doesn't look like any other line can assume those animation properties.

I was wondering if things like weapon feats and stuff would correspond, but my guess is that's a no.
               
               

               
            

Legacy_OldTimeRadio

  • Hero Member
  • *****
  • Posts: 2307
  • Karma: +0/-0
Hard coded limit?
« Reply #12 on: May 12, 2011, 07:13:38 pm »


               Ah that's too bad.  Sometimes that kind of thing pays off.  Thanks for giving it a shot, though! 

You might also try making a new shield (which is just one below torch, I think) and see if it gives you the "You are too large to equip this item." message when trying to equip it.  Or, if you still have your test module laying around, feel free to kick it to me.  One of the things I've had a bit of fun with is searching for "hardcoded" in the NWN Omnibus and then seeing just how hardcoded (whatever) winds up being.  It's not a perfect method but I dig a bit in the strings of NWMain.exe (and sometimes others) to see if I can get a "clue" what's hardcoded and what's not or, sometimes, undocumented functions.
               
               

               


                     Modifié par OldTimeRadio, 12 mai 2011 - 06:15 .
                     
                  


            

Legacy_Khuzadrepa

  • Sr. Member
  • ****
  • Posts: 347
  • Karma: +0/-0
Hard coded limit?
« Reply #13 on: May 16, 2011, 01:25:01 pm »


               I thinks it's fantastic you are trying to test the limits of stuff OTR! I think your .txi method is spectacular!

I'll give the shields a whirl, too.  Then I'll probably forward you my test hak and module, so you can poke around if you like. '<img'>