Dark Bit Factory & Gravity

PROGRAMMING => Freebasic => Topic started by: Shockwave on January 30, 2007

Title: New project, early source..
Post by: Shockwave on January 30, 2007
I've been asked by someone to make an intro for a group which I will not be able to post on this forum, had an idea to make a better version of my boxtunnel  and have glenze vectors or something like that flying out of the tunnel.

Just as a gift, I've attahed a rar including the source code for the tunnel part of it. It will look completely different when it's done but the source may be useful to some so here it is..
Title: Re: New project, early source..
Post by: Rbz on January 31, 2007
That's a nice tunnel, run smoothly here  :goodpost:
Title: Re: New project, early source..
Post by: rdc on January 31, 2007
Thanks for sharing man. Cool stuff.
Title: Re: New project, early source..
Post by: Shockwave on January 31, 2007
My pleasure :)
Title: Re: New project, early source..
Post by: benny! on January 31, 2007
Totally awesome. Thanks for sharing and adding code.
Code: [Select]
inc karma
Title: Re: New project, early source..
Post by: Shockwave on January 31, 2007
Thanks Benny :)
Title: Re: New project, early source..
Post by: .:] Druid [:. on February 01, 2007
thanks a lot for your help shockie! 
Title: Re: New project, early source..
Post by: Shockwave on February 03, 2007
YW...

This is how it looks at the moment..
Title: Re: New project, early source..
Post by: rdc on February 03, 2007
 :clap:
Title: Re: New project, early source..
Post by: .:] Druid [:. on February 08, 2007
looks great
Title: Re: New project, early source..
Post by: DrewPee on February 11, 2007
Shockwave
that sure is some fast code . . . it draws so fast on my machine! I don't understand exactly how the routine works but I will check it out and have a looksee!!
Drew

ps Karma up+ for the code!
Title: Re: New project, early source..
Post by: Shockwave on February 11, 2007
The tunnel is using an interesting dodge to keep the speed up and eliminate the need for any sorting or z buffer. essentially all I have done is to create a series of diminishing squares, these are treated as 3D points, but in fact it's no more involved than writing a 3D starfield. You see, the tunnel never actually moves, I just add a variable to it, the variable moves forward and when it's advanced by one square it is re-set. This means that the tunnel is always drawn from back to front. Then it is a matter of adding some sine and cos to each layer of the tunnel to make it bend, in the full version it rotates, but a simple rotation around one axis is not hard.

Code: [Select]
        X = COS(theta) * XX - SIN(theta) * YY
        Y = COS(theta) * YY + SIN(theta) * XX

Theta is just a posh way of saying rotation angle.