smoothen original DM graphics as addon for 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
T0Mi
Expert
Posts: 324
Joined: Thu Dec 27, 2007 10:21 pm
Location: schland

smoothen original DM graphics as addon for CSBwin?

Post by T0Mi »

...hmmm, just thought about...

while fixing the hint oracle for me on the PPC I tried out CSBwin (out from the Part I-III *.rar package of Conflux III) and thought: "uuhh... it looks so much better on the PPC just because of the pixelsize, why is there no antialiasing mode in CSBwin?" And back to my mind came a long lost thought about making the 320 x 200 look nicer on a modern Desktop PC with those modern LCD Flatscreens without exccesive use of an complex anti-aliasing algorithm.

Please keep in mind, that I'm not a computer geek, so my thoughts may seem childish. ;-)

Lets say you would like to increase the resolution to 1280 x 800 pixels. Streching the original 'dotpile' without enlarging the pixels to ugly squares (the old TV attached to the Atari would just use every second line and displayed a pixel as a dot rather than a square) would result in something looking like that:
(it is needed to copy/paste the ASCII 'art' into an Editor with fixed spacing!)


o___o___o___o___o___o
_____________________
_____________________
_____________________
o___o___o___o___o___o
_____________________
_____________________
_____________________
o___o___o___o___o___o
_____________________
_____________________
_____________________
o___o___o___o___o___o
(o = Pixel)


Giving all of the 64000 pixies a name and and adressing their new x/y position, then drawing 4 lines (N E S W) between all dots interpoling the color difference on each pixel of the added lines would result in:

o---o---o---o---o---o
|___|___|___|___|___|
|___|___|___|___|___|
|___|___|___|___|___|
o---o---o---o---o---o
|___|___|___|___|___|
|___|___|___|___|___|
|___|___|___|___|___|
o---o---o---o---o---o
|___|___|___|___|___|
|___|___|___|___|___|
|___|___|___|___|___|
o---o---o---o---o---o


Between 4 pixels, there will be 9 black pixels left:
(for 960 x 600 it would be 4, for 640 x 400 it would be 1)

___
___
___


Using openGLs option to drag a nicely interpoled color-rectancle with 4 dots + their colorinformation would of course have saved you from drawing the lines at all, but in any case the dungeon (grey) would optically 'melt' with for example a monster, producing the look of early *.jpg images.

Lets still stick to the lines, additionally connecting all the dots diagonally:


o---o---o---o---o---o
|\_/|\_/|\_/|\_/|\_/|
|_X_|_X_|_X_|_X_|_X_|
|/_\|/_\|/_\|/_\|/_\|
o---o---o---o---o---o
|\_/|\_/|\_/|\_/|\_/|
|_X_|_X_|_X_|_X_|_X_|
|/_\|/_\|/_\|/_\|/_\|
o---o---o---o---o---o
|\_/|\_/|\_/|\_/|\_/|
|_X_|_X_|_X_|_X_|_X_|
|/_\|/_\|/_\|/_\|/_\|
o---o---o---o---o---o

leaving 4 free (unpainted black) pixels _in_ every square, replacing the 2 pixels at the beginning and end of a line with black ones + interpol the overlapped diagonal lines (dot in the middle of a square) would result:

from:
o---o
|\_/|
|_X_|
|/_\|
o---o

to:
o_o_o
_o_o_
o_o_o
_o_o_
o_o_o

This would produce an ST-like look (ok - without killing every second line), buts still the 'melting effect' dungeon<->monster is there of course. (Again it would have been much easier creating the same result drawing the colored interpol-rectancle in openGL, then blacken every second pixel)

To eliminate the melting or at least make it look smoother it has to be judged if a line is drawn or not.
And this is where it starts to get complicated.

First thought was to detect large color differences (--> return null to draw_interpolline)
or (if possible) detect the mask of the monster/decal so it can be directly judged which pixel belongs to the dungeon and which one belongs to the object in the dungeon. (avoiding: gray pixel from golem = gray pixel from dungeon)

Assuming this or any way of drawing a virtual mask around the monster, decal, etc. using the lines that surround each orig pixel would work, doing it blindly could result in:


D___D___D___D___D___M
|\_/|\_/|\_/|\_/___/|
|_X_|_X_|_X_|_/___/_|
|/_\|/_\|/_\|/___/__|
D___D___D___D___M___M
|\_/|\_/|\_/___/|\_/|
|_X_|_X_|_/___/_|_X_|
|/_\|/_\|/___/__|/_\|
D___D___D___M___M___M
|\_/|\_/|___|\_/|\_/|
|_X_|_X_|___|_X_|_X_|
|/_\|/_\|___|/_\|/_\|
D___D___D___M___M___M
(D = Dungeon)
(M = monster, decal, etc)


Between the monster and the dungeon a black line made of staight horizontal/vertical and 45° diagonal lines will appear, likely looking ugly.

Approaching the screen as it pops out of CSBwin or doing the smootening before dungeon and monster/items/decals marry surely makes a difference, avoiding the black line, but keeping the mentioned step-like look on the standalone dungeon, monster, etc. plus having to dig into the code before the dungeon is put together. Also the dungeon frame has to done in another way than the ingame menu (spells/wepons/chars), but let's say the screen is threatend as a whole and not seperately - used as an addon for CSBwin.

Maybe you code-wizard can hack in a nice routine withhin 30 minutes. I can't judge it, I'm a lame coder. Avoiding the 90°/45° step-look from dungeon to item and viaversa surly is the hardest part, maybe even with the need to vectorice the grafic using the 'extended' pixels of a monster as hooks for drawing the connecting line, avoiding 45° steps.

What existing tools could be used to make the original DM grafix look better?

Maybe its enough to just increase the resoltion to 800x600, then forcing the grafic card to antialiase the window for an satisfiing result, I haven't tried yet. Maybe a better approach would be to try to emulate/recreate the Atari screen output as mentioned above. I remember the ST emulator PacifiST did this quit nicely without ressorce eating calculations from the graca.

greetings
T0Mi
Last edited by T0Mi on Mon Feb 04, 2008 7:59 am, edited 1 time in total.
User avatar
Paul Stevens
CSBwin Guru
Posts: 4318
Joined: Sun Apr 08, 2001 6:00 pm
Location: Madison, Wisconsin, USA

Post by Paul Stevens »

There might be some hope that the
graphics could be manipulated at the
very last moment. The entire image
is built by the original Atari code which is
totally impenetrable. It is all done
in the old '4-plane' graphics mode of
the Atari, much like the four bit-plane
mode of the VGA card.

I wrote the program that then takes the
320x200 image and turns it into 4-bit
pixel data and then into 16-bit
pixel data and duplicates the pixels for
larger images. That code is almost
understandable although it is, I think,
still in assembly language on the PC.
It was written to work fast enough to
take only a few percent of the CPU time
on a 166MHz Pentium I. Therefore, a lot
could be done on modern machines that
are twenty times faster.

If you were to convince me that people
would like the result of applying some
algorithm to this image, I would be willing
to implement it (at least as an option).
What you would need to do is to specify the
algorithm and provide 'before and after'
examples of screenshots from the game
itself.

I have to say that I don't mind the square
pixels at all. But I do enjoy:
doing the smootening
occasionally. :D
User avatar
Parallax
DMwiki contributor
Posts: 424
Joined: Mon Aug 28, 2006 7:56 pm
Location: Back in New Jersey

Post by Parallax »

My first thought was: It will look blurry.

Now, for modern clones, the way to go (although it's a lot of work) is probably to redo the graphics at a higher resolution, either by using the old graphics as a base and manipulating the stretched images with photoshop to make them look good at the higher resolution, or just to restart from scratch, as Linflas has done with his Forest of Doom dungeon for RTC. Of course, he is only going for a 640x480 resolution, but the same thing could be done for 1280x960 or any other format (widescreen? it seems to have become ubiquitous with the recent world laptop takeover) you might want. And yes, I know, it's an awful lot of work.
User avatar
Paul Stevens
CSBwin Guru
Posts: 4318
Joined: Sun Apr 08, 2001 6:00 pm
Location: Madison, Wisconsin, USA

Post by Paul Stevens »

Parallax wrote:My first thought was: It will look blurry.

it's an awful lot of work.
No. It is not a lot of work. It is impossible using CSBwin.

Move on! Use DSB. You can port Conflux to DSB
long before you can modify CSBwin to use larger
graphics.
User avatar
beowuuf
Archmastiff
Posts: 20687
Joined: Sat Sep 16, 2000 2:00 pm
Location: Basingstoke, UK

Post by beowuuf »

I love how in RTC the scaled graphics in the distance look so sharpened, even though they are the same low res graphics.

Anythign that could make even that small improvement would be quite cool and make the old DM graphics look fresher

And yes, I agree, CSBwin is for the retro feel, though tweakign the old graphics would be welcome.

If you want hi resolution graphics support, definitely the newer engines are the way forward. That and finding people to do that work!
User avatar
T0Mi
Expert
Posts: 324
Joined: Thu Dec 27, 2007 10:21 pm
Location: schland

Post by T0Mi »

thanks for your replies, I'm learning alot about the progress that has been made in times I've been away from DMgaming. :-)

So it would be much less time consuming to use a modern clone that already can handle 16 bit *.bmp with 640x400... (never seen anything beyond CSBwin and CSBwinCE, remember I'm all new to this)


what it -could- look like:

original size, cool for PPC:

Image


same with screen size x4 on the PC:

Image


and punishing it with Photoshop:

Image



(All pics are 16 bit *.bmps, just to put them online they were converted to *.jpg)
Of course this are advanced filter techniques, it would be much easier to use "force antialiasing in any window" if your grafic card supports it (mine doesn't) to get at least a bit smoothening.

@Paul: you see an way to include the antialiasing option that Direct3D or openGL offers?

Anyway I'm willing to redo all of the DM grafics the way seen above, if you like, but I'm no expert in Photoshop (in fact, this has been the first time I used it longer than 5 minutes), still if someone can supply me with the original *.bmp from DM or conflux and knows a way to implement them in say 640x400 or 1280 x 800, I'm eager to do this. :-)

greetings
T0Mi
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 filters did you apply in Photoshop?
I.e. How did you do that?
User avatar
beowuuf
Archmastiff
Posts: 20687
Joined: Sat Sep 16, 2000 2:00 pm
Location: Basingstoke, UK

Post by beowuuf »

If you download adge from tools forum, you can rip the graphics.dat - cause the .bmp are quite large in total!
User avatar
T0Mi
Expert
Posts: 324
Joined: Thu Dec 27, 2007 10:21 pm
Location: schland

Post by T0Mi »

mainly a mild aquarell option followed by some smoothing/antialiasing,
but I fear I would have to reinstall PS (it's an old v7.0) in English to exactly tell you which filters can produce this result.
But it were just a few clicks.

I tried some monsters as standalone (without dungeon) too, and it was much more difficult to get a nice look.
It would be needed to modify every monster/item specificly because one filter pattern won't look good on all of them.

[graphics removed because of puplic nudity (rope anyone?)]

@wuuf: I will try to figure this out. If it can handle 16bit bmp to be ripped into/from a graphics.dat (now finally got this spelled right... #-) used for modern clones, it would be wonderful.
(But I fear it won't be that easy...)

greeting
T0Mi
Last edited by T0Mi on Wed Feb 06, 2008 12:55 am, edited 1 time in total.
User avatar
T0Mi
Expert
Posts: 324
Joined: Thu Dec 27, 2007 10:21 pm
Location: schland

Post by T0Mi »

EDIT:
in case you wondered about the standalone monsters without knowing any modern tools: they were taken out of a very old picture I created back in '98 running through DMI on PacifiST screenshooting, then erasing all dungeon pixels by hand.

Here they are as a whole:

Image

you might notice (enlarge it), that a basic antialiasing already was done (10 years ago!)

unmodified:


Image
User avatar
linflas
My other avatar is gay
Posts: 2445
Joined: Tue Nov 04, 2003 9:58 pm
Location: Lille, France
Contact:

Post by linflas »

all those blurry things have already been done for DMJava : get DMJava, addons 0.1 and 0.2 and see what you can do with them instead of restarting from scratch.
http://www.dungeon-master.com/forum/viewforum.php?f=50
User avatar
Parallax
DMwiki contributor
Posts: 424
Joined: Mon Aug 28, 2006 7:56 pm
Location: Back in New Jersey

Post by Parallax »

Mild acquarell? I doubt CSBWin could do that every frame on-the-fly, if it can at all. Interpolation schemes are probably your best bet, and maybe blur is not going to be too significant if you're restricted to 16 colors? That would be interesting to see. A smoothing of the lines rather than graphical enhancement. It might look weird since there is no way you're going to add detail that way but I'd be curious to see the results.
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 have to agree with others here:

1) Making things blurry to improve them is simply... silly and pointless.

2) Trying to get such imagery into CSBWin is impossible.

3) If you want better quality images (ie, higher res) you need to create them from scratch and use one of the more modern engines such as RTC or DSB.

CSBWin is an impressive piece of work, but sometimes you have to know when to let go of the past and move on. :-)

In my opinion, part of the charm of DM in the modern age is aresult of the lower res imagery. It's retro by default and looks great.
User avatar
T0Mi
Expert
Posts: 324
Joined: Thu Dec 27, 2007 10:21 pm
Location: schland

Post by T0Mi »

I'll check out DM Java.

For those who like the smoothening/blurring (yes, like me ;-)) there are small (driver related) apps out there on inet which force advanced 2D antialiasing/filtering in any window, regardles of its content. For the very nostalgic look I'll suggest using an old TV attached to the graca TV-out.

greeting
T0Mi
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 am willing to try some sort of
convolution function on the 320x200
viewport. But nothing much more
complicated than that. And I doubt
you would want anything more than
a 9-point function.

We simply CANNOT do any filtering
ahead of that (like as a monster is
being added to the scene).

Anyway, if you demonstrate a simple
function that you think improves matters
significantly, I'll try to implement it.

Different folks defintely see things
differently.
User avatar
T0Mi
Expert
Posts: 324
Joined: Thu Dec 27, 2007 10:21 pm
Location: schland

Post by T0Mi »

nostalgia surly is a topic of it own.

I'm happy you're in!
Anyway, if you demonstrate a simple
function that you think improves matters
significantly, I'll try to implement it.

Please stand by (I have some very busy days at work ahead of me), actually I have an idea how to generate a look that eliminates the ugly VGA squares generating the original Atari look quite nicely, without having to implement any complex algorithms that take away the original look and feel many hardcore DM geeks (oops, reminds me of something... :-)) prefer.

greeting
T0Mi
User avatar
T0Mi
Expert
Posts: 324
Joined: Thu Dec 27, 2007 10:21 pm
Location: schland

Post by T0Mi »

ok, first try...
taken from CSBwin: conflux III window size x2:

Image


doing the next logical step:
Image

Much closer to the Atari than VGA pixels IMHO and just by killing every second line. so simple.... I LOVE IT ! :D

Unfortunately converting it to *.jpg (for uploading) darkens the picture alot more than just the ereasing does. But anyway tuning up the gamma manually wouldn't be a bad idea, producing a additional bloom effect on a standard Monitor.

ok... I'll see what has to be done next, sb. :-)

greez
T0Mi

EDIT:
I'll poke on been wierd, but firstoff some more linelo... eh killing:

orig x3:
http://hometown.aol.com/TToommii/DM/gra ... x3kill.jpg

with just a tiny bit of cheating (lines in godmode):
http://hometown.aol.com/TToommii/DM/gra ... x3kill.jpg

created from a doublekill:
http://hometown.aol.com/TToommii/DM/gra ... x3kill.jpg
Last edited by T0Mi on Wed Feb 06, 2008 12:53 am, edited 1 time in total.
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'll see what has to be done next,
Let me guess. Every other vertical line?

Has anyone suggested that you are wierd? :wink:
Ah! No accounting for personal taste!
User avatar
T0Mi
Expert
Posts: 324
Joined: Thu Dec 27, 2007 10:21 pm
Location: schland

Post by T0Mi »

Just returned from another busy day at work, finally completed a project that was started in March last year. With success, so I feel a bit lighthearted right now! (Beware ;-))
I may have a free day tomorrow spending some time to do DM related things (maybe even play?) but I fear I'll have to figure out more RL stuff than I actually like to.

People call me wierd often. In fact they call me wierd that offen, it utterly feels normal.
I came to conclusion that it doesn't make any sense to try to have a 'straight line' in life, simply because the world isn't straight. So living vegan, being -owned- by horses and driving a ex-army chevy as a daily doesn't bite. Compared to some workmates from Fraunhofer Institute and the Research Group of Daimler who could calculate the temperature of the universe 1s after BB while taking a shower using their fingers on the fogged glass I'm just a average geek anyway. I can do a lot of stuff quite well, but never managed to get a single ability archmastered.

But I do have painted a pixel dragon as a pet you might like:
(original from ES of TEX, taken out of the Super Neo Show)

Image

(he needs to be smoot(h)end, yes. I'll get a sponge and some dispersent)
so we found the way back to the pixel here:

In my initial post the described methods are merely creating a basic antialiasing having the 'blurry' look so much disliked. Also it would be very timeconsuming to test various manual modifications, even on a very minimized part of the dungeon (let's say a hand or keyhole). I could not do it on the whole 320x200 without using code and spending months to get back to programming. As there are programms out there that force advanced antialiasing/filtering it wouldn't make sense to add it as an option.

After having offended everyone with the monster pics, I anyway would really like to hear the honest opinions and suggestions of the nostalgian DM geeks here; how you would like to have the original graphics modified without enlarging the amount of information and keeping the original look and feel. I can't believe you actually -like- the VGA pixel look of a x4 sized screen, do you? ;-)

my suggestions are pointed out already:
For screen size x2 its simply enough to erase every second line. It won't get any closer to the Atari.
Take a look at the details: for example the scroll on the right of the screamer: VGA pixels create a sharp 4-square rhomb, while in the modified pic, it just looks natural. (at least for me: as I first tried it, looking at the chars hands there was just one thought on my mind: ATARI !)

The emulator PacifiST used a similar 'technique' to come closer to the original look of the ST.
( http://www.atari.st/pacifist/ the page is badly outdated, as is the emulator). Modern emulators like STeem use the linekilling at least in fullscreen mode too - because simply the Atari did. I really would like to have the option of "ST-look" at least in windows size x2. For screen size x3 I'd suggest to add a another line with reduced brightness (ex. RGB 777 turned down to 444) just below the surviving original line.

greeting from Germany
T0Mi
User avatar
Gambit37
Should eat more pies
Posts: 13715
Joined: Wed May 31, 2000 1:57 pm
Location: Location, Location
Contact:

Post by Gambit37 »

TOMi, I edited your post above to make those images links instead as they were far too big and breaking the forum. Please keep embedded images no larger than 650pixels wide, thank you.
User avatar
zoom
Grand Master
Posts: 1819
Joined: Tue Sep 23, 2003 1:27 am
Location: far away but close enough

Post by zoom »

the screen appears more greyish.
not as saturated as with pixels.

At first glance it looks cool, there
is potential but the colour loss is
not that good.
User avatar
Paul Stevens
CSBwin Guru
Posts: 4318
Joined: Sun Apr 08, 2001 6:00 pm
Location: Madison, Wisconsin, USA

Post by Paul Stevens »

See what you think of
http://dianneandpaul.net/CSBwin/CSBwinBlur.exe

in x4 mode.

It is not really a 'Blur'. No detail is lost.
The origianl pixels are present.
I simply interpolated the intermediate points.
There are some rounding artifacts in large
areas that are suppost to be the same color.
User avatar
Zyx
DSA Master
Posts: 2592
Joined: Mon Jun 05, 2000 1:53 pm
Location: in the mind
Contact:

Post by Zyx »

that's interesting, but I can see a kind of dotted grid on flat surfaces, while it should be homogeneous.
User avatar
beowuuf
Archmastiff
Posts: 20687
Joined: Sat Sep 16, 2000 2:00 pm
Location: Basingstoke, UK

Post by beowuuf »

I thought the darkness was part of the screen cap, but this filter makes the game quite dark.

Need a bgger monitor to run it in x4 mode too!
User avatar
Paul Stevens
CSBwin Guru
Posts: 4318
Joined: Sun Apr 08, 2001 6:00 pm
Location: Madison, Wisconsin, USA

Post by Paul Stevens »

Ignore the x2 mode. It is the x4 mode that
I did the bilinear interpolation on.
Zyx wrote:see a kind of dotted grid on flat surfaces
Paul Stevens wrote:There are some rounding artifacts in large
areas that are suppost to be the same color
This was all done in 15-bit color mode with only 5
bits per color. Rounding is pretty obvious.
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 fixed that rounding error in the
case that all 4 pixels are exactly
the same color. I think that this
is about the best we can do without
re-writing the whole video-screen
and overlay code.
User avatar
T0Mi
Expert
Posts: 324
Joined: Thu Dec 27, 2007 10:21 pm
Location: schland

Post by T0Mi »

sorry folks...

Tax investigation payed me a visit yesterday morning at 8:00 am. Big bad guys in black robes. Well, not really, but it was a -very- unpleasent experience to have those Gestapo sniffing around my private property, personal papers and computers. I have to figure this out, hoping they won't kick my ***.

I'll be back.

T0Mi
User avatar
zoom
Grand Master
Posts: 1819
Joined: Tue Sep 23, 2003 1:27 am
Location: far away but close enough

Post by zoom »

it does not work graphic-glitch free for me.
it looks as if the screen was divided into 2 thirds .
could make a screen shot if wanted..
User avatar
Paul Stevens
CSBwin Guru
Posts: 4318
Joined: Sun Apr 08, 2001 6:00 pm
Location: Madison, Wisconsin, USA

Post by Paul Stevens »

The screen is divided. Into the pieces used
during gamepaly. It was done to re-arrange
the pieces for differently-shaped screens
(like the PocketPC, for example).

If I were to release this blurring feature,
I would have to turn it off except during
gameplay (the '3d' viewport screen).
Also, the right edge and bottom edge need
a tweaking of some sort. I guess I would
pretend that the non-existent pixels to the
right and bottom are black.
User avatar
zoom
Grand Master
Posts: 1819
Joined: Tue Sep 23, 2003 1:27 am
Location: far away but close enough

Post by zoom »

there are lines on upper edge, side edge and bottom edge,
the bottom edge glitch changes slightly (on the right) if I move
the mousecoursor over that area left and right.

sound lags when I use CSBwinBlur.exe
(lag about 3 seconds for attack sounds like swing )
just wanted to tell.
Post Reply

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