The basic communications library provides internal E-mail (sometimes called mud-mail) and bulletin board facilities for users.
01 Message boards
Tells you how to add one or message boards to your online world.
Adding message boards to your online world is very easy:
-
Create a new object and base it
off of cMessageBoard.
-
Make sure the Automatically create as an object button
is checked. The message board should not be located in
a room though.
-
Set the pNLPNounName and pNLPParseName with
the message board's name, like "Suggestions".
-
Set pExamineGeneral to a string describing the message board.
-
pMessageBoardDatabase should be filled with a unique database
name for the message board where the message thread objects will
be stored. This string will be passed into the DatabaseXXX() functions.
You might wish to prefix the string with "MessageBoard" so the database is
obviously a message board.
That's it. You're done!
If you wish to change the priviledges for the message board then
write a MessageBoardCanAcces() method for the object.
Documentation – Basic RPG Library
Provides functionality to handle standard CRPG features.
The Basic RPG Library provides functionality to handle standard CRPG features, such as attributes, skills, combat, combat with NPCs, talking to NPCs, etc. It also handles a lot of MUD-style functionality.
This library is based on the Basic Interactive Fiction Library, which must also be included in the project. It must have a higher priority than the Basic Interactive Fiction Library.
01 Skills, attributes, and disadvantages
Describes how to define new skills, attributes, and disadvantages, and how to use them.
Skills, attributes, and disadvantages
The RPG library does not support class levels,
as is typical in Dungeons & Dragons. Instead, it supports
skills, allowing players to advance their characters in any
direction they like.
There are three types of skills:
-
Skills - These are learned abilities, such as
swordfighting, archery, and basket weaving. Skills can be
learned by the characters and trained over time to improve
them; training is done using experience points.
-
Attribute - Attributes are characteristics that
are fundamental to a character and cannot be changed (under
normal circumstances.)
-
Disadvantages - Disadvantages are, in many
ways, negative skills. They are something the character begins
with, but can pay off over time and get rid of. Some sample
disadvantages are: fear of spiders, studdering, and alcoholism.
Disadvantages are useful role-playing devices.
Role playing games often have "special abilities" and "feats".
These could be categorized under skills too.
Create your own attributes, skills, and disadvantages
The "Basic RPG library" and "Basic Fantasy library" include some
standar attributes, skills, and disadvantages. You can always
create your own. Here's how:
-
Create a new object, called "oSkillXXX", where XXX
is replaced with your skill's name.
-
Base the skill off the super-class, cSkill. The
cSkill class is a sub-class of cObject.
-
Check the Automatically create as an
object button. All skills are instantiated objects.
-
Fill in the pNLPNounName and pNLPParseName for
the skill with an appropriate name,
-
Provide a description for the skill in pExamineGeneral.
This description is displayed when the user types the "skills" command.
-
Fill in the skill's pSkillCategory so that the
skill will be placed in the appropriate category in the skills
list, such as "Combat skills", or "Spells".
-
If this is an attribute, set pSkillType to 'a' (case
is important). Attributes cannot be trained, and are randomly
generated for a character when it is first created. You
should also modify gAttributes to include the skill
object.
If the skill is really a disadvantage,
set pSkillType to 'd' (case
is important). Users cannot train their characters with a
disadvantage, so you will need to modify the character creation
code so that disadvantages will be randomly applied or the
player will be able to select the character's disadvantage.
If the skill is a normal skill, don't set pSkillType since
the default value, set in cSkill, is 's'.
-
The pSkillLevelCap is normally set to a reasonably
high value, around 30. However, you can make this lower or higher.
If the value is low, the skill acts more like a "feat", where the
skill is either not known, or known completely. (For example: Riding
a bicycle.)
-
You may wish to set pSkillTrainTeacherLevel. A player
with a high enough level in a skill can teach the skill to
other players. This is a number indicating the required skill
level.
If pSkillTrainTeacherLevel is set to 0, any
characters can learn the skill without a teacher. You might
wish to use a 0-value for skills like climbing or jumping, where
the skills are just a matter of practice.
To prevent players from training the skill to
thousands of other players, the teacher loses one
experience point every time they train another character.
-
To make the skill require another skill, or an attribute,
set pSkillTrainPrerequisites. This can contain
zero or more skills with required levels.
-
If the skill is associated with a language,
set pSkillLanguage to the language-independent
(and case sensative) language string, such as "common" or "elvish".
If it's not a language, leave pSkillLanguage blank or set to NULL.
-
If the language is an animal or monster language, you might
wish to write a LanguageSoundEffect() for the skill
so that when the animal/monster speaks to players that don't
understand the language, a wave file will be played (like a growl sound)
instead text-to-speech.
Those are the basics of creating a new skill. There is more,
but I'll get to the advanced topics after discussing experience points.
Every skill has a skill level. Skills begin at level 0,
and are increased as the user trains the skill using up
earned experience points.
The amount of experience points to raise a skill to the next
level is (roughly) the level of the skill. The actual equation
is that the level of the skill =
sqrt(experience points invested)/2.
This makes is more and more difficult for skill levels to improve.
As a general guideline, 1 XP is handed out for every hour
that the player plays. 1 XP = 1 hour of play.
Therefore, if a player only raises one skill, they can go
from level 0 to level 10 in about 50 hours of play.
You are, of course, welcome to hand out experience points
any way you wish.
In online (multiplayer) mode, the default behavior is to
automatically hand out 1 XP for every hour the player is logged
on (even if they're chatting). This is limited to no more than 1XP
per day, and 3 XP per week. That means, that barring additional
XP from quests, a player can get a maximum of 156 XP per year.
In offline (single player) mode, experience points are handed out
based on what quests/tasks the player completes. To
provide XP in either offline or online mode,
call XPAward().
The RPG library also includes an XPPenalize() call
that will penalize the player if they act out of character. When
the player has been penalized, his character can receive no
experience for the next 24 hours. An example of penalization would
be if the player's character has a "fear of heights" disadvantage
but persisted in having his character walk across a tall bridge
despite warnings.
A player's attributes (or even other skills) affects how much
1 XP helps a skill. Each skill has a pSkillAttribiteBase property
that can list zero or more attributes. You can use this so that
a higher attribute makes the experience go further towards advancing
the skill. For example: A high intelligence would make learning
a mathematics skill easier, thus making XP count for more. If
the same character had a low strength attribute, strength-based
skills would not advance as quickly.
In Dungeons & Dragons, attributes are rolled on 3 6-sided dice,
resulting in a value between 3 and 18, with the average value
being 10.5. The distribution of the numbers forms a bell curve,
with attribute values in the 8-12 range being much more common than
those at the extremes.
A bell curve is a non-technical term for a mathematical
entity known as a gaussian. The neat thing about
bell curves, as mentioned above, is that most people's strength (or
whatever) ends up being near the norm, but a very are very strong
or very weak.
The topic of bell curves brings up standard deviations.
A standard deviation says how close an attribute is close to the
norm. 68% of all characters will have a strength attribute
within 1 standard deviation of the norm. 95%
will be within 2 standard deviations, 99% for 3, and 99.99% within
4 standard deviations.
In English terms, a world champion body builder is about 5 standard
deviations above normal (stronger than 99.9999% of the population).
Likewise, a exceptionally weak person is -5 standard deviations,
or weaker than 99.9999% of the population.
The RPG library stores attributes in standard deviations,
not values between 3 and 18. Therefore, most characters' attributes
will be close to 0 (meaning average), with ranges between
-1 and 1. Some will be higher 1 to 2 or lower (-1 to -2) meaning
above/below normal strength (or, dexterity, etc.) but nothing
too unusually. A rare character will have values higher than 2, or
lower than -2.
Storing attributes as standard deviations has many handy ramifications
that will become apparent as you read through the tutorials.
When a new character (based in cCharacter) is created, the constructor
automatically "rolls" random values for the attributes
in gAttributes. It uses the RandomStdDev() function
to generate the values. The attributes are also "normalized" so
that the sum of all the character's attributes are 0... so as
not to create any hopeless characters.
While races won't be discusses completely until a later topic,
I will touch on some issues here where races affect what skills
a character has.
First of all, any race class (such as cRaceElf) is ultimately
sub-classed from cCharacter. cCharacter supports several
properties related to attributes, a few of which are relevant
to races.
-
pSkillsRacialInnate are a list of skills that
are innate to a race. These include attribute adjustments
(like all Elves having a +1 dexterity), or abilities
that the race is born with (such as all Elves having a +5 magic skill).
-
pSkillRacialLearned are skills that are automatically
learned by the race. For example: All Elves being knowing cSkillElvish
at level 10, and cSkillArchery at level 5, or whatever.
When a character is first created, the character's constructor will
move all the skills from pSkillRacialLearned into the character's
skill list.
-
pSkillsMaleInnate and pSkillsFemaleInnate work
similarly to pSkillsRacialInnate except that they affect skills
based on gender. There is no equivalent male/female test
for pSkillRacialLearned though.
Each character, based on cCharacter, has a number of properties
and methods pertaining to skills:
-
pSkills is a list of all the skills the character
knows along with their skill level. As stated above, the
character's constructor will add any skills
from pSkillsRacialInnate that do not already
appear in pSkills.
If you write code to add or remove a skill from pSkills,
don't forget to call SkillAdded() or SkillRemoved().
See the advanced skill topic below.
-
As a general rule, you should not access pSkills directly,
but instead use SkillGet() from the character object.
SkillGet() is a useful method that gets the skill level
from pSkills, and then adds the skill levels from
pSkillsRacialInnate and pSkillsTemporary if
there are any. This basically returns the skill level
that includes character-specific skills/attributes,
racial skills/attributes, and magic effect enhancements
from pSkillsTemporary.
-
pSkillsTemporary stores temporary modifications
to skills, usually resulting from the possession or use
of magic items. For example: A "Ring of Elvish Speech" would
add the oSkillElvish skill to pSkillsTemporary while it
was worn, allowing the user to speak elvish.
-
Rather than modifying pSkillsTemporary directly, you
should call the SkillTemporaryAdd() method,
as well as SkillTemporaryQuery() and SkillTemporaryRemove().
Now that I have spend time discussing how skills fit in with
characters, I'll delve into some advanced skill topics:
-
Whenever a skill is added or removed from
a character's pSkills or pSkillsTemporary properties,
you should
call cSkill.SkillAdded() or cSkill.SkillRemoved().
(You don't need to call these if you
use SkillTemporaryXXX() since the functions are
called automatically.)
These calls allow the skills to set or remove timers and other
hooks into the character object. The most common use for such
hooks is disadvantage, where, for example, a cSkillAlcoholic
disadvantage might require the character to drink some
alchohol every 30 minutes of play or suffer an XPPenalize() call.
Thus, if you wrote a cSkillAchoholic disadvantage, you'd
provide a SkillAdded() method that would set
a timer to go off every 30 mintes. SkillRemoved() would
destroy the timer.
-
You can write a SkillCanLearn() method for your
skill that only allows it to be learned by certain races.
-
If a skill allows a player to issue new command then
you should provide a NLPCommandParseQuery(),
NLPCommandParse(), and NLPRuleSetTempVerb() message
to parse th new command. For example: If the skill were
gymnastics, you might provide a "backflip" or "do a handstand"
command for the user. Players who did not know the skill wouldn't
be able to use the commands.
Share with your friends: |