DSA Overview

The DSA (Designer Specified Actuator) provides a mechanism that allows the designer to create custom effects.  He can write a program to respond to player actions, make decisions based on the state of the game, and manipulate the dungeon and the heroes that populate it.

The DSA is based on a 'State Machine'.  To a large extent you are a 'State Machine'.  What you do and how you respond to events in the world depends on your 'State'.  For example, when you get up on a sunny morning your state might be 'Happy'.  When you discover that the orange juice has gone sour you may enter the 'Unhappy' state.  And when your lawyer calls to say that you owe the government seven-thousand dollars you might enter the 'Depressed' state.  Here is how you might respond to events in the world:



Friend Says "Hi"
orange juice sour
Lawyer calls
Win Lottery
Happy Say "Hi" Stay Happy.
Say "Darn".
Become Unhappy.
Say "What can we do?"  Become Unhappy.
Remain Happy.
Unhappy
Say "yeh".  Stay Unhappy.
Say "Damn".
Stay Unhappy.
Slam down the receiver.  Become Depressed.
Become Happy.
Depressed
Say nothing.  Stay Depressed.
Throw juice out the window.  Stay Depressed
Shoot self.  Become Dead.
Become Happy.
Dead
Do nothing.  Stay Dead.
Do nothing.  Stay Dead. Do nothing.  Stay Dead. Do nothing.  Stay Dead.

In the DSA the states are numbered (0, 1, 2, ...) instead of named (Happy, Unhappy, ...) and the events are messages received from other actuators such a Pressure-Pads or other DSAs.  But the idea is the same.  Events occur in the dungeon and the DSA, in general, does something and changes its state.

A simple DSA has up to 16 states (expandable by experts) and can receive up to 12 different kinds of messages (expandable by experts).  The messages represent events that take place in the dungeon such as a switch being pressed.  There are 3 message types  (Set, Clear, Toggle) combined with the four directions (North, East, South, and West) and therefore 12 different combinations.  Our example used four messages ("Hi", "sour", "calls", and "Lottery").  The 12 DSA messages are named "S0", "C0", "T0", "S1", "C1", "T1", "S2", "C2", "T2", "S3", "C3", "T3",  where S=Set, C=Clear, T=Toggle, 0=North, 1=East, 2=South, 3=West.

Each of the boxes in the example above contains English text that says two things:
The bulk of this documentation will describe the language we use to accomplish these two things.  But let us do a very simple example right now.  Say that we want to open a pit when a Pressure-Pad has been activated five times.  We arrange for the Pressure-Pad to send a "S0" (Set-North) message to our DSA and we insert the following DSA into the dungeon:


S0
0
1N
1
2N
2
3N
3
4N
4
5M
5
5N

This example could be accomplished with a normal "Counter" actuator but we are studying DSAs so we will do it this way.  In the boxs you see a digit and a letter.  The letter tells what to do and the digit tells what state to go to next.  The 'N' means "do nothing".  The 'M' means "send a set message to the Pit".  Here is how it works:  The first time the pad is actuated we are in state 0 and do nothing and enter state 1.  The second gime the pad is actuated we are in state 1 and we do nothing and go to state 2.  Etc.  The fifth time the pad is actuated we are in state 4 and we send a message to open the Pit and go to state 5.  Each time the pad is actuated after that we do nothing and stay in state 5.

All quite simple.  We only receive one message type and the state sequence is easy to understand.  More complicated DSAs will probably require us to draw a couple of diagrams in order to be sure we understand its workings.  But how does that 'M' know what Pit is to be opened?  How would we close a Pit?  We'll talk about these things in the details.

Back to the Index