Page 1 of 2

Warp

Posted: Wed Sep 28, 2011 3:47 am
by tentus
I've clearly been watching too much Star Trek lately. I sat down and wrote a very, very simple app that would render something similar to the warp effect (the stars flying by the window).

Controls:
Up: increase speed.
Down: decrease speed.
Left: rotate counterclockwise.
Right: rotate clockwise.
+ / = / kp+: add a star.
- / _ / kp-: delete a star.
Space: toggle pause.
Tab: toggle smoothing.
Escape: exit app.

Thoughts, comments, improvements?

Re: Warp

Posted: Wed Sep 28, 2011 3:52 am
by slime
Cool! You should make the length of the stars based on their speed relative to you rather than just their 'distance'.

Re: Warp

Posted: Wed Sep 28, 2011 3:54 am
by tentus
slime wrote:Cool! You should make the length of the stars based on their speed relative to you rather than just their 'distance'.
:awesome: Their distance from the "camera" determines their speed, length, and scale. More distant stars travel more slowly, closer stars travel more quickly, and appear larger with longer tails.

Version 2 includes the ability to add and delete stars (the default is 32 stars onscreen at once).

Re: Warp

Posted: Wed Sep 28, 2011 4:27 am
by SoggyWaffles
Brings back memories of Flying Toasters.....

Re: Warp

Posted: Wed Sep 28, 2011 4:28 am
by slime
tentus wrote:
slime wrote:Cool! You should make the length of the stars based on their speed relative to you rather than just their 'distance'.
:awesome: Their distance from the "camera" determines their speed, length, and scale. More distant stars travel more slowly, closer stars travel more quickly, and appear larger with longer tails.

Version 2 includes the ability to add and delete stars (the default is 32 stars onscreen at once).
The tail lengths need to increase/decrease as your speed increases/decreases though. :P

Re: Warp

Posted: Wed Sep 28, 2011 4:43 am
by tentus
slime wrote:
tentus wrote:
slime wrote:Cool! You should make the length of the stars based on their speed relative to you rather than just their 'distance'.
:awesome: Their distance from the "camera" determines their speed, length, and scale. More distant stars travel more slowly, closer stars travel more quickly, and appear larger with longer tails.

Version 2 includes the ability to add and delete stars (the default is 32 stars onscreen at once).
The tail lengths need to increase/decrease as your speed increases/decreases though. :P
Oh I gotcha I thought you were referring to the star speed, not the camera speed. Hmm. I'll think on it.

In the meantime, I introduced a smoothing option. The old code is still there, you can see it in action by hitting space to toggle smoothing.

Does anyone else find it a little weird that the ImageData stuff is all indexed at 0, rather than 1 like most of the rest of Love? I mean, it's not a big deal, it's just a little jolting the first time you mess it up and Love crashes without an error.

Re: Warp

Posted: Wed Sep 28, 2011 8:59 am
by kikito
The increase/decrease speed looks "bumpy" - at least on my computer, stars' positions change (or are reset, not sure) a lot with each velocity increase.

I have not seen the code. Would it be very difficult to make it multi-directional (move up/down/left/right or anything in between, instead of just "left")?

Re: Warp

Posted: Wed Sep 28, 2011 1:07 pm
by tentus
kikito wrote:The increase/decrease speed looks "bumpy" - at least on my computer, stars' positions change (or are reset, not sure) a lot with each velocity increase.

I have not seen the code. Would it be very difficult to make it multi-directional (move up/down/left/right or anything in between, instead of just "left")?
Yeah, I need to figure out the discrepancy (offset x somehow)?

Considering how short the app is, I don't think adding multiple directions would be too hard. The easiest thing to do would be adjust the size of it and use love.graphics.rotate.

Re: Warp

Posted: Thu Sep 29, 2011 5:30 pm
by tentus
kikito wrote:The increase/decrease speed looks "bumpy" - at least on my computer, stars' positions change (or are reset, not sure) a lot with each velocity increase.

I have not seen the code. Would it be very difficult to make it multi-directional (move up/down/left/right or anything in between, instead of just "left")?
Alright, rotating is now in effect, use the arrow keys, and you can pause using space. Adding and deleting stars is now done with plus and minus, and toggling smoothing is now done with tab. The position bug should be fixed now, after a ton of fiddling around (end solution: flip the image backwards, the math for displacing it to the left was just too easy to break).

Re: Warp

Posted: Fri Sep 30, 2011 7:50 am
by kikito
Nice!

I've noticed that the lines thickness increases with velocity - that's intentional, right?