Potions and ingredients
Posted: Thu Dec 01, 2016 3:29 am
I broke this topic off from the "next tasks?" thread to try and keep this one topic consolidated, but it builds off of information in that thread. I'll summarize the key findings that relate to the potions, ingredients, and recipe reader, and add more information:
The data from 001B:A130 - 001B:A9A0 in FALL.EXE contains a table of fixed-length structs that describe the potions in the game, but which don't seem to contain the actual ingredients used to make the potions. I've partially decoded the struct:
I've done extensive fiddling to try and see if the unknown bytes contain the ingredients in any form, including bitwise operations to see if they're expressed as a bitfield (masked or not), or to see if they're indices into another table.
So far I'm led to conclude that the ingredients are described elsewhere, which probably means that another section of data has indices into the potions table. I also think that some of the unknown bytes in the potions table encodes spell effects, which will become important when the spell feature is tackled.
Ideally all of this information would be decoded from the EXE at runtime, but it may be necessary to just write the logic out into resource files and load them manually (basically plug in the information from the UESP wiki). That's what I'll end up doing to finish up the potion recipe reader, I think. Not as cool, but more practical.
I did one more thing to try and ferret out where the EXE might contain the table that indexes the above array of potion structs. I reasoned the following:
Here are those memory locations, though I don't expect them to be immediately useful to anyone. I'm including them because they could come in handy for implementing the spell feature: http://pastebin.com/TrgWFd6P. There are clearly some areas where font or printable character information is stored (which were flagged because it's highly sequential data)
More potion progress might not be possible until spells are taken care of. I think a good approach would be to visit a spellmaker and make a few spells with the same effects as a potion, then compare the saved bytes to reverse engineer the way the information is expressed. It could unlock the meaning of both spell records and potions. As seen on the roadmap though, this'll come after quests and some other features.
The data from 001B:A130 - 001B:A9A0 in FALL.EXE contains a table of fixed-length structs that describe the potions in the game, but which don't seem to contain the actual ingredients used to make the potions. I've partially decoded the struct:
Code: Select all
// 109 bytes per record
struct potion {
char* ???[8];
uint16_t value;
char *???[24];
char duration_min;
char duration_max;
char duration_per_level;
char *???[6];
char chance_min;
char chance_max;
char chance_per_level;
char *???[6];
char magnitude_min;
char magnitude_max;
char magnitude_plus_min;
char magnitude_plus_max;
char magnitude_per_level;
char *???[10];
const char* name[42];
}
So far I'm led to conclude that the ingredients are described elsewhere, which probably means that another section of data has indices into the potions table. I also think that some of the unknown bytes in the potions table encodes spell effects, which will become important when the spell feature is tackled.
Ideally all of this information would be decoded from the EXE at runtime, but it may be necessary to just write the logic out into resource files and load them manually (basically plug in the information from the UESP wiki). That's what I'll end up doing to finish up the potion recipe reader, I think. Not as cool, but more practical.
I did one more thing to try and ferret out where the EXE might contain the table that indexes the above array of potion structs. I reasoned the following:
- There'll be an array of unknown length, but with fixed-length structs
- Each struct will contain an index into the potions table, which is 20 elements long
- The structs will index the potions in order (similar to elsewhere in the EXE)
- The struct size won't be bigger than 192 bytes, which is the item record size, I believe
Here are those memory locations, though I don't expect them to be immediately useful to anyone. I'm including them because they could come in handy for implementing the spell feature: http://pastebin.com/TrgWFd6P. There are clearly some areas where font or printable character information is stored (which were flagged because it's highly sequential data)
More potion progress might not be possible until spells are taken care of. I think a good approach would be to visit a spellmaker and make a few spells with the same effects as a potion, then compare the saved bytes to reverse engineer the way the information is expressed. It could unlock the meaning of both spell records and potions. As seen on the roadmap though, this'll come after quests and some other features.