dot tunnel

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
JJPeerless
Posts: 82
Joined: Mon Jun 20, 2005 3:32 am

dot tunnel

Post by JJPeerless »

im trying to create the old "dot tunnel" effect used in many demo's on the psp...i already wrote my own drawCircle() routine..it draws circles based on the center x,y the radius and the color..

i could only find ONE site that explained how to do a dot tunnel..but it wasnt very thorough..it said

"draw a dark circle"
"move center of circle"
"increase radius and brightness"
"display circle"
"go back to step 2"

so i did this, it worked.....sorta..but you could only "travel" through the tunnel "once" like..once the radius got bigger than the screen...thats it.

so i thought of once radius gets big enough, reset it back to 0, and same with the color back to dark..

but then once it reset, the old circles were there and it just drew over them but they werent lined up..soo it just started to make a mess everywhere..

so then i tried clearing the screen after it reset..so now i was just going through the tunnel once..over and over again..still wasnt what i wanted..

so i cant really figure how to "continue" through the circle..

i have an example of what i want to accomplish.. oh and im using a SinTable to generate the Y values of the center Y..

www.geocities.com/jjpeerless1/tunnel.zip that is what im going for..

any guidance/help/ideas would be greatly appreciated.thanks.
th0mas
Posts: 43
Joined: Sun Apr 24, 2005 1:59 am
Location: Canada
Contact:

Post by th0mas »

- learn polar coordinates, and how to convert from polar to cartesian
- randomly initialize coordinates.
- draw brighter/darker based on radius (larger radius = brighter)
- every move, make the radius 10% larger than it currently is (this will make a closer star move quicker than a further away star)
- regenerate the position of the star if, when you map the polar coordinate to x/y, it lands outside your screen

now when the user pressed L/R if you want, you can add/subtract an angle to the polar coordinate, making a "spinning" effect.
JJPeerless
Posts: 82
Joined: Mon Jun 20, 2005 3:32 am

Post by JJPeerless »

are you saying to initialize coordinates for the first circle..or all of them?

so every "frame" i redraw all the old circles too?

i need some kind of data structure to hold the coordates of ALL the circles?

not just 1?
JJPeerless
Posts: 82
Joined: Mon Jun 20, 2005 3:32 am

Post by JJPeerless »

also..isnt converting from polar to cartesian just like this:

polar coord = (radius,angle)

cartesian coord would equal:

( radius*cos(angle),radius*sin(angle) )

whats the point of using polar coordinates?
JJPeerless
Posts: 82
Joined: Mon Jun 20, 2005 3:32 am

Post by JJPeerless »

also, i was just rereading your post..why are you talking about STAR's..
do you mean circles?
ector
Posts: 195
Joined: Thu May 12, 2005 10:22 pm

Post by ector »

You should clear the screen every frame and redraw the dot tunnel every frame, if you're trying to do the kind of dot tunnel I'm thinking of :)
JJPeerless
Posts: 82
Joined: Mon Jun 20, 2005 3:32 am

Post by JJPeerless »

im trying to do the dot tunnel that you see in the link i posted in my first post.
th0mas
Posts: 43
Joined: Sun Apr 24, 2005 1:59 am
Location: Canada
Contact:

Post by th0mas »

JJPeerless wrote:im trying to do the dot tunnel that you see in the link i posted in my first post.
maybe more people would look at it if you didn't post a link to a .zip (an image would be more appropriate). Until then I'm going by my assumption that you mean a simulation of a starfield like the old windows screensaver.

the reasons for using polar coordinates are twofold:
- you want the star to move further away from the center of the screen while pretty much maintaining it's angle with the center of your field of view. So you're increasing it's radius every move. You could store it in cartesian if you insist but your equation is going to basically take the cartesian coordinate, convert into the radius from the center, multiply it by a fixed ratio, then convert back to cartesian. No real difference.
- you can also then make a cool rotation effect by offsetting ALL the dot's by some angle when the user presses L/R, making the whole field spin.
JJPeerless
Posts: 82
Joined: Mon Jun 20, 2005 3:32 am

Post by JJPeerless »

yea..you got it all wrong..im not doing a starfield..

here ill post a pic..



Image

pretty much like that..
ector
Posts: 195
Joined: Thu May 12, 2005 10:22 pm

Post by ector »

You want to draw a bunch of circles offset in x/y by some suitable amount based on the circle number and time, and radius and offset scaled by somefactor*(1/distance) where distance would be the number of the circle scaled by some value.
JJPeerless
Posts: 82
Joined: Mon Jun 20, 2005 3:32 am

Post by JJPeerless »

so i have to keep track of the x,y,radius,color of Each circle and redraw all of them each frame?
chp
Posts: 313
Joined: Wed Jun 23, 2004 7:16 am

Post by chp »

Or, you pre-generate a unit-circle, load a transform that sets the position & size of each circle and let the GE render it for you. :) Then you could kick quite a few circles, among other advantages.
JJPeerless
Posts: 82
Joined: Mon Jun 20, 2005 3:32 am

Post by JJPeerless »

yea...im lost.
AnonymousTipster
Posts: 197
Joined: Fri Jul 01, 2005 2:50 am

Post by AnonymousTipster »

Just throwing this out into the open, but I think this might be what you are after:
http://www.blitzbasic.co.nz/codearcs/co ... p?code=734
The code is in basic, but shouldn't take too much porting.

Hope this helps.
JJPeerless
Posts: 82
Joined: Mon Jun 20, 2005 3:32 am

Post by JJPeerless »

thanks, ill work on porting that later, gotta go out..
Post Reply