Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

The 20 Line Challenge / The Matrix

Author
Message
The Darthster
21
Years of Service
User Offline
Joined: 25th Sep 2002
Location: United Kingdom
Posted: 1st Feb 2003 23:02
Welcome, to the real world...

Here I've tried to simulate the effect of the matrix as seen through Neo's eyes at the end of the film, in only 20 lines of code! If the actual matrix were only 20 lines of code the film might be a lot shorter, lol. However I went back and saw the film again afterwards, and saw it was just textured with the code, but I think my program is still fairly impressive. It requires no media, for your copy 'n' paste pleasure, but you need DBPro and a fairly good machine, it runs at a snails pace on my Athlon 2000+ with 32mb GeForce2 MX 400.

sync on:sync rate 60:hide mouse:autocam off:randomize timer()
dim stats#(5):dim chars(65):dim char$(65):for j=0 to 63:chars(j)=0
char$(j)=chr$(int(rnd(60)+33)):next j:dim message$(2):message$(0)="enter the matrix":message$(1)="by the darthster":create bitmap 1,2,2
cls rgb(255,255,255):get image 1,0,0,1,1:set current bitmap 0:delete bitmap 1:set camera view 0,0,63,47
dim level(142):data 1,5,2,1,2,2,2,4,2,5,2,7,2,8,3,1,3,8,4,5,5,2,5,8,6,6,6,8,6,9,7,1,7,4,8,1,8,7,9,1,9,2,9,3,9,4,9,7,9,9,0,0,1,0,2,0,3,0,4,0,5,0,6,0,7,0,8,0,9,0,10,0,10,1,10,2,10,3,10,4,10,5,10,6,10,7,10,8,10,9,10,10,0,1,0,2,0,3,0,4,0,5,0,6,0,7,0,8,0,9,0,10,1,10,2,10,3,10,4,10,5,10,6,10,7,10,8,10,9,10,2,3,6,5,4,9,1,8,7,2:for i=0 to 71:read level(i*2):read level((i*2)+1)
if i 24 and j"" and c#24 and j"" and b#50 and j"" and d# operators, so I expect it not to work.

Those of you not Pro enabled can probably download it at http://www.mikeyben.org:5432/darkb/thematrix.zip
UberTuba
21
Years of Service
User Offline
Joined: 5th Oct 2002
Location: Brittania
Posted: 1st Feb 2003 23:22
can you post that again please?

Life is a terminal disease.
You never survive it.
The Darthster
21
Years of Service
User Offline
Joined: 25th Sep 2002
Location: United Kingdom
Posted: 2nd Feb 2003 00:53
Yeah, sure. I tried to post it again, but it apparently didn't show up.

The Darthster
21
Years of Service
User Offline
Joined: 25th Sep 2002
Location: United Kingdom
Posted: 2nd Feb 2003 00:59
That code works . Use the arrow keys to navigate, by the way.

That address should be http://www.mikeyben.org:5432/darkb/thematrix.zip
The Darthster
21
Years of Service
User Offline
Joined: 25th Sep 2002
Location: United Kingdom
Posted: 4th Feb 2003 19:55
Doesn't anyone else have any comments at all?

Once I was but the learner,
now, I am the Master.
D Man
21
Years of Service
User Offline
Joined: 3rd Oct 2002
Location: Germany
Posted: 4th Feb 2003 21:17
Nice effect...but why does it run only 20-30 fps on my Geforce4 Ti 4400?

"If you can't make it good
make it look good."
Bill Gates
The Darthster
21
Years of Service
User Offline
Joined: 25th Sep 2002
Location: United Kingdom
Posted: 4th Feb 2003 23:23
Because it's a hideously slow method of doing it. It grabs the screen image, puts it into a memblock, then creates a 640x480 bitmap and fills it with text using mid$() values and color values from the memblock, copies it back and deletes the bitmap and memblock every frame. I might optimise it sometime soon.

Oh yeah, to see the 3d scene it helps if you stand back from the screen, as it's such a low resolution. There might be some philosophical message about that, if you look too close you only see the code, but if you stand back you get the whole picture. Or something.

Once I was but the learner,
now, I am the Master.
TheMaster
21
Years of Service
User Offline
Joined: 14th Mar 2003
Location: United States
Posted: 17th Mar 2003 21:08 Edited at: 28th Apr 2003 16:29
Well my matrix was pretty good! But your's is better! You said my stuff was usefull it kind of is! But your's is useful!
joesmithcool34@yahoo.com

Destroyer's are not killers they are programmers!
Daz
21
Years of Service
User Offline
Joined: 26th Dec 2002
Location: United Kingdom
Posted: 18th Mar 2003 19:17
What's the 3D scene? I can't see it.

But it's a very nice piece of code.

DarkBASIC Professional is the best programming utility.
8/10 Housewives agree!
The Darthster
21
Years of Service
User Offline
Joined: 25th Sep 2002
Location: United Kingdom
Posted: 18th Mar 2003 20:02
Hmm, looks like people are only seeing the text effect, not
appreciating the fact that the text is only a front for the
3D world. Move away from the screen, but close enough that
you can use the keyboard. Turn right, and then left (using
the arrowkeys. Move forwards until you see a gap in the
wall to the right. This is the 3D level, inside there. It
isn't very well lit, however. It might help if you can
defocus your eyes, don't look at the text as text, look
beyond the text.

And it's all in 20 lines! With 8 commands spare!

Once I was but the learner,
now, I am the Master.
Eponick
21
Years of Service
User Offline
Joined: 18th Mar 2003
Location:
Posted: 19th Mar 2003 01:59
wow, how cool

I didnt see the 3D level the first time I did it, but when i defocused my eyes and stuff, it looked really cool!!

spooky
21
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 20th Mar 2003 23:30
When I first loaded this up last month, I just thought it was alright, nothing special, just some scrolly text.

Now revisiting it, I now see the 3D game hidden behind the text.

VERY, VERY CLEVER!!!

Gronda, Gronda
Kohai of UWDesign
21
Years of Service
User Offline
Joined: 12th Sep 2002
Location: France
Posted: 21st Mar 2003 10:40
Hey, very good use of the 'ascii-render' effect !

This method has long enough used on the demoscene, nice to see it in action in DB ( on another, i'm planning to use this effect also ! ^^ )

[Kohai]
[url]www.underwaredesign.com[/url] [url]www.kohaistyle.com[/url]
pIII 733/256 Ram/Geforce 256
lcfcfan
21
Years of Service
User Offline
Joined: 19th Feb 2003
Location: North East, UK
Posted: 21st Mar 2003 15:16
darthster thats cool every piece of code you do is good,
how long did it take you to learn dbp?

2ghz, ati radeon mobility 32mb DDR, 30gb, 256mb DDR ram, Win Xp
The Darthster
21
Years of Service
User Offline
Joined: 25th Sep 2002
Location: United Kingdom
Posted: 21st Mar 2003 20:30
It only took me a few days to pick up DBPro, it's very similar to DB. DB took me about 2 or 3 weeks to pick up the 3d basics. I just have lots of experience.

Thanks for the good comments, people!

Once I was but the learner,
now, I am the Master.
Arrow
21
Years of Service
User Offline
Joined: 1st Jan 2003
Location: United States
Posted: 8th Apr 2003 09:01
Good god, Darthser, is there anything you can't do?

The Legend of Zelda IS NOT an RPG! It's an Adventure, just like Ico or Dark Cloud.
Shadow Robert
21
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 8th Apr 2003 20:06
lol@sonic well someone had to say it didn't they

the effect is quite a simple one, and you could do this alot faster using a shader style methology - yet even without them will stil be pretty bloody fast
personally i'd do something like this



didn't test it, just did a quick write - i think it should work from straight off the bat, but most of my code doesn't so i wouldn't bet on it lol
i'm sure you can understand whats going on though, all i'm doing different is taking several images of the writing - put them into memblocks ... then using another one to create the texture in which i place the text (albeit in the wrong order there) which travels down the Y axis, from that i'm also alphing based on its life cycle with 10 additional copies of it.

really if i was to develop this proply i'd setup a proper type for this, setup an algorithm to change the positions of each pixel and check if it is off screen before i try to copy it
but you get the idea - and because you're not making it so large nor are you working outside of the memory it is a hell of a lot quicker + you can apply it to any object onscreen as a texture ... and as it is an alpha-ed image map this means that if you make the 3D Backdrop black and then use it, it'll show what is through the walls which looks pretty cool and is similar to the technique used in 3DMark2000's demo

Tsu'va Oni Ni Jyuuko Fiori Sei Tau!
One block follows the suit ... the whole suit of blocks is the path ... what have you found?
The Darthster
21
Years of Service
User Offline
Joined: 25th Sep 2002
Location: United Kingdom
Posted: 8th Apr 2003 22:50
Ok I think I understand what you are doing Raven. I've expanded your code and fixed a few bugs, but it still doesn't work (memblock range illegal at 116):



What you seem to be doing is creating a flat texture to go on objects, which is what happens in the 3dMark 2000 demo, and actually what happens in the film as well, but isn't the effect I was after. I was attempting to have text on the screen which is coloured giving an ASCII render effect.

I don't have the hardware to do shaders, I must look into them when I have a new graphics card.

Once I was but the learner,
now, I am the Master.
Shadow Robert
21
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 9th Apr 2003 01:41
yeah i know shaders are the way to go...
the effect is the same, and if you notice i also texture the background with it so i'll appear the same there, so hopefully looks cool.
i'll work a little more on this and actually code it properly rather than within the code limit - someone else can compress and take the glory if they like afterwards i don't care, just wanna show the effect working
gimme like an hour - maybe 2 cause Dr.Phil is on in a min, sad but i love his attitude it so funny

Tsu'va Oni Ni Jyuuko Fiori Sei Tau!
One block follows the suit ... the whole suit of blocks is the path ... what have you found?
Ian T
21
Years of Service
User Offline
Joined: 12th Sep 2002
Location: Around
Posted: 10th May 2003 21:28
Holy crap, that's neat...

--Mouse

Famous Fighting Furball
JASiN
20
Years of Service
User Offline
Joined: 10th May 2003
Location:
Posted: 11th May 2003 03:58
I was just looking over the code because I wanted to see what It would look like, I'm not that good at coding, but the memory error on line 116 seems to be when you give it a zero... concidering the code always used i+1 when a 0-5 was given so it uses 1-6... I changed line 95 to the following

arMatrixFX(c,3)=rnd(5)+1
`set the image value to a random image

and it lets it load, but I don't get any images though.. just white cylinders. I'm still working through the code.

JASiN
20
Years of Service
User Offline
Joined: 10th May 2003
Location:
Posted: 11th May 2003 04:16
Ok, I was looking more into why no textures were in there and it seems you took the code out because you said you get a memory error and this is why, the resolution was set to 400x300... yet it was trying to get the image 512x512, so you could set the image to get 400x300 but I figured make the screen bigger so i change the resolution to 512x512 insted. The next problem with this is texturing the backdrop... It says that command is obsolete so there needs to be a diffrent way to apply the image.

JASiN
20
Years of Service
User Offline
Joined: 10th May 2003
Location:
Posted: 11th May 2003 04:52 Edited at: 11th May 2003 05:10
since I changed the resolution, you need to increase the text size so the get image grabs enough, i used 16 but it can't get the I.. everything works after that except for the texture backdrop which i dont know what to do with out using it. if you take it out, you cant really see anything but if you change the color backdrop you can see the cylinders are there with somewhat green lines;.. kinda small but almost there

Andy Igoe
21
Years of Service
User Offline
Joined: 6th Oct 2002
Location: United Kingdom
Posted: 11th May 2003 15:09
Personally i'd not have used your method Raven, because with several people bug fixing it your code still doesn't work.

Rock on The Darthster, for keeping it simple. And for doing a darn good 20 line challenge too

Pneumatic Dryll
The Darthster
21
Years of Service
User Offline
Joined: 25th Sep 2002
Location: United Kingdom
Posted: 12th May 2003 20:37
Thanks, Pneumatic!

I've now got a GeForce 4 Ti4800 card, so I should be able to do
shaders! If only there were any tutorials...

Once I was but the learner,
now, I am the Master.
sicjoshsic
20
Years of Service
User Offline
Joined: 8th May 2003
Location: United Kingdom
Posted: 16th May 2003 13:11 Edited at: 16th May 2003 15:37
when i try to run the .exe (in xp) i get an error report

{EDIT}
Works great on my win98 pc though, that's really cool! kinda hard to see the 3d at first, but then it just hits you! talk about a great way to focus! probably not related, but i fixed 2 major bugs in my game after seeing that, shows that relaxing for a moment and just focusing really does help!

Dark Wolf
21
Years of Service
User Offline
Joined: 21st Apr 2003
Location: Shadows
Posted: 18th May 2003 08:49
Can you make it for dbc or how did u make the letters appear down like that cause i really liked it x-d

The Darthster
21
Years of Service
User Offline
Joined: 25th Sep 2002
Location: United Kingdom
Posted: 19th May 2003 19:16
Unfortunately, it's completely screwed on my computer now. I don't know if it's because of the latest patch, or because of my new graphics card, but it just doesn't work. I was thinking of rewriting it anyway to look much better.

I can probably extract the text effect for you, Newuser, shouldn't take long.

Once I was but the learner,
now, I am the Master.
The Darthster
21
Years of Service
User Offline
Joined: 25th Sep 2002
Location: United Kingdom
Posted: 19th May 2003 19:34
Here's just the text on it's own:



It will work in DBC, but is hideously slow.

Once I was but the learner,
now, I am the Master.
The Darthster
21
Years of Service
User Offline
Joined: 25th Sep 2002
Location: United Kingdom
Posted: 20th May 2003 01:19
Ok, I've made the scrolling text effect far better, more like it is in the film, but I'm not going to show you until it's been worked into something cool. I've also rewritten the tech demo, but again it is amazingly slow, slower than before even with the GeForce 4. It uses two bitmaps, one containing the camera view and the other containing scrolling text, then puts them into memblocks and compares them word by word, replacing objects in the camera view with text. I only get about 2 fps, so there must be a better way of doing it.

I've thought of a way involving texture deformation, but I don't know if Raven's code already does that.

Once I was but the learner,
now, I am the Master.
Danmatsuma
21
Years of Service
User Offline
Joined: 2nd Mar 2003
Location: Australia
Posted: 20th May 2003 18:37
Hehe, that's cool darthster, Are you going to make some yellowish glowing humanoid text creatures to fight?

ZX Spectrum 48k Issue 3, Radio shack Tape drive, Rank arena 12" T.V. set.
Dark Wolf
21
Years of Service
User Offline
Joined: 21st Apr 2003
Location: Shadows
Posted: 22nd May 2003 05:11
Thanks for taking the time to do that in dbc i think that looks cool

Teh Missingz0rs
21
Years of Service
User Offline
Joined: 6th Dec 2002
Location: United Kingdom
Posted: 7th Jun 2003 01:12
It's kinda like half magic-eye picture and half retro-3D (where all the pixels were HUGE)

Your damaged cells are replaced by the mitosis of others. But sometimes when they split they change a little... until there are too many mistakes and you die.

- Edd Biddulph
UberTuba
21
Years of Service
User Offline
Joined: 5th Oct 2002
Location: Brittania
Posted: 7th Jun 2003 12:31
sorry all i can see is text

Life is a terminal disease.
You never survive it.
The Darthster
21
Years of Service
User Offline
Joined: 25th Sep 2002
Location: United Kingdom
Posted: 7th Jun 2003 13:12
Here's a version that shows the image it's using as a reference. It doesn't work on my machine anymore, so I can't tell if it's working properly or not.

Once I was but the learner,
now, I am the Master.
Shadow Robert
21
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 11th Jun 2003 16:58
oki i've edited this now (now that i even bothered to check this post again)

before anyone says "hey this don't work" ... i know it don't, i couldn't be arsed to do the last little bit in the function as i've only just woken up - probably get around to it later, but atleast now you can understnd what is going on.



Within the Epic battle of the fates the Shadow and the Angel will meet. With it will harbinger the very fight of good vs evil!

Login to post a reply

Server time is: 2024-04-26 10:49:53
Your offset time is: 2024-04-26 10:49:53