Qbasicnews.com

QbasicNews.Com => Challenges => Topic started by: adosorken on December 18, 2003, 03:43:40 AM



Title: ASCII Graphics Challenge! :P
Post by: adosorken on December 18, 2003, 03:43:40 AM
Yeah yeah yeah...y'all are movin' into SVGA, 3D, and all that jazz. But nothing beats good old ASCII graphics. :P And since I don't think anyone's really going to try this thing out normally anyways, I figured this was a good chance to see some real-world applications built with this library.

http://www.nodtveidt.net/useless_10a.zip

Here's the challenge:

-Create any kind of game you want, but it has to be ASCII graphical, and in a non-graphics mode (aka you can't use SCREEN 7 but use ASCII graphics, for example)
-Create this game using ONLY the library at the listed URL, no other libraries are allowed
-You are allowed to add your own routines in BASIC code, or in CALL ABSOLUTE strings
-You must provide the sourcecode upon submission as proof that only this library was used

This competition begins right now (December 18th) and will run until March 1st.

Why am I doing this? It's simple, really. I have no real tests for the library, and am curious as to how well it does in a production environment. Since KOQB'04 won't be ready for some time, it'd be nice to see one or two people trying to make a game with this library. I figure this is a great way of seeing how well this thing does in a real production environment :D

Soooo...anyone up to the challenge? :D


Title: ASCII Graphics Challenge! :P
Post by: wildcard on December 18, 2003, 07:58:50 AM
I'm checking out the library, I'll give the challenge a go; I can't exactly moan about lack of graphics now can I ;-)

[*Looks around wondering if "The Beast" is going to enter and blow the competition away*]


Title: ASCII Graphics Challenge! :P
Post by: na_th_an on December 18, 2003, 09:25:37 AM
Hmmm - Good, this compo starts today that's my birthday...
I will take a glance to the lib.


Title: ASCII Graphics Challenge! :P
Post by: Neo on December 18, 2003, 09:38:29 AM
HAPPY BIRTHDAY Na Than!!! And many years. :D

About any programming, I wonder how my computer is atm... ;)


Title: ASCII Graphics Challenge! :P
Post by: na_th_an on December 18, 2003, 10:35:16 AM
Thanks, Neo :)

Really cool routines. This library is really interesting. Adosorken, I love text mode stuff, if ya wanna I could try to help you providing some functions ;) I've seen the "future plans" section and I can provide the 512 characters mode and the extended text resolutions, as well as the custom character set loader.

---

This is my little set of routines to use the 512 characters mode and to load the customized char maps into VGA memory:

Code:
DECLARE SUB LoadCharInMap (file$, Map%)
DECLARE SUB BlockBitPlane2 ()
DECLARE SUB UnBlockBitPlane2 ()
DECLARE SUB SelectMaps (Map0%, Map1%)
DECLARE SUB OutPortW (dir%, a%)
'$INCLUDE: 'QB.BI'

SUB BlockBitPlane2
EgaVgaSequencer% = &H3C4
EgaVgaGraphCtr% = &H3CE
OutPortW EgaVgaSequencer%, &H100
OutPortW EgaVgaSequencer%, &H402
OutPortW EgaVgaSequencer%, &H704
OutPortW EgaVgaSequencer%, &H300
OutPortW EgaVgaGraphCtr%, &H204
OutPortW EgaVgaGraphCtr%, &H5
OutPortW EgaVgaGraphCtr%, &H6
END SUB

SUB LoadCharInMap (file$, Map%)
d$ = CHR$(0)
aBase% = &H4000 * Map%
DEF SEG = &HA000
f% = FREEFILE
OPEN file$ FOR BINARY AS #f%
FOR i% = 0 TO 255
FOR j% = 0 TO 15
GET #f%, , d$
POKE aBase% + j%, ASC(d$)
NEXT j%
aBase% = aBase% + 32
NEXT i%
CLOSE #f%
DEF SEG
END SUB

SUB OutPortW (dir%, a%)
OUT dir%, a% AND 255
OUT dir% + 1, a% \ 256
END SUB

SUB SelectMaps (Map0%, Map1%)
DIM Regs AS RegType
DIM OutPortWs AS RegType
' Bytes:
Map0% = Map0% AND 255
Map1% = Map1% AND 255
' Acceso a los registros
Regs.ax = &H1103
b% = (Map0% AND 3) + (Map0% AND 4) * 4
c% = (Map1% AND 3) * 4 + (Map1% AND 4) * 8
bc% = b% + c%
Regs.bx = bc%
INTERRUPT &H10, Regs, OutPortWs
END SUB

SUB UnBlockBitPlane2
EgaVgaSequencer% = &H3C4
EgaVgaGraphCtr% = &H3CE
OutPortW EgaVgaSequencer%, &H100
OutPortW EgaVgaSequencer%, &H302
OutPortW EgaVgaSequencer%, &H304
OutPortW EgaVgaSequencer%, &H300
OutPortW EgaVgaGraphCtr%, &H4
OutPortW EgaVgaGraphCtr%, &H1005
OutPortW EgaVgaGraphCtr%, &HE06
END SUB


To use it you just do this:

Code:
BlockBitPlane2
LoadCharInMap "charset1.fnt", 0
LoadCharInMap "charset2.fnt", 1
SelectMaps 0, 1
UnBlockBitPlane2


... where charset1.fnt and charset2.fnt are standard 4096 bytes text-mode font files (all the 256 characters, 16 bytes each).

Now remember that with colour 0-7 you print with the charset1 font and with colour 8-15 you print with the charset2 font, so adjust your palettes.

If you, reader, don't know what the heck the 512 characters mode is, check this demo Right-click -> Save as (http://usuarios.lycos.es/firstqbasicforum/stuff/512.ZIP)

---

Edited once more: I can't work with the enhaced SVGA text modes 'cause my card doesn't seem to support them. I just call the interrupt and it does... nothing :P :o


Title: ASCII Graphics Challenge! :P
Post by: Anonymous on December 18, 2003, 12:20:42 PM
happy bday nathan! my bday was actually yesterday :)

as for the ascii compo, i think maybe ill join... i dunno if i have time it sounds cool! well peace


Title: ASCII Graphics Challenge! :P
Post by: adosorken on December 18, 2003, 12:32:13 PM
Quote from: "na_th_an"
Hmmm - Good, this compo starts today that's my birthday...
I will take a glance to the lib.

ahhhhhhhhhhhhhhhhhh nooooooooooooooo! You share yer birthday with one of my ex's!!! nooooooooooooo!

:lol:

Seriously though :D happy birthday man, and I'll add the stuff to the lib asap :) And happy belated birthday to you cha0s :D


Title: ASCII Graphics Challenge! :P
Post by: na_th_an on December 18, 2003, 01:05:54 PM
Thanks chaos and Adosorken.

Adosorken: I think your could wrap these functions inside one. Having them separated would allow do some tweaks and stuff, but in 99.99% of cases you just want to switch to 512 characters mode, load the fonts, and that's all. That "BlockBitPlane2" & co. stuff may look way too strange for most people :lol:


Title: ASCII Graphics Challenge! :P
Post by: adosorken on December 18, 2003, 01:27:41 PM
Yeah that's probably a good idea. Will do :D

...as soon as Rhiannon gives me the network cable so I can download this stuff to my dev computer...sheesh we need a hub badly :(


Title: ASCII Graphics Challenge! :P
Post by: barok on December 18, 2003, 08:07:22 PM
A Most Happy Birthday, Na_th_an!  And many more!!!


whew, got that out of my system...  Just wanted to see for once what that would be like.  Not trying to make fun of someone  :wink:


Title: ASCII Graphics Challenge! :P
Post by: Rhiannon on December 18, 2003, 09:01:39 PM
Quote from: "barok"
A Most Happy Birthday, Na_th_an!  And many more!!!


whew, got that out of my system...  Just wanted to see for once what that would be like.  Not trying to make fun of someone  :wink:


of course not! who would ever suggest such a thing?! Happy bday boys, i'll give ya your bday spankings later :D anywho, this promised to be a fun challenge ;)


Title: ASCII Graphics Challenge! :P
Post by: oracle on December 18, 2003, 09:42:16 PM
Happy b'day nath! Greetz from ME (dbl meaning) :lol:

(save me some cake, ok? I'll be over soon... :lol:)

Anyway, I'll definately have a look at the lib, I'll try to make my character with it too, but I don't think I'll make a game, I've got too much on...


Title: ASCII Graphics Challenge! :P
Post by: relsoft on December 18, 2003, 11:49:00 PM
Happy Birthday bro!!!!

Hah!!!!

My entry: http://rel.betterwebber.com/junk.php?id=11
 :D
j/k


Title: ASCII Graphics Challenge! :P
Post by: Lachie Dazdarian on January 08, 2004, 04:41:32 AM
Cheesy run is a masterpiece!

And no. I did not laughed. It was a pleasant surprise. Deffinetly
better than somekind of pureQB 3D raceing game that would run with
0.05 FPS on my PC.

I love the game. Reached level 18. There should be an end though.


Title: ASCII Graphics Challenge! :P
Post by: relsoft on January 09, 2004, 03:39:33 AM
WOW!!!  That means yer better than me.  ;*)  Yeah, but it was made to torture anyone who plays it. ;*)


Title: ASCII Graphics Challenge! :P
Post by: adosorken on January 09, 2004, 09:13:10 AM
www.nodtveidt.net/useless_10b.zip

Just released: an updated version of the library, has much faster box routines and all the routines have been split into related modules. No new routines, but the manual comes in DOC HTML and TXT formats now, and there's a nifty (built in like 4 hours, so prolly buggy hehe) library builder included.


Title: ASCII Graphics Challenge! :P
Post by: KiZ on January 09, 2004, 11:17:59 AM
So with all this talk of libraries, is anyone actually writing a proggy?


Title: ascii raycast
Post by: ravenxau on March 31, 2004, 08:14:47 AM
here is an ascii raycaster with texture mapping for anyone who wants to make a 3d game with it.

Cheers, Matt:)
 
Code:
'   Ascii Ray Caster with texture mapping
'   Using Integer Mathematics for speed    Clu 5-7-03      Qbasic 1.1
'
DEFINT A-Z: DIM l(16, 16), c(360), s(360), t(16, 16)
FOR y = 1 TO 16
READ l$
FOR x = 1 TO 16
l(x, y) = VAL(MID$(l$, x, 1))
NEXT x
NEXT y
FOR y = 1 TO 16
READ l$
FOR x = 1 TO 16
t(x - 1, y) = VAL(MID$(l$, x, 1))
NEXT x
NEXT y

FOR t = 0 TO 360
s(t) = 100 * SIN(22 / 7 * t / 180)
c(t) = 100 * COS(22 / 7 * t / 180)
NEXT t

x = 5600: y = 4000: f = 0: SCREEN 0: WIDTH 80, 50
DEF SEG = &HB800

main:
FOR s = -40 TO 39: a$ = INKEY$
r = f + (s * 60 \ 80): r = r + 360 * ((r > 360) - (r < 0))
r = r - (c(r) = 0): xi = c(r): yi = s(r): x1 = x: y1 = y:
wallcheck:
x1 = x1 + xi: y1 = y1 + yi
IF l(x1 \ 1600, y1 \ 1600) = 0 THEN GOTO wallcheck

xint = ABS(x1 - INT((x1 + 800) \ 1600) * 1600)
yint = ABS(y1 - INT((y1 + 800) \ 1600) * 1600)
IF xint > yint THEN tc = (x1 - (((x1 \ 1600)) * 1600)) \ 100
IF yint > xint THEN tc = (y1 - (((y1 \ 1600)) * 1600)) \ 100

d = (ABS((x - x1) \ c(r)) * c(ABS(r - f))) * .01
h = (69 * 16 \ d) \ 2
FOR ys = 0 TO 49
addr = (s + 40) * 2 + (ys * 160): POKE addr, 178
IF ys > 25 - h AND ys < 25 + h THEN POKE addr + 1, t(tc, INT(ys - (25 - h)) / (h * 2) * 16)
IF ys > 24 + h THEN POKE addr + 1, 2
IF ys <= 26 - h THEN POKE addr + 1, 9

NEXT ys
NEXT s

k = INP(96): f = f + 5 * (k = 75) - 5 * (k = 77)
f = f - 355 * (f = -5) + 360 * (f = 365)
dx = c(f) * (-(k = 72) + (k = 80)): dy = s(f) * (-(k = 72) + (k = 80))
IF l((x + dx) \ 1600, (y + dy) \ 1600) = 0 THEN x = x + dx: y = y + dy
IF INP(96) = 1 THEN SYSTEM ELSE GOTO main

DATA "1111111111111111"
DATA "1000010000010011"
DATA "1000000111110001"
DATA "1000010010000001"
DATA "1111111010000001"
DATA "1000001011101111"
DATA "1000001000000001"
DATA "1000000011100001"
DATA "1000001010000001"
DATA "1111111011100111"
DATA "1000001000000001"
DATA "1000101101001001"
DATA "1000000101011101"
DATA "1001000000001001"
DATA "1000000100000001"
DATA "1111111111111111"

DATA "8666666686666666"
DATA "8666666686666666"
DATA "8666666686666666"
DATA "8888888888888888"
DATA "6666866666668666"
DATA "6666866666668666"
DATA "6666866666668666"
DATA "8888888888888888"
DATA "8666666686666666"
DATA "8666666686666666"
DATA "8666666686666666"
DATA "8888888888888888"
DATA "6666866666668666"
DATA "6666866666668666"
DATA "6666866666668666"
DATA "8888888888888888"


Title: ASCII Graphics Challenge! :P
Post by: Spotted Cheetah on April 02, 2004, 08:01:47 PM
Plasma357 wrote on a topic some months ago:

Quote

To disable blinking:
Code:
junk = INP(&H3DA)             'disable text blinking
OUT &H3C0, &H20 + &H10        'and enable all the background colors
OldAttr = INP(&H3C1)
OUT &H3C0, OldAttr AND &HF7
junk = INP(&H3DA)


To change a character on the screen:
Code:
POKE (Row - 1) * NumCols * 2 + (Col - 1) * 2, Char

To change a color on the screen:
Code:
POKE (Row - 1) * NumCols * 2 + (Col - 1) * 2 + 1, Colr

Where NumCols is the number of columns active (80 or 40).



This should be useful here, not? :)

(I found these words at DEF SEG = &HB800, at 29th Octobre, 2003)


I have not got anything to show up here now, but I am interested in this subject. I will do something as soon as I will have time :)


Title: ASCII is NOT dead
Post by: Pc72 on April 04, 2004, 05:46:31 PM
If you want ASCII graphics, I'll give you ASCII graphics!!! The first thing you do is go to my old page, http://pc72.narod.ru/old/ and download REFORM.  REFORM is a VGA font editor, which you can use to make fonts for use in text mode.

I've developed it a year ago, but it's still good.  Let's see what you think :)

With REFORM you can do all the ASCII graphics you want.


Title: ASCII Graphics Challenge! :P
Post by: Rhiannon on April 04, 2004, 08:07:11 PM
adosorken was thinking about something like that earlier, he'll check it out later ;)


Title: ASCII Graphics Challenge! :P
Post by: speedlemon on April 04, 2004, 09:20:01 PM
ravenxao- all i can say is WOW! elegant gem


Title: ASCII Graphics Challenge! :P
Post by: Spotted Cheetah on April 05, 2004, 01:37:09 PM
Pc72:

I would like to get your program, but i could not download it! I am using netscape 7, and MsIE does not work very well...

I think you should create something what works under Netscape too. This is the only way to put out Bill Gates  :wink:


Title: ASCII Graphics Challenge! :P
Post by: adosorken on April 10, 2004, 11:02:41 PM
Quote from: "Spotted Cheetah"
I think you should create something what works under Netscape too. This is the only way to put out Bill Gates  :wink:

 :roll:  :roll:  :roll:  :roll:  :roll:  :roll:
Pulease, get off the "I hate Bill Gates" bandwagon...it's such an overused cliché...

Anyways...glad to see some people are still interested in textmode stuff :D


Title: ASCII Graphics Challenge! :P
Post by: Spotted Cheetah on April 12, 2004, 08:47:48 PM
I not hate Bill Gates, i only hate that everything other is diing. And when some homepage creators make homepages only for MSIE - and what if someone uses a Linux - only system? Then what to do? Make them blind, or try creating something what works on their browser too. I would do the last... I think everybody should make his or her homepage to work with at least these two browsers: MSIE, and Netscape (or Mozilla).

Anyways thanks for welcoming here (Instead of firing off this another Gates - killer) :)