| 1 |
SKILLS/EXPERIENCE DOCUMENTATION for DEVELOPERS |
| 2 |
---------------------------------------------- |
| 3 |
|
| 4 |
- Summary - |
| 5 |
|
| 6 |
0. Introduction |
| 7 |
|
| 8 |
1. Sketch of system |
| 9 |
a. Initialization - how skills and experience are linked |
| 10 |
|
| 11 |
2. How to add new skills |
| 12 |
a. creation of new skill: outline of needed steps |
| 13 |
|
| 14 |
3. Detail of skill archetype values. |
| 15 |
|
| 16 |
4. Skill Tools |
| 17 |
|
| 18 |
5. Skill Scrolls |
| 19 |
|
| 20 |
6. Other Objects |
| 21 |
|
| 22 |
7. Workings of the Skill System |
| 23 |
|
| 24 |
8. Changes & Limitations |
| 25 |
|
| 26 |
------------------------------------------------------------------------- |
| 27 |
0. Introduction |
| 28 |
--------------- |
| 29 |
|
| 30 |
Skills were redone to a large extent in April 2003. This document has been |
| 31 |
updated to reflect how the skills work. |
| 32 |
|
| 33 |
The main change is that experience categories were removed from the game. |
| 34 |
Instead, experience goes to the skill itself. Thus. how good a player is at |
| 35 |
the skills is directly proportional to how good they are at that skill, and |
| 36 |
not the category itself. |
| 37 |
|
| 38 |
1. Sketch of system |
| 39 |
------------------- |
| 40 |
|
| 41 |
In the skills/experience code, players gain experience for the activities |
| 42 |
which they perform in the game ("You are what you do"). The activities a |
| 43 |
player may engage in are controlled by the skills they possess. All players |
| 44 |
start with a basic set of skills which they may expand through adventuring. |
| 45 |
While monsters do not gain experience from the use of skills, they may use any |
| 46 |
skills which exist in their inventory if they have the can_use_skill flag set. |
| 47 |
|
| 48 |
In the code, skills are objects which exist in the player/monster inventory. |
| 49 |
Both NPC/monsters and players use the same skill archetypes. Not all skills |
| 50 |
are however enabled for monster use. Check the Skills_players.doc for |
| 51 |
available NPC skills. |
| 52 |
|
| 53 |
The experience one gets for a skill is greatly simplified. No longer |
| 54 |
is it weighted based on the stats of the player. Rather, the experience is |
| 55 |
based on what the skill was used for - opening a tough trap gets more |
| 56 |
exp than opening an easy trap. The stats the player has will improve |
| 57 |
the chances of success in most cases - this is bonus enough without also |
| 58 |
gaining additional experience. |
| 59 |
|
| 60 |
The chracters total experience is no longer related to the sum of experience |
| 61 |
in the players skills - A player could for example only of 1000 exp, but have |
| 62 |
skills with 2500 exp, 300 exp, etc. Removing the tie between skills and total |
| 63 |
experience allows for reasonable skill advancement - you can allow a player |
| 64 |
to easily get to level 20 in a skill without them now being level 20 player. |
| 65 |
|
| 66 |
Note also that the only tunables are now in the code or in the archetypes - |
| 67 |
if the exp for disarming is out of whack, the code would need to be changed |
| 68 |
to give more appropriate amounts. |
| 69 |
|
| 70 |
2. How to add new skills |
| 71 |
------------------------- |
| 72 |
|
| 73 |
Adding a new skill to CF is not overly difficult, it is little more difficult |
| 74 |
than adding new archetypes and a spell to the game. |
| 75 |
|
| 76 |
a. creation of new skill: outline of needed steps |
| 77 |
|
| 78 |
A number of steps are required to create a new skill. |
| 79 |
|
| 80 |
1) Edit a new skills archetype. See below for appropriate parameters. If |
| 81 |
you desire the skill to be a skill tool, edit a "face" for the new skill. |
| 82 |
If you want to have the skill to be learned via a skill scroll, edit a |
| 83 |
skillscroll for the skill. Place the new archetype(s) in the |
| 84 |
lib/arch/skills directory. Remember to name your new skill appropriately |
| 85 |
(ie skill_<new skill name>). Make sure you select a unique subtype |
| 86 |
for your new skill. |
| 87 |
|
| 88 |
2) Edit skill_util.c. Add an entry for the skill in do_skill() (so that it may |
| 89 |
be used as a "long-range attack"). If the new skill is a hth attack take a |
| 90 |
look at the attack_hth_skills[] table in do_skill_attack() -- where does |
| 91 |
the hth attack rank? The most useful attacks should occur earlier in the |
| 92 |
table. |
| 93 |
|
| 94 |
3) Create the skill code. If you created a hth attack, you probably can get |
| 95 |
away with just using attack_hth. For other skills, put the skill code in |
| 96 |
skills.c. If your new skill is to be an "associated" skill, then make sure |
| 97 |
that it returns the value of calc_skill_exp(). |
| 98 |
|
| 99 |
4) Edit treasures/artifacts file as needed (esp. if your skill will become one |
| 100 |
of the starting skills, or will show up in shops.) |
| 101 |
|
| 102 |
|
| 103 |
|
| 104 |
3. Detail of skill archetype values. |
| 105 |
------------------------------------ |
| 106 |
|
| 107 |
This section details the various object/archetype values. |
| 108 |
|
| 109 |
First, we detail skill objects: |
| 110 |
type: SKILL (43) |
| 111 |
subtype: subtype of skill |
| 112 |
invisible: 1 |
| 113 |
no_drop: 1 |
| 114 |
|
| 115 |
name: Name of the skill, used by things like 'use_skill', as well as output |
| 116 |
of 'skills' command. |
| 117 |
|
| 118 |
skill: Same as name - this simplifies code, so that we can look at |
| 119 |
op->skill for both skills and skill tools. It also means that if a skill |
| 120 |
named is passed, we can verify we have the matching entry. |
| 121 |
|
| 122 |
stats (Str, Dex, sp, grace, etc): These modify the abilities of the player, |
| 123 |
in a sense giving bonuses. |
| 124 |
|
| 125 |
expmul: this is the ratio of experience the players total should increase by |
| 126 |
when this skill is use. If this is zero, then experience only goes to |
| 127 |
to the skill. Values higher than 1 are allowed. Note that experience |
| 128 |
rewarded to the players total is in addition to that given to the |
| 129 |
skill. Eg, if player should get 500 exp for using a skill, and |
| 130 |
expmul is 1, the player will get 500 added to that skill as well as |
| 131 |
500 to their total. |
| 132 |
|
| 133 |
exp: The exp the player has in the skill (object). If this is an archetype, |
| 134 |
this contains the base amount the player gets for using the skill. |
| 135 |
exp will be set to 0 when the skill is given to the player. |
| 136 |
|
| 137 |
level: Object: The level of this skill - this is just determined from the exp |
| 138 |
above based on the experience table. Archetype: This is a percentage value |
| 139 |
that determines how the level difference effects experience rewards (like |
| 140 |
the old lexp value). Basically, if it is set to 100, the ratio is normal |
| 141 |
(eg, if opponent is twice level of player, player would get twice as much |
| 142 |
normal exp). If level is 200, player would get 4 times. If level if 50, |
| 143 |
player would half normal. If level is 0, then we don't adjust exp reward |
| 144 |
based on level. |
| 145 |
|
| 146 |
can_use_skill (flag): If this is set, the player knows the skill natively |
| 147 |
(eg, does not need a skill tool, see below). If this is not set, |
| 148 |
then this skill object is acting as a container for experience. |
| 149 |
For example, if a player is using a holy symbol in order to get his |
| 150 |
praying skill, we still need to have skill_praying in the players |
| 151 |
inventory to store the experience in. However, the player can't |
| 152 |
use that praying skill without a holy symbole until they learn it from a |
| 153 |
skill scroll. |
| 154 |
|
| 155 |
Note that specific skills may use other fields to convey more information |
| 156 |
about the skills. |
| 157 |
|
| 158 |
For combat skills (karate, punching, one handed weapons, etc): |
| 159 |
dam: Every 10 levels of the skill, characters does 'dam' more damage. |
| 160 |
wc: Increases characters wc by this amount. |
| 161 |
wc_increase_rate: This is a divisor - skill level is divided by this |
| 162 |
to determine improvement to wc. Lower values are better. |
| 163 |
|
| 164 |
|
| 165 |
|
| 166 |
4. Skill Tools |
| 167 |
----------------- |
| 168 |
|
| 169 |
Skill tools are items that let a player use a skill they do not otherwise |
| 170 |
know. Skill tools may also have advantages, eg, spellpaths they grant to the |
| 171 |
caster, stat bonuses, etc. |
| 172 |
|
| 173 |
Most of the values for the skill tools are just like normal equipment |
| 174 |
(value, weight, face, body_..., ) fields. |
| 175 |
|
| 176 |
type: skill_tool (74) |
| 177 |
skill: Name of the skill this object allows the user of. |
| 178 |
|
| 179 |
Note - the old skill code used 'sp' to denote the skill to use. |
| 180 |
|
| 181 |
5. Skill Scrolls |
| 182 |
---------------- |
| 183 |
type: SKILLSCROLL |
| 184 |
skill: Name of the skill to be learned |
| 185 |
Rest of the values are per normal equipment (weight, value, identified, |
| 186 |
etc). |
| 187 |
|
| 188 |
|
| 189 |
6. Other Objects |
| 190 |
---------------- |
| 191 |
|
| 192 |
Many other objects will use the 'skill' field in their object to denote |
| 193 |
what skill is needed to use this object. Thus, for examples, readable |
| 194 |
objects have 'skill literacy' to denote that the literacy skill is |
| 195 |
needed to read them. Weapons have 'skill' values to denote what |
| 196 |
skill is needed to use the weapon. Same for spells. |
| 197 |
|
| 198 |
|
| 199 |
------------------------------- |
| 200 |
7. Workings of the Skill System |
| 201 |
------------------------------- |
| 202 |
|
| 203 |
This section attempts to briefly explain how this all works. |
| 204 |
|
| 205 |
Due to the addition of the skill pointer, it is no longer required |
| 206 |
that a skill be in the ready_skill position to gain experience. |
| 207 |
|
| 208 |
Whenever a player tries to use skill either directly (ready_skill ..) |
| 209 |
or indirectly (cast a spell which requires knowledge of the skill), the |
| 210 |
code will examine the players inventory to see if they an in fact |
| 211 |
use the skill. This first checks to see if the player has the appropriate |
| 212 |
skill archetype in their object. If they do, and can_use_skill is set |
| 213 |
to 1, nothing more is done. If that is not the case, we then look for |
| 214 |
a skill tool. If none is found, we tell the player the can't use the |
| 215 |
skill. If one is found, we try to apply the skill tool - if this can not |
| 216 |
be done, we also error out. |
| 217 |
|
| 218 |
Only if the player explicitly activates a skill with ready_skill do |
| 219 |
we change the players range pointer. Otherwise, it will remain as is |
| 220 |
(but not that casting a spell might also change the range pointer). |
| 221 |
|
| 222 |
add_exp has been modified to take two additional parameters - |
| 223 |
skill_name and flag. |
| 224 |
|
| 225 |
skill_name is the skill to add the experience to. By passing this |
| 226 |
to add exp, a lot of the code no longer needs to change chosen_skill, |
| 227 |
then reset it back again. |
| 228 |
|
| 229 |
|
| 230 |
flag determines what to do if the player does not currently have the |
| 231 |
skill pointer in their inventory. This can arise if the player |
| 232 |
is using a skill tool, or part of a party. |
| 233 |
|
| 234 |
In the default case of flag being 0, if the player does not currently |
| 235 |
have the skill in their inventory, this is added (with can_use_skill 0). |
| 236 |
If flag is 1, we add the exp to the players total exp, but don't |
| 237 |
give them any in the skill. If it is 2, the player gets nothing. |
| 238 |
|
| 239 |
This fixes many of the abuses of party combat - if a member of your |
| 240 |
party is killing things with wizardry, you'll get wizardry exp. If |
| 241 |
you don't have wizardry, you'll get some general exp, but you can't |
| 242 |
funnel it into things like alchemy anymore. |
| 243 |
|
| 244 |
The effect of flag 1 to add exp is so that that a player can't have |
| 245 |
thousands of exp in a skill and never have used in themselves - for a player |
| 246 |
to have any exp in a skill, he will have had to use it at least once. Note |
| 247 |
however that a player could have used the skill just once (to say kill a |
| 248 |
kobold) and yet get a bunch more exp from party members that are actually good |
| 249 |
wizards. |
| 250 |
|
| 251 |
The handling of add_exp with skill_name is pretty simple. In most cases, we |
| 252 |
know immediately the skill that was used (eg, melee combat, search, disarm, |
| 253 |
etc). In cases of indirect death (spells), we set the skill in the spell |
| 254 |
object to the skill that it should get awarded to. |
| 255 |
|
| 256 |
------------------------ |
| 257 |
8. Changes & Limitations |
| 258 |
------------------------ |
| 259 |
|
| 260 |
The old skill system had the idea of stats that effect the skill. There |
| 261 |
is no good way to do that within the new system - instead, the code |
| 262 |
the executes the skill will do this. This really isn't much worse |
| 263 |
than the old system anyways - the old code still did things like |
| 264 |
'stat average * 3' or otherwise determine how important the stats are. |
| 265 |
|
| 266 |
In addition, this allows for more flexibility for multi faceted |
| 267 |
skills. For example, the identification portion of some skills should |
| 268 |
probably use int, but the creation portion should perhaps be dex and strength. |
| 269 |
|
| 270 |
There is no more SK_level function - while this could still be useful |
| 271 |
to replace code like |
| 272 |
|
| 273 |
level= op->chosen_skill?op->chosen_skill->level:op->level; |
| 274 |
|
| 275 |
the use of automatically de-referencing the op->chosen_skill is not |
| 276 |
suggested - the new skill system is much more lenient on passing the |
| 277 |
appropriate skill object to functions that need it, so calls to |
| 278 |
SK_level in most cases may not really be the right approach - in many |
| 279 |
cases, the chosen_skill may not be what the code is really expecting. |