Background Graphics

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: 4319
Joined: Sun Apr 08, 2001 6:00 pm
Location: Madison, Wisconsin, USA

Background Graphics

Post by Paul Stevens »

I put preliminary documentation of the Background Graphic
capability at

http://dianneandpaul.net/CSBwin/documentation

None of this woks yet but it is under way and appears to
have a good chance of working someday.

It occurs to me that the 'Skin' number associated with
each cell in the dungeon could be used as a 'Zone'. Perhaps
someday we can implement things like 'Enter Zone'
messsages. But first things first.
User avatar
Paul Stevens
CSBwin Guru
Posts: 4319
Joined: Sun Apr 08, 2001 6:00 pm
Location: Madison, Wisconsin, USA

Post by Paul Stevens »

http://dianneandpaul.net/CSBwin/FloorGraphics.zip

demonstrates the ability to associate Floor, Middle, and Ceiling
graphics on a cell-by-cell basis. It has no useful graphics. I'll
leave that to you. It has a small, striped graphic for cell 0
and even that is the wrong shape, size, and placement. But it
demonstrates the capability of the runtime. You can create the
proper graphics. If someone makes the proper masks, I hope
they will share......those should not change for the most straight-
forward case.

There is as yet no way for CSBuild to set the skin numbers
for the individual cells. So the runtime has a hard-coded
skin 1 for cells where the x and y coordinate add to an odd
number. Else a skin of 0 which does nothing.
User avatar
cowsmanaut
Moo Master
Posts: 4378
Joined: Fri Jun 30, 2000 12:53 am
Location: canada

Post by cowsmanaut »

how about control for left and right most walls? for the final row of walls there is no left or right graphic i just uses the same wall. So if the addition of a side wall for that row could be established and be sure that it were flipped then I could use this lighting model. These are made to work with the DM 16 colours.

Image

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

Post by Paul Stevens »

I have only implemented the Floor, Middle, and
Ceiling background graphics. The walls will follow
and you will be able to place any graphic you please
on any side of any of the 16 cells that are visible.

But a question does arise. Do I need to worry about
the flipping? I could let the artist worry about it and
have him produce different graphics for the even and
odd cases. But this would mean that the skin numbers would
have to be placed in the dungeon in checkerboard fashion.
Even that does not wok too well because it does not take into
account the party's turning. The original code did the flip if
x + y + facing was an odd number.

I suggest that we do as follows:

Skin numbers 1 through 127 are simple. No flipping as the
party moves or turns. This takes care of things like
trees that you don't want flipping back and forth.

Skin numbers 128 through 255 are 'flipping' skins. You have
to draw two graphics. When x + y + facing is even I draw the
skin specified. When x + y + facing is odd I draw the next
next higher skin (skin# + 1). Of course, the graphics can
be identical in places where you don't want the 'flipping' effect.
User avatar
Toni Y
Adept
Posts: 221
Joined: Sat Feb 07, 2004 8:54 am
Location: Finland

Post by Toni Y »

The plan sounds good Paul. Gives the choice to the artist instead of forcing one way or another. And 127 items should be plenty.
Toni Ylisirniö
Author of Grave of King Millias, Return of Chaos, and DM2 dungeons.
User avatar
Paul Stevens
CSBwin Guru
Posts: 4319
Joined: Sun Apr 08, 2001 6:00 pm
Location: Madison, Wisconsin, USA

Post by Paul Stevens »

CSBuild185.zip and FloorGraphics.zip are posted at
http://dianneandpaul.net/CSBwin
http://dianneandpaul.net/CSBwin/documentation

They implement the Background Graphics as described
in recent posts. I am ready for suggestions and bug
reports.
User avatar
PaulH
Ghastly gastropod
Posts: 3763
Joined: Wed Aug 07, 2002 10:27 pm
Location: Level 6

Post by PaulH »

This looks very good. If someone could post a working example it would be much appreciated. I tend to learn how things work better from examples!
User avatar
Florent
Um Master
Posts: 457
Joined: Sun Nov 14, 2004 5:03 pm
Location: Paris, France
Contact:

Post by Florent »

Cows, those wall graphics are pretty neat, I can't believe they're only 16 colors !
User avatar
Paul Stevens
CSBwin Guru
Posts: 4319
Joined: Sun Apr 08, 2001 6:00 pm
Location: Madison, Wisconsin, USA

Post by Paul Stevens »

post a working example
The release has a working example. Level 0 (5,1)
displays a Custom Floor graphic (Skin #1). The
graphic itself is nothing to write home about and it
only displays as cell 0 but that is just a matter of
drawing a better graphic and creating proper masks
rather than a simple rectangle.

By the way, CSBuild requires the updated tiles.bmp
to mark the skin locations. I forgot to say that in my
first release message above.
User avatar
PaulH
Ghastly gastropod
Posts: 3763
Joined: Wed Aug 07, 2002 10:27 pm
Location: Level 6

Post by PaulH »

Ah, it helps if I download the 'floorgraphics' zip... I just downloaded CSBuild185 and read the documentation. I am a bit slow out of the blocks somedays...

Anyway, I have had a look. Is what I am looking for the 'barcode' thingy that appears in the bottom right of the screen when: facing N at 07,04; and facing E at 02,03? I can see where you put the 'skin' in CSBuild, which is at 05,01. I tried to export the graphic to view it and see if I could edit, but it wouldn't open with Paint. It will not recognise the bmp after exporting.
User avatar
Paul Stevens
CSBwin Guru
Posts: 4319
Joined: Sun Apr 08, 2001 6:00 pm
Location: Madison, Wisconsin, USA

Post by Paul Stevens »

As I explained above, the graphic is in the Atari
'BitPlane' format. It is strictly a binary file. No
bitmap headers or anything like that. You can export
it an look at it with a Hex Editor. All you will see is
a file full of 0xa5a5.
User avatar
PaulH
Ghastly gastropod
Posts: 3763
Joined: Wed Aug 07, 2002 10:27 pm
Location: Level 6

Post by PaulH »

I think (as usual) my understanding of the implementation of this is seriously flawed. I think I'll sit and watch what happens here for a bit. Or stick to fixing bikes.

I think a nice demonstration would be to take the existing graphics and define mask parameters and draw in yellow around all the boundaries of the graphics which would indicate the mask in a demo game.
User avatar
Paul Stevens
CSBwin Guru
Posts: 4319
Joined: Sun Apr 08, 2001 6:00 pm
Location: Madison, Wisconsin, USA

Post by Paul Stevens »

Some of your misunderstanding may be understandable.
I just posted a new FloorGraphics.zip that fixes
a problem in CSBwin (using the mask words incorrectly)
and in CSBgraphics.exe (export worked wrong except for
sound files).
User avatar
Zyx
DSA Master
Posts: 2592
Joined: Mon Jun 05, 2000 1:53 pm
Location: in the mind
Contact:

Post by Zyx »

I can't change level when viewing the skin location with CSBuild.
User avatar
Paul Stevens
CSBwin Guru
Posts: 4319
Joined: Sun Apr 08, 2001 6:00 pm
Location: Madison, Wisconsin, USA

Post by Paul Stevens »

You can by going back to the main window.
But you are right that this needs to be fixed.
Also it needs a 'SHOW ALL' mode that shows all
'skinned' cells and clicking on one does not change
it but rather shows which skin it has.
User avatar
Paul Stevens
CSBwin Guru
Posts: 4319
Joined: Sun Apr 08, 2001 6:00 pm
Location: Madison, Wisconsin, USA

Post by Paul Stevens »

CSBuild1.86 has a 'ShowAll' feature that shows all the
custom skins and shows the selected one in a different
way. You can change the selected skin by
clicking on the map. You need the new tiles.bmp for
it to work.

Also it allows you to change the level on the edit skins dialog.
User avatar
Zyx
DSA Master
Posts: 2592
Joined: Mon Jun 05, 2000 1:53 pm
Location: in the mind
Contact:

Post by Zyx »

Could you add up/down or +/- buttons to change levels?
Also, right clicking should be used to set skin 0.
User avatar
Zyx
DSA Master
Posts: 2592
Joined: Mon Jun 05, 2000 1:53 pm
Location: in the mind
Contact:

Post by Zyx »

I'm trying to understand how the skins, the graphics and the masks work...

Some questions:

All the custom skins have to use the same masks?

Why is there no mask for the walls?

"The definition of the skins is stored as 'Background Graphic' with ID = 2.."<- shouldn't it be ID=1?

Is there a tool to convert bmp (not the masks) from/to the structure needed for CSBgraphics.exe?

How do I import skins/masks/graphics with CSBgraphics.exe?
User avatar
Paul Stevens
CSBwin Guru
Posts: 4319
Joined: Sun Apr 08, 2001 6:00 pm
Location: Madison, Wisconsin, USA

Post by Paul Stevens »

Up/Down. Right click clear. CSBuild1.87
All the custom skins have to use the same masks?
Yep. That is a BIG mistake. The whole thing will
have to be rearranged a bit to make room for a
mask number.
Why is there no mask for the walls
They are not implemented yet.
s there a tool to convert bmp
Nope. I thought someone else could do this.
How do I import skins/masks/graphics with CSBgraphics.exe?
I do not understand this question. You have been doing
these Imports for months. The only thing that changes is
the 'Type' of graphic. Set it to 'Background Graphic'.
The definition of the skins is stored as 'Background Graphic' with ID = 2
Something is amiss here. I ust looked at the CSBgraphics.dat
and I see ID=1 Skins; ID=2 Floor Mask; ID=10 Floor10.
What do you see?
User avatar
Paul Stevens
CSBwin Guru
Posts: 4319
Joined: Sun Apr 08, 2001 6:00 pm
Location: Madison, Wisconsin, USA

Post by Paul Stevens »

Oh. I see your problem with the ID=2 in the documentation.
I fixed it.

I put new documentation describing the ability to
use different masks with different graphics. It has
not been implemented yet but I will get a demo posted
later this evening or early in the morning.
User avatar
Zyx
DSA Master
Posts: 2592
Joined: Mon Jun 05, 2000 1:53 pm
Location: in the mind
Contact:

Post by Zyx »

"The definition of the skins is stored as 'Background Graphic' with ID = 2", says the doc.
All the other points are understood, now.
User avatar
Paul Stevens
CSBwin Guru
Posts: 4319
Joined: Sun Apr 08, 2001 6:00 pm
Location: Madison, Wisconsin, USA

Post by Paul Stevens »

All the custom skins have to use the same masks
Not any more. Get the latest FloorGraphics.zip.
User avatar
Charlatan75
Apprentice
Posts: 59
Joined: Mon Nov 10, 2003 2:32 pm

Post by Charlatan75 »

Hello! :)

Would it be possible to make CSBWin draw the floor skin of a cell after it draws the walls which are "behind" this cell in the dungeon view ? (it seems that the floor is always drawn before the walls)

This could allow, for example, to use a floor skin representing grass that would not be "cut" according to the rectilinear edges of the walls which should appear as "behind" the grass.

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

Post by Paul Stevens »

Hmmmmmm. I agree that it needs to be that way.
Not impossible, I think.

I dislike producing test cases. If anyone has a test for this
kind of thing, let me know. I can also release it as part
of the demo.
User avatar
cowsmanaut
Moo Master
Posts: 4378
Joined: Fri Jun 30, 2000 12:53 am
Location: canada

Post by cowsmanaut »

so my question now is: how are these being displayed? Looks like you are pulling from a different source to get these skins. Does this mean they could be in the range of 256 colours now? or must it still follow the same rules?

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

Post by Paul Stevens »

draw the floor skin of a cell after it draws the walls
The latest FloorGraphics.zip attempts to do this.
they could be in the range of 256 colours now
Nope. I am overlaying the original background graphic and
it is in the Atari 4-color-plane format. I don't think there is anything
we are ever going to do about that unless we start from
scratch and build a program named RTC.
User avatar
Charlatan75
Apprentice
Posts: 59
Joined: Mon Nov 10, 2003 2:32 pm

Post by Charlatan75 »

Hello! :)

Thank you, Paul. ^^

Well, I tried to create a test dungeon with a floor skin representing grass, just like the example I talked about.

* In the first room there is only one cell, in the center, which is ornated with the floor skin. This is just to check that the skin is well drawn in all the different possible views.

NB : this skin is designed to be drawn when it is in one of the following cells (P is the position of the player):

--------------------------
| | | | | |
| | | | | | D3
--------------------------
|////| | | |////|
|////| a | | b |////| D2
--------------------------
| | | |
| | | | D1
----------------
| | | |
| | P | | D0
----------------

I did not use the possiblity to draw the floor skin in the hatched cells because the floor of these cells is never visible in the Atari ST version (you will never see the left side wall of cell 'a' or the right side wall of cell 'b' for example...).

=> In this first room you can already see that when you are standing on the cell where the "grass" is (or one step beside this cell), the bottom line of the dungeon view is not covered by the graphic of the floor skin. The reason is : when I write the correct height for these graphics (32 pixels) in the Floormask.bin file, these graphics are not displayed at all (!), so I had to "cheat" and write '31' instead of '32' (I don't know if something can be done here (?)). :)



* In the second room (full of grass), you'll be able to see when a wall is drawn over the grass when it should not (the right wall at D0, D1, D2 or D3 for example, or the left wall at D2). And you'll see when grass is drawn over a wall when it should not (place yourself so that one of the isolated pieces of wall in the middle of the room is just one step on your right at D3 for example).

I put all the files in the following zip :

Http://pageperso.aol.fr/TheCharlatan75/Lucyle/Test.zip

Charlatan75
User avatar
Charlatan75
Apprentice
Posts: 59
Joined: Mon Nov 10, 2003 2:32 pm

Post by Charlatan75 »

Oups, sorry, it seems that the drawing of the cells didn't work fine.
Well, I put a picture here for that :

Http://pageperso.aol.fr/TheCharlatan75/Lucyle/pic.gif

Charlatan75
User avatar
cowsmanaut
Moo Master
Posts: 4378
Joined: Fri Jun 30, 2000 12:53 am
Location: canada

Post by cowsmanaut »

hmm I posted this but it vanished.. how odd..

Can the skin images be a seperate palette? if so they by dithering the top "skin" with the original dungeon image we could get a hacked together 32 colours..

moo
User avatar
Gambit37
Should eat more pies
Posts: 13720
Joined: Wed May 31, 2000 1:57 pm
Location: Location, Location
Contact:

Post by Gambit37 »

@Charlatan: Image link not found...
Post Reply

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