PDA

View Full Version : Text-Mode Demo Como 8



LP
01-11-2005, 03:47 PM
TMDC 8 Invitation has been released on http://www.taat.fi/tmdc.



TMDC is a pseudo-annual demo-making contest held over the internet. TMDC8 is yet again organized by tAAt ry, registered non-commercial organization in Finland, which aims to promote demo-making culture.

Text mode demos offer unique challenges for the demo maker which play a very insignificant role in other kinds of demo competitions. First of all, resolution and color spaces are rather limited, forcing the demo authors to consider different forms of anti-aliasing and careful adjustment of contrast and color balance.

Additionally the demo authors will not have any hardware-assisted rendering, forcing them to create their own rasterization methods, while giving them a huge amount of CPU power per pixel. Things like per-pixel real-time raytracing are a realistic choice in text mode demos.


I've heard that there are many experienced developers on PGD. Well, now is the chance to show that this wasn't just a bunch of empty words! No fancy artwork from your favorite artist will be of any help here; no third-party library like SDL or DelphiX will be able to assist you; it's all about your skill. Take Delphi (http://www.borland.com/us/products/delphi/index.html) or Free Pascal (http://www.freepascal.org/) and show the evil C/C++ empire (http://www.google.com/search?hl=en&lr=&q=c%2Fc%2B%2B+web+ring&btnG=Search) what a Pascal Programmer can do! :D

Disclaimer: The meaning of this message should not be taken literally...

cairnswm
01-11-2005, 06:24 PM
Having never done a Text demo before I dont really know where to start. How about giving us some guidelines on getting a basic Delphi template set up to do a text demo.

Paulius
01-11-2005, 08:06 PM
Relating to just Windows textmode:
ScreenBuffer: HWND;
Console: HWND;
Src, Dimentions: COORD;
outrect: SMALL_RECT;
Output: array of CHAR_INFO;
//create
Src.X:= 0;
Src.Y:= 0;
Dimentions.X:= Width;
Dimentions.Y:= Height;
outrect.Left:= Src.X;
outrect.Top:= Src.Y;
outrect.Right:= Dimentions.X-1;
outrect.Bottom:= Dimentions.Y-1;
SetLength(Output, Height*Width);
AllocConsole;
ScreenBuffer:= CreateConsoleScreenBuffer(GENERIC_WRITE, 0, nil, CONSOLE_TEXTMODE_BUFFER, nil);
SetConsoleActiveScreenBuffer(ScreenBuffer);
SetConsoleScreenBufferSize(ScreenBuffer, Dimentions);
SetConsoleMode(ScreenBuffer, 0);
SetConsoleTitle(PChar(title));
Console:= GetConsoleWindow();
ShowWindow(Console, SW_MAXIMIZE);
//destroy
CloseHandle(ScreenBuffer);
//present
WriteConsoleOutput(ScreenBuffer, Output, Dimentions, src, outrect);
You?¢_Tre probably better off jumpstarting with something like Lifepowers textmode component.

LP
01-11-2005, 11:23 PM
First of all, I think it won't be enough to write a paper on ASCII art to describe a *good* method of representation. Indeed, the greatest challange I found so far making TMDC entries is how to represent 24-bit RGB image in Text Mode using ASCII characters. Drawing RGB image in ASCII can get as simple as 20 mins of work (and it will look awful!) or you can do what we did for TMDC 7 - extensive mapping, 4x antialias, error diffusion, sharp filtering (and still it may look awful! :() What I have learned so far is that you should find the best average - use good rasterizer and a combination of nice & clean colors to make the image look good.

However, the theory is pretty simple. In text mode you have 15 background and 15 foreground colors (before in MS-DOS days there were actually 8 background colors and another set of the same background colors blinking). If you take a character like #177 (http://www.afterwarp.com/downloads/char177.gif), you can see that it's 50% foreground and 50% background. You can use this property to get more than just 16 colors in text mode. For instance, take white background (r:255, g:255, b:255) and draw blue (r:0, g:0, b:255) character #177 on it. You'll get a result of an average of both colors: (r:127, g: 127, b: 255), which is a new bright blue color. Now, take another character #176 (http://www.afterwarp.com/downloads/char176.gif). It's mostly background with few foreground pixels (16 out of 64). You can use this character to mix a set of two colors, which with our previously used colors would give (r: 191, g: 191, b: 255) very bright blue color. By using characters #176, #177 and #32 (which is pure background) and by mixing the entire palette, you can get few hundred colors to work with (note: character #178 is an "inverse" of character #176 and character #219 is inverse of character #32 and thus are redundant). In fact, this is the palette you get (278 colors in total):
http://www.afterwarp.com/downloads/asciipalette.png

Now, some of you could remember old MS-DOS days where you have to convert an RGB image to 256-color palette and this is exactly the case! :) You have to "approximate" a true 24-bit RGB color to one of the existing ones. In order to do this in real-time, some lookup table will be needed.

Finally, you have a limitation of 80x50 resolution which is another challange. However, this can be worked out easily by rendering everything in 160x100 and then simply reduce it to 80x50 by using average of each 4 pixels.

In few weeks I will release some package to rasterize in Text Mode but I really ask you people to try to do this yourself and perhaps we can come up with the best solution here on PGD :)

Also, you can use my TWinConsole component which helps you configure and output text in Text-Mode.
Download it at: http://www.afterwarp.com/downloads/winconsoles.pas.

You can access the screen buffer directly by using TWinConsole.ScreenBuffer pointer and then display it using TWinConsole.Flush(). Each cell on the screen is represented as TCharInfo (Windows.pas?) Settings colors is a bit tricky, but you can use TWinConsole.Color2Attrib() function which receives a pair of Delphi standard colors (clWhite, clBlue, clNavy, etc...) and returns the attribute you can set in TCharInfo.

Here is an image of all letters in 8x8 font used with 80x50 mode (437 codepage used in TMDC):
http://www.afterwarp.com/downloads/font8x8.gif

Hope you find this large post useful...

cairnswm
02-11-2005, 05:11 AM
Thanks Guys - I will see if I can think of something to do.

savage
03-11-2005, 07:31 AM
Great stuff Lifepower, news item posted.

Twistofchaos
04-11-2005, 10:40 AM
Hi,

That looks interesting, (didn't know it existed) and i might give it a try.
Atleast i'll go see what i'm able to do with drawing text quickly and colours and textmodes and things.

regards

LP
09-11-2005, 09:27 PM
After messing around with this for a couple of hours, I decided to go "old fashioned" way, using 1-year old rasterizer package :)

I've uploaded the entire package which can get you working in Text-Mode in just few minutes. It uses Software Mode (asm with MMX) from old Asphyre 1.5.2. This is pretty advanced stuff (remember - it won 3rd place :D), I hope someone can make a good use of it...

Here are two screenshots, showing popular Lena image:
http://www.afterwarp.com/downloads/lena0.jpg http://www.afterwarp.com/downloads/lena1.jpg
(The first one uses characters #176, #177 and #219, the second one uses entire 255-character palette).

Download the package:
tmdc-dev.rar (1.21 Mb) (http://www.afterwarp.com/downloads/tmdc-dev.rar).

You will have to install Asphyre 1.5.2 from \Source folder (aww, I almost feel nostalgic :cry:), add path to Library too.
Then, just open Hello2Ascii project and hit compile.

Don't forget that there's a source code for our Armageddon TMDC entry:
armageddon.zip (EXE, 1.51 Mb) (http://www.afterwarp.com/downloads/armageddon.zip)
armageddon-src.zip (Source, 99 Kb) (http://www.afterwarp.com/downloads/armageddon-src.zip)
I know, it's a crappy entry, but it was our first time :)


By the way, if someone is entering this context, let us know to put you in our greetings :)

LP
11-11-2005, 05:32 AM
Perhaps nobody cares, but here's some funny ascii conversion table I've managed to create. It includes some weird characters, musical notes and happy faces :lol:

http://www.afterwarp.com/downloads/funnyascii.gif

P.S. Sorry for big image - if I make it smaller, individual characters get blurred...

cairnswm
11-11-2005, 07:34 AM
Thanks for these. I am interested - but am working on another contest entry at the moment (for a local South african contest).

If I'm finished In time I might try something small for the Text Mode contest (Basically finding a way to just print various images to the screen - possibly with some sort of transition effect).

LP
06-12-2005, 02:50 PM
Only 6 days to the deadline and I'm just starting (was busy + had vacation before) :fuzzy:

So anyone made anything for TMDC or am I the only pascaller entering the contest?

Paulius
06-12-2005, 04:26 PM
I hadn?¢_~t started yet and stuff just keeps coming up :cry: I still have hope to get it done over the weekend. The deadline is 2005 12 12, but is Sunday or Monday the last day to submit?

LP
06-12-2005, 08:24 PM
The deadline is 2005 12 12, but is Sunday or Monday the last day to submit?
It's Monday +/- 1 day. You can ask for deadline extension though (what I'll probably do myself) ;)

LP
19-12-2005, 06:11 AM
Phew! Finally finished my demo entry... very thankful to TMDC staff for giving deadline extension till today, 18-Dec-2005. :)

Anyone else made anything for TMDC or was it just me doing futile efforts?

Paulius
19-12-2005, 08:40 AM
Well I made ?¢_osomething?¢__ :) not hoping to be near the top since it was practically smacked together in the last couple of days, but since it seems like forever since I actually completed anything, I just had to break the cycle.

LP
19-12-2005, 08:49 PM
Paulius, wanna exchange entries? We can't release them to public yet (until judges give results), but we can exchange the demos. :wink:

Paulius
15-01-2006, 04:00 PM
Yay for Lifepower, a deserving winner!!! Congrats man :clap: And boo for Bero and myself, didn?¢_Tt hope to be near the top, but definitely didn?¢_Tt expect to be at the bottom either :(

LP
15-01-2006, 07:33 PM
Yay for Lifepower, a deserving winner!!! Congrats man :clap: And boo for Bero and myself, didn?¢_Tt hope to be near the top, but definitely didn?¢_Tt expect to be at the bottom either :(
Thanks! After seeing your message in the morning, I didn't believe it and visited TMDC site. It's unbelieveable! :shock:

Too bad you guys got bad places though (I actually like BeRo's demo, although the music could be better ;)).

Paulius, as I said before, it's most likely you got that place because of the music (these guys prefer classic music, just check previous TMDC entries). I personally love the heavy guitar riffs though :)

I really hope to see you both participate again in the TMDC 9! ;)

savage
15-01-2006, 09:59 PM
What was the name of your entry LifePower?

Paulius
15-01-2006, 10:06 PM
It should be obvious if you follow the link in the previous page :) its InnerFlux

LP
15-01-2006, 10:41 PM
Ok, here're screenshots and download link:

http://img395.imageshack.us/img395/5919/scene07ck.th.gif (http://img395.imageshack.us/my.php?image=scene07ck.gif) http://img395.imageshack.us/img395/8329/scene14iv.th.gif (http://img395.imageshack.us/my.php?image=scene14iv.gif) http://img451.imageshack.us/img451/7492/scene47eg.th.gif (http://img451.imageshack.us/my.php?image=scene47eg.gif) http://img451.imageshack.us/img451/1185/scene54uu.th.gif (http://img451.imageshack.us/my.php?image=scene54uu.gif) http://img451.imageshack.us/img451/3408/scene69pf.th.gif (http://img451.imageshack.us/my.php?image=scene69pf.gif)

Download: InnerFlux.rar (http://www.afterwarp.net/misc/InnerFlux.rar).

savage
16-01-2006, 08:06 AM
Wow!! WAY TO GO!!! Well done!

Paulius
16-01-2006, 09:14 PM
The first and last demos were exceptional, the others were mediocre and probably chosen by judges mood. I really think if you took the second and second from last (mine) you could hardly tell which is which. After getting high and watching some bunnies, my entry definitely wouldn?¢_Tt look on par :lol:

NecroDOME
16-01-2006, 09:42 PM
It rembers me to my first 3D engine I programmed in DOS with ASCII cause I didn't know how grapical modes worked at that time :P

LP
16-01-2006, 10:14 PM
The first and last demos were exceptional, the others were mediocre and probably chosen by judges mood. I really think if you took the second and second from last (mine) you could hardly tell which is which. After getting high and watching some bunnies, my entry definitely wouldn?¢_Tt look on par :lol:
In my own and very personal taste I'd put entries in this order (the first are the entries I liked the most): #8, #7, #6, #3, #4, #5, #9, #2. Actually, I quited entries #2, #5 and #9 few times with ESC key, since I was getting awful bored. IMHO #2 entry is the worst: bad rasterizer, a tunnel which isn't even illuminated, annoying effects, colors and my eyes hurt! :fuzzy: My favorite demo *was* (when we exchanged our entries with Paulius) and *is* Kazkas because of the wow-factor (CSG, ray-tracing and metal mood). \o/

P.S. Is it really hard to see that letter "f" looks the same as "t" in text-mode? :)