CustomGraphicsEngine CSBwin)

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

CustomGraphicsEngine CSBwin)

Post by Paul Stevens »

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

Has everything needed to demonstrate the
capability to draw custom walls. Actually, it is
capable of drawing floors, background, ceiling,
and floor/wall decorations but it needs a few more
additions to make things easier.
User avatar
Adamo
Italodance spammer
Posts: 1534
Joined: Fri Apr 22, 2005 11:59 am
Location: Poland
Contact:

Post by Adamo »

cannot find "tiles.bmp" file
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 »

Sorry. Any old tiles.bmp will do. I added one
to the CustomGraphicDemo1.zip
User avatar
Gambit37
Should eat more pies
Posts: 13715
Joined: Wed May 31, 2000 1:57 pm
Location: Location, Location
Contact:

Post by Gambit37 »

Unless I'm mising something very obvious, it doesn't seem to demonstrate anything new.

I just get a basic first level with some DSA stuff going on and then a sub level where you can walk into invisible walls and there's a weird graphics glitch in the middle of the room.

OK, there are lots of extra .txt and .bin files but not really any indication of how to use them.

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

Post by Paul Stevens »

That ain't a graphics glitch. That's my wall.
OK. I admit it. I ain't a very good artist. I hope
someone can improve on it.

The documentation on this stuff is on my website

http://dianneandpaul.net/CSBwin/documentation
User avatar
Gambit37
Should eat more pies
Posts: 13715
Joined: Wed May 31, 2000 1:57 pm
Location: Location, Location
Contact:

Post by Gambit37 »

I can't get my head around this. I read the documentation and although I understand the intention, I don't understand how the information helps me create new graphics and masks.

I took a look at the skin2code.txt file which sheds some more light on the subject. However, it's anyone's guess how the parameters actually work as the 'code' in here doesn't seem to equate to the diagram on your documentation. You discuss numbered cells but then the 'code' uses pointers like F1R1 etc. And I have no idea what those values in your (if...then) statements relate to.

I don't really understand your dungeon. Is the whole thing being drawn with your new routine, or just that solitary 'glitch' wall? When I go downstairs, I can't walk right up to any of the walls -- I get stopped one tile in front with the party "oof" sound. Is this deliberate or a mistake? Is the entire contents of skin2code.txt used to display the one glitch wall?

This seems like a good extension to the engine but I'm the kind of person who needs much more thorough examples and documentation to get anything out of it.
User avatar
Paul Stevens
CSBwin Guru
Posts: 4318
Joined: Sun Apr 08, 2001 6:00 pm
Location: Madison, Wisconsin, USA

Post by Paul Stevens »

but I'm the kind of person who needs much more thorough examples
That was expected.
Is the whole thing being drawn with your new routine, or just that solitary 'glitch' wall?
Yes. And yes. To both questions.
The upper level is skin 0 and is being drawn with the
standard code. I think I included a copy of it in the
zip file. Skin0Code.txt. You will not find this in the
CSBGraphics.data because a copy of that code is built into
CSBwin.

The lower level is mostly skin 1. You will notice that there
is no code for skin1 in CSBgraphics.dat. So the walls don't
get drawn at all. If you sere to install the standard code
for skin 0 into CSBGraphics.dat for skin 1 then the walls
would look just like the walls upstairs. If you were to install
the skin2 code for skin1 then all the walls downstairs would
look like that 'Glitch' wall.
took a look at the skin2code.txt
The skin2 code is very simple because there is nothing
downstairs to be drawn except stone walls and open space.
Only the stone wall code has been changed from the standard
skin0 code. And all the relative cell numbers are treated
exactly the same.......they call the function 'Skin2Stone'.
For example:
: StdDrawF2R1Stone
Skin2Stone ;

This function draws the cell at F2R1 ( forward 2 right 1 ) where
F0 is where the party stands. This calls Skin2Stone to do the
actual drawing.

: Skin2Stone
CurrentSkin WallGraphicID CurrentSkin WallMaskID CurrentCell DrawCustomGraphic
;

This function gets the current WallGraphic ID (the Id of the bitmap
in CBGraphics.dat by 'CurrentSkin WallGraphicID'.
Then it gets the mask graphic by 'CurrentSkin WallMaskID'.
Then it gets the relative cell number by 'CurrentCell'.
Then it draws something on the screen using those three things:
1 - the graphic (the bitmap)
2 - the mask ( the maskID)
3 - The mask number.

I arranged that my masks have the same numbers as the
relative cell numbers. But it need nt be that way. You can
draw whatever you please using ANY bitmapID, ANY maskID,
and ANY maskNumber. For example:

'7 9 3 DrawCustomGraphic'

would use bitmap 7 and mask number 3 from mask graphic 9.
I can't get my head around this
Don't feel bad. I get lost in all this indirectness myself.
There will be a lot of discussion before this is useful to
anyone. But the hooks are there and they work and they
are very general.
User avatar
Zyx
DSA Master
Posts: 2592
Joined: Mon Jun 05, 2000 1:53 pm
Location: in the mind
Contact:

Post by Zyx »

What's the code ID in the SKINDEF?
User avatar
Paul Stevens
CSBwin Guru
Posts: 4318
Joined: Sun Apr 08, 2001 6:00 pm
Location: Madison, Wisconsin, USA

Post by Paul Stevens »

What's the code ID in the SKINDEF
Do you see Skin2Code.txt?

That is the code to display skin number 2.

You use ViewportCompiler (there is a batch file
to show how) to create a Skin2Code.bin.
Then you put Skin2Code.bin int some CSBgraphics.dat
ID. You can look in there and see it. That is the code
that CSBwin runs to display the skin. In the SkinDef
for the skin you point to the ID of the code to display that
skin.

My Skin2Code.txt mostly uses the standard built-in code
to display stairs, teleports, pits, etc. But it has custom code
for all the Stone cells (F3R1Stone, F3L1Stone, etc, etc.)

In my case the code for Skin 2 is in CSBgraphics.dat ID 12.
ID 10 has the bitmap and ID 11 has the masks.
User avatar
Gambit37
Should eat more pies
Posts: 13715
Joined: Wed May 31, 2000 1:57 pm
Location: Location, Location
Contact:

Post by Gambit37 »

It would really help to be able to view the bitmaps and masks.
User avatar
Paul Stevens
CSBwin Guru
Posts: 4318
Joined: Sun Apr 08, 2001 6:00 pm
Location: Madison, Wisconsin, USA

Post by Paul Stevens »

t would really help to be able to view the bitmaps and masks
No problem. I included them.
masks.bin
Skin2Graphic.bin

Admitedly, the bitmaps are ugly and the masks are
only approximate. I hope someone can improve them.

Or, you can use CSBGraphics.exe and EXPORT them from
the CSBgraphics.dat. ( I IMPORTED them. )
User avatar
Gambit37
Should eat more pies
Posts: 13715
Joined: Wed May 31, 2000 1:57 pm
Location: Location, Location
Contact:

Post by Gambit37 »

No, that's what I meant. I already exported them but no graphics prog can read them (and I have a lot!). They don't have a proper BMP header.
User avatar
Paul Stevens
CSBwin Guru
Posts: 4318
Joined: Sun Apr 08, 2001 6:00 pm
Location: Madison, Wisconsin, USA

Post by Paul Stevens »

Well you are right about that. They are in Atari 'Internal'
format. I doubt that any commercial programs can handle
that.

Who made that nice 'Grass' background? Whoever it
was must have developed some sort of utilities to manuipulate
the graphics and masks. Those were in the same format
as these (documented on my website).

I had hoped that someone besides me would be capable
of creating utilities to convert .BMP files to/from the
Atari bit-plane format. If it falls onto me I can do it.
But a lot of other people have expressed interest in helping
with these kinds of things.

Those that are in the Demo were created with a HEX Editor.
Painfully.
User avatar
Paul Stevens
CSBwin Guru
Posts: 4318
Joined: Sun Apr 08, 2001 6:00 pm
Location: Madison, Wisconsin, USA

Post by Paul Stevens »

As exciting as these developments are, I am going
to take a couple days off to go camping with my
wife. She is exciting, too. So for the next two days
I will not be very resposive to your anguished cries
of confusion.
User avatar
Gambit37
Should eat more pies
Posts: 13715
Joined: Wed May 31, 2000 1:57 pm
Location: Location, Location
Contact:

Post by Gambit37 »

There *are* some things more important than DM, after all. Just about. I think. Maybe. An exciting wife has to be a close second.
User avatar
cowsmanaut
Moo Master
Posts: 4378
Joined: Fri Jun 30, 2000 12:53 am
Location: canada

Post by cowsmanaut »

Have loads of fun!! Sleeping on the ground.. cooking with strange gas filled devices that might implode... finding mosquitoes in your juice and beetles in your eggs.. mmmmm.. yum. you both wear the must smell of Off bug spray and she looks longingly at you... then she smacks her arm because the damn bug spray isn't working.

yes.. such romance.. such.. ambiance. ahhh L'amour!

I'm kidding.. I LOVE camping. I'm just jelous you are going and I'm not :P

moo
User avatar
Zyx
DSA Master
Posts: 2592
Joined: Mon Jun 05, 2000 1:53 pm
Location: in the mind
Contact:

Post by Zyx »

Yes, have fun! It's been so long since I didn't camp anywhere but in front of my PC!
User avatar
beowuuf
Archmastiff
Posts: 20687
Joined: Sat Sep 16, 2000 2:00 pm
Location: Basingstoke, UK

Post by beowuuf »

Yes, enjoy all that fresh air and alone time! *Bets you will have dreams about programming though*

I believe it was Toni who developed the grass walls bit, wasn't it?
User avatar
Zyx
DSA Master
Posts: 2592
Joined: Mon Jun 05, 2000 1:53 pm
Location: in the mind
Contact:

Post by Zyx »

The grass floor was developped by Charlatan who did a nice program to convert .bmp to .bin masks.
User avatar
Zyx
DSA Master
Posts: 2592
Joined: Mon Jun 05, 2000 1:53 pm
Location: in the mind
Contact:

Post by Zyx »

I don't understand how wall decorations and floor decorations are part of a skin. Does it mean normal, DM decorations are replaced by them? If not, how do I put a custom wall decoration in a dungeon, I can only put a skin on a tile.

Also, what will appear in the white zone of wallsets masks? The DM wall or what's behind? How could I make a column thiner than the usual wall, that would allow to see what's behind?
User avatar
Paul Stevens
CSBwin Guru
Posts: 4318
Joined: Sun Apr 08, 2001 6:00 pm
Location: Madison, Wisconsin, USA

Post by Paul Stevens »

how wall decorations and floor decorations are part of a skin.
We have not really implemented wall/floor decorations.
If you recall, we talked about it a bit. I made provision
for as many 'decoration' 'files' as you need and you said
you would like one 'file' for each decoration, each file containing
the various scaled/mirrored pictures and various locations
in the viewport at which to draw them (because one picture
might be drawn in several locations).

So the skin index has provision for the decorations and the
documentation tells their format but there are no Code
function defined (or implemented) to actually draw them
into the viewport. We need functions like:

Code: Select all

WallDecoration (skin# decoration# . . . graphicID )
FloorDecoration( skin# decoration# . . . graphicID )
DrawDecoration( graphicID picture# location# . . . )
Does it mean normal, DM decorations are replaced by them?
If you provide code for your shin thin I draw NOTHING except
what that code says to draw. So the answer is "Yes", I suppose.
But you can copy the 'Skin 0' code to draw the normal
decorations if you so choose. Or draw mostly the 'normal'
decorations and a few of your special ones. Whatever.
what will appear in the white zone
First I draw the Floor, Middle, and Ceiling.
Then, if you provide Code for your skin, everything else
that is drawn is drawn by you. The 'white space in the masks'
leave the pixels unchanged. So, if you have drawn 'what
is behind' already, then the whilte space will show what is
behind. If you have drawn nothing behind then the white
space will show the original Floor, Middle, and Ceiling.
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 posted a new "CusomGraphicsDemo.zip" which
demonstrates the drawing of a wall decoration.
kentaro-k.21
Artisan
Posts: 178
Joined: Wed Dec 17, 2003 1:39 am
Location: Osaka, Japan
Contact:

Post by kentaro-k.21 »

hi.

i smell good technical tastes from the completed skinning feature.
it should be full of mystery CSBwin feature for me (or ffor us)... and wannaa write a personal tutorial for itt.
also i have a plan to make a tool CSBgraffer.

i started with recent CSBwin (CustomGraphicsDemo1).
i tried your test dungeon.
and i couldn't see look at all of the skin feature. but i couldn't understand logical structure of skinning feature. in the archive file, there are too many files for new feature: CSBGraphics.dat, masks.bin, Skin0Code.txt, Skin2Code.bin, Skin2Code.lst, Skin2Code.txt, Skin2Graphic.bin and SkinDef.bin. there are few explanation about connection between CSB engine and their files.

i decided to write a tool so that anyone can try it with more easy way. but i don't know all about this feature, so i may write a new tool for our next step when i'll have get more understand. plz post about any of your good progress for this featuree or tips.

in this time, i'll write CSBgraffer to edit/view the contents of csbgraphics.dat. yes, i know CSBgraphics.exe attached to CSBwin package already does it. i'll write my one to supply more good usage for view/edit features. first version'll be available in few days.
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'l be happy to supply any help you need. I look forward
to someone making this feature accesible.

I forgot to rename the latest upload. The latest upload
is now 'CustomGraphicsDemo3.zip. It has the wall decoration.
couldn't understand logical structure of skinning feature.
Did you read the documentation at:
http://www.dianneandpaul.net/CSBwin/doc ... phics.html
there are too many files for new feature
***CSBGraphics.dat THis is the only file needed to play
the demo. It is the only file CSBwin looks at. It contains
the Skin definitions and the custom graphics.

***masks.bin The backgrounds (floor, middle, ceiling, and
wall) require 'masks' to show which pixels are transparent
and where the pixels come from and where they go. The
masks.bin file contains this information. It is separate from
the bitmaps because I felt that many skins (with different
bitmaps) could share a single mask. In this case: mask.bin
is the mask for the wall bitmaps. It is installed as ID=11
in CSBgraphics.dat.

***Skin0Code.txt This is not used in the demo. It is the
code used by CSBwin to draw the unmodified dungeon
walls, teleporters, pits, etc, etc for Skin 0. This code is
hardwired into CSBwin. But I included it because it is a
good place to start when you are building your own
Skin. You can modify it to chage the parts that you want
to change. My Skin2 modified only the StoneWall parts
and left the teleporters, etc unchanged.

***Skin2Code.bin This is the final result of compiling
Skin2Code.txt. It has been imported into CSBgraphics.dat
as ID=12. This is the code that draws Skin2.

***Skin2Code.lst THis is the 'Human-Readable' result of
compiling Skin2Code.txt. It is the compilation listing. Not
useful except perhaps for debugging.

***Skin2Code.txt This is the code that draws Skin 2. It
is compiled to produce Skin2Code.bin and Skin2Code.lst

***Skin2Graphic.bin This is the bitmap for the walls for
Skin2. It is imported into CSBgraphics.dat as ID=10.

***SkinDef.bin. This is the definition of the Skins. It is
imported into CSBgrahics as ID=1. It tells CSBwin what
bitmaps, masks, and code to use for each Skin.
kentaro-k.21
Artisan
Posts: 178
Joined: Wed Dec 17, 2003 1:39 am
Location: Osaka, Japan
Contact:

Post by kentaro-k.21 »

hi, Paul.
thanks to your help, i could know new files usage. ok, all required files to run CSBwin are in csbgrapics.dat.

and i get more questions when i read your documents/posts.

1)
in your document:
Each cell of the dungeon can have its own 'Skin'
what's exact meaning for "Each cell of the dungeon"?
my possible is:

a) every cell in your dungeon.dat. if you have 32x32 cells in a level, it's 1024 cells
b) every cell you see thru viewport. probably each skin is attached to your numbered cell format (from 0 to 20)

if you can attach skin to each cell in dungeon.dat with latest CSBuild, where is the skin selection UI? i checked the cell editing window (Edit Open Room, Edit Solid Wall at x(xx ,xx)) but there was no selector.

2)
in your document:
The Skin number for each Cell is stored in the dungeon file
this means following which or another?

a) each cell in dungeon level? maximized level (32x32) can have up to 1024 associated skins in one level?
b) each cell means each type of cell? e.g. floor/ceil/pit-fall/false/teleporter/etc?

3)
in your document:
The Code has a separate function for each Cell position and Cell type
i took a look at Skin0Code.txt and Skin2Code.txt. they should be source code of "The Code".
IMHO it should be programming language using stack machine mechanism like DSA. but i can't know whether it is from exist programming language or not.
i'm curious to know what kind of programming language it uses? probably it is not any sort of language: x86 asm/BASIC/C/Java/Pascal/Post script.
User avatar
Paul Stevens
CSBwin Guru
Posts: 4318
Joined: Sun Apr 08, 2001 6:00 pm
Location: Madison, Wisconsin, USA

Post by Paul Stevens »

-1-
what's exact meaning for "Each cell of the dungeon
Each cell in the map. 32x32x64 = 65536 cells.
latest CSBuild, where is the skin selection UI
'Menu/Edit/Skin Map'

-2-

The number is stored for each of 32x32x64 cells.

-3-
what kind of programming language it uses
Forth. A simple, interpreted, stack-oriented language.
Modified for my particular needs.
User avatar
Zyx
DSA Master
Posts: 2592
Joined: Mon Jun 05, 2000 1:53 pm
Location: in the mind
Contact:

Post by Zyx »

If I configure a skin to have a CodeID of 0, should it work as if using the skin0code.bin provided in your example? (I generated skin0code.bin from skin0code.txt)



I started studying the skin0code.txt, but quickly came to a complete ununderstanding.

Take one of the first lines:
: StdDrawF4L1Any
F4L1Contents F4L1xy F4L1 DrawOrder01 StdDrawRoomObjects

I guess it's a succession of functions calls for displaying the tile F4L1, no matter the kind of tile (wall, floor, pit, etc)?

I don't have a clue about any of these functions, unless maybe the last one:
StdDrawRoomObjects
Maybe it shows the items in the tile?
What does "Std" mean? standart?
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 non-zero skin with a CodeID of zero? I don't
know off the top of my head. What it appears in
the code is that if the CodeID is zero then nothing
will get drawn. Isn't this how my demo Skin1 works?

You should be able to compile Skin0Code and import
it as CodeID=20 (for example), have Skin5 (for example)
point to CodeID=20, and then Skin5 would, indeed,
get drawn in the Standard (STD) way. That is what is
SUPPOSED to happen. Let me know if it fails.
I guess it's a succession of functions calls for displaying the tile F4L1, no matter the kind of tile (wall, floor, pit, etc)?
Yep.
What does "Std" mean? standart?
Nope. "Standard"

F4L1Contents = the objects in F4L1
F4L1xy = the coordinates of F4L1
F4L1 = the relative cell number....see diagram
DrawOrder01 = A bit of magic. Requires some explanation.

When you are looking at a cell in the viewport you see
there are four positions that an object can occupy.

Code: Select all

             open cell    wall cell

position 1  far left    far side
position 2  far right   right side
position 3  near right  near side
position 3  near left   left side
The Drawing order specifies what order to draw
the positions starting with the rightmost digit and working
to the left. DrawOrder01 means only draw objects in
position 1. (Don't ask me why !!!!!! I just copied. I did
not invent this.) DrawOrder3421 means draw position 1,
then 2, then 4, then 3.

Notice that a door draws the far objects, then the door,
then the near objects.
User avatar
Paul Stevens
CSBwin Guru
Posts: 4318
Joined: Sun Apr 08, 2001 6:00 pm
Location: Madison, Wisconsin, USA

Post by Paul Stevens »

You may have missed the code at the end of
the text file. It tells what to do for each cell and
each kind of cell. The 'F4' cases all call the
same function, namely StdDrawF4L1Any.

At any rate, it is this list at the end of the file which
is the body of the function 'main', that CSBwin looks
at when drawing a cell.
User avatar
Zyx
DSA Master
Posts: 2592
Joined: Mon Jun 05, 2000 1:53 pm
Location: in the mind
Contact:

Post by Zyx »

Quote:
What does "Std" mean? standart?

Nope. "Standard"
Err, hmm, right. It was a tricky question, indeed. Congrats, you passed the test.
You gave a coherent answer, which is very disturbing, since it sheds some credibility to all the skincode which I assumed was some sort of satanic language, aiming at the perdition of mankind, alike the curse of God on the workers of the tower of Babel, and you, the great heresiarch of an underground cabalistic sect devoted to misanthropy, just decided it was time to unveil your mask to the DM community and seize the world, which all in all was a much simpler theory than the other, alternative hypothesis that everything written in the book of skin0code.txt actually makes sense.


---------

Ok, some questions now, oh great heresiarch, or Paul - I'm still confused about your real identity now - :

For skin2code.txt, I see the main difference is a call to this function instead of the standard one.

Code: Select all

: Skin2Stone
	CurrentSkin WallGraphicID CurrentSkin WallMaskID CurrentCell DrawCustomGraphic
What does everything?
How would it be for a floorskin?
Something like:

Code: Select all

CurrentSkin floorGraphicID CurrentSkin FloorMaskID CurrentCell DrawCustomGraphic
?

What are the other variables/functions available ?
Post Reply

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