What is the DSA?

Discuss Chaos Strikes Back for Windows and Linux, an unofficial port of Chaos Strikes Back to PC by Paul Stevens, as well as CSBuild, an associated dungeon editor.

Moderator: Zyx

Forum rules
Please read the Forum rules and policies before posting.
Post Reply
User avatar
Gambit37
Should eat more pies
Posts: 13715
Joined: Wed May 31, 2000 1:57 pm
Location: Location, Location
Contact:

What is the DSA?

Post by Gambit37 »

There's been some talk in a couple of threads about the DSA in CSBuild. Yet I've not seen any description of what it is or how to use it.

Can someone explain it please. Thanks.
User avatar
Paul Stevens
CSBwin Guru
Posts: 4318
Joined: Sun Apr 08, 2001 6:00 pm
Location: Madison, Wisconsin, USA

Re: What is the DSA?

Post by Paul Stevens »

Go to the 'View' 'Global Info'.
Edit DSA.
Pick one of the DSAs and click on 'Edit'.
There yoiu will find a description of a 'State Machine'.
There is also a 'Help' button to remind you of
how it works.

Here you can define your own 'Actuator'. Unlimited
number of message inputs, unlimited number of states,
and unlimitied number of outputs. Ability to send
messages between levels. Up to 32 different DSAs
on each level. Unlimited number
of actions (but you have to tell me which are needed so
I can implement only the interesting ones).

Any more questions? ;-)

Actually, it will take a long time to convince you that
this is going to be easy. So let us start off gently. We can
continue this discussion over the next few weeks if it
turns out that anyone is interested enough to continue to
ask questions.

A 'State Machine' is a very standard way of describing
digital machinery like computers. A fellow named Turing
described a famous one. British, I believe.

Each line of the chart is a 'STATE'. Each column of the chart
represents a 'INPUT MESSAGE'. The contents of each cell in
the array describes what should happen when the machine
is in a particular STATE and a particular INPUT MESSAGE is
received. For example, you might want to relay a message to
many different cells in your dungeon. Usually, this is done by
putting many actuators, one on top of each other. We can
do it with one DSA. Example:

If a Set0 (Set north or whatever you call it) arrives we want to
send a set after 0 ticks and a clear after 100 ticks to two doors
located at 9(4,5) and 3(6,12). That will cause both doors to open
immediately and then close again after about 16 seconds.

In STATE 0 INPUT MESSAGE S0 we will write:

MS9(4,5) MS3(6,12) M100C9(4,5) M100C3(6,12)

This would normally require four actuators. Here we do it
with one. And we can give the DSA actuator a nice name to
remind us of what it does. 80 characters, I believe.

See? Check the 'Help' and see if you can figure it out.
Practice will make perfect. This is a pretty simple example.
Once we get the idea we can get rid of the absolute
references to locations so that the same DSA can be used
many places for different doors. And then we will add
multiple STATEs to make decisions. And then multiple
INPUT MESSAGEs. But let us start slowly.
User avatar
rain`
Artisan
Posts: 164
Joined: Sat Feb 19, 2005 11:44 pm

Re: What is the DSA?

Post by rain` »

Were DSA's a feature built into CSB or did you implement that in CSB4win only?

DSA's as an idea are downright heavenly, but I only hope that after implementing DSA's, its still possible to convert the new dungeon.dat files for use with any other CSB/DM client then CSB4win.

Also, The concepts of DSA's are still extremely confusing to even me (and i'm a programming myself), Your help file explains a few things, and your post above explains some more, but its still a little hazy (at least to me) on how it works.

Unfortunately, my windows machine died, so until I get my new parts I am unable to test out DSA's.

-rain`
User avatar
Paul Stevens
CSBwin Guru
Posts: 4318
Joined: Sun Apr 08, 2001 6:00 pm
Location: Madison, Wisconsin, USA

Re: What is the DSA?

Post by Paul Stevens »

Only CSBwin can use files created by CSBuild. With or
without the use of DSAs. Long ago the entire database
was rearranged to allow 65000 objects. Your hopes are
hereby dashed. If you want 'standard' files you must
only use DMBuilder or DMute. You can use CSBuild to
find errors in those dungeons, however.

I rather expected that people would not understand DSAs
immediately. I said in my post that it will take a few
weeks of questions and answers to convince you that
it is really simple. I imagine that 'a little hazy' may be
an understatement.

PAul
User avatar
PicturesInTheDark
Arch Master
Posts: 1154
Joined: Mon Aug 26, 2002 4:47 pm
Location: Vienna, Austria

Re: What is the DSA?

Post by PicturesInTheDark »

Hi Paul,

since I'm willing to start a documentation effort for CSBuild to encourage it's use for a broader crowd of people that are basically no programmers, I would suggest some online meeting via a messenger of some sort. That way Q/A could be faster and more precise if I have follow-up questions which will no doubt come when DSA's are concerned, for example.
Is that a possibility you're willing to do?

Regards, PitD
User avatar
Paul Stevens
CSBwin Guru
Posts: 4318
Joined: Sun Apr 08, 2001 6:00 pm
Location: Madison, Wisconsin, USA

Re: What is the DSA?

Post by Paul Stevens »

I am sitting on MIRC / QuakeNet / #snevets pretty
much 7/24.
User avatar
Paul Stevens
CSBwin Guru
Posts: 4318
Joined: Sun Apr 08, 2001 6:00 pm
Location: Madison, Wisconsin, USA

Re: What is the DSA?

Post by Paul Stevens »

I should have added that:

IMHO it is best to ask/answer questions right here
for at least a little while. If we go off-line then only
you will be exposed to these 'frequently asked questions'.
Learning something new is hard enough. Learning it from
a printed document is generally so difficult as to discourage
people. Watching a slowly developing interactive dialog
and being able to ask questions makes it less distressful.

Anyone else have a viewpoint here?

Off-line discussion of meta-questions and implementation
details would be fine.
User avatar
PicturesInTheDark
Arch Master
Posts: 1154
Joined: Mon Aug 26, 2002 4:47 pm
Location: Vienna, Austria

Re: What is the DSA?

Post by PicturesInTheDark »

Ok, have to go for today, will look through your answers tomorrow.
About the documentation: I think pdf will be most likely, including screenshots and examples as given by you. WinHelp might be worth looking into, but are there Screenshots possible? That might be tricky.
We'll see.

Regards, PitD
User avatar
ChristopheF
Encyclopedist
Posts: 1538
Joined: Sun Oct 24, 1999 2:36 pm
Location: France
Contact:

Re: What is the DSA?

Post by ChristopheF »

I think HTML is the best solution for documentation. In that way, we can publish the documentation online for direct access, and supply a download archive for offline viewing.
Besides, the .hlp format (Windows Help Files) is now an obsolete format. Microsoft switched to .chm format, which is basically a compressed archive of HTML pages and images.
I don't know how difficult it would be to make a .chm file from a bunch of HTML files, but I guess it should not be much more difficult than to build an .hlp file.
User avatar
Paul Stevens
CSBwin Guru
Posts: 4318
Joined: Sun Apr 08, 2001 6:00 pm
Location: Madison, Wisconsin, USA

Re: What is the DSA?

Post by Paul Stevens »

Christophe, it appears you are right in all respects.
I had never looked into .chm before but
it seems that low-cost tools are available and will
become available. See, eg:
http://sandsprite.com/chmspider/
User avatar
PicturesInTheDark
Arch Master
Posts: 1154
Joined: Mon Aug 26, 2002 4:47 pm
Location: Vienna, Austria

Re: What is the DSA?

Post by PicturesInTheDark »

Hmm I'm no programmer so html would be an effort. Basics are no problem to learn but how fluent would that work? What about pdf format? Any objections to that?

Regards, PitD
User avatar
rain`
Artisan
Posts: 164
Joined: Sat Feb 19, 2005 11:44 pm

Re: What is the DSA?

Post by rain` »

"I am sitting on MIRC / QuakeNet / #snevets pretty much 7/24."

A group of us idle at quakenet.org #dungeonmaster, although I won't be for awhile

I'd advise questions be posted on the forums, therefore since everyone can view it anytime, only one answer is required for each question.

-rain`
User avatar
ChristopheF
Encyclopedist
Posts: 1538
Joined: Sun Oct 24, 1999 2:36 pm
Location: France
Contact:

Re: What is the DSA?

Post by ChristopheF »

You don't need to know HTML to make basic HTML pages. Just use any wysiwyg HTML editor (like Frontpage or Dreamweaver), it is really not more difficult than using any word processor.

Personnaly I don't like PDF documents very much. Other than HTML, I'd prefer .rtf which is supported by most word processors, or even a simple text file would be enough.

Having said that, as you do the doc, you do it just like you want.
User avatar
Sphenx
On Master
Posts: 566
Joined: Sun Sep 09, 2001 11:23 am
Contact:

Re: What is the DSA?

Post by Sphenx »

pour les français, wysiwyg = cqvvecqvo.
User avatar
beowuuf
Archmastiff
Posts: 20687
Joined: Sat Sep 16, 2000 2:00 pm
Location: Basingstoke, UK

Re: What is the DSA?

Post by beowuuf »

lol, what's the full phrase?
Was unable to (permenantly) kill off ian_scho (Haynuus), Ameena, oh_brother (Westian), money (Falkor), raixel (Petal) and Lord_Bones (Aurek) in the DM D&D game Time's Champions!

CONGRATULATIONS TO THOSE WHO MADE THE GAME WHAT IT WAS - GREAT!
User avatar
rain`
Artisan
Posts: 164
Joined: Sat Feb 19, 2005 11:44 pm

Re: What is the DSA?

Post by rain` »

Regarding DSA's again:

I now understand the use of DSA's... to save time (and shitloads of it), and allow for unlimited possibilities =]

Now that I understand them a little bit (hopefully more people do as well), you'll have to go a bit farther on your explanations:

Q#1: What are DSA groups used for, and what does Master/Slave do?

Q#2: "State of machine". Local state, Global state, or "Parameter B": Please explain!

Q#3: If the DSA gets a set message for the first time, its obviously going to use S0/S1/S2/S3 columns and row 0. If that contains something like 3M4T4(3,2), it will Toggle 4(3,2) (level 4, x=3 y=2) in 4/6ths of a second. After this, will it automatically execute State 3 then? Or will it wait until another set message has arrived, then execute State 3.

Q#4: In Position masks, you say 1 is north, 2 east, 4 south, 8 west. Does 10 mean east and west? Or would i have to us A (hex code) for east/west.

Q#5: How do you differentiate between multiple "actions" in a single cell? For instance, I want to open 3 doors, then close a 4th with 1 "set" of the DSA.

Q#6: Is it possible for you to give us a few examples of various DSA actions that have been implemented so far? For example: I notice that there is If/Else in the action list, but it says ?[<J|G><state>[<column>] blahblahblah... To us, i think i speak for all of us when i say that it looks like mumbo jumbo =] (sorry for making fun of your lack of "lamen's terms" =])


Comment 7: I think we have gathered enough information on these threads to write a 300 page bible on CSBuild! Perhaps a CSBuild webpage with documentation, examples, tutorials etc are required on this massive project! I'd be willing to write a bit on it, because I'm beginning to understand all of it (finally). Also, I think we could spread ideas on new dungeons through simple tutorials etc.

-rain`

PS. Are you a teacher? I don't remember why I think of you as one, but I have this strange notion that you teach computer science classes at UW-Madison...
User avatar
Paul Stevens
CSBwin Guru
Posts: 4318
Joined: Sun Apr 08, 2001 6:00 pm
Location: Madison, Wisconsin, USA

Re: What is the DSA?

Post by Paul Stevens »

Q#1 DSA Groups and Master Versus Slave

Not implemented. I promised people that they could
have an unlimited number of inputs to a DSA. But you
will see that there are only 12. If you want more than
12 you have to put another DSA adjacent to the Master
DSA and it will provide 12 additional inputs. The group
number identifies all the DSAs that go together. In the
group should be one master and as many slaves as you
please. Don't worry about it until you need more than
12 inputs....then ask me to implement it.
========================================
Q#2 State 'Global' 'Local' 'ParameterB'

I assume that you understand what 'the state of the machine'
means. It identifies the line (row) that will be
interpreted when a message arrives. The 'state' is kept
in a 4-bit field which only allows for 16 states. This
is hardly what I promised. I promised unlimited states.
So you can specify that the state is, instead, kept in the
'Parameter-B' field which is 16 bits and allows for
65536 states. Both of these are 'local', which means
that every instance of the DSA has its own state.
For example, if we put a 'Money Changer' DSA at 02(1,3)
and another at 02(1,4), each will have its own state.

The Global option keeps the state Globally in the definition
of the DSA. It is a 32-bit field which allows 4294967296
states. But the number of states is not really the
big difference. Because the state is kept globally
you can put instances of the DSA at various places in
the dungeon and they all share the same state and
doing this might avoid having to arrange for a lot
of inter-level repeaters. Of course, if you did this
with 'Money Changers' and wanted more than one then
you would have to define a 'Money Changes A' and a
'Money Changers B'.

I anticipate that I may not have answered this fully
in your mind. We can hack at it more tomorrow.
==================================================
Q#3 When does it go to next state?

Oh, WOW!!! You understand this !VERY! well. I am
impressed.

The answer is that when a message arrives it executes
the 'code' in only one cell of the matrix. Then it
sets its state to the state specified by that cell
and waits for the next message. In your example,
it would set the state to 3 and wait.

There are exceptions......The code itself has
instructions to 'JUMP' or 'GOSUB' to another state
and continue there immediately. These are so that
you don't need to make dozens of copies of identical
instructions.
====================================================
Q#4 Decimal versus hex

I believe everything is decimal. I will check more
thoroughly and put a clarification in the 'help'.
====================================================
Q#5 Multiple actions

Just put them all in there with spaces between.
The [next state] is specified only by the first of
multiple actions so putting it in the others is a
waste of time. Example:

4M4T2(3,5) MS5(4,4) M300T5(4,4) ...............

Go on as long as you like.
====================================================
Q#6 What the &?@#$@ is ?[<J|G><state>[,<column>] blah blah?

That is mumbo jumbo. Soon you will read this #@&%@#
like a pro!

I think the help says it best:
?[<J|G><state>[,<column>]][:<J|G><state>[,<column>]]

The square brackets "[]" enclose optional parts. For
example you can always leave out the <column> and
it will assume that you mean column zero.

The broken brackets "<>" enclose names of the pieces of
the syntax. For example, you do not write "<state>",
you write something that will be interpreted as
a state number. Something like "3".

The vertical bar "|" means "OR". In this case you
can choose to write "J" or "G".

So much for the syntax. Now for the semantics of
these expressions. Perhaps we can learn by example:

?G3:J5

There. That was pretty simple. It means:
"If true then (GOSUB 3) else (JUMP 5)"

"If WHAT is true?" I hear you ask. The answer is short
but it may elicit additional questions. The answer
is "The top of the stack". So altogether our little
example means:
"If the top of the stack is true GOSUB 3 else JUMP 5".
=====================================================
Q#7 Are you a teacher?

No. I worked at the University of Wisconsin as a
System Programmer for 33 years. I have been retired
for 4 years.
User avatar
Paul Stevens
CSBwin Guru
Posts: 4318
Joined: Sun Apr 08, 2001 6:00 pm
Location: Madison, Wisconsin, USA

Re: What is the DSA?

Post by Paul Stevens »

Your question # 3 says:
message for the first time, its obviously going to use S0/S1/S2/S3 columns and row 0.

That is the default but....

For the two 'local' cases (Local and ParameterB) you can specify
the initial state when you plant an instance of the DSA in the
dungeon.

For the Global case you can specify the initial state when
you define the DSA.
User avatar
rain`
Artisan
Posts: 164
Joined: Sat Feb 19, 2005 11:44 pm

Re: What is the DSA?

Post by rain` »

Oh my, the global state DSA sounds great! Multi-level actuators sharing the same state... damn!

More questions: If 3 DSA's all are set to global state, does that mean each share 1 single state or each has its own state, that is shared between the actual DSA Actuators in the dungeon. For instance: If i have 1 DSA on 6 tiles, another DSA on 3 tiles, and a 3rd DSA on another tile, do all 10 of them share a single state variable, or does each set share its own (thus making 3 different shared state variables)

If/Else: You say "If the top of the stack is true", what is the top of the stack? (I think its safe to assume that the "first" cell in the upper left's integer value is far from true =]) I would assume its a literal meaning (meaning the last interpreted value before the call?) is true, making it an exact replica of the C/C++ format of ( a ? b : c ), or if A, then B else C. The problem there is that there is no DSA actions that fetch a value (yet) besides fetch object ID, and there is also a Literal to Stack (stack being keyword), which makes me confused again =]

-rain`
User avatar
Paul Stevens
CSBwin Guru
Posts: 4318
Joined: Sun Apr 08, 2001 6:00 pm
Location: Madison, Wisconsin, USA

Re: What is the DSA?

Post by Paul Stevens »

I will try to be precise. First definitions of terms.

--DSA Definition - this is one of those named state tables.
There can be 256 of them. For example: "Money Changer"

--DSA Actuator - what you plant in one of the cells in your
dungeon - I also have called this an 'instance' of the DSA.

A global state is kept with the definition. So there can be at
most 256 global states. A local state is kept with the actuator
so there can be as many states as you like. Well 65000.

===============================================

The stack. There is an internal operand stack. You figured
it out when you saw the 'Fetch' and the 'Literal'. It is like
the stack in the language 'Forth'. Or in the old Reverse Polish
calculators. You put values on the top and fetch them again
from the top. Like a stack of plates.

But you have caught up with me. You are right that very
few stack operations exist. They have not yet been invented.
They will be invented as needed.
User avatar
rain`
Artisan
Posts: 164
Joined: Sat Feb 19, 2005 11:44 pm

Re: What is the DSA?

Post by rain` »

Excellent! In that case, as I create new puzzles in dungeons, I will post requests for DSA actions/functions (is it safe to call them "functions" because they now return values?).

So far I've already suggested one above, which you discussed, I'll be sure to inform you on any new ideas/requirements i may need with DSA's.

Note: I don't know if you know this, but CSB4win is by far, the best DM/CSB clone out there =]. The possibilities are literally endless on what you can do (as long as the creative mind can think it, which is actually the hardest part!)

-rain`
User avatar
Paul Stevens
CSBwin Guru
Posts: 4318
Joined: Sun Apr 08, 2001 6:00 pm
Location: Madison, Wisconsin, USA

Re: What is the DSA?

Post by Paul Stevens »

If you mean the business about testing for and copying
objects:

That is more than just writing the DSA definition. The
functions for testing and copying need to be defined
and then the code for compiling/decompiling and
interpreting need to be written. I am still working on the
'Swap Object' (the Firestaff) actuator and will not get to
this new project for a couple of days. That will also give
time for people to suggest better solutions. Sometimes
things get clearer after a few days of thought. What I
proposed was my first idea to solve your problem. But
rest assured we will solve it somehow.
kentaro-k.21
Artisan
Posts: 178
Joined: Wed Dec 17, 2003 1:39 am
Location: Osaka, Japan
Contact:

Post by kentaro-k.21 »

currently, i'm writing a DSA reference page:
http://members.at.infoseek.co.jp/danmas ... syntax.htm

source of DSA syntax/operators are from DSA help on CSBuild161/comments and source code from CSBsrc98/technical docs at dianneandpaul.net.

* BE CAREFUL. it is still DRAFT and incomplete. my reference page contains many unconfirmed information, where i have to verify the actual behavior of sample codes.
kentaro-k.21
Artisan
Posts: 178
Joined: Wed Dec 17, 2003 1:39 am
Location: Osaka, Japan
Contact:

Post by kentaro-k.21 »

recently, i enjoy to write my personal review for DM clones CSBwin (DSA reference) and Dungeon Maker (editor tutorial).

i'm just fun to explore the mystery structure of their engines, to know how creator realized his dream with his engine. just curious to seek the trick as a developer :)

i'm interested in DSA. it was a kind of magic for me then. i did't know what it does and it's goal.
now, i can see a little bit, so my next preasure is to write any kind of review so that everyone can enjoy to understand and try DSA for his own goal!
User avatar
Paul Stevens
CSBwin Guru
Posts: 4318
Joined: Sun Apr 08, 2001 6:00 pm
Location: Madison, Wisconsin, USA

Post by Paul Stevens »

Your documentation is very nice.

You can see that I tried to start such a thing.....

http://www.dianneandpaul.net/CSBwin/doc ... Index.html

but I did not get too far. Please let me know if you need any details that
you cannot make out from the code itself.
User avatar
beowuuf
Archmastiff
Posts: 20687
Joined: Sat Sep 16, 2000 2:00 pm
Location: Basingstoke, UK

Post by beowuuf »

*bump for Adamo and others*
Post Reply

Return to “Chaos Strikes Back for Windows & Linux (CSBWin) / CSBuild”