[MUD-Dev] Re: let's call it a spellcraft

quzah quzah
Wed Sep 23 16:24:21 CEST 1998


From: Vadim Tkachenko <vt at freehold.crocodile.org> on Tuesday, September 22, 1998
at 8:39 PM
Subject: [MUD-Dev] Re: let's call it a spellcraft

[Since this is a reply to a two-in-one-reply, the quoting is a
 bit odd, but I think I've got it all worked out. -Q-]

In addition to the above, I replied to this in an odd order, (I
started at the bottom after I had read through the message, and
wrote my reply to something near the bottom first, so, hopefully
it makes sence. Heh.


>OK, I want to create the 'Apocalypse' spell, destroying every player in
>the area of effect, except myself.

>
>And at the same time I joined the game 5 minutes ago.
>
>How are you going to define the limitations on the spell being created?

[snip]

>What about the side and cumulative effects of the variouse spell
>components?
>How about creating a complex spell by sequencing some simpler spells and
>setting a proper timing for them (I guess, that was discussed here
>before)?


You'd just have to write some sort of spell editor, and allow
the user to dump more and more effects into the spell. I would
do it so the order they are added (effects) decides the fireing-
order of the spells effects. Example:

   (1) define base magical realm for the spell (its power source)
       this could limit the things you could add to the spell.
       you could also allow for multiple power sources (ie: many
       components)
   (2) define triggering mechanism (spoken words, just thoughts,
       a full drawn out dance, whatever) Perhaps depending on the
       realm, you have to do X, or you cannot do X, or X gives it
       Y amount of additional power, or whatever. You [the game
       designer] would have to work that out ahead of time.
   (3) define any saving throws/checks needed (say, the more of
       a chance you give it to fail [more saving throws] then it
       would be easier on the caster or whatever. Again, GD's
       choice.
   (4) add effect [effect_type, effect_duration, effect_amount]
   (5) repeat step (4) until you have your spell made.
   (6) name it.

Shrug. Anyway, there's another way you could do it. Then, the
way I'd do it is that they would trigger (the effects) in the
order they were put onto the spell, however, depending on if
you had a delay on them or not (effect_delay) they would be
added to (in my case) the global effect list in their "time I
trigger" order. So... if I the spell I made had 100 things
that were its effects, they would be checked in the order they
were added to the spell, however they would "fire" in the order
they fell in the world's effect list. (Not necessarily in the
order the creator of the spell thought they would)


>Like, I can feel the opponent going to cast a fireball on me, so I fire
>the sequence of "magic mirror" on myself and "Dispel heat resistance" on
>him?
>

>How would you define the necessity of some material component for the
>spell? See, if you just say "I want this spell to require the feather"
>and that's it, it's not fun, but if you say "This spell requires a
>feather because...", it's completely different.


It was just a rough example. You would have to define an element table
of sorts, giving specific attributes to each element. Or perhaps, in
define a set of magical realms/bases/origins that have specific element
lists that they derive their power from. Then, to use X type of magical
element, you need to be sure to provide a source from which to grab the
magical power. (In this case, we used soap and a feather, so let's say
that they fall into the "fire_plane" element table.

How would people know what fell into what? Make them play around and
find out. Hide tomes, describing bits of arcane knowledge, there are
a multitude of things you could do. I was just tossing out a very basic
example.

And like I said, it would have to be something you worked into your
spell model/engine/physics.


>[Vladimir Prelovac]
>> He would then give it a name, write it to his spellbook, and maybe teach it
>> to his friends. That way the new spell, carrying the name he gave it, would
>> be tought in the lands for generations after.
>
>Good idea, tough to implement, though ;-)


No, it should be really easy. I would save no "in game" spells. The
world would have no spells that it came with, were I doing it. Then,
players would just have the spells saved in their player file. Some
thing simple, like so:

SPELL
(name) (element) (componants) (magic words) (gestures/etc) (etc...)
END

Then, they'd just load with the player, and to teach someone the
spell, you'd just have to make a scribe skill, or some such thing.


>Now, some afterthoughts.
>
>[Quzah]
>> I have in mind a much simpler effect list. Basically, there are
>> only a very very few things that a spell can do:
>
>> Lower X
>> Raise X
>> Set X to Y
>
>I presume that X and Y are properties (for clarity sake, sometimes
>they're called attibutes, or stats).


Nod. I am going to use the above for the entire game. I have
decided to try and rid the game of all pre-built commands and
what not. Basically, I am going to make a "cause and effect"
sort of "engine" if you will, add to that a terrain generator
and something to save/load/handle_connections, and call it a
day. Then, (ideally) I'll do the same thing as described with
the spells, and apply it to all of the things you would do in
a typical game day.

Naturally, you'll have to set up some constants in the game,
things like a "character sheet" or whatever, and some things
like element tables (which list properties of X_element) and
the like. Things from which you can grab bits of info that
you need to successfully execute a command.


>Now, can you give me a real example when Y can be _set_ to X, unless
>it's boolean? Also, let's consider this:


Sure, here are a few types real quickly:

spell_random_teleport:  SET( character->room_i_am_in, random_room );
spell_quicksand:        SET( room->floor_type,  FLOOR_QUICKSAND );
spell_evaporate:        SET( water_barrel->liquid_amount, ZERO );

Shrug. Just a few. Bascially, anything that is not a damage/heal
type of thing, is a "set_to" type of thing. If you are not just
altering it by a known amount, then you do specific "set_to" stuff.
At least that is how I see it, and I think it will work great.


>1. You scratch your hand, have some temporary disability (can't put your
>hand into boiling water), but it will heal off by itself.
>2. You accidentally miscalculate your axe swing and chop off your hand.
>You can't fix it unless you go to the surgeon with a lump sum and he
>sews it back, or you use magic to grow a new hand.
>
>Here you have the example of the vanishing effect and permanent effect.
>Unfortunately, the vanishing effect could be pretty
>calculation-intensive (especially if you go into extremes like the
>trajectories - say, it may be half-decay, or linear, or whatever else),
>but I believe the abovesaid is a good _generic_ way to handle the
>property changes and hopefully can be optimized (here's a callback to
>the event handling discussion).
>
>[actually, all abovesaid is a simplified version of property handling in
>Gradient MUD, dormant at the time]
>
>Also, there are effect dependencies, like - if you chop off your hand,
>you start bleeding until you either fix it or die from the blood loss,
>not counting the original effect ;-)
>
>Comments, anyone?


Sort of what I am thinking (from what I gather from the above) with
my someday_to_be_done cause and effect thing. I am thinking of just
keeping a large in-game list of effects, and they'll update whenever
it is their turn. Then, depending on their type, they will update in
a different way.

A wound effect would be added to the character, with a duration, and
then also added into the global update list. When its turn came around
it would deincrement. If its X got to zero, it would mean that it was
no longer an issue, and would be removed from the character and also
the global list. If it was not at zero, it would still be deincremented
but then it would be tossed back lower on the list, to wait its next
update turn.


>[Quzah]
>> 1) area of effect needed
>> 2) range needed
>> 3) component list
>> 4) sylibus list
>> 5) spell trigger/action
>
>Actually, can it be generalized as
>
> "action results are a function of (action, actor, target, context)",


I am thinking when I define a CAE (cause and effect), it will have a
total of ten pieces. This is what currently looks like:

CAE: ((subject)(condition)(topic)) ((target) (result))

This is split into two pieces; the fist makes up the CAUSE,
the second group is target and result, which is the EFFECT.

CAUSE = {(subject)(subject_prop)} {{condition)(condition_prop)}
EFFECT= {(target)(target_prop)} {(reaction_type)(reaction_amount)}

IF (cause) THEN (effect)

Example:

if ( player->gold < 300 ) then ( player->gold = 1 );

CAUSE
"player" == (subject)           /* player info */
"->gold" == (subject_property)  /* ie: a sub-piece of player info. */
" < "    == (condition)         /* basic comparison */
         == (condition_property)/* there is none in this example. */
" 300 "  == (condition topic)   /* an amount here */
EFFECT
"player" == (target)            /* player info */
"->gold" == (target_property)   /* a sub-piece of player info. */
" = "    == (reaction_type)     /* what to do to the target */
" 1 "    == (reaction_ammount)  /* how much to do. */


This should work for anything I can think of; rooms, objects,
creatures, spell effects, anything else. I opted to do it this
way instead of a the simpler (less pieces to fill in) method,
so that I don't have to make a million things like:

#define PLAYER_ITSELF    0
#define PLAYER_GOLD      1
#define PLAYER_WEIGHT    2
....
#define ROOM_SOMEPART    342554356

This also should avoid an huge huge case statement or something
that I'd have to run through to find out every possible way to
handle every comparison and so on...

It is yet to be fully written, but I think I have a pretty nice
design, so I'll have to see how it finally turns out.


>and every component may change properties through the action. For
>example, if you try to cast a fireball in a small room, you definitely
>get some ashes on the walls and ceiling, and expect some backfire, too
>;-) and just prey that the ceiling doesn't collapse on you.



When the action of the fireball went off, it would run through the
stuff in its effect range, and, well, effect them. Then they will
run through the yet-to-be-finished physics model to see if they all
get broken or whatever. (physics model == CAE_checker, which will
handle the adding and subtracting of effects on the world)


>And again, I'd propose to include the response actions along with the
>property changes into the action results (touch that plant I don't know
>the English name for (mimose?), and it squeezes its leaves).

I am sure I'll have to limit myself, none of this "butterfly flapping
in the wind causes a tornado 5000 years later" stuff. Dang ;)

>>         Vladimir.
>Vadim Tkachenko <vt at freehold.crocodile.org>
-Q-





More information about the mud-dev-archive mailing list