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 / Ripples 'n' Lights 3!

Author
Message
The Darthster
22
Years of Service
User Offline
Joined: 25th Sep 2002
Location: United Kingdom
Posted: 20th Mar 2003 02:09 Edited at: 20th Mar 2003 02:22
Here's my new improved version of ripples 'n' lights. I've decided to go more with the "sit back and watch" approach, rather than having user input. The ripples appear randomly, and the camera pans around nicely. There's no media, so you can copy 'n' paste.

This was written in DBPro, but does work in DBC if you separate the lines out. I say 'work', it complained a lot more than DBPro did, about un-wrapped angles and divisions by zero. Eep. Also, in DBPro the stars on the background appear to have antialiasing, whereas in DBC they are just big squares in the sky.

Press spacebar to convert between wireframe and textured, and press enter to show and hide the info.

It almost didn't fit into the 20 lines, but then I figured out a way to optimize the light movement, it only takes 2 lines rather than 12!

I hope this works, it contains a few comparison operators which don't have a good history of working.



By the time you read this you should be able to get it (the .exe) at http://www.mikeyben.org:5432/darkb/rnl3.zip

Once I was but the learner,
now, I am the Master.
The Darthster
22
Years of Service
User Offline
Joined: 25th Sep 2002
Location: United Kingdom
Posted: 20th Mar 2003 02:14 Edited at: 20th Mar 2003 02:16
Line 17 should be:

for j=0 to 20:for k=1 to 2:if (sqrt((((i*(1000/20))-ripple(k,1))^2)+(((j*(1000/20))-ripple(k,2))^2)))<(ripple(k,4)*5) and (sqrt((((i*(1000/20))-ripple(k,1))^2)+(((j*(1000/20))-ripple(k,2))^2)))>(ripple(k,4)*5)-540:height#=height#+sin(2*(ripple(k,3)+sqrt((((i*(1000/20))-ripple(k,1))^2)+(((j*(1000/20))-ripple(k,2))^2))))*((150-ripple(k,4))/5):endif:next k:set matrix height 1,i,j,height#

not

for j=0 to 20:for k=1 to 2:if (sqrt((((i*(1000/20))-ripple(k,1))^2)+(((j*(1000/20))-ripple(k,2))^2))) (ripple(k,4)*5)-540:height#=height#+sin(2*(ripple(k,3)+sqrt((((i*(1000/20))-ripple(k,1))^2)+(((j*(1000/20))-ripple(k,2))^2))))*((150-ripple(k,4))/5):endif:next k:set matrix height 1,i,j,height#

Watch that not work because of the comparisons. Again.

Once I was but the learner,
now, I am the Master.
The Darthster
22
Years of Service
User Offline
Joined: 25th Sep 2002
Location: United Kingdom
Posted: 20th Mar 2003 02:19 Edited at: 20th Mar 2003 02:20
Ok this code works:



Once I was but the learner,
now, I am the Master.
Richard Davey
Retired Moderator
22
Years of Service
User Offline
Joined: 30th Apr 2002
Location: On the Jupiter Probe
Posted: 20th Mar 2003 02:24
Very very cool indeed - I'd probably make this another winner if you hadn't won already

Cheers,

Rich

"Gentlemen, we are about to short-circuit the Universe!"
DB Team / Atari ST / DarkForge / Retro Gaming
spooky
22
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 20th Mar 2003 23:27
just had to say WOW!!!!!!

Gronda, Gronda
PiratSS
22
Years of Service
User Offline
Joined: 18th Oct 2002
Location:
Posted: 23rd Mar 2003 19:33
Yes,

It's a big improvment from your first one

Cheers.

1PH J00 C4|\| U|\|dER$T@|\||) +|-|I$, j00 |-|@\/3 4lR3Ady w0|\|! - p1r@T$$
Hamish McHaggis
21
Years of Service
User Offline
Joined: 13th Dec 2002
Location: Modgnik Detinu
Posted: 23rd Mar 2003 20:59
Why does it have to be so good?!?!?! I wish I could understand the code and maths though.

Why the hell'd you ask me for crying out loud!?!
The Darthster
22
Years of Service
User Offline
Joined: 25th Sep 2002
Location: United Kingdom
Posted: 23rd Mar 2003 23:12
Here's an explanation of the code and maths behind it:

You know that wavy sine graph? Well, if you rotate that around the y axis it looks like ripples! Wow! So, to get that effect, we just need to map the graph in a circle to the points on the matrix. Using simple pythagoras we can work out the distance from the centre of the ripple to each point on the matrix in turn, and use that distance in the sine function to get the ripples. Easy, no? Then it's just a case of having it stop short of a radius and fade away after a time, and having two ripples at the same time, and putting the ripples in random places when they have stopped, and getting the lights to smoothly change colour, and swarm around the centre of the matrix, oh and getting the camera to move around in a circle around the matrix and have that nice rolling effect, and let's not forget the skysphere, with a texture generated on the fly. And then of course there's the text, which changes colour in the same way as the lights, and each letter rotates in it's own little circle to make a wave effect with that. And the user input to toggle the wireframe and text. But that's all. (if I haven't forgotten anything)

If there's enough demand I'll post the whole lot uncompressed with comments.

Once I was but the learner,
now, I am the Master.
Chiwawa
22
Years of Service
User Offline
Joined: 13th Oct 2002
Location: Canada
Posted: 24th Mar 2003 00:34
really good


thats the word(s)
Witch Bomber
21
Years of Service
User Offline
Joined: 25th Jan 2003
Location: Scotland
Posted: 25th Mar 2003 17:45
I thought you were only allowed five commands per line. I counted seven in line seventeen.

Visit the new Madd Matt Games Website
http://www.madamattgames.o-f.com/index.htm
Home of Witch Bomber,Magic Cube and Pinball Football(and a lame website)
The Darthster
22
Years of Service
User Offline
Joined: 25th Sep 2002
Location: United Kingdom
Posted: 25th Mar 2003 18:47
Endif and next k are part of other commands. You'll find a lot of commands like that doubled up in my code, I already explained why in other posts.

Once I was but the learner,
now, I am the Master.
Attreid
21
Years of Service
User Offline
Joined: 27th Nov 2002
Location:
Posted: 25th Mar 2003 19:32
good work

Bu$herie
How many civilians is he going to kill ? I know that Bush will sit at God's left, next to Saddam.
Witch Bomber
21
Years of Service
User Offline
Joined: 25th Jan 2003
Location: Scotland
Posted: 25th Mar 2003 22:42
ok sorry. Great program. I just look forward to using that twist in the rules to make my next 20-liner even better.

Visit the new Madd Matt Games Website
http://www.madamattgames.o-f.com/index.htm
Home of Witch Bomber,Magic Cube and Pinball Football(and a lame website)
Witch Bomber
21
Years of Service
User Offline
Joined: 25th Jan 2003
Location: Scotland
Posted: 25th Mar 2003 22:43
Even if I can't win again

Visit the new Madd Matt Games Website
http://www.madamattgames.o-f.com/index.htm
Home of Witch Bomber,Magic Cube and Pinball Football(and a lame website)

Login to post a reply

Server time is: 2024-11-23 11:56:55
Your offset time is: 2024-11-23 11:56:55