Research:Stats and Levelling

HP
Initial HP

At every level-up

Magicka points
Every time intelligence or magicka multiplier is modified

Fatigue
Recovery every frame

Every time a base stat is modified

Encumbrance
Every time strength is modified

Comments
Resting allows all actors in the game to recover. There is a bug with interrupted sleep; the code only spawns the first creature it finds in the levelled list, as well as calculating the number of creatures incorrectly. interruptingCreatures should be 1 + roll iNumberCreatures, and that number of creatures should be spawned.

PC skill progress
When player receive point in the skill:

Levelling up
On level-up PC get 3 points to redistribute, bonus will be this:

where $$ is value of attribute counter

Skill increases
Based on research on leveling of the Alchemy skill (ref: http://openmw.org/forum/viewtopic.php?f=2&t=853)

level_progress = the progress factor through a level (from 0 to 1).

level = current level of the skill.

skill_gain_factor = skill gain factor(s) that come from the skill records.
 * For alchemy only "Potion creation" (default value: 2.00) is used.
 * For other skills, please add alphabetically.

skill_type_GMST = value of the GMST corresponding skill type:
 * Major skill: GMST fMajorSkillBonus (default: 0.75)
 * Minor skill: GMST fMinorSkillBonus (default: 1.00)
 * Misc skill: GMST fMiscSkillBonus (default: 1.25)

specialisation_bonus = value of fSpecialSkillBonus (default: 0.80) when the Player has the same specialization as the skill or 1.00 if not.

On using player->setSkill

 * Experiments on Alchemy showed that using player->setAlchemy did change the alchemy level, but not the skill progress. Therefore, when lowering the alchemy level, the skill progress will be recalculated for that level en give a higher progress. When increasing the alchemy level, the reverse will happen, resulting in a lower skill progress.
 * To reset the progress, level first to the next level and then use player->setSkill to the target level.

Comments
The correct rounding mode is critical for accurate skills, which affect important gameplay like spell auto-selection and training.

Note that there are level 0 NPCs in the game, so the (level - 1) term will become -1; use a signed representation of level in calculations.

Comments
Auto-calculated spells are selected at initial loading time. baseActor refers to the actor with attributes as loaded or auto-calculated, without any kind of spell effects (i.e. abilities) applied.

Due to poor design, iteration order is critical to the algorithm's behaviour. The list of all spells in the game must be in the same order as loaded from the files. NPC spells are held in a vector, which the findMinCostSpell function scans linearly; during the scan, if there is a another spell that matches the lowest cost, it keeps the first one found.

Note that when a spell school is past its limit, the weakest spell is removed, and a new weakest spell is selected. This may not be a spell from the same school as the limit. While this is undesired behaviour, fixing it is likely to cause a major difference from vanilla spell selection, which will not have been play tested. It's not recommend to fix this part at the moment.

Comments
This is first executed once the stat review menu appear, and then executed every time the player modifies their character. The spell list must therefore be cleared before selecting new spells.

See NPC auto-calculated spells for additional comments.