What is an Activity?
Fishing, combat, and singing are all examples of activities. What
do these have in common?
Some activities generate Actions. Combat, for example, will generate
many actions (strikes, blocks, dodges...). That's why it is connected
to the Clock - just like a Soul. Singing would probably not generate
any actions. It is merely started and, eventually, stopped.
People entering within hearing range would hear the singing.
The all have a duration - a start time and (hopefully) a stop time.
They may involved more than one participant (creatures fight against each
other, people can sing together, ...)
In White Orb only one activity can be performed at a time by a single
person. So you can't sing while fighting. This is to simplify
things - it may be changed later.
Activities vs Souls
Each Physical can only be involved in one activity (or none). If
a new activity is started, the current one will stop. When involved
in an activity, the activity will be like a temporary soul that sits between
the Physical and it's normal Soul(s) - if it has any. The creature's
real Souls are still active and allowed to produce actions - but the Activity
has higher priority and may cancel actions requested by the soul.
Here is the normal relation between a soul and it's body (when no activities
are in progress):
Here's what happens when an Activity is started:
So the activity may cancel or modify any actions requested by the soul.
Take a combat situation for example. "Talk" actions would probably
not be affected by the Activity (they would be let through, unmodified),
while "Move" actions might be cancelled completely (if the combat handler
activity wants full control over movements). Spellcasting might be
made more difficult in a combat situation, etc.
How are activities started?
Yep. The act of starting an Activity is in itself an Action.
Stopping an activity is also an action. They will probably be
implemented as StartActivityEvent and StopActivityEvent. Here's an example
of the control flow.
Let's say Joe has found a nice lake and wants to start fishing.
And let's say I'm controlling Joe via a player client (so I'm his Soul).
Here's what happens:
I indicate that I want to start fishing in the lake (using some menu or
text command in the client GUI). The client will send off a StartActivity
action to the server, which will be placed in the action queue.
The StartActivity action will be executed. It will create a new instance
of FishingActivity. The FishingActivity will be set as my current
activity. This means that any new actions I try to do from now
on (for example drinking from my bottle) will be filtered throught the
fishing activity. The fishing activity will probably decide that
drinking doesn't interfere with fishing, and let it through.
The FishingActivity will now work as a Soul, telling me that I've caught
a fish once in a while, stuff like that. After a while it might say,
for example, "oops you lost your hook" - and you will have to replace it.
Now I want to Joe to stop fishing, because he smells orcs and wants to
get armed. So I use the GUI to tell Joe to stop fishing.
A StopActivity action will be executed. The FishingActivity decides
that this is OK, and let's the action through. When the action is
executed, the fishing activity will be stopped, and Joe will again be free
to do what he likes.
Action filtering can be used in quite useful ways. If the soul requests
an action that contradicts the current activity the activity has three
This will vary from case to case. Fishing is quite harmless, so if
the Soul wants to do something like walk away from the lake the activity
will probably just stop automatically (no point bothering the player with
messages like "you can't walk east because you are fishing"). In
combat, on the other hand, the activity itself will probably be more dominant.
Like you can't just walk off - you have to manage to disengage first.
Or suffer heavy penalties...
Cancel the action.
Modify the action
Stop the activity and execute the action
Another difference between Activity and Soul is that activity is not a
subclass of Physical. This is because an activity can control more
than one participant - it doesn't fit nicely into the container hierarchy
like a Soul does. Here's how Activity fits into the core hierarchy:
Active is an interface for objects that queue actions want to be notified
when they have been completed (or cancelled).