Author Topic: Hacking encumbrance  (Read 326 times)

Offline steve_mcdee

  • Dungeon Craft Tester
  • Hero Member
  • ***
  • Posts: 1953
Hacking encumbrance
« on: April 24, 2017, 09:46:44 AM »
Does anyone have any information about hacking encumbrance?

CKITFORM.txt identifies some bytes which provide for the effects of certain armor on encumbrance, and the strength increases to encumbrance. I am not really interested in those.

What I would like to do is to increase the unadjusted maximum encumbrance for characters - for example, by multiplying it by 5 or setting a different figure. Unfortunately, CKITFORM.txt does not appear to identify this number.

Alternatively, I would like to cause a coin to weigh 0 instead of 1. Since encumbrance is actually measured in "platinum pieces", I suspect that 1 coin = 1 encumbrance unit is hardwired and there may be no byte to change it easily.

Offline Mechanaut

  • Full Member
  • ***
  • Posts: 146
Re: Hacking encumbrance
« Reply #1 on: April 24, 2017, 12:36:40 PM »
Just out of curiosity... why do you want to remove the combat penalties incurred for hauling excessive amount's of money?

Offline steve_mcdee

  • Dungeon Craft Tester
  • Hero Member
  • ***
  • Posts: 1953
Re: Hacking encumbrance
« Reply #2 on: April 24, 2017, 04:19:25 PM »
For a modern / sci-fi mod setting, I want to create a credit card, the weight of which doesn't depend upon the amount of money.

Also, for a fantasy mod I want to use steel pieces pricing (equivalent to gold pieces) rather than platinum pieces pricing. I'm concerned that simply multiplying all prices by 5, without making any adjustment to encumbrance, will mean that the party quickly becomes overloaded and may even be unable to hold enough cash to purchase the most expensive items. My experience is that these games are generally less fun if all characters have a movement of 3 or if it is necessary to engage in a lot of management just to be able to hold a lot of money. Also, I figure steel may be made to weigh less than gold so I am justified in allowing a higher max encumbrance. I don't want to eliminate that from the game, just to give the player a bit more room before they become weighed down with coins. Fortunately, in FRUA the wearing of heavy armour has effects on movement regardless of encumbrance.

Finally, for both mods I want to be able to have "who pays" events leading to the purchase of expensive items such as real property or journeys by ship, which means it is necessary for a single character to be able to hold quite a lot of money.

Offline steve_mcdee

  • Dungeon Craft Tester
  • Hero Member
  • ***
  • Posts: 1953
Re: Hacking encumbrance
« Reply #3 on: April 25, 2017, 09:12:32 PM »
I have made a breakthrough with this. Here is what I have discovered.

The relative adjustments to the encumbrance limits in unhacked FRUA, based on a character's STR score, reflect the adjustments in the table on p 9 of the AD&D 1st Edition Players Handbook.

The following two bytes set the value of the "default" maximum encumbrance -- to which the adjustments are then applied. In unhacked FRUA this is 1500.

395039 (0x6071F)    220
395040 (0x60720)    5

So, for my purposes I will adjust these from "220 5" to "184 11", making the default maximum encumbrance 3000 rather than 1500.

Offline Nol Drek

  • Dungeon Craft Tester
  • Hero Member
  • ***
  • Posts: 2185
    • Nol Drek's Web Site
Re: Hacking encumbrance
« Reply #4 on: April 26, 2017, 11:30:13 PM »
Awesome discovery!

If I understand this correctly, in FRUA a normal human with a strength of 8-11 can carry a maximum of 1500 gold pieces of weight or 150 pounds (68 kg). A character with an 18/00 strength has a strength adjustment of +3000 gold pieces of weight or +300 pounds for a total maximum encumbrance of 4500 gold pieces or 450 pounds (204 kg).

I wonder if FRUA use the following values for encumbrance:
ENCUMBRANCE MOVEMENT RATE
350         12"
700         9"
1050        6"
1500        3"


If so, it might be useful to look for the values 350, 700, and 1050 somewhere close to the part of the code where you found your new discovery.
"Into the Drachensgrab Mountains!"

http://www.noldrek.com

Offline steve_mcdee

  • Dungeon Craft Tester
  • Hero Member
  • ***
  • Posts: 1953
Re: Hacking encumbrance
« Reply #5 on: April 27, 2017, 08:08:32 AM »
If I understand this correctly, in FRUA a normal human with a strength of 8-11 can carry a maximum of 1500 gold pieces of weight or 150 pounds (68 kg). A character with an 18/00 strength has a strength adjustment of +3000 gold pieces of weight or +300 pounds for a total maximum encumbrance of 4500 gold pieces or 450 pounds (204 kg).
You do understand this correctly.

It may be of interest for you if I explain a little more about how the STR-based adjustments appear to work. The general outline appears from CKITFORM.txt, but without the detail. The following bytes affect the STR adjustments to maximum encumbrance:


29652 (0x73d4)    bonus for characters with STR 3 (-350)
29664 (0x73e0)    bonus for characters with STR 4-5 (-250)
29676 (0x73ec)    bonus for characters with STR 6-7 (-150)
29697 (0x7401)    bonus for characters with STR 12-13 (100)
                   CKITFORM.txt describes this as "1 byte" but it is in fact a 2-byte number
                   like the other adjustments (albeit the second byte is, by default, 0)
29709 (0x740d)    bonus for characters with STR 14-15 (200)
29720 (0x7418)    bonus for characters with STR 16 (350)
29739 (0x742b)    bonus (250) applied by multiples to characters with STR 18 (x1=250),
                   18(1-50) (x2=500), 18(51-75) (x3=750) and 18(76-90) (x4=1000)
29747 (0x7433)    bonus (500) applied equally to characters with STR 17, 18, 18(1-50)
                   18(51-75) and 18(76-90) -- cumulative on the previous bonus
29766 (0x7446)    bonus for characters with STR 18(100)
29774 (0x744e)    bonus for characters with STR 18(91-99) and 18(100) -- cumulative


Given that characters with STR 8-11 don't receive a bonus, it is not surprising that there doesn't seem to be a place to specify any bonus for them.

I wonder if FRUA use the following values for encumbrance:
ENCUMBRANCE MOVEMENT RATE
350         12"
700         9"
1050        6"
1500        3"


If so, it might be useful to look for the values 350, 700, and 1050 somewhere close to the part of the code where you found your new discovery.
A nice thought. However, these are not the values that FRUA uses. I have now worked this out too, to some extent.

The same STR-score-based encumbrance bonuses are applied to the encumbrance values at which movement is decreased. For example, a character with STR 16 drops from 12 movement to 9 movement at a figure 350 greater than a character with STR 8-11.

The "normal" figures (ie, unadjusted, applicable to characters with STR 8-11) are as follows:

ENCUMBRANCE  MOVEMENT RATE
613          9"
869          6"
1125         3"


The significance of these numbers seems to be that they equate to two-byte pairs of "101 2", "101 3" and "101 4" respectively. I'm not sure that there is any greater significance. These figures are not altered by changing the maximum encumbrance value from 1500.

I tried searching CKIT for all values of 613 and 1125, but none of these control the encumbrance effect on movement rate. I suppose we might just be looking for a byte with the value "101", but there are an awful lot of those... and if it is a single byte then we would presumably be limited to adjusting this figure within a range of 256, which is not likely to be very helpful anyway.
« Last Edit: April 27, 2017, 08:11:28 AM by steve_mcdee »

Offline Nol Drek

  • Dungeon Craft Tester
  • Hero Member
  • ***
  • Posts: 2185
    • Nol Drek's Web Site
Re: Hacking encumbrance
« Reply #6 on: April 27, 2017, 07:46:32 PM »
That's also progress. I wasn't aware that the encumbrance changes in FRUA when the weight carried > 100 + 256 * n, for some integer n>=2.
"Into the Drachensgrab Mountains!"

http://www.noldrek.com

Offline Simeon Pilgrim

  • Full Member
  • ***
  • Posts: 169
    • simeonpilgrim.com
Re: Hacking encumbrance
« Reply #7 on: May 25, 2017, 06:22:59 PM »
The curse code, uses encumbrance to alter move distance here https://github.com/simeonpilgrim/coab/blob/master/engine/ovr025.cs#L137

Offline Nol Drek

  • Dungeon Craft Tester
  • Hero Member
  • ***
  • Posts: 2185
    • Nol Drek's Web Site
Re: Hacking encumbrance
« Reply #8 on: May 25, 2017, 08:36:03 PM »
The curse code, uses encumbrance to alter move distance here https://github.com/simeonpilgrim/coab/blob/master/engine/ovr025.cs#L137

So the engine subtracts the player's "maximum unencumbered weight" from their "current weight carried" and stores this value in a variable. If this number is negative, then they are carrying less than their "maximum unencumbered weight". The first 100 gold pieces of gear and loot don't count.

The comparison values to look for are:
var >= 0
var <= 512
var >= 513
var <= 768
var >= 769
var <= 1024

Those >='s are all redundant code, but it actually helps with our search since there will be more conditional values to find.
"Into the Drachensgrab Mountains!"

http://www.noldrek.com

Offline steve_mcdee

  • Dungeon Craft Tester
  • Hero Member
  • ***
  • Posts: 1953
Re: Hacking encumbrance
« Reply #9 on: May 25, 2017, 09:31:38 PM »
512, 768 and 1024 seem to have more sense to them than 613, 869 and 1125! I will see what I can find.

Edit to add: Hmm, couldn't locate the >= values on a quick look...
« Last Edit: May 25, 2017, 10:13:15 PM by steve_mcdee »

Offline Simeon Pilgrim

  • Full Member
  • ***
  • Posts: 169
    • simeonpilgrim.com
Re: Hacking encumbrance
« Reply #10 on: May 26, 2017, 09:03:11 PM »
those values could be off by one for what you have in your code, as >= 1 and > 0 are eqaul as in !< 2