&PALETTE

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.
User avatar
Paul Stevens
CSBwin Guru
Posts: 4318
Joined: Sun Apr 08, 2001 6:00 pm
Location: Madison, Wisconsin, USA

Post by Paul Stevens »

10000% = 100 * 100%
7500% = 100 * 75%

No fractional math is available. Only integer.
So I mutiplied all values by 100 to compute
things with 2 'virtual' decimal places. Notice that
at the last step before &PALETTE I divide these
values by 100.
User avatar
Adamo
Italodance spammer
Posts: 1534
Joined: Fri Apr 22, 2005 11:59 am
Location: Poland
Contact:

Post by Adamo »

Thank you for the demo! Your DSA works excellent!

I`ve prepared a lot of custom palettes (well, not really.. I made 372 custom palettes with only one colour wchich has actually two functions but, by manipulating with the values by tries-and-mistakes method, got similar effects) and tied them with a proper DSAs and it all works fine!

But there is one problem.
When the same Viewport Palette DSA is being set again during its work, then that DSA tends to shorten its work time. The same situation happens when another Viewport Palette DSA is set while first is still working. I would like all the ViewportPalette DSAs to stop it previous work and start the new one (in other words I want only ONE ViewportPalette DSA to work at the time); when the ViewportPalette DSA is set, all the others (previous) ViewportPalettes should stop working. Is that possible to do?

Now it seems:
1. ViewportPalette DSA gets a message and starts working
2. the same (or other) ViewportPalette DSA is activated (while the first is still working) and engine tries to execute both of them

I would like to:
1. ViewportPalette DSA gets a message and starts working
2. the same (or other) ViewportPalette DSA is activated (while the first one is still working) and engine interrupts (cancels) previous ViewportPalettes to execute the new ViewportPalettes

I guess the best method to do that would be adding something wchich checks if there is already some ViewportPalettes (or DSAs rensponsible for changing them) working and, if so, when the engine is going to activate new ViewportPalettes, cancels all the previous ViewportPalette manipulations to install new ones.

I will send you a demo to show that.

EDIT: demo sent
Spoiler
(\__/) (\__/) (\__/) (\__/) (\__/) (\__/) (\__/) (\__/) (\__/) (\__/) (\__/) (\__/)
Spoiler
(@.@) (@.@) (@.@) (@.@) (@.@) (@.@) (@.@) (@.@) (@.@) (@.@) (@.@) (@.@)
Spoiler
(>s<) (>s<) (>s<) (>s<) (>s<) (>s<) (>s<) (>s<) (>s<) (>s<) (>s<) (>s<)
User avatar
Paul Stevens
CSBwin Guru
Posts: 4318
Joined: Sun Apr 08, 2001 6:00 pm
Location: Madison, Wisconsin, USA

Post by Paul Stevens »

I received your demo dungeon.

The easiest way to be sure that only
one DSA is manipulating the palette
is to have only one DSA that manipulates
the palette. You have six.

Instead of having six DSAs you should
have one DSA with six different states
doing the work. Since there are 12 different
messages that can be sent to a DSA, you
could have up to 11 different "Active
States", each initiated by one of 11 different
'switches' or 'pressure pads' or whatever.
The twelfth message type is used to send a
message to itself to continue the animation.

If you need more than 11 different animation
sequences we can still do it with one DSA but
it will require more clever messages. Either
the 'Slave DSA' (never tested) or combinations
of messages ( 66 possible ways to send two
messages).

Coordinating multiple DSAs in this application
would be quite a challenge, I think. One DSA
is tough enough when there are asynchronous
events occuring (the party moving and the
animation updates).
User avatar
Zyx
DSA Master
Posts: 2592
Joined: Mon Jun 05, 2000 1:53 pm
Location: in the mind
Contact:

Post by Zyx »

You can also use a global variable.
User avatar
Paul Stevens
CSBwin Guru
Posts: 4318
Joined: Sun Apr 08, 2001 6:00 pm
Location: Madison, Wisconsin, USA

Post by Paul Stevens »

Zyx wrote:You can also use a global variable.
Indeed. I had not thought of that. Each
Pressure Pad would send a message to
an intermediate DSA which would set the
global variable and send another message on
to the Palette-Cycling DSA.

In fact, to the extent that the Palette
Cycling can be parameterized, all the
needed parameters can be set in
global variables prior to activating
the main DSA.

This is probably the most straight-forward
and easily-debugged method. Thanks :D
User avatar
beowuuf
Archmastiff
Posts: 20687
Joined: Sat Sep 16, 2000 2:00 pm
Location: Basingstoke, UK

Post by beowuuf »

Zyx has still got it after all this time!
User avatar
Paul Stevens
CSBwin Guru
Posts: 4318
Joined: Sun Apr 08, 2001 6:00 pm
Location: Madison, Wisconsin, USA

Post by Paul Stevens »

Let me tell you......Zyx has had lots
of practice in overcoming limitations.
User avatar
Adamo
Italodance spammer
Posts: 1534
Joined: Fri Apr 22, 2005 11:59 am
Location: Poland
Contact:

Post by Adamo »

You have six DSAs
actually, seven. Seventh DSA is called by a pad named "special" in the demo I sent you.
DSA#1 uses p 2-63
DSA#2 uses p 64-126
DSA#3 uses p 127-188
DSA#4 uses p 189-250
DSA#5 uses p 251-312
DSA#6 uses p 313-374
DSA#7 uses p 64-316
The main reason why I asked you for all that was the DSA named "palCHAOS_64-316_T10" DSA. When you take a look at it, you`ll see that it uses VP from 64 to 316 with a delay of 10. It also randomizes colours somehow (inadequate parameter L=8383838; I tried many possibilities and it gives best results IMHO). The palettes should be changed every 10 game ticks of 251 palettes, wchich lasts 2510 game ticks.

Everything works fine untill you press the same ("special") pad once again during its work. So, start the demo and start pressing the "special" pad quickly (step on the special pad, step off, step on, step off, etc.). When you do that, the palettes start behaving strange. If the paletting activity was cancelled and started again after (the same) DSA gets (the same) message, the palettes would simply start from the begining. But the engine tries to execute more than one same DSAs in a time, wchich causes weird results.

For me, the good solution would look like this: "When DSA named palCHAOS_64-316_T10 gets the message (is activated), it starts work from the beginning".
Maybe we should, say, add something to the 0S0 line, whcich FIRST interrupts/cancels the activity of this particular DSA and THEN starts it from the beginning to avoid the situation that more than one palCHAOS_64-316_T10 DSA is executed in the time?
You can also use a global variable.
Hmm, I never did it before. Global variables has 64 numbers to use. What are they referring to? Does GVnnn@ and GVnnn! calls them? What`s next? I`ll dig for some Global Variable descriptions in the meantime.
Spoiler
(\__/) (\__/) (\__/) (\__/) (\__/) (\__/) (\__/) (\__/) (\__/) (\__/) (\__/) (\__/)
Spoiler
(@.@) (@.@) (@.@) (@.@) (@.@) (@.@) (@.@) (@.@) (@.@) (@.@) (@.@) (@.@)
Spoiler
(>s<) (>s<) (>s<) (>s<) (>s<) (>s<) (>s<) (>s<) (>s<) (>s<) (>s<) (>s<)
User avatar
Paul Stevens
CSBwin Guru
Posts: 4318
Joined: Sun Apr 08, 2001 6:00 pm
Location: Madison, Wisconsin, USA

Post by Paul Stevens »

I can modify the DSA named:
palCHAOS_64_316_T10
so that it restarts properly. I meant to
do that in the first place and must
have missed something. I think
I know what I did wrong.
User avatar
Paul Stevens
CSBwin Guru
Posts: 4318
Joined: Sun Apr 08, 2001 6:00 pm
Location: Madison, Wisconsin, USA

Post by Paul Stevens »

I could not find palCHAOS_64_316_T10.
I found magic_light_64-316.

There is a diagram of the following
DSA at:
http://www.dianneandpaul.net/CSBwin/mag ... 64-316.jpg


Description = magic_light_64-316
State = 0
StateLocation = 0
GroupID = 0
Number of States = 7
First Displayed State = 2
Number of non-empty states = 7
State Number = 0
Number of Actions = 1
S0 = 2G1 J2T0
State Number = 1
Number of Actions = 1
S0 = L0 L0 L1 L100 &PALETTE L64 SA L8383838 SB
State Number = 2
Number of Actions = 4
S0 = 3G1 G4 G5 G6
T0 = LA L316 &= ?JT3:JS1
S1 = G4 G5 G6
T3 = G1 L0 &SETNEWSTATE
State Number = 3
Number of Actions = 1
T0 = 2N
State Number = 4
Number of Actions = 1
S0 = L0 L0 L1 L100 &PALETTE L0 L0 LA L10000 LB &NEG &+ L50 &+ L100 &/ &PALETTE
State Number = 5
Number of Actions = 1
S0 = L$ M10T*
State Number = 6
Number of Actions = 1
S0 = LA &1+ SA LB L100 &* L100 &/ SB
signature = 525236EADD71E71FBA6DB84E53F20110
User avatar
Adamo
Italodance spammer
Posts: 1534
Joined: Fri Apr 22, 2005 11:59 am
Location: Poland
Contact:

Post by Adamo »

works perfectly now! thank you! :D
Spoiler
(\__/) (\__/) (\__/) (\__/) (\__/) (\__/) (\__/) (\__/) (\__/) (\__/) (\__/) (\__/)
Spoiler
(@.@) (@.@) (@.@) (@.@) (@.@) (@.@) (@.@) (@.@) (@.@) (@.@) (@.@) (@.@)
Spoiler
(>s<) (>s<) (>s<) (>s<) (>s<) (>s<) (>s<) (>s<) (>s<) (>s<) (>s<) (>s<)
User avatar
Paul Stevens
CSBwin Guru
Posts: 4318
Joined: Sun Apr 08, 2001 6:00 pm
Location: Madison, Wisconsin, USA

Post by Paul Stevens »

A lesson from a real dungeon and a
real problem.

Adamo reported to me that this DSA fails
when the speed is set to "Quick as a Bunny",
the DSA is activated repeatedly, and the
party is moving quickly.

He is right. It does fail. Because under these
circumstances there are occasionally two
identical messages in the queue.

Every time he edited this dungeon he was warned
that he had not yet decided what should be done
when more than one identical message is in the
queue. So duplicate messages were discarded by
default.

I set this to deliver ALL messages and everything
appeared to work much better.

If anyone who uses CSBwin/DSAs does not understand
what this is all about, speak up. These are
difficult to reproduce/debug problems and you
need to know how this works.
User avatar
Joramun
Mon Master
Posts: 925
Joined: Thu May 25, 2006 7:05 pm
Location: The Universe

Post by Joramun »

Hehe, in fact the above post are totally not understandable to the neophyte.

Maybe a craftsman could...
What Is Your Quest ?
User avatar
Adamo
Italodance spammer
Posts: 1534
Joined: Fri Apr 22, 2005 11:59 am
Location: Poland
Contact:

Post by Adamo »

oooh you`re right! I didn`t suppose it could affect on ViewportPalette DSA/Party Attack Filter!
I set the game to deliver all the messages and everything is ok now! :)
Spoiler
(\__/) (\__/) (\__/) (\__/) (\__/) (\__/) (\__/) (\__/) (\__/) (\__/) (\__/) (\__/)
Spoiler
(@.@) (@.@) (@.@) (@.@) (@.@) (@.@) (@.@) (@.@) (@.@) (@.@) (@.@) (@.@)
Spoiler
(>s<) (>s<) (>s<) (>s<) (>s<) (>s<) (>s<) (>s<) (>s<) (>s<) (>s<) (>s<)
User avatar
Paul Stevens
CSBwin Guru
Posts: 4318
Joined: Sun Apr 08, 2001 6:00 pm
Location: Madison, Wisconsin, USA

Post by Paul Stevens »

CSBwin10_009 fixes a problem that could
cause a save game to be un-loadable.

It also saves the current palette in the save game
so that when you reload the palette will still be
in effect. Adamo reported this problem.
User avatar
Adamo
Italodance spammer
Posts: 1534
Joined: Fri Apr 22, 2005 11:59 am
Location: Poland
Contact:

Post by Adamo »

it works well now! thank you! :D
Spoiler
(\__/) (\__/) (\__/) (\__/) (\__/) (\__/) (\__/) (\__/) (\__/) (\__/) (\__/) (\__/)
Spoiler
(@.@) (@.@) (@.@) (@.@) (@.@) (@.@) (@.@) (@.@) (@.@) (@.@) (@.@) (@.@)
Spoiler
(>s<) (>s<) (>s<) (>s<) (>s<) (>s<) (>s<) (>s<) (>s<) (>s<) (>s<) (>s<)
Post Reply

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