Geometry wars grid effect

Showcase your libraries, tools and other projects that help your fellow love users.
User avatar
Tesselode
Party member
Posts: 555
Joined: Fri Jul 23, 2010 7:55 pm

Re: Geometry wars grid effect

Post by Tesselode »

It turns out you can make a circular grid pretty easy. And I managed to accidentally make a funky pentagon grid too.
Attachments
pentagon grid.love
(644 Bytes) Downloaded 184 times
circle grid.love
(649 Bytes) Downloaded 180 times
coffee
Party member
Posts: 1206
Joined: Wed Nov 02, 2011 9:07 pm

Re: Geometry wars grid effect

Post by coffee »

Tesselode wrote:It turns out you can make a circular grid pretty easy. And I managed to accidentally make a funky pentagon grid too.
Wow! Do you accept requests? Can't the cursor be the Shelob and cross circle and pentagon codes to do a perfect web? PLEASE stop amazing us! ;)
User avatar
miko
Party member
Posts: 410
Joined: Fri Nov 26, 2010 2:25 pm
Location: PL

Re: Geometry wars grid effect

Post by miko »

Nice effect!
Tesselode wrote: Known bugs:
-Moving the cursor near the bottom-right corner of the screen causes all of the lines to light up
This one is easy to fix. You never set color before drawing circles, so add this line as a firs line of love.draw():

Code: Select all

      love.graphics.setColor(100,100,100)
My lovely code lives at GitHub: http://github.com/miko/Love2d-samples
stripwax
Prole
Posts: 39
Joined: Sun Jul 31, 2011 1:16 pm

Re: Geometry wars grid effect

Post by stripwax »

This is neat! Especially for only a couple hours work!

It doesn't run at anything near 75 fps for me on my machine though unfortunately, which is a shame. I can speed it up significantly (although still not 75 fps) by using locals for the stuff in the update loop, including things like local matan2 = math.atan2. Also, since the inner loop is requesting mouse.getX(), mouse.getY() and mouse.isDown every iteration, that takes a few unnecessary cycles too (can just ask for them each once at the start of the update fn)

I think there's probably ways to speed up the calculations significantly (by reducing reliance on trig), I'll have a play with that.

It would be neat (although, I think, difficult) to constrain the edges of the grid - so that they stay put. The warping will then stretch the grid still, but leave the edges where they are, rather than drag the edges in towards the black hole. Any thoughts on how best to achieve that?
stripwax
Prole
Posts: 39
Joined: Sun Jul 31, 2011 1:16 pm

Re: Geometry wars grid effect

Post by stripwax »

The attached gives much better performance for me with no (I think) change in behaviour. In particular, you can remove the dir2/vel2 atan2/sqrt/cos/sin trig stuff stuff entirely and just do a weighted sum of the current x and the xorig. Also moved most accesses in the inner loops to locals.
Attachments
newgrid.zip
(714 Bytes) Downloaded 150 times
coffee
Party member
Posts: 1206
Joined: Wed Nov 02, 2011 9:07 pm

Re: Geometry wars grid effect

Post by coffee »

hmmm... a nice effect would be that the blue circle "stain" instead of be fixed in last place clicked would follow the mouse cursor.
Didn't see really what's new apart of new improved code now but still awesome. :)
stripwax
Prole
Posts: 39
Joined: Sun Jul 31, 2011 1:16 pm

Re: Geometry wars grid effect

Post by stripwax »

That 'stain' would simply appear to be a bug in the code, where velocity is only updated if the mouse button is held down. I am certain that the velocity value really ought to reset if the mouse is release, but as you say, it would be more neat if there was simply a glow that followed the mouse pointer around.
User avatar
T-Bone
Inner party member
Posts: 1492
Joined: Thu Jun 09, 2011 9:03 am

Re: Geometry wars grid effect

Post by T-Bone »

stripwax wrote:The attached gives much better performance for me with no (I think) change in behaviour. In particular, you can remove the dir2/vel2 atan2/sqrt/cos/sin trig stuff stuff entirely and just do a weighted sum of the current x and the xorig. Also moved most accesses in the inner loops to locals.
The improvement in performance is notable!
User avatar
Tesselode
Party member
Posts: 555
Joined: Fri Jul 23, 2010 7:55 pm

Re: Geometry wars grid effect

Post by Tesselode »

I updated it to fix the bug with the colors not fading. I think I'm also going to try to imitate some of the particle effects from Geometry Wars.
User avatar
ishkabible
Party member
Posts: 241
Joined: Sat Oct 23, 2010 7:34 pm
Location: Kansas USA

Re: Geometry wars grid effect

Post by ishkabible »

this so reminds me of some graphics i saw describing space time and gravity's effect on it.
Post Reply

Who is online

Users browsing this forum: No registered users and 30 guests