Page 1 of 1

Character strings have no representation for Neophyte level

Posted: Sat Sep 21, 2013 3:36 am
by Sophia
When character data is encoded into text strings to be stored in front of mirrors, the skill levels are converted to a text string, where each letter represents proficiency in each of the four subskills (e.g., Stabbing, Fireballs, etc.). To get the character's level in the main skill (e.g., Fighter, Wizard, or whatever), these four are just added together.

Interestingly, though, there is no representation of neophyte level (i.e., level 1) in this system.
The relevant code is in Character.cpp, right here:

Code: Select all

      D4W = sw(*(A2++) - 'A');
      if (D4W > 0)
      {
        D0L = 125 << D4W;
        pcA3->skills92[D6W].experience = D0L;
      };
If the value is A, D4W is 0, which is not greater than 0, so this results in 0.
However, if the value is B, D4W is 1, which is immediately applied to 125 << 1 and we get a result of 250. BBBB results in a sum of 1000 which is a novice.

Is it a bug in CSBwin? I don't think so. I think this what FTL intended. Perhaps why there are almost no neophyte anythings in the DM mirrors. Daroou is a neophyte wizard because he is AABB: he has 0 levels in two subskills and 2 levels in the other two, resulting in a total of 0+0+250+250=500 xp.

As far as I know, all current sources got this wrong, including CSBuild.

Re: Character strings have no representation for Neophyte le

Posted: Sat Sep 21, 2013 11:30 am
by ChristopheF
As you say, in DM Darouu is a neophyte Wizard so it is indeed possible to represent that skill level.
The 'issue' resides in the definition of what we call a 'skill level', as this does not mean the same thing for the 4 base skills and for the 16 hidden skills.

The following behavior, whether intended or not by FTL, is part of the original game (and there is no code translation bug in CSBwin).

Champion text strings do not store experience amounts directly, they store a value between 0 and 15 (encoded as letters 'A' to 'P') for each of the 16 hidden skills (but not for the 4 base skills).
The game computes the corresponding initial experience amount in each hidden skill by using the base value 125 * 2 exponentiated to the value 0..15.
You may think of these values 0..15 as 'skill levels', but in fact they are not. Or at least they cannot be compared directly with skill levels in the 4 base skills. Please note that:
- these 0..15 values are not stored anywhere, only the resulting experience amounts
- these 0..15 values are never computed again by the game (and thus never used again anywhere and never displayed on screen)
- these 'skill levels' are based on the 125 value

The game computes the experience amounts in each of the base skills as the sum of the experiences in the 4 corresponding hidden skills.

When computing the skill level of a champion in a base skill the base value of 500 is used.
These are the 'real' skill levels, as displayed in the game.
As you see, they do not use the same base value.
The term 'skill level' only really makes sense about the base skills.

Note that the 'issue' you mention does not apply only for neophyte: if a champion has the same value for four related hidden skills like DDDD ("level 3"), then the resulting skill level of the corresponding base skill will be 4, not 3 (because 125 * 2^3 * 4 = 4000 = level 4.

Re: Character strings have no representation for Neophyte le

Posted: Sat Sep 21, 2013 5:25 pm
by Paul Stevens
Here is how I would have seen it:

Each of the hidden skills has 16 possible experience values:
What should they be? For the sake of argument, let us
say that we are limited to four different values. What
should they be? Possibilities include:

500, 250, 125, 62.5
1000, 500, 250, 125
500, 250, 125, 0
1000, 500, 250, 0

The decision will determine how much experience
is gained at the very first level versus the
maximum experience that can be represented.

It appears that the person who made the decison
wanted both numbers to be larger. So he had to
abandon the exponential formula and insert a
special case. He could have done something more
linear (and a few microseconds faster) such as:

250 * (2**n) - 250 which would result in:

1750, 750, 250, 0

This would increase both the first step and
the maximum and would would approximate
the doubling at every 'level' for large levels,
but not at the low levels. Whatever.....it
appears to have been a somewhat arbitrary
decision.

Re: Character strings have no representation for Neophyte le

Posted: Sat Sep 21, 2013 6:07 pm
by Sophia
ChristopheF wrote:The game computes the corresponding initial experience amount in each hidden skill by using the base value 125 * 2 exponentiated to the value 0..15.
This statement is not correct, and actually points directly at the root of the issue. It is not possible to represent 125 * 2^0, i.e., 125, because a value of A = 0, which is hardcoded to result in 0, and a value of B = 1, which results in 125 * 2^1 = 250. I understand you can represent a Neophyte level in the skill as a whole, so perhaps my topic wasn't quite clear. I was talking about this "gap" in the numbers which means there is no across-the-board value you can use to get a Neophyte like you can for every other skill.
ChristopheF wrote:You may think of these values 0..15 as 'skill levels', but in fact they are not.
I agree with this. That is why it confuses me that the Encyclopaedia and CSBuild map directly to these numbers. If we instead treated B as 2, C as 3 and so on (and just left 1 out) then we'd at least have a situation where the four subskills values averaged together resulted in the proper level in the main skill, which is in my opinion much more intuitive, and far closer to the way that the giving of experience points in DM actually works in-game. As it stands, you'd have to know this kind of idiosyncratic 125*2^n formula to be able to determine what actual skill level you end up with.

Re: Character strings have no representation for Neophyte le

Posted: Sat Sep 21, 2013 9:48 pm
by terkio
D4W = sw(*(A2++) - 'A');
if (D4W > 0)
{
D0L = 125 << D4W;
pcA3->skills92[D6W].experience = D0L;
};
If the value is A, D4W is 0, which is not greater than 0,
Ok
so this results in 0.
Do you mean DOL is 0 ?
As far I see this chunk of code the DOL value is undifined.
May be, some compiler zero initialize ? ( a compiler dependant feature ).

Re: Character strings have no representation for Neophyte le

Posted: Sat Sep 21, 2013 11:24 pm
by Paul Stevens
terkio wrote:Do you mean DOL is 0
No....If D4W is 0 then D0L is not used.
Nor is anything stored at skills92[D6W].

But the entire character structure is cleared
to zero at the outset....so storing nothing
results in skills92[D6W] being zero.

Re: Character strings have no representation for Neophyte le

Posted: Sun Sep 22, 2013 3:09 am
by ChristopheF
You should really see the initialization of experience values as separate from the computation of a skill level. There is no simple relationship
FTL simply did not use the same set of values (see tables below). I don't know if this was intentional or not. I agree this is not very intuitive, but that's how the game works.

1) When initializing a champion data, the following table is used to initialize the experience value of each hidden skill:

Code: Select all

Letter  Value    Initial Experience
                  in hidden skill
A         0               0
B         1             250
C         2             500
D         3            1000
E         4            2000
F         5            4000
G         6            8000
H         7           16000
I         8           32000
J         9           64000
K        10          128000
L        11          256000
M        12          512000
N        13         1024000
O        14         2048000
P        15         4096000
2) During the game, to compute the skill level of any skill (both base skills and hidden skills), the following table is used:

Code: Select all

Skill      Skill
level    Experience
0                0
1              500
2             1000
3             2000
4             4000
5             8000
6            16000
7            32000
8            64000
9           128000
10          256000
11          512000
12         1024000
13         2048000
14         4096000
15         8192000

Re: Character strings have no representation for Neophyte le

Posted: Sun Sep 22, 2013 4:47 am
by Sophia
Try this one:

Code: Select all

Letter  Value    Initial Experience
                  in hidden skill
A         0               0
?         1             125
B         2             250
C         3             500
D         4            1000
E         5            2000
F         6            4000
G         7            8000
H         8           16000
I         9           32000
J        10           64000
K        11          128000
L        12          256000
M        13          512000
N        14         1024000
O        15         2048000
P        16         4096000
The advantage to this approach is that a character's main skill becomes the average of the four initial hidden skills. This is a lot more intuitive when the goal is to know what a character is actually good at. The other way maintains a more precise correspondence to the code, but I consider it essentially nonsensical that I put BBBB into CSBuild and this is displayed as Neophyte,Neophyte,Neophyte,Neophyte but the resulting character is a not a Neophyte, but rather a Novice. The Encyclopaedia uses similar representations for its champion data and I also find the results strange.

You guys do what you want, though. :roll: :mrgreen:

Re: Character strings have no representation for Neophyte le

Posted: Sun Sep 22, 2013 5:16 am
by Paul Stevens
You know what, Sophia? It makes absolutely no
difference to me. Your DSB can use whatever it
prefers for the first few levels - I would not be
aware of any difference. Starting with about level
'G' or thereabouts, things probably should align
with the 'Old' way.

But I don't find the 'Old' way nonsensical. I might
be a 2nd class long jumper, a 2nd class runner, a
2nd class swimmer, a 2nd class vaulter, yet a
1st class Decathlon(er), whatever that word might be.

Re: Character strings have no representation for Neophyte le

Posted: Sun Sep 22, 2013 4:57 pm
by ChristopheF
I was only describing how it works in the original game, and I think now we all agree on that understanding.
Now if you want to implement a different algorithm in DSB, I have no problem with that, it is your own choice.

Re: Character strings have no representation for Neophyte le

Posted: Sun Sep 22, 2013 6:57 pm
by Sophia
ChristopheF wrote:I was only describing how it works in the original game, and I think now we all agree on that understanding.
Now if you want to implement a different algorithm in DSB, I have no problem with that, it is your own choice.
Just to clarify, I'm not implementing any different algorithm in the game itself. The only thing I'm changing is the how the data is represented in a human readable form in DSB's editor.

Re: Character strings have no representation for Neophyte le

Posted: Sun Sep 22, 2013 11:13 pm
by zoom
well, at least the mystery is now solved why champions can get access to some actions before gaining an actual level - the prerequisite for that very action. or so I think.
(example :: access to the melee-action before gaining the fighter level that would provide the champion with "melee" option in the first place)
main skill experience must be less crucial in determining access to new actions than is all hidden skills' total ?

Re: Character strings have no representation for Neophyte le

Posted: Mon Sep 23, 2013 12:48 am
by ChristopheF
Yes, some actions require a minimum skill level for a hidden skill.

Re: Character strings have no representation for Neophyte le

Posted: Mon Sep 23, 2013 4:46 pm
by zoom
I guess this issue is yet to be put on the csb dm encyclopedia, if you want/can update that info at all in the near future. I would appreciate it, but it is okay if there are reasons contraire it