forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

dot tunnel

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
JJPeerless



Joined: 20 Jun 2005
Posts: 82

PostPosted: Wed Jul 13, 2005 3:20 am    Post subject: dot tunnel Reply with quote

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.
Back to top
View user's profile Send private message
th0mas



Joined: 24 Apr 2005
Posts: 43
Location: Canada

PostPosted: Wed Jul 13, 2005 3:32 am    Post subject: Reply with quote

- 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.
_________________
http://th0mas.xbox-scene.com
Back to top
View user's profile Send private message Visit poster's website
JJPeerless



Joined: 20 Jun 2005
Posts: 82

PostPosted: Wed Jul 13, 2005 3:36 am    Post subject: Reply with quote

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?
Back to top
View user's profile Send private message
JJPeerless



Joined: 20 Jun 2005
Posts: 82

PostPosted: Wed Jul 13, 2005 3:38 am    Post subject: Reply with quote

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?
Back to top
View user's profile Send private message
JJPeerless



Joined: 20 Jun 2005
Posts: 82

PostPosted: Wed Jul 13, 2005 3:44 am    Post subject: Reply with quote

also, i was just rereading your post..why are you talking about STAR's..
do you mean circles?
Back to top
View user's profile Send private message
ector



Joined: 12 May 2005
Posts: 195

PostPosted: Wed Jul 13, 2005 4:12 am    Post subject: Reply with quote

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 :)
Back to top
View user's profile Send private message
JJPeerless



Joined: 20 Jun 2005
Posts: 82

PostPosted: Wed Jul 13, 2005 4:24 am    Post subject: Reply with quote

im trying to do the dot tunnel that you see in the link i posted in my first post.
Back to top
View user's profile Send private message
th0mas



Joined: 24 Apr 2005
Posts: 43
Location: Canada

PostPosted: Wed Jul 13, 2005 5:25 am    Post subject: Reply with quote

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.
_________________
http://th0mas.xbox-scene.com
Back to top
View user's profile Send private message Visit poster's website
JJPeerless



Joined: 20 Jun 2005
Posts: 82

PostPosted: Wed Jul 13, 2005 5:30 am    Post subject: Reply with quote

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

here ill post a pic..





pretty much like that..
Back to top
View user's profile Send private message
ector



Joined: 12 May 2005
Posts: 195

PostPosted: Wed Jul 13, 2005 5:34 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
JJPeerless



Joined: 20 Jun 2005
Posts: 82

PostPosted: Wed Jul 13, 2005 5:43 am    Post subject: Reply with quote

so i have to keep track of the x,y,radius,color of Each circle and redraw all of them each frame?
Back to top
View user's profile Send private message
chp



Joined: 23 Jun 2004
Posts: 313

PostPosted: Wed Jul 13, 2005 6:57 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
JJPeerless



Joined: 20 Jun 2005
Posts: 82

PostPosted: Wed Jul 13, 2005 7:03 am    Post subject: Reply with quote

yea...im lost.
Back to top
View user's profile Send private message
AnonymousTipster



Joined: 01 Jul 2005
Posts: 197

PostPosted: Wed Jul 13, 2005 7:29 am    Post subject: Reply with quote

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

Hope this helps.
Back to top
View user's profile Send private message
JJPeerless



Joined: 20 Jun 2005
Posts: 82

PostPosted: Wed Jul 13, 2005 7:44 am    Post subject: Reply with quote

thanks, ill work on porting that later, gotta go out..
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group